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 import os import subprocess import sys BASEDIR = '../main/src/com/joelapenna/foursquare' TYPESDIR = '../captures/types/v1' captures = sys.argv[1:] if not captures: captures = os.listdir(TYPESDIR) for f in captures: basename = f.split('.')[0] javaname = ''.join([c.capitalize() for c in basename.split('_')]) fullpath = os.path.join(TYPESDIR, f) typepath = os.path.join(BASEDIR, 'types', javaname + '.java') parserpath = os.path.join(BASEDIR, 'parsers', javaname + 'Parser.java') cmd = 'python gen_class.py %s > %s' % (fullpath, typepath) print cmd subprocess.call(cmd, stdout=sys.stdout, shell=True) cmd = 'python gen_parser.py %s > %s' % (fullpath, parserpath) print cmd subprocess.call(cmd, stdout=sys.stdout, shell=True)
ajibawa-2023/Python-Code-Large/train/row_990
20
27
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_990:Import_L3_C0", "label": "os import os", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.037, 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_990:Import_L4_C0", "label": "subprocess import subprocess", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1481, 0.037, 0, 0.66, 0.1429, 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_990:Import_L5_C0", "label": "sys import sys", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1852, 0.037, 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_990:Assign_L7_C0", "label": "BASEDIR =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.2593, 0.037, 0, 0.66, 0.4286, 914, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "BASEDIR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "BASEDIR = '../main/src/com/joelapenna/foursquare'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_990:Assign_L8_C0", "label": "TYPESDIR =", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.2963, 0.037, 0, 0.66, 0.5714, 369, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TYPESDIR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TYPESDIR = '../captures/types/v1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_990:Assign_L10_C0", "label": "captures =", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.3704, 0.037, 0, 0.66, 0.7143, 890, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "captures", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "captures = sys.argv[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_990:If_L11_C0", "label": "if", "type": "if", "loc": [11, 12], "level": 0, "parent": null, "vector": [4, 0, 0.4259, 0.0741, 0, 0.66, 0.8571, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if not captures:\n captures = os.listdir(TYPESDIR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_990:Assign_L12_C2", "label": "captures = listdir()", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_990:If_L11_C0", "vector": [14, 1, 0.4444, 0.037, 1, 0.68, 0.0, 890, 3, 1, 0, 0, 551, 10, 1], "semantic": {"name": "captures", "arg_names": [], "import_names": [], "rhs_call_name": "listdir", "annotation": ""}, "snippet": " captures = os.listdir(TYPESDIR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "label": "for f", "type": "for", "loc": [14, 27], "level": 0, "parent": null, "vector": [6, 0, 0.7593, 0.5185, 0, 0.66, 1.0, 899, 2, 0, 0, 0, 0, 0, 11], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for f in captures:\n basename = f.split('.')[0]\n javaname = ''.join([c.capitalize() for c in basename.split('_')])\n fullpath = os.path.join(TYPESDIR, f)\n typepath = os.path.join(BASEDIR, 'types', javaname + '.java')\n parserpath = os.path.join(BASEDIR, 'parsers', javaname + 'Parser.java')\n\n cmd = 'python gen_class.py %s > %s' % (fullpath, typepath)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_990:Assign_L15_C2", "label": "basename =", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "vector": [14, 1, 0.5556, 0.037, 1, 0.84, 0.0, 164, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "basename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " basename = f.split('.')[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_990:Assign_L16_C2", "label": "javaname = join()", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "vector": [14, 1, 0.5926, 0.037, 1, 0.84, 0.1, 554, 3, 1, 0, 0, 933, 10, 3], "semantic": {"name": "javaname", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " javaname = ''.join([c.capitalize() for c in basename.split('_')])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_990:Assign_L17_C2", "label": "fullpath = join()", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "vector": [14, 1, 0.6296, 0.037, 1, 0.84, 0.2, 858, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "fullpath", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " fullpath = os.path.join(TYPESDIR, f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_990:Assign_L18_C2", "label": "typepath = join()", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "vector": [14, 1, 0.6667, 0.037, 1, 0.84, 0.3, 428, 3, 3, 0, 0, 933, 10, 1], "semantic": {"name": "typepath", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " typepath = os.path.join(BASEDIR, 'types', javaname + '.java')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_990:Assign_L19_C2", "label": "parserpath = join()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "vector": [14, 1, 0.7037, 0.037, 1, 0.84, 0.4, 114, 3, 3, 0, 0, 933, 10, 1], "semantic": {"name": "parserpath", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " parserpath = os.path.join(BASEDIR, 'parsers', javaname + 'Parser.java')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_990:Assign_L21_C2", "label": "cmd =", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "vector": [14, 1, 0.7778, 0.037, 1, 0.84, 0.5, 604, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cmd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cmd = 'python gen_class.py %s > %s' % (fullpath, typepath)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_990:Expr_L22_C2", "label": "print()", "type": "expression", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "vector": [8, 1, 0.8148, 0.037, 1, 0.84, 0.6, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(cmd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_990:Expr_L23_C2", "label": "call()", "type": "expression", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "vector": [8, 1, 0.8519, 0.037, 1, 0.84, 0.7, 832, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "call", "arg_names": [], "import_names": [], "rhs_call_name": "call", "annotation": ""}, "snippet": " subprocess.call(cmd, stdout=sys.stdout, shell=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_990:Assign_L25_C2", "label": "cmd =", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "vector": [14, 1, 0.9259, 0.037, 1, 0.84, 0.8, 604, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cmd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cmd = 'python gen_parser.py %s > %s' % (fullpath, parserpath)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_990:Expr_L26_C2", "label": "print()", "type": "expression", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "vector": [8, 1, 0.963, 0.037, 1, 0.84, 0.9, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(cmd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_990:Expr_L27_C2", "label": "call()", "type": "expression", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "vector": [8, 1, 1.0, 0.037, 1, 0.84, 1.0, 832, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "call", "arg_names": [], "import_names": [], "rhs_call_name": "call", "annotation": ""}, "snippet": " subprocess.call(cmd, stdout=sys.stdout, shell=True)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_990:If_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_990:Assign_L12_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_990:Assign_L15_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_990:Assign_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_990:Assign_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_990:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_990:Assign_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_990:Assign_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_990:Expr_L22_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_990:Expr_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_990:Assign_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_990:Expr_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_990:For_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_990:Expr_L27_C2"}]
#! /usr/bin/env python import sys, os import tarfile, zipfile, gzip, bz2 from optparse import OptionParser """ Builds packaged releases of DebugKit so I don't have to do things manually. Excludes itself (build.py), .gitignore, .DS_Store and the .git folder from the archives. """ def main(): parser = OptionParser(); parser.add_option('-o', '--output-dir', dest="output_dir", help="write the packages to DIR", metavar="DIR") parser.add_option('-p', '--prefix-name', dest="prefix", help="prefix used for the generated files") parser.add_option('-k', '--skip', dest="skip", default="", help="A comma separated list of files to skip") parser.add_option('-s', '--source-dir', dest="source", default=".", help="The source directory for the build process") (options, args) = parser.parse_args() if options.output_dir == '' or options.output_dir == options.source: print 'Requires an output dir, and that output dir cannot be the same as the source one!' exit() # append .git and build.py to the skip files skip = options.skip.split(',') skip.extend(['.git', '.gitignore', '.DS_Store', 'build.py']) # get list of files in top level dir. files = os.listdir(options.source) os.chdir(options.source) # filter the files, I couldn't figure out how to do it in a more concise way. for f in files[:]: try: skip.index(f) files.remove(f) except ValueError: pass # make a boring tar file destfile = ''.join([options.output_dir, options.prefix]) tar_file_name = destfile + '.tar' tar = tarfile.open(tar_file_name, 'w'); for f in files: tar.add(f) tar.close() print "Generated tar file" # make the gzip if make_gzip(tar_file_name, destfile): print "Generated gzip file" else: print "Could not generate gzip file" # make the bz2 if make_bz2(tar_file_name, destfile): print "Generated bz2 file" else: print "Could not generate bz2 file" # make the zip file zip_recursive(destfile + '.zip', options.source, files) print "Generated zip file\n" def make_gzip(tar_file, destination): """ Takes a tar_file and destination. Compressess the tar file and creates a .tar.gzip """ tar_contents = open(tar_file, 'rb') gzipfile = gzip.open(destination + '.tar.gz', 'wb') gzipfile.writelines(tar_contents) gzipfile.close() tar_contents.close() return True def make_bz2(tar_file, destination): """ Takes a tar_file and destination. Compressess the tar file and creates a .tar.bz2 """ tar_contents = open(tar_file, 'rb') bz2file = bz2.BZ2File(destination + '.tar.bz2', 'wb') bz2file.writelines(tar_contents) bz2file.close() tar_contents.close() return True def zip_recursive(destination, source_dir, rootfiles): """ Recursively zips source_dir into destination. rootfiles should contain a list of files in the top level directory that are to be included. Any top level files not in rootfiles will be omitted from the zip file. """ zipped = zipfile.ZipFile(destination, 'w', zipfile.ZIP_DEFLATED) for root, dirs, files in os.walk(source_dir): inRoot = False if root == source_dir: inRoot = True if inRoot: for d in dirs: try: rootfiles.index(d) except ValueError: dirs.remove(d) for f in files[:]: if inRoot: try: rootfiles.index(f) except ValueError: continue fullpath = os.path.join(root, f) zipped.write(fullpath) zipped.close() return destination if __name__ == '__main__': main()
ajibawa-2023/Python-Code-Large/train/row_991
75
130
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_991:Import_L3_C0", "label": "sys import sys, os", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0231, 0.0077, 0, 0.66, 0.0, 509, 0, 2, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys", "os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys, os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Import_L4_C0", "label": "tarfile import tarfile, zipfile, gzip\u2026", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0308, 0.0077, 0, 0.66, 0.125, 223, 0, 4, 0, 0, 223, 0, 0], "semantic": {"name": "tarfile", "arg_names": [], "import_names": ["tarfile", "zipfile", "gzip", "bz2"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tarfile, zipfile, gzip, bz2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:ImportFrom_L5_C0", "label": "from optparse import OptionParser", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0385, 0.0077, 0, 0.66, 0.25, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["OptionParser"], "rhs_call_name": "", "annotation": ""}, "snippet": "from optparse import OptionParser"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L7_C0", "label": "expression", "type": "expression", "loc": [7, 11], "level": 0, "parent": null, "vector": [8, 0, 0.0692, 0.0385, 0, 0.66, 0.375, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nBuilds packaged releases of DebugKit so I don't have to do things manually.\n\nExcludes itself (build.py), .gitignore, .DS_Store and the .git folder from the archives.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "label": "main", "type": "function", "loc": [12, 69], "level": 0, "parent": null, "vector": [2, 0, 0.3115, 0.4462, 0, 0.66, 0.5, 624, 0, 0, 0, 0, 0, 0, 27], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n parser = OptionParser();\n parser.add_option('-o', '--output-dir', dest=\"output_dir\",\n help=\"write the packages to DIR\", metavar=\"DIR\")\n parser.add_option('-p', '--prefix-name', dest=\"prefix\",\n help=\"prefix used for the generated files\")\n parser.add_option('-k', '--skip', dest=\"skip\", default=\"\",\n help=\"A comma separated list of files to skip\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L13_C4", "label": "parser = OptionParser()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "vector": [14, 1, 0.1, 0.0077, 1, 0.38, 0.0, 968, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "parser", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " parser = OptionParser();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L14_C4", "label": "add_option()", "type": "expression", "loc": [14, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "vector": [8, 1, 0.1115, 0.0154, 1, 0.38, 0.0476, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-o', '--output-dir', dest=\"output_dir\",\n help=\"write the packages to DIR\", metavar=\"DIR\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L16_C4", "label": "add_option()", "type": "expression", "loc": [16, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "vector": [8, 1, 0.1269, 0.0154, 1, 0.38, 0.0952, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-p', '--prefix-name', dest=\"prefix\",\n help=\"prefix used for the generated files\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L18_C4", "label": "add_option()", "type": "expression", "loc": [18, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "vector": [8, 1, 0.1423, 0.0154, 1, 0.38, 0.1429, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-k', '--skip', dest=\"skip\", default=\"\",\n help=\"A comma separated list of files to skip\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L20_C4", "label": "add_option()", "type": "expression", "loc": [20, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "vector": [8, 1, 0.1577, 0.0154, 1, 0.38, 0.1905, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-s', '--source-dir', dest=\"source\", default=\".\",\n help=\"The source directory for the build process\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L23_C4", "label": "options, args = parse_args()", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "vector": [14, 1, 0.1769, 0.0077, 1, 0.38, 0.2381, 584, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "options, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " (options, args) = parser.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:If_L25_C4", "label": "if", "type": "if", "loc": [25, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "vector": [4, 1, 0.2, 0.0231, 1, 0.38, 0.2857, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if options.output_dir == '' or options.output_dir == options.source:\n print('Requires an output dir, and that output dir cannot be the same as the source one!')\n exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L26_C8", "label": "print()", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:If_L25_C4", "vector": [8, 2, 0.2, 0.0077, 2, 0.05, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Requires an output dir, and that output dir cannot be the same as the source one!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L27_C8", "label": "exit()", "type": "expression", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:If_L25_C4", "vector": [8, 2, 0.2077, 0.0077, 2, 0.05, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L30_C4", "label": "skip = split()", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "vector": [14, 1, 0.2308, 0.0077, 1, 0.38, 0.3333, 171, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "skip", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " skip = options.skip.split(',')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L31_C4", "label": "extend()", "type": "expression", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "vector": [8, 1, 0.2385, 0.0077, 1, 0.38, 0.381, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " skip.extend(['.git', '.gitignore', '.DS_Store', 'build.py'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L34_C4", "label": "files = listdir()", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "vector": [14, 1, 0.2615, 0.0077, 1, 0.38, 0.4286, 598, 3, 1, 0, 0, 551, 10, 1], "semantic": {"name": "files", "arg_names": [], "import_names": [], "rhs_call_name": "listdir", "annotation": ""}, "snippet": " files = os.listdir(options.source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L36_C4", "label": "chdir()", "type": "expression", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "vector": [8, 1, 0.2769, 0.0077, 1, 0.38, 0.4762, 122, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "chdir", "arg_names": [], "import_names": [], "rhs_call_name": "chdir", "annotation": ""}, "snippet": " os.chdir(options.source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:For_L39_C4", "label": "for f", "type": "for", "loc": [39, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "vector": [6, 1, 0.3192, 0.0462, 1, 0.38, 0.5238, 899, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for f in files[:]:\n try:\n skip.index(f)\n files.remove(f)\n except ValueError:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Try_L40_C8", "label": "try", "type": "try", "loc": [40, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:For_L39_C4", "vector": [7, 2, 0.3231, 0.0385, 2, 0.46, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n skip.index(f)\n files.remove(f)\n except ValueError:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L41_C12", "label": "index()", "type": "expression", "loc": [41, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:Try_L40_C8", "vector": [8, 3, 0.3154, 0.0077, 3, 0.15, 0.0, 780, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "index", "annotation": ""}, "snippet": " skip.index(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L42_C12", "label": "remove()", "type": "expression", "loc": [42, 42], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:Try_L40_C8", "vector": [8, 3, 0.3231, 0.0077, 3, 0.15, 1.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " files.remove(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L47_C4", "label": "destfile = join()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "vector": [14, 1, 0.3615, 0.0077, 1, 0.38, 0.5714, 773, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "destfile", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " destfile = ''.join([options.output_dir, options.prefix])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L48_C4", "label": "tar_file_name =", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "vector": [14, 1, 0.3692, 0.0077, 1, 0.38, 0.619, 263, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tar_file_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tar_file_name = destfile + '.tar'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L49_C4", "label": "tar = open()", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "vector": [14, 1, 0.3769, 0.0077, 1, 0.38, 0.6667, 249, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "tar", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " tar = tarfile.open(tar_file_name, 'w');"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:For_L50_C4", "label": "for f", "type": "for", "loc": [50, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "vector": [6, 1, 0.3885, 0.0154, 1, 0.38, 0.7143, 899, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for f in files:\n tar.add(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L51_C8", "label": "add()", "type": "expression", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:For_L50_C4", "vector": [8, 2, 0.3923, 0.0077, 2, 0.24, 0.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " tar.add(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L52_C4", "label": "close()", "type": "expression", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "vector": [8, 1, 0.4, 0.0077, 1, 0.38, 0.7619, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " tar.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L53_C4", "label": "print()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "vector": [8, 1, 0.4077, 0.0077, 1, 0.38, 0.8095, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Generated tar file\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:If_L56_C4", "label": "if", "type": "if", "loc": [56, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "vector": [4, 1, 0.4423, 0.0308, 1, 0.38, 0.8571, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if make_gzip(tar_file_name, destfile):\n print(\"Generated gzip file\")\n else:\n print(\"Could not generate gzip file\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L57_C8", "label": "print()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:If_L56_C4", "vector": [8, 2, 0.4385, 0.0077, 2, 0.17, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Generated gzip file\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L59_C8", "label": "print()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:If_L56_C4", "vector": [8, 2, 0.4538, 0.0077, 2, 0.17, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Could not generate gzip file\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:If_L62_C4", "label": "if", "type": "if", "loc": [62, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "vector": [4, 1, 0.4885, 0.0308, 1, 0.38, 0.9048, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if make_bz2(tar_file_name, destfile):\n print(\"Generated bz2 file\")\n else:\n print(\"Could not generate bz2 file\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L63_C8", "label": "print()", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:If_L62_C4", "vector": [8, 2, 0.4846, 0.0077, 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(\"Generated bz2 file\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L65_C8", "label": "print()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:If_L62_C4", "vector": [8, 2, 0.5, 0.0077, 2, 0.71, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Could not generate bz2 file\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L68_C4", "label": "zip_recursive()", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "vector": [8, 1, 0.5231, 0.0077, 1, 0.38, 0.9524, 912, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "zip_recursive", "arg_names": [], "import_names": [], "rhs_call_name": "zip_recursive", "annotation": ""}, "snippet": " zip_recursive(destfile + '.zip', options.source, files)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L69_C4", "label": "print()", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "vector": [8, 1, 0.5308, 0.0077, 1, 0.38, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Generated zip file\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L71_C0", "label": "make_gzip", "type": "function", "loc": [71, 81], "level": 0, "parent": null, "vector": [2, 0, 0.5846, 0.0846, 0, 0.66, 0.625, 851, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "make_gzip", "arg_names": ["tar_file", "destination"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def make_gzip(tar_file, destination):\n \"\"\"\n Takes a tar_file and destination. Compressess the tar file and creates\n a .tar.gzip\n \"\"\"\n tar_contents = open(tar_file, 'rb')\n gzipfile = gzip.open(destination + '.tar.gz', 'wb')\n gzipfile.writelines(tar_contents)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L72_C4", "label": "expression", "type": "expression", "loc": [72, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L71_C0", "vector": [8, 1, 0.5654, 0.0308, 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 Takes a tar_file and destination. Compressess the tar file and creates\n a .tar.gzip\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L76_C4", "label": "tar_contents = open()", "type": "assigned_variable", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L71_C0", "vector": [14, 1, 0.5846, 0.0077, 1, 0.55, 0.1667, 31, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "tar_contents", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " tar_contents = open(tar_file, 'rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L77_C4", "label": "gzipfile = open()", "type": "assigned_variable", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L71_C0", "vector": [14, 1, 0.5923, 0.0077, 1, 0.55, 0.3333, 559, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "gzipfile", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " gzipfile = gzip.open(destination + '.tar.gz', 'wb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L78_C4", "label": "writelines()", "type": "expression", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L71_C0", "vector": [8, 1, 0.6, 0.0077, 1, 0.55, 0.5, 290, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "writelines", "arg_names": [], "import_names": [], "rhs_call_name": "writelines", "annotation": ""}, "snippet": " gzipfile.writelines(tar_contents)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L79_C4", "label": "close()", "type": "expression", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L71_C0", "vector": [8, 1, 0.6077, 0.0077, 1, 0.55, 0.6667, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " gzipfile.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L80_C4", "label": "close()", "type": "expression", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L71_C0", "vector": [8, 1, 0.6154, 0.0077, 1, 0.55, 0.8333, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " tar_contents.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Return_L81_C4", "label": "return", "type": "return", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L71_C0", "vector": [13, 1, 0.6231, 0.0077, 1, 0.55, 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_991:FunctionDef_L83_C0", "label": "make_bz2", "type": "function", "loc": [83, 93], "level": 0, "parent": null, "vector": [2, 0, 0.6769, 0.0846, 0, 0.66, 0.75, 245, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "make_bz2", "arg_names": ["tar_file", "destination"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def make_bz2(tar_file, destination):\n \"\"\"\n Takes a tar_file and destination. Compressess the tar file and creates\n a .tar.bz2\n \"\"\"\n tar_contents = open(tar_file, 'rb')\n bz2file = bz2.BZ2File(destination + '.tar.bz2', 'wb')\n bz2file.writelines(tar_contents)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L84_C4", "label": "expression", "type": "expression", "loc": [84, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L83_C0", "vector": [8, 1, 0.6577, 0.0308, 1, 0.39, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Takes a tar_file and destination. Compressess the tar file and creates\n a .tar.bz2\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L88_C4", "label": "tar_contents = open()", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L83_C0", "vector": [14, 1, 0.6769, 0.0077, 1, 0.39, 0.1667, 31, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "tar_contents", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " tar_contents = open(tar_file, 'rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L89_C4", "label": "bz2file = BZ2File()", "type": "assigned_variable", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L83_C0", "vector": [14, 1, 0.6846, 0.0077, 1, 0.39, 0.3333, 989, 3, 2, 0, 0, 236, 10, 1], "semantic": {"name": "bz2file", "arg_names": [], "import_names": [], "rhs_call_name": "BZ2File", "annotation": ""}, "snippet": " bz2file = bz2.BZ2File(destination + '.tar.bz2', 'wb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L90_C4", "label": "writelines()", "type": "expression", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L83_C0", "vector": [8, 1, 0.6923, 0.0077, 1, 0.39, 0.5, 290, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "writelines", "arg_names": [], "import_names": [], "rhs_call_name": "writelines", "annotation": ""}, "snippet": " bz2file.writelines(tar_contents)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L91_C4", "label": "close()", "type": "expression", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L83_C0", "vector": [8, 1, 0.7, 0.0077, 1, 0.39, 0.6667, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " bz2file.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L92_C4", "label": "close()", "type": "expression", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L83_C0", "vector": [8, 1, 0.7077, 0.0077, 1, 0.39, 0.8333, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " tar_contents.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Return_L93_C4", "label": "return", "type": "return", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L83_C0", "vector": [13, 1, 0.7154, 0.0077, 1, 0.39, 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_991:FunctionDef_L95_C0", "label": "zip_recursive", "type": "function", "loc": [95, 126], "level": 0, "parent": null, "vector": [2, 0, 0.85, 0.2462, 0, 0.66, 0.875, 912, 0, 3, 1, 0, 0, 0, 8], "semantic": {"name": "zip_recursive", "arg_names": ["destination", "source_dir", "rootfiles"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def zip_recursive(destination, source_dir, rootfiles):\n \"\"\"\n Recursively zips source_dir into destination.\n rootfiles should contain a list of files in the top level directory that \n are to be included. Any top level files not in rootfiles will be omitted\n from the zip file.\n \"\"\"\n zipped = zipfile.ZipFile(destination, 'w', zipfile.ZIP_DEFLATED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L96_C4", "label": "expression", "type": "expression", "loc": [96, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L95_C0", "vector": [8, 1, 0.7577, 0.0462, 1, 0.62, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Recursively zips source_dir into destination.\n rootfiles should contain a list of files in the top level directory that \n are to be included. Any top level files not in rootfiles will be omitted\n from the zip file.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L102_C4", "label": "zipped = ZipFile()", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L95_C0", "vector": [14, 1, 0.7846, 0.0077, 1, 0.62, 0.25, 888, 3, 3, 0, 0, 299, 10, 1], "semantic": {"name": "zipped", "arg_names": [], "import_names": [], "rhs_call_name": "ZipFile", "annotation": ""}, "snippet": " zipped = zipfile.ZipFile(destination, 'w', zipfile.ZIP_DEFLATED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:For_L104_C4", "label": "for root, dirs, files", "type": "for", "loc": [104, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L95_C0", "vector": [6, 1, 0.8769, 0.1615, 1, 0.62, 0.5, 129, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "root, dirs, files", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for root, dirs, files in os.walk(source_dir):\n inRoot = False\n if root == source_dir:\n inRoot = True\n \n if inRoot:\n for d in dirs:\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L105_C8", "label": "inRoot =", "type": "assigned_variable", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:For_L104_C4", "vector": [14, 2, 0.8077, 0.0077, 2, 0.91, 0.0, 227, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "inRoot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " inRoot = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:If_L106_C8", "label": "if", "type": "if", "loc": [106, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:For_L104_C4", "vector": [4, 2, 0.8192, 0.0154, 2, 0.91, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if root == source_dir:\n inRoot = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L107_C12", "label": "inRoot =", "type": "assigned_variable", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:If_L106_C8", "vector": [14, 3, 0.8231, 0.0077, 3, 0.7, 0.0, 227, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "inRoot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " inRoot = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:If_L109_C8", "label": "if", "type": "if", "loc": [109, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:For_L104_C4", "vector": [4, 2, 0.8577, 0.0462, 2, 0.91, 0.6667, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if inRoot:\n for d in dirs:\n try:\n rootfiles.index(d)\n except ValueError:\n dirs.remove(d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:For_L110_C12", "label": "for d", "type": "for", "loc": [110, 114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:If_L109_C8", "vector": [6, 3, 0.8615, 0.0385, 3, 0.84, 0.0, 355, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for d in dirs:\n try:\n rootfiles.index(d)\n except ValueError:\n dirs.remove(d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Try_L111_C16", "label": "try", "type": "try", "loc": [111, 114], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:For_L110_C12", "vector": [7, 4, 0.8654, 0.0308, 4, 0.35, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n rootfiles.index(d)\n except ValueError:\n dirs.remove(d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L112_C20", "label": "index()", "type": "expression", "loc": [112, 112], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:Try_L111_C16", "vector": [8, 5, 0.8615, 0.0077, 5, 0.98, 0.0, 780, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "index", "annotation": ""}, "snippet": " rootfiles.index(d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L114_C20", "label": "remove()", "type": "expression", "loc": [114, 114], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:Try_L111_C16", "vector": [8, 5, 0.8769, 0.0077, 5, 0.98, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " dirs.remove(d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:For_L116_C8", "label": "for f", "type": "for", "loc": [116, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:For_L104_C4", "vector": [6, 2, 0.9231, 0.0692, 2, 0.91, 1.0, 899, 6, 0, 0, 0, 0, 0, 3], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for f in files[:]:\n if inRoot:\n try:\n rootfiles.index(f)\n except ValueError:\n continue\n \n fullpath = os.path.join(root, f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:If_L117_C12", "label": "if", "type": "if", "loc": [117, 121], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:For_L116_C8", "vector": [4, 3, 0.9154, 0.0385, 3, 0.93, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if inRoot:\n try:\n rootfiles.index(f)\n except ValueError:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Try_L118_C16", "label": "try", "type": "try", "loc": [118, 121], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:If_L117_C12", "vector": [7, 4, 0.9192, 0.0308, 4, 0.7, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n rootfiles.index(f)\n except ValueError:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L119_C20", "label": "index()", "type": "expression", "loc": [119, 119], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:Try_L118_C16", "vector": [8, 5, 0.9154, 0.0077, 5, 0.31, 0.0, 780, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "index", "annotation": ""}, "snippet": " rootfiles.index(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L123_C12", "label": "fullpath = join()", "type": "assigned_variable", "loc": [123, 123], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:For_L116_C8", "vector": [14, 3, 0.9462, 0.0077, 3, 0.93, 0.5, 858, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "fullpath", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " fullpath = os.path.join(root, f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L124_C12", "label": "write()", "type": "expression", "loc": [124, 124], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:For_L116_C8", "vector": [8, 3, 0.9538, 0.0077, 3, 0.93, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " zipped.write(fullpath)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L125_C4", "label": "close()", "type": "expression", "loc": [125, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L95_C0", "vector": [8, 1, 0.9615, 0.0077, 1, 0.62, 0.75, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " zipped.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:Return_L126_C4", "label": "return", "type": "return", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L95_C0", "vector": [13, 1, 0.9692, 0.0077, 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 destination"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_991:If_L129_C0", "label": "if", "type": "if", "loc": [129, 130], "level": 0, "parent": null, "vector": [4, 0, 0.9962, 0.0154, 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_991:Expr_L130_C4", "label": "main()", "type": "expression", "loc": [130, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_991:If_L129_C0", "vector": [8, 1, 1.0, 0.0077, 1, 0.52, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:If_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:If_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:If_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:For_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:For_L39_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Try_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:Try_L40_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L41_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:Try_L40_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L42_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:For_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:For_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:If_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:If_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:If_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:If_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Return_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Return_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:For_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:For_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:For_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_991:If_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:If_L106_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:For_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_991:If_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:If_L109_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_991:For_L110_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:For_L110_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Try_L111_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:Try_L111_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L112_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:Try_L111_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L114_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:For_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_991:For_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:For_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_991:If_L117_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:If_L117_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Try_L118_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:Try_L118_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L119_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:For_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Assign_L123_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:For_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L124_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Return_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_991:If_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_991:Expr_L130_C4"}]
#! /usr/bin/env python import sys, os import tarfile, zipfile, gzip, bz2 from optparse import OptionParser """ Builds packaged releases of DebugKit so I don't have to do things manually. Excludes itself (build.py), .gitignore, .DS_Store and the .git folder from the archives. """ def main(): parser = OptionParser(); parser.add_option('-o', '--output-dir', dest="output_dir", help="write the packages to DIR", metavar="DIR") parser.add_option('-p', '--prefix-name', dest="prefix", help="prefix used for the generated files") parser.add_option('-k', '--skip', dest="skip", default="", help="A comma separated list of files to skip") parser.add_option('-s', '--source-dir', dest="source", default=".", help="The source directory for the build process") (options, args) = parser.parse_args() if options.output_dir == '' or options.output_dir == options.source: print 'Requires an output dir, and that output dir cannot be the same as the source one!' exit() # append .git and build.py to the skip files skip = options.skip.split(',') skip.extend(['.git', '.gitignore', '.DS_Store', 'build.py']) # get list of files in top level dir. files = os.listdir(options.source) os.chdir(options.source) # filter the files, I couldn't figure out how to do it in a more concise way. for f in files[:]: try: skip.index(f) files.remove(f) except ValueError: pass # make a boring tar file destfile = ''.join([options.output_dir, options.prefix]) tar_file_name = destfile + '.tar' tar = tarfile.open(tar_file_name, 'w'); for f in files: tar.add(f) tar.close() print "Generated tar file" # make the gzip if make_gzip(tar_file_name, destfile): print "Generated gzip file" else: print "Could not generate gzip file" # make the bz2 if make_bz2(tar_file_name, destfile): print "Generated bz2 file" else: print "Could not generate bz2 file" # make the zip file zip_recursive(destfile + '.zip', options.source, files) print "Generated zip file\n" def make_gzip(tar_file, destination): """ Takes a tar_file and destination. Compressess the tar file and creates a .tar.gzip """ tar_contents = open(tar_file, 'rb') gzipfile = gzip.open(destination + '.tar.gz', 'wb') gzipfile.writelines(tar_contents) gzipfile.close() tar_contents.close() return True def make_bz2(tar_file, destination): """ Takes a tar_file and destination. Compressess the tar file and creates a .tar.bz2 """ tar_contents = open(tar_file, 'rb') bz2file = bz2.BZ2File(destination + '.tar.bz2', 'wb') bz2file.writelines(tar_contents) bz2file.close() tar_contents.close() return True def zip_recursive(destination, source_dir, rootfiles): """ Recursively zips source_dir into destination. rootfiles should contain a list of files in the top level directory that are to be included. Any top level files not in rootfiles will be omitted from the zip file. """ zipped = zipfile.ZipFile(destination, 'w', zipfile.ZIP_DEFLATED) for root, dirs, files in os.walk(source_dir): inRoot = False if root == source_dir: inRoot = True if inRoot: for d in dirs: try: rootfiles.index(d) except ValueError: dirs.remove(d) for f in files[:]: if inRoot: try: rootfiles.index(f) except ValueError: continue fullpath = os.path.join(root, f) zipped.write(fullpath) zipped.close() return destination if __name__ == '__main__': main()
ajibawa-2023/Python-Code-Large/train/row_992
75
130
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_992:Import_L3_C0", "label": "sys import sys, os", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0231, 0.0077, 0, 0.66, 0.0, 509, 0, 2, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys", "os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys, os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Import_L4_C0", "label": "tarfile import tarfile, zipfile, gzip\u2026", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0308, 0.0077, 0, 0.66, 0.125, 223, 0, 4, 0, 0, 223, 0, 0], "semantic": {"name": "tarfile", "arg_names": [], "import_names": ["tarfile", "zipfile", "gzip", "bz2"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tarfile, zipfile, gzip, bz2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:ImportFrom_L5_C0", "label": "from optparse import OptionParser", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0385, 0.0077, 0, 0.66, 0.25, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["OptionParser"], "rhs_call_name": "", "annotation": ""}, "snippet": "from optparse import OptionParser"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L7_C0", "label": "expression", "type": "expression", "loc": [7, 11], "level": 0, "parent": null, "vector": [8, 0, 0.0692, 0.0385, 0, 0.66, 0.375, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nBuilds packaged releases of DebugKit so I don't have to do things manually.\n\nExcludes itself (build.py), .gitignore, .DS_Store and the .git folder from the archives.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "label": "main", "type": "function", "loc": [12, 69], "level": 0, "parent": null, "vector": [2, 0, 0.3115, 0.4462, 0, 0.66, 0.5, 624, 0, 0, 0, 0, 0, 0, 27], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n parser = OptionParser();\n parser.add_option('-o', '--output-dir', dest=\"output_dir\",\n help=\"write the packages to DIR\", metavar=\"DIR\")\n parser.add_option('-p', '--prefix-name', dest=\"prefix\",\n help=\"prefix used for the generated files\")\n parser.add_option('-k', '--skip', dest=\"skip\", default=\"\",\n help=\"A comma separated list of files to skip\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L13_C4", "label": "parser = OptionParser()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "vector": [14, 1, 0.1, 0.0077, 1, 0.28, 0.0, 968, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "parser", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " parser = OptionParser();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L14_C4", "label": "add_option()", "type": "expression", "loc": [14, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "vector": [8, 1, 0.1115, 0.0154, 1, 0.28, 0.0476, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-o', '--output-dir', dest=\"output_dir\",\n help=\"write the packages to DIR\", metavar=\"DIR\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L16_C4", "label": "add_option()", "type": "expression", "loc": [16, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "vector": [8, 1, 0.1269, 0.0154, 1, 0.28, 0.0952, 176, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-p', '--prefix-name', dest=\"prefix\",\n help=\"prefix used for the generated files\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L18_C4", "label": "add_option()", "type": "expression", "loc": [18, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "vector": [8, 1, 0.1423, 0.0154, 1, 0.28, 0.1429, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-k', '--skip', dest=\"skip\", default=\"\",\n help=\"A comma separated list of files to skip\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L20_C4", "label": "add_option()", "type": "expression", "loc": [20, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "vector": [8, 1, 0.1577, 0.0154, 1, 0.28, 0.1905, 176, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-s', '--source-dir', dest=\"source\", default=\".\",\n help=\"The source directory for the build process\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L23_C4", "label": "options, args = parse_args()", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "vector": [14, 1, 0.1769, 0.0077, 1, 0.28, 0.2381, 584, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "options, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " (options, args) = parser.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:If_L25_C4", "label": "if", "type": "if", "loc": [25, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "vector": [4, 1, 0.2, 0.0231, 1, 0.28, 0.2857, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if options.output_dir == '' or options.output_dir == options.source:\n print('Requires an output dir, and that output dir cannot be the same as the source one!')\n exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L26_C8", "label": "print()", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:If_L25_C4", "vector": [8, 2, 0.2, 0.0077, 2, 0.1, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Requires an output dir, and that output dir cannot be the same as the source one!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L27_C8", "label": "exit()", "type": "expression", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:If_L25_C4", "vector": [8, 2, 0.2077, 0.0077, 2, 0.1, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L30_C4", "label": "skip = split()", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "vector": [14, 1, 0.2308, 0.0077, 1, 0.28, 0.3333, 171, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "skip", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " skip = options.skip.split(',')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L31_C4", "label": "extend()", "type": "expression", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "vector": [8, 1, 0.2385, 0.0077, 1, 0.28, 0.381, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " skip.extend(['.git', '.gitignore', '.DS_Store', 'build.py'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L34_C4", "label": "files = listdir()", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "vector": [14, 1, 0.2615, 0.0077, 1, 0.28, 0.4286, 598, 3, 1, 0, 0, 551, 10, 1], "semantic": {"name": "files", "arg_names": [], "import_names": [], "rhs_call_name": "listdir", "annotation": ""}, "snippet": " files = os.listdir(options.source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L36_C4", "label": "chdir()", "type": "expression", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "vector": [8, 1, 0.2769, 0.0077, 1, 0.28, 0.4762, 122, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "chdir", "arg_names": [], "import_names": [], "rhs_call_name": "chdir", "annotation": ""}, "snippet": " os.chdir(options.source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:For_L39_C4", "label": "for f", "type": "for", "loc": [39, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "vector": [6, 1, 0.3192, 0.0462, 1, 0.28, 0.5238, 899, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for f in files[:]:\n try:\n skip.index(f)\n files.remove(f)\n except ValueError:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Try_L40_C8", "label": "try", "type": "try", "loc": [40, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:For_L39_C4", "vector": [7, 2, 0.3231, 0.0385, 2, 0.98, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n skip.index(f)\n files.remove(f)\n except ValueError:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L41_C12", "label": "index()", "type": "expression", "loc": [41, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:Try_L40_C8", "vector": [8, 3, 0.3154, 0.0077, 3, 0.16, 0.0, 780, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "index", "annotation": ""}, "snippet": " skip.index(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L42_C12", "label": "remove()", "type": "expression", "loc": [42, 42], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:Try_L40_C8", "vector": [8, 3, 0.3231, 0.0077, 3, 0.16, 1.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " files.remove(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L47_C4", "label": "destfile = join()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "vector": [14, 1, 0.3615, 0.0077, 1, 0.28, 0.5714, 773, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "destfile", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " destfile = ''.join([options.output_dir, options.prefix])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L48_C4", "label": "tar_file_name =", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "vector": [14, 1, 0.3692, 0.0077, 1, 0.28, 0.619, 263, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tar_file_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tar_file_name = destfile + '.tar'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L49_C4", "label": "tar = open()", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "vector": [14, 1, 0.3769, 0.0077, 1, 0.28, 0.6667, 249, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "tar", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " tar = tarfile.open(tar_file_name, 'w');"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:For_L50_C4", "label": "for f", "type": "for", "loc": [50, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "vector": [6, 1, 0.3885, 0.0154, 1, 0.28, 0.7143, 899, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for f in files:\n tar.add(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L51_C8", "label": "add()", "type": "expression", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:For_L50_C4", "vector": [8, 2, 0.3923, 0.0077, 2, 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": " tar.add(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L52_C4", "label": "close()", "type": "expression", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "vector": [8, 1, 0.4, 0.0077, 1, 0.28, 0.7619, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " tar.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L53_C4", "label": "print()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "vector": [8, 1, 0.4077, 0.0077, 1, 0.28, 0.8095, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Generated tar file\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:If_L56_C4", "label": "if", "type": "if", "loc": [56, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "vector": [4, 1, 0.4423, 0.0308, 1, 0.28, 0.8571, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if make_gzip(tar_file_name, destfile):\n print(\"Generated gzip file\")\n else:\n print(\"Could not generate gzip file\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L57_C8", "label": "print()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:If_L56_C4", "vector": [8, 2, 0.4385, 0.0077, 2, 0.72, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Generated gzip file\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L59_C8", "label": "print()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:If_L56_C4", "vector": [8, 2, 0.4538, 0.0077, 2, 0.72, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Could not generate gzip file\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:If_L62_C4", "label": "if", "type": "if", "loc": [62, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "vector": [4, 1, 0.4885, 0.0308, 1, 0.28, 0.9048, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if make_bz2(tar_file_name, destfile):\n print(\"Generated bz2 file\")\n else:\n print(\"Could not generate bz2 file\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L63_C8", "label": "print()", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:If_L62_C4", "vector": [8, 2, 0.4846, 0.0077, 2, 0.5, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Generated bz2 file\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L65_C8", "label": "print()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:If_L62_C4", "vector": [8, 2, 0.5, 0.0077, 2, 0.5, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Could not generate bz2 file\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L68_C4", "label": "zip_recursive()", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "vector": [8, 1, 0.5231, 0.0077, 1, 0.28, 0.9524, 912, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "zip_recursive", "arg_names": [], "import_names": [], "rhs_call_name": "zip_recursive", "annotation": ""}, "snippet": " zip_recursive(destfile + '.zip', options.source, files)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L69_C4", "label": "print()", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "vector": [8, 1, 0.5308, 0.0077, 1, 0.28, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Generated zip file\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L71_C0", "label": "make_gzip", "type": "function", "loc": [71, 81], "level": 0, "parent": null, "vector": [2, 0, 0.5846, 0.0846, 0, 0.66, 0.625, 851, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "make_gzip", "arg_names": ["tar_file", "destination"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def make_gzip(tar_file, destination):\n \"\"\"\n Takes a tar_file and destination. Compressess the tar file and creates\n a .tar.gzip\n \"\"\"\n tar_contents = open(tar_file, 'rb')\n gzipfile = gzip.open(destination + '.tar.gz', 'wb')\n gzipfile.writelines(tar_contents)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L72_C4", "label": "expression", "type": "expression", "loc": [72, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L71_C0", "vector": [8, 1, 0.5654, 0.0308, 1, 0.36, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Takes a tar_file and destination. Compressess the tar file and creates\n a .tar.gzip\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L76_C4", "label": "tar_contents = open()", "type": "assigned_variable", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L71_C0", "vector": [14, 1, 0.5846, 0.0077, 1, 0.36, 0.1667, 31, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "tar_contents", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " tar_contents = open(tar_file, 'rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L77_C4", "label": "gzipfile = open()", "type": "assigned_variable", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L71_C0", "vector": [14, 1, 0.5923, 0.0077, 1, 0.36, 0.3333, 559, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "gzipfile", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " gzipfile = gzip.open(destination + '.tar.gz', 'wb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L78_C4", "label": "writelines()", "type": "expression", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L71_C0", "vector": [8, 1, 0.6, 0.0077, 1, 0.36, 0.5, 290, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "writelines", "arg_names": [], "import_names": [], "rhs_call_name": "writelines", "annotation": ""}, "snippet": " gzipfile.writelines(tar_contents)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L79_C4", "label": "close()", "type": "expression", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L71_C0", "vector": [8, 1, 0.6077, 0.0077, 1, 0.36, 0.6667, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " gzipfile.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L80_C4", "label": "close()", "type": "expression", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L71_C0", "vector": [8, 1, 0.6154, 0.0077, 1, 0.36, 0.8333, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " tar_contents.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Return_L81_C4", "label": "return", "type": "return", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L71_C0", "vector": [13, 1, 0.6231, 0.0077, 1, 0.36, 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_992:FunctionDef_L83_C0", "label": "make_bz2", "type": "function", "loc": [83, 93], "level": 0, "parent": null, "vector": [2, 0, 0.6769, 0.0846, 0, 0.66, 0.75, 245, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "make_bz2", "arg_names": ["tar_file", "destination"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def make_bz2(tar_file, destination):\n \"\"\"\n Takes a tar_file and destination. Compressess the tar file and creates\n a .tar.bz2\n \"\"\"\n tar_contents = open(tar_file, 'rb')\n bz2file = bz2.BZ2File(destination + '.tar.bz2', 'wb')\n bz2file.writelines(tar_contents)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L84_C4", "label": "expression", "type": "expression", "loc": [84, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L83_C0", "vector": [8, 1, 0.6577, 0.0308, 1, 0.48, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Takes a tar_file and destination. Compressess the tar file and creates\n a .tar.bz2\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L88_C4", "label": "tar_contents = open()", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L83_C0", "vector": [14, 1, 0.6769, 0.0077, 1, 0.48, 0.1667, 31, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "tar_contents", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " tar_contents = open(tar_file, 'rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L89_C4", "label": "bz2file = BZ2File()", "type": "assigned_variable", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L83_C0", "vector": [14, 1, 0.6846, 0.0077, 1, 0.48, 0.3333, 989, 3, 2, 0, 0, 236, 10, 1], "semantic": {"name": "bz2file", "arg_names": [], "import_names": [], "rhs_call_name": "BZ2File", "annotation": ""}, "snippet": " bz2file = bz2.BZ2File(destination + '.tar.bz2', 'wb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L90_C4", "label": "writelines()", "type": "expression", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L83_C0", "vector": [8, 1, 0.6923, 0.0077, 1, 0.48, 0.5, 290, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "writelines", "arg_names": [], "import_names": [], "rhs_call_name": "writelines", "annotation": ""}, "snippet": " bz2file.writelines(tar_contents)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L91_C4", "label": "close()", "type": "expression", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L83_C0", "vector": [8, 1, 0.7, 0.0077, 1, 0.48, 0.6667, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " bz2file.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L92_C4", "label": "close()", "type": "expression", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L83_C0", "vector": [8, 1, 0.7077, 0.0077, 1, 0.48, 0.8333, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " tar_contents.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Return_L93_C4", "label": "return", "type": "return", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L83_C0", "vector": [13, 1, 0.7154, 0.0077, 1, 0.48, 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_992:FunctionDef_L95_C0", "label": "zip_recursive", "type": "function", "loc": [95, 126], "level": 0, "parent": null, "vector": [2, 0, 0.85, 0.2462, 0, 0.66, 0.875, 912, 0, 3, 1, 0, 0, 0, 8], "semantic": {"name": "zip_recursive", "arg_names": ["destination", "source_dir", "rootfiles"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def zip_recursive(destination, source_dir, rootfiles):\n \"\"\"\n Recursively zips source_dir into destination.\n rootfiles should contain a list of files in the top level directory that \n are to be included. Any top level files not in rootfiles will be omitted\n from the zip file.\n \"\"\"\n zipped = zipfile.ZipFile(destination, 'w', zipfile.ZIP_DEFLATED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L96_C4", "label": "expression", "type": "expression", "loc": [96, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L95_C0", "vector": [8, 1, 0.7577, 0.0462, 1, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Recursively zips source_dir into destination.\n rootfiles should contain a list of files in the top level directory that \n are to be included. Any top level files not in rootfiles will be omitted\n from the zip file.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L102_C4", "label": "zipped = ZipFile()", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L95_C0", "vector": [14, 1, 0.7846, 0.0077, 1, 0.84, 0.25, 888, 3, 3, 0, 0, 299, 10, 1], "semantic": {"name": "zipped", "arg_names": [], "import_names": [], "rhs_call_name": "ZipFile", "annotation": ""}, "snippet": " zipped = zipfile.ZipFile(destination, 'w', zipfile.ZIP_DEFLATED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:For_L104_C4", "label": "for root, dirs, files", "type": "for", "loc": [104, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L95_C0", "vector": [6, 1, 0.8769, 0.1615, 1, 0.84, 0.5, 129, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "root, dirs, files", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for root, dirs, files in os.walk(source_dir):\n inRoot = False\n if root == source_dir:\n inRoot = True\n \n if inRoot:\n for d in dirs:\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L105_C8", "label": "inRoot =", "type": "assigned_variable", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:For_L104_C4", "vector": [14, 2, 0.8077, 0.0077, 2, 0.27, 0.0, 227, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "inRoot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " inRoot = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:If_L106_C8", "label": "if", "type": "if", "loc": [106, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:For_L104_C4", "vector": [4, 2, 0.8192, 0.0154, 2, 0.27, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if root == source_dir:\n inRoot = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L107_C12", "label": "inRoot =", "type": "assigned_variable", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:If_L106_C8", "vector": [14, 3, 0.8231, 0.0077, 3, 0.36, 0.0, 227, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "inRoot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " inRoot = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:If_L109_C8", "label": "if", "type": "if", "loc": [109, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:For_L104_C4", "vector": [4, 2, 0.8577, 0.0462, 2, 0.27, 0.6667, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if inRoot:\n for d in dirs:\n try:\n rootfiles.index(d)\n except ValueError:\n dirs.remove(d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:For_L110_C12", "label": "for d", "type": "for", "loc": [110, 114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:If_L109_C8", "vector": [6, 3, 0.8615, 0.0385, 3, 0.1, 0.0, 355, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for d in dirs:\n try:\n rootfiles.index(d)\n except ValueError:\n dirs.remove(d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Try_L111_C16", "label": "try", "type": "try", "loc": [111, 114], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:For_L110_C12", "vector": [7, 4, 0.8654, 0.0308, 4, 0.99, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n rootfiles.index(d)\n except ValueError:\n dirs.remove(d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L112_C20", "label": "index()", "type": "expression", "loc": [112, 112], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:Try_L111_C16", "vector": [8, 5, 0.8615, 0.0077, 5, 0.85, 0.0, 780, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "index", "annotation": ""}, "snippet": " rootfiles.index(d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L114_C20", "label": "remove()", "type": "expression", "loc": [114, 114], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:Try_L111_C16", "vector": [8, 5, 0.8769, 0.0077, 5, 0.85, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " dirs.remove(d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:For_L116_C8", "label": "for f", "type": "for", "loc": [116, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:For_L104_C4", "vector": [6, 2, 0.9231, 0.0692, 2, 0.27, 1.0, 899, 6, 0, 0, 0, 0, 0, 3], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for f in files[:]:\n if inRoot:\n try:\n rootfiles.index(f)\n except ValueError:\n continue\n \n fullpath = os.path.join(root, f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:If_L117_C12", "label": "if", "type": "if", "loc": [117, 121], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:For_L116_C8", "vector": [4, 3, 0.9154, 0.0385, 3, 0.6, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if inRoot:\n try:\n rootfiles.index(f)\n except ValueError:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Try_L118_C16", "label": "try", "type": "try", "loc": [118, 121], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:If_L117_C12", "vector": [7, 4, 0.9192, 0.0308, 4, 0.91, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n rootfiles.index(f)\n except ValueError:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L119_C20", "label": "index()", "type": "expression", "loc": [119, 119], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:Try_L118_C16", "vector": [8, 5, 0.9154, 0.0077, 5, 0.73, 0.0, 780, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "index", "annotation": ""}, "snippet": " rootfiles.index(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L123_C12", "label": "fullpath = join()", "type": "assigned_variable", "loc": [123, 123], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:For_L116_C8", "vector": [14, 3, 0.9462, 0.0077, 3, 0.6, 0.5, 858, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "fullpath", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " fullpath = os.path.join(root, f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L124_C12", "label": "write()", "type": "expression", "loc": [124, 124], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:For_L116_C8", "vector": [8, 3, 0.9538, 0.0077, 3, 0.6, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " zipped.write(fullpath)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L125_C4", "label": "close()", "type": "expression", "loc": [125, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L95_C0", "vector": [8, 1, 0.9615, 0.0077, 1, 0.84, 0.75, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " zipped.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:Return_L126_C4", "label": "return", "type": "return", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L95_C0", "vector": [13, 1, 0.9692, 0.0077, 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 destination"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_992:If_L129_C0", "label": "if", "type": "if", "loc": [129, 130], "level": 0, "parent": null, "vector": [4, 0, 0.9962, 0.0154, 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_992:Expr_L130_C4", "label": "main()", "type": "expression", "loc": [130, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_992:If_L129_C0", "vector": [8, 1, 1.0, 0.0077, 1, 0.24, 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_992:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:If_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:If_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:If_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:For_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:For_L39_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Try_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:Try_L40_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L41_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:Try_L40_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L42_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:For_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:For_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:If_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:If_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:If_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:If_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Return_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Return_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:For_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:For_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:For_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_992:If_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:If_L106_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:For_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_992:If_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:If_L109_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_992:For_L110_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:For_L110_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Try_L111_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:Try_L111_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L112_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:Try_L111_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L114_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:For_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_992:For_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:For_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_992:If_L117_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:If_L117_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Try_L118_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:Try_L118_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L119_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:For_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Assign_L123_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:For_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L124_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:FunctionDef_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Return_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_992:If_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_992:Expr_L130_C4"}]
#==================================================================== # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you 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. # ==================================================================== # # This software consists of voluntary contributions made by many # individuals on behalf of the Apache Software Foundation. For more # information on the Apache Software Foundation, please see # <http://www.apache.org/>. # import os import re import tempfile import shutil ignore_pattern = re.compile('^(.svn|target|bin|classes)') java_pattern = re.compile('^.*\.java') annot_pattern = re.compile('import org\.apache\.http\.annotation\.') def process_dir(dir): files = os.listdir(dir) for file in files: f = os.path.join(dir, file) if os.path.isdir(f): if not ignore_pattern.match(file): process_dir(f) else: if java_pattern.match(file): process_source(f) def process_source(filename): tmp = tempfile.mkstemp() tmpfd = tmp[0] tmpfile = tmp[1] try: changed = False dst = os.fdopen(tmpfd, 'w') try: src = open(filename) try: for line in src: if annot_pattern.match(line): changed = True line = line.replace('import org.apache.http.annotation.', 'import net.jcip.annotations.') dst.write(line) finally: src.close() finally: dst.close(); if changed: shutil.move(tmpfile, filename) else: os.remove(tmpfile) except: os.remove(tmpfile) process_dir('.')
ajibawa-2023/Python-Code-Large/train/row_993
38
74
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_993:Import_L26_C0", "label": "os import os", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.3514, 0.0135, 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_993:Import_L27_C0", "label": "re import re", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.3649, 0.0135, 0, 0.66, 0.1111, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Import_L28_C0", "label": "tempfile import tempfile", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.3784, 0.0135, 0, 0.66, 0.2222, 516, 0, 1, 0, 0, 516, 0, 0], "semantic": {"name": "tempfile", "arg_names": [], "import_names": ["tempfile"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tempfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Import_L29_C0", "label": "shutil import shutil", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.3919, 0.0135, 0, 0.66, 0.3333, 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_993:Assign_L31_C0", "label": "ignore_pattern = compile()", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.4189, 0.0135, 0, 0.66, 0.4444, 989, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "ignore_pattern", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "ignore_pattern = re.compile('^(.svn|target|bin|classes)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Assign_L32_C0", "label": "java_pattern = compile()", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.4324, 0.0135, 0, 0.66, 0.5556, 579, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "java_pattern", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "java_pattern = re.compile('^.*\\.java')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Assign_L33_C0", "label": "annot_pattern = compile()", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.4459, 0.0135, 0, 0.66, 0.6667, 164, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "annot_pattern", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "annot_pattern = re.compile('import org\\.apache\\.http\\.annotation\\.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:FunctionDef_L35_C0", "label": "process_dir", "type": "function", "loc": [35, 44], "level": 0, "parent": null, "vector": [2, 0, 0.5338, 0.1351, 0, 0.66, 0.7778, 660, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "process_dir", "arg_names": ["dir"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def process_dir(dir):\n files = os.listdir(dir)\n for file in files:\n f = os.path.join(dir, file)\n if os.path.isdir(f):\n if not ignore_pattern.match(file):\n process_dir(f)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Assign_L36_C4", "label": "files = listdir()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:FunctionDef_L35_C0", "vector": [14, 1, 0.4865, 0.0135, 1, 0.48, 0.0, 598, 3, 1, 0, 0, 551, 10, 1], "semantic": {"name": "files", "arg_names": [], "import_names": [], "rhs_call_name": "listdir", "annotation": ""}, "snippet": " files = os.listdir(dir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:For_L37_C4", "label": "for file", "type": "for", "loc": [37, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:FunctionDef_L35_C0", "vector": [6, 1, 0.5473, 0.1081, 1, 0.48, 1.0, 107, 2, 0, 0, 0, 0, 0, 6], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for file in files:\n f = os.path.join(dir, file)\n if os.path.isdir(f):\n if not ignore_pattern.match(file):\n process_dir(f)\n else:\n if java_pattern.match(file):\n process_source(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Assign_L38_C8", "label": "f = join()", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:For_L37_C4", "vector": [14, 2, 0.5135, 0.0135, 2, 0.78, 0.0, 899, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " f = os.path.join(dir, file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:If_L39_C8", "label": "if", "type": "if", "loc": [39, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:For_L37_C4", "vector": [4, 2, 0.5608, 0.0811, 2, 0.78, 1.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.isdir(f):\n if not ignore_pattern.match(file):\n process_dir(f)\n else:\n if java_pattern.match(file):\n process_source(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:If_L40_C12", "label": "if", "type": "if", "loc": [40, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:If_L39_C8", "vector": [4, 3, 0.5473, 0.027, 3, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not ignore_pattern.match(file):\n process_dir(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Expr_L41_C16", "label": "process_dir()", "type": "expression", "loc": [41, 41], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:If_L40_C12", "vector": [8, 4, 0.5541, 0.0135, 4, 0.4, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "process_dir", "arg_names": [], "import_names": [], "rhs_call_name": "process_dir", "annotation": ""}, "snippet": " process_dir(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:If_L43_C12", "label": "if", "type": "if", "loc": [43, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:If_L39_C8", "vector": [4, 3, 0.5878, 0.027, 3, 0.56, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if java_pattern.match(file):\n process_source(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Expr_L44_C16", "label": "process_source()", "type": "expression", "loc": [44, 44], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:If_L43_C12", "vector": [8, 4, 0.5946, 0.0135, 4, 0.37, 0.0, 173, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "process_source", "arg_names": [], "import_names": [], "rhs_call_name": "process_source", "annotation": ""}, "snippet": " process_source(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:FunctionDef_L46_C0", "label": "process_source", "type": "function", "loc": [46, 72], "level": 0, "parent": null, "vector": [2, 0, 0.7973, 0.3649, 0, 0.66, 0.8889, 173, 0, 1, 0, 0, 0, 0, 11], "semantic": {"name": "process_source", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def process_source(filename):\n tmp = tempfile.mkstemp()\n tmpfd = tmp[0]\n tmpfile = tmp[1]\n try:\n changed = False\n dst = os.fdopen(tmpfd, 'w')\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Assign_L47_C4", "label": "tmp = mkstemp()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:FunctionDef_L46_C0", "vector": [14, 1, 0.6351, 0.0135, 1, 0.59, 0.0, 517, 3, 0, 0, 0, 708, 10, 1], "semantic": {"name": "tmp", "arg_names": [], "import_names": [], "rhs_call_name": "mkstemp", "annotation": ""}, "snippet": " tmp = tempfile.mkstemp()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Assign_L48_C4", "label": "tmpfd =", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:FunctionDef_L46_C0", "vector": [14, 1, 0.6486, 0.0135, 1, 0.59, 0.3333, 608, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tmpfd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tmpfd = tmp[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Assign_L49_C4", "label": "tmpfile =", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:FunctionDef_L46_C0", "vector": [14, 1, 0.6622, 0.0135, 1, 0.59, 0.6667, 719, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tmpfile", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tmpfile = tmp[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L50_C4", "label": "try", "type": "try", "loc": [50, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:FunctionDef_L46_C0", "vector": [7, 1, 0.8243, 0.3108, 1, 0.59, 1.0, 0, 0, 1, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n changed = False\n dst = os.fdopen(tmpfd, 'w')\n try:\n src = open(filename)\n try:\n for line in src:\n if annot_pattern.match(line):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Assign_L51_C8", "label": "changed =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L50_C4", "vector": [14, 2, 0.6892, 0.0135, 2, 0.86, 0.0, 404, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "changed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " changed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Assign_L52_C8", "label": "dst = fdopen()", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L50_C4", "vector": [14, 2, 0.7027, 0.0135, 2, 0.86, 0.3333, 856, 3, 2, 0, 0, 783, 10, 1], "semantic": {"name": "dst", "arg_names": [], "import_names": [], "rhs_call_name": "fdopen", "annotation": ""}, "snippet": " dst = os.fdopen(tmpfd, 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L53_C8", "label": "try", "type": "try", "loc": [53, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L50_C4", "vector": [7, 2, 0.7905, 0.1622, 2, 0.86, 0.6667, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n src = open(filename)\n try:\n for line in src:\n if annot_pattern.match(line):\n changed = True\n line = line.replace('import org.apache.http.annotation.', 'import net.jcip.annotations.')\n dst.write(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Assign_L54_C12", "label": "src = open()", "type": "assigned_variable", "loc": [54, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L53_C8", "vector": [14, 3, 0.7297, 0.0135, 3, 0.86, 0.0, 345, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "src", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " src = open(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L55_C12", "label": "try", "type": "try", "loc": [55, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L53_C8", "vector": [7, 3, 0.7905, 0.1081, 3, 0.86, 0.5, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n for line in src:\n if annot_pattern.match(line):\n changed = True\n line = line.replace('import org.apache.http.annotation.', 'import net.jcip.annotations.')\n dst.write(line)\n finally:\n src.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:For_L56_C16", "label": "for line", "type": "for", "loc": [56, 60], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L55_C12", "vector": [6, 4, 0.7838, 0.0676, 4, 0.46, 0.0, 373, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in src:\n if annot_pattern.match(line):\n changed = True\n line = line.replace('import org.apache.http.annotation.', 'import net.jcip.annotations.')\n dst.write(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:If_L57_C20", "label": "if", "type": "if", "loc": [57, 59], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:For_L56_C16", "vector": [4, 5, 0.7838, 0.0405, 5, 0.96, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if annot_pattern.match(line):\n changed = True\n line = line.replace('import org.apache.http.annotation.', 'import net.jcip.annotations.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Assign_L58_C24", "label": "changed =", "type": "assigned_variable", "loc": [58, 58], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:If_L57_C20", "vector": [14, 6, 0.7838, 0.0135, 6, 0.91, 0.0, 404, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "changed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " changed = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Assign_L59_C24", "label": "line = replace()", "type": "assigned_variable", "loc": [59, 59], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:If_L57_C20", "vector": [14, 6, 0.7973, 0.0135, 6, 0.91, 1.0, 373, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " line = line.replace('import org.apache.http.annotation.', 'import net.jcip.annotations.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Expr_L60_C20", "label": "write()", "type": "expression", "loc": [60, 60], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:For_L56_C16", "vector": [8, 5, 0.8108, 0.0135, 5, 0.96, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " dst.write(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Expr_L62_C15", "label": "close()", "type": "expression", "loc": [62, 62], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L55_C12", "vector": [8, 4, 0.8378, 0.0135, 4, 0.46, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " src.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Expr_L64_C12", "label": "close()", "type": "expression", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L53_C8", "vector": [8, 3, 0.8649, 0.0135, 3, 0.86, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " dst.close();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:If_L66_C8", "label": "if", "type": "if", "loc": [66, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L50_C4", "vector": [4, 2, 0.9122, 0.0541, 2, 0.86, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if changed:\n shutil.move(tmpfile, filename)\n else:\n os.remove(tmpfile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Expr_L67_C12", "label": "move()", "type": "expression", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:If_L66_C8", "vector": [8, 3, 0.9054, 0.0135, 3, 0.15, 0.0, 856, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "move", "arg_names": [], "import_names": [], "rhs_call_name": "move", "annotation": ""}, "snippet": " shutil.move(tmpfile, filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Expr_L69_C12", "label": "remove()", "type": "expression", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:If_L66_C8", "vector": [8, 3, 0.9324, 0.0135, 3, 0.15, 1.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " os.remove(tmpfile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Expr_L72_C8", "label": "remove()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L50_C4", "vector": [8, 2, 0.973, 0.0135, 2, 0.86, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " os.remove(tmpfile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_993:Expr_L74_C0", "label": "process_dir()", "type": "expression", "loc": [74, 74], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0135, 0, 0.66, 1.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "process_dir", "arg_names": [], "import_names": [], "rhs_call_name": "process_dir", "annotation": ""}, "snippet": "process_dir('.')"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_993:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_993:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_993:For_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:For_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_993:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:For_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_993:If_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_993:If_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:If_L40_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_993:Expr_L41_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_993:If_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:If_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_993:Expr_L44_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_993:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_993:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_993:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_993:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_993:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_993:Assign_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L55_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_993:For_L56_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:For_L56_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_993:If_L57_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:If_L57_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_993:Assign_L58_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:If_L57_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_993:Assign_L59_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:For_L56_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_993:Expr_L60_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L55_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_993:Expr_L62_C15"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_993:Expr_L64_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_993:If_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_993:Expr_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_993:Expr_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_993:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_993:Expr_L72_C8"}]
""" Data format classes ("responders") that can be plugged into model_resource.ModelResource and determine how the objects of a ModelResource instance are rendered (e.g. serialized to XML, rendered by templates, ...). """ from django.core import serializers from django.core.handlers.wsgi import STATUS_CODE_TEXT from django.core.paginator import QuerySetPaginator, InvalidPage # the correct paginator for Model objects is the QuerySetPaginator, # not the Paginator! (see Django doc) from django.core.xheaders import populate_xheaders from django import forms from django.http import Http404, HttpResponse from django.forms.util import ErrorDict from django.shortcuts import render_to_response from django.template import loader, RequestContext from django.utils import simplejson from django.utils.xmlutils import SimplerXMLGenerator from django.views.generic.simple import direct_to_template class SerializeResponder(object): """ Class for all data formats that are possible with Django's serializer framework. """ def __init__(self, format, mimetype=None, paginate_by=None, allow_empty=False): """ format: may be every format that works with Django's serializer framework. By default: xml, python, json, (yaml). mimetype: if the default None is not changed, any HttpResponse calls use settings.DEFAULT_CONTENT_TYPE and settings.DEFAULT_CHARSET paginate_by: Number of elements per page. Default: All elements. """ self.format = format self.mimetype = mimetype self.paginate_by = paginate_by self.allow_empty = allow_empty self.expose_fields = [] def render(self, object_list): """ Serializes a queryset to the format specified in self.format. """ # Hide unexposed fields hidden_fields = [] for obj in list(object_list): for field in obj._meta.fields: if not field.name in self.expose_fields and field.serialize: field.serialize = False hidden_fields.append(field) response = serializers.serialize(self.format, object_list) # Show unexposed fields again for field in hidden_fields: field.serialize = True return response def element(self, request, elem): """ Renders single model objects to HttpResponse. """ return HttpResponse(self.render([elem]), self.mimetype) def error(self, request, status_code, error_dict=None): """ Handles errors in a RESTful way. - appropriate status code - appropriate mimetype - human-readable error message """ if not error_dict: error_dict = ErrorDict() response = HttpResponse(mimetype = self.mimetype) response.write('%d %s' % (status_code, STATUS_CODE_TEXT[status_code])) if error_dict: response.write('\n\nErrors:\n') response.write(error_dict.as_text()) response.status_code = status_code return response def list(self, request, queryset, page=None): """ Renders a list of model objects to HttpResponse. """ if self.paginate_by: paginator = QuerySetPaginator(queryset, self.paginate_by) if not page: page = request.GET.get('page', 1) try: page = int(page) object_list = paginator.page(page).object_list except (InvalidPage, ValueError): if page == 1 and self.allow_empty: object_list = [] else: return self.error(request, 404) else: object_list = list(queryset) return HttpResponse(self.render(object_list), self.mimetype) class JSONResponder(SerializeResponder): """ JSON data format class. """ def __init__(self, paginate_by=None, allow_empty=False): SerializeResponder.__init__(self, 'json', 'application/json', paginate_by=paginate_by, allow_empty=allow_empty) def error(self, request, status_code, error_dict=None): """ Return JSON error response that includes a human readable error message, application-specific errors and a machine readable status code. """ if not error_dict: error_dict = ErrorDict() response = HttpResponse(mimetype = self.mimetype) response.status_code = status_code response_dict = { "error-message" : '%d %s' % (status_code, STATUS_CODE_TEXT[status_code]), "status-code" : status_code, "model-errors" : error_dict.as_ul() } simplejson.dump(response_dict, response) return response class XMLResponder(SerializeResponder): """ XML data format class. """ def __init__(self, paginate_by=None, allow_empty=False): SerializeResponder.__init__(self, 'xml', 'application/xml', paginate_by=paginate_by, allow_empty=allow_empty) def error(self, request, status_code, error_dict=None): """ Return XML error response that includes a human readable error message, application-specific errors and a machine readable status code. """ from django.conf import settings if not error_dict: error_dict = ErrorDict() response = HttpResponse(mimetype = self.mimetype) response.status_code = status_code xml = SimplerXMLGenerator(response, settings.DEFAULT_CHARSET) xml.startDocument() xml.startElement("django-error", {}) xml.addQuickElement(name="error-message", contents='%d %s' % (status_code, STATUS_CODE_TEXT[status_code])) xml.addQuickElement(name="status-code", contents=str(status_code)) if error_dict: xml.startElement("model-errors", {}) for (model_field, errors) in error_dict.items(): for error in errors: xml.addQuickElement(name=model_field, contents=error) xml.endElement("model-errors") xml.endElement("django-error") xml.endDocument() return response class TemplateResponder(object): """ Data format class that uses templates (similar to Django's generic views). """ def __init__(self, template_dir, paginate_by=None, template_loader=loader, extra_context=None, allow_empty=False, context_processors=None, template_object_name='object', mimetype=None): self.template_dir = template_dir self.paginate_by = paginate_by self.template_loader = template_loader if not extra_context: extra_context = {} for key, value in extra_context.items(): if callable(value): extra_context[key] = value() self.extra_context = extra_context self.allow_empty = allow_empty self.context_processors = context_processors self.template_object_name = template_object_name self.mimetype = mimetype self.expose_fields = None # Set by Collection.__init__ def _hide_unexposed_fields(self, obj, allowed_fields): """ Remove fields from a model that should not be public. """ for field in obj._meta.fields: if not field.name in allowed_fields and \ not field.name + '_id' in allowed_fields: obj.__dict__.pop(field.name) def list(self, request, queryset, page=None): """ Renders a list of model objects to HttpResponse. """ template_name = '%s/%s_list.html' % (self.template_dir, queryset.model._meta.module_name) if self.paginate_by: paginator = QuerySetPaginator(queryset, self.paginate_by) if not page: page = request.GET.get('page', 1) try: page = int(page) object_list = paginator.page(page).object_list except (InvalidPage, ValueError): if page == 1 and self.allow_empty: object_list = [] else: raise Http404 current_page = paginator.page(page) c = RequestContext(request, { '%s_list' % self.template_object_name: object_list, 'is_paginated': paginator.num_pages > 1, 'results_per_page': self.paginate_by, 'has_next': current_page.has_next(), 'has_previous': current_page.has_previous(), 'page': page, 'next': page + 1, 'previous': page - 1, 'last_on_page': current_page.end_index(), 'first_on_page': current_page.start_index(), 'pages': paginator.num_pages, 'hits' : paginator.count, }, self.context_processors) else: object_list = queryset c = RequestContext(request, { '%s_list' % self.template_object_name: object_list, 'is_paginated': False }, self.context_processors) if not self.allow_empty and len(queryset) == 0: raise Http404 # Hide unexposed fields for obj in object_list: self._hide_unexposed_fields(obj, self.expose_fields) c.update(self.extra_context) t = self.template_loader.get_template(template_name) return HttpResponse(t.render(c), mimetype=self.mimetype) def element(self, request, elem): """ Renders single model objects to HttpResponse. """ template_name = '%s/%s_detail.html' % (self.template_dir, elem._meta.module_name) t = self.template_loader.get_template(template_name) c = RequestContext(request, { self.template_object_name : elem, }, self.context_processors) # Hide unexposed fields self._hide_unexposed_fields(elem, self.expose_fields) c.update(self.extra_context) response = HttpResponse(t.render(c), mimetype=self.mimetype) populate_xheaders(request, response, elem.__class__, getattr(elem, elem._meta.pk.name)) return response def error(self, request, status_code, error_dict=None): """ Renders error template (template name: error status code). """ if not error_dict: error_dict = ErrorDict() response = direct_to_template(request, template = '%s/%s.html' % (self.template_dir, str(status_code)), extra_context = { 'errors' : error_dict }, mimetype = self.mimetype) response.status_code = status_code return response def create_form(self, request, queryset, form_class): """ Render form for creation of new collection entry. """ ResourceForm = forms.form_for_model(queryset.model, form=form_class) if request.POST: form = ResourceForm(request.POST) else: form = ResourceForm() template_name = '%s/%s_form.html' % (self.template_dir, queryset.model._meta.module_name) return render_to_response(template_name, {'form':form}) def update_form(self, request, pk, queryset, form_class): """ Render edit form for single entry. """ # Remove queryset cache by cloning the queryset queryset = queryset._clone() elem = queryset.get(**{queryset.model._meta.pk.name : pk}) ResourceForm = forms.form_for_instance(elem, form=form_class) if request.PUT: form = ResourceForm(request.PUT) else: form = ResourceForm() template_name = '%s/%s_form.html' % (self.template_dir, elem._meta.module_name) return render_to_response(template_name, {'form':form, 'update':True, self.template_object_name:elem})
ajibawa-2023/Python-Code-Large/train/row_994
179
299
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0117, 0.0201, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nData format classes (\"responders\") that can be plugged \ninto model_resource.ModelResource and determine how\nthe objects of a ModelResource instance are rendered\n(e.g. serialized to XML, rendered by templates, ...).\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:ImportFrom_L7_C0", "label": "from django.core import serializers", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0234, 0.0033, 0, 0.66, 0.0625, 913, 0, 1, 0, 0, 913, 0, 0], "semantic": {"name": "django.core", "arg_names": [], "import_names": ["serializers"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core import serializers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:ImportFrom_L8_C0", "label": "from django.core.handlers.wsgi import STATUS_CODE_TEXT", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0268, 0.0033, 0, 0.66, 0.125, 643, 0, 1, 0, 0, 643, 0, 0], "semantic": {"name": "django.core.handlers.wsgi", "arg_names": [], "import_names": ["STATUS_CODE_TEXT"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.handlers.wsgi import STATUS_CODE_TEXT"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:ImportFrom_L9_C0", "label": "from django.core.paginator import QuerySetPaginator, InvalidPage", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0301, 0.0033, 0, 0.66, 0.1875, 831, 0, 2, 0, 0, 831, 0, 0], "semantic": {"name": "django.core.paginator", "arg_names": [], "import_names": ["QuerySetPaginator", "InvalidPage"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.paginator import QuerySetPaginator, InvalidPage"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:ImportFrom_L12_C0", "label": "from django.core.xheaders import populate_xheaders", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0401, 0.0033, 0, 0.66, 0.25, 794, 0, 1, 0, 0, 794, 0, 0], "semantic": {"name": "django.core.xheaders", "arg_names": [], "import_names": ["populate_xheaders"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.xheaders import populate_xheaders"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:ImportFrom_L13_C0", "label": "from django import forms", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0435, 0.0033, 0, 0.66, 0.3125, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["forms"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django import forms"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:ImportFrom_L14_C0", "label": "from django.http import Http404, HttpResponse", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0468, 0.0033, 0, 0.66, 0.375, 779, 0, 2, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_names": ["Http404", "HttpResponse"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.http import Http404, HttpResponse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:ImportFrom_L15_C0", "label": "from django.forms.util import ErrorDict", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0502, 0.0033, 0, 0.66, 0.4375, 332, 0, 1, 0, 0, 332, 0, 0], "semantic": {"name": "django.forms.util", "arg_names": [], "import_names": ["ErrorDict"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.forms.util import ErrorDict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:ImportFrom_L16_C0", "label": "from django.shortcuts import render_to_response", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0535, 0.0033, 0, 0.66, 0.5, 852, 0, 1, 0, 0, 852, 0, 0], "semantic": {"name": "django.shortcuts", "arg_names": [], "import_names": ["render_to_response"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.shortcuts import render_to_response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:ImportFrom_L17_C0", "label": "from django.template import loader, RequestContext", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0569, 0.0033, 0, 0.66, 0.5625, 213, 0, 2, 0, 0, 213, 0, 0], "semantic": {"name": "django.template", "arg_names": [], "import_names": ["loader", "RequestContext"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.template import loader, RequestContext"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:ImportFrom_L18_C0", "label": "from django.utils import simplejson", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0602, 0.0033, 0, 0.66, 0.625, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.utils", "arg_names": [], "import_names": ["simplejson"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils import simplejson"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:ImportFrom_L19_C0", "label": "from django.utils.xmlutils import SimplerXMLGenerator", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0635, 0.0033, 0, 0.66, 0.6875, 990, 0, 1, 0, 0, 990, 0, 0], "semantic": {"name": "django.utils.xmlutils", "arg_names": [], "import_names": ["SimplerXMLGenerator"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.xmlutils import SimplerXMLGenerator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:ImportFrom_L20_C0", "label": "from django.views.generic.simple import direct_to_template", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.0669, 0.0033, 0, 0.66, 0.75, 956, 0, 1, 0, 0, 956, 0, 0], "semantic": {"name": "django.views.generic.simple", "arg_names": [], "import_names": ["direct_to_template"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.views.generic.simple import direct_to_template"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L22_C0", "label": "SerializeResponder", "type": "class", "loc": [22, 103], "level": 0, "parent": null, "vector": [3, 0, 0.209, 0.2742, 0, 0.66, 0.8125, 899, 0, 5, 0, 0, 186, 0, 19], "semantic": {"name": "SerializeResponder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SerializeResponder(object):\n \"\"\"\n Class for all data formats that are possible\n with Django's serializer framework.\n \"\"\"\n def __init__(self, format, mimetype=None, paginate_by=None, allow_empty=False):\n \"\"\"\n format:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L23_C4", "label": "expression", "type": "expression", "loc": [23, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L22_C0", "vector": [8, 1, 0.0819, 0.0134, 1, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Class for all data formats that are possible\n with Django's serializer framework.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L27_C4", "label": "__init__", "type": "function", "loc": [27, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L22_C0", "vector": [2, 1, 0.1154, 0.0535, 1, 0.88, 0.2, 555, 0, 5, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "format", "mimetype", "paginate_by", "allow_empty"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, format, mimetype=None, paginate_by=None, allow_empty=False):\n \"\"\"\n format:\n may be every format that works with Django's serializer\n framework. By default: xml, python, json, (yaml).\n mimetype:\n if the default None is not changed, any HttpResponse calls \n use settings.DEFAULT_CONTENT_TYPE and settings.DEFAULT_CHARSET"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L28_C8", "label": "expression", "type": "expression", "loc": [28, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L27_C4", "vector": [8, 2, 0.1087, 0.0334, 2, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n format:\n may be every format that works with Django's serializer\n framework. By default: xml, python, json, (yaml).\n mimetype:\n if the default None is not changed, any HttpResponse calls \n use settings.DEFAULT_CONTENT_TYPE and settings.DEFAULT_CHARSET\n paginate_by:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L38_C8", "label": "self.format =", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L27_C4", "vector": [14, 2, 0.1271, 0.0033, 2, 0.85, 0.2, 896, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.format", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.format = format"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L39_C8", "label": "self.mimetype =", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L27_C4", "vector": [14, 2, 0.1304, 0.0033, 2, 0.85, 0.4, 284, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.mimetype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mimetype = mimetype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L40_C8", "label": "self.paginate_by =", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L27_C4", "vector": [14, 2, 0.1338, 0.0033, 2, 0.85, 0.6, 88, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.paginate_by", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.paginate_by = paginate_by"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L41_C8", "label": "self.allow_empty =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L27_C4", "vector": [14, 2, 0.1371, 0.0033, 2, 0.85, 0.8, 140, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.allow_empty", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.allow_empty = allow_empty"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L42_C8", "label": "self.expose_fields =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L27_C4", "vector": [14, 2, 0.1405, 0.0033, 2, 0.85, 1.0, 240, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.expose_fields", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.expose_fields = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L44_C4", "label": "render", "type": "function", "loc": [44, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L22_C0", "vector": [2, 1, 0.1739, 0.0569, 1, 0.88, 0.4, 24, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "render", "arg_names": ["self", "object_list"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def render(self, object_list):\n \"\"\"\n Serializes a queryset to the format specified in\n self.format.\n \"\"\"\n # Hide unexposed fields\n hidden_fields = []\n for obj in list(object_list):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L45_C8", "label": "expression", "type": "expression", "loc": [45, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L44_C4", "vector": [8, 2, 0.1555, 0.0134, 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 Serializes a queryset to the format specified in\n self.format.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L50_C8", "label": "hidden_fields =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L44_C4", "vector": [14, 2, 0.1672, 0.0033, 2, 0.62, 0.2, 463, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "hidden_fields", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hidden_fields = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:For_L51_C8", "label": "for obj", "type": "for", "loc": [51, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L44_C4", "vector": [6, 2, 0.1773, 0.0167, 2, 0.62, 0.4, 505, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for obj in list(object_list):\n for field in obj._meta.fields:\n if not field.name in self.expose_fields and field.serialize:\n field.serialize = False\n hidden_fields.append(field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:For_L52_C12", "label": "for field", "type": "for", "loc": [52, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:For_L51_C8", "vector": [6, 3, 0.1789, 0.0134, 3, 0.71, 0.0, 480, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for field in obj._meta.fields:\n if not field.name in self.expose_fields and field.serialize:\n field.serialize = False\n hidden_fields.append(field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:If_L53_C16", "label": "if", "type": "if", "loc": [53, 55], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:For_L52_C12", "vector": [4, 4, 0.1806, 0.01, 4, 0.38, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not field.name in self.expose_fields and field.serialize:\n field.serialize = False\n hidden_fields.append(field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L54_C20", "label": "field.serialize =", "type": "assigned_variable", "loc": [54, 54], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L53_C16", "vector": [14, 5, 0.1806, 0.0033, 5, 0.9, 0.0, 17, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "field.serialize", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field.serialize = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L55_C20", "label": "append()", "type": "expression", "loc": [55, 55], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L53_C16", "vector": [8, 5, 0.1839, 0.0033, 5, 0.9, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " hidden_fields.append(field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L56_C8", "label": "response = serialize()", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L44_C4", "vector": [14, 2, 0.1873, 0.0033, 2, 0.62, 0.6, 511, 3, 2, 0, 0, 50, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " response = serializers.serialize(self.format, object_list)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:For_L58_C8", "label": "for field", "type": "for", "loc": [58, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L44_C4", "vector": [6, 2, 0.1957, 0.0067, 2, 0.62, 0.8, 480, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for field in hidden_fields:\n field.serialize = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L59_C12", "label": "field.serialize =", "type": "assigned_variable", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:For_L58_C8", "vector": [14, 3, 0.1973, 0.0033, 3, 0.65, 0.0, 17, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "field.serialize", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field.serialize = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L60_C8", "label": "return", "type": "return", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L44_C4", "vector": [13, 2, 0.2007, 0.0033, 2, 0.62, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L62_C4", "label": "element", "type": "function", "loc": [62, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L22_C0", "vector": [2, 1, 0.214, 0.0167, 1, 0.88, 0.6, 736, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "element", "arg_names": ["self", "request", "elem"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def element(self, request, elem):\n \"\"\"\n Renders single model objects to HttpResponse.\n \"\"\"\n return HttpResponse(self.render([elem]), self.mimetype)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L63_C8", "label": "expression", "type": "expression", "loc": [63, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L62_C4", "vector": [8, 2, 0.214, 0.01, 2, 0.5, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Renders single model objects to HttpResponse.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L66_C8", "label": "return", "type": "return", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L62_C4", "vector": [13, 2, 0.2207, 0.0033, 2, 0.5, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return HttpResponse(self.render([elem]), self.mimetype)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L68_C4", "label": "error", "type": "function", "loc": [68, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L22_C0", "vector": [2, 1, 0.2525, 0.0535, 1, 0.88, 0.8, 771, 0, 4, 1, 0, 0, 0, 6], "semantic": {"name": "error", "arg_names": ["self", "request", "status_code", "error_dict"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def error(self, request, status_code, error_dict=None):\n \"\"\"\n Handles errors in a RESTful way.\n - appropriate status code\n - appropriate mimetype\n - human-readable error message\n \"\"\"\n if not error_dict:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L69_C8", "label": "expression", "type": "expression", "loc": [69, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L68_C4", "vector": [8, 2, 0.2391, 0.0201, 2, 0.39, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Handles errors in a RESTful way.\n - appropriate status code\n - appropriate mimetype\n - human-readable error message\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:If_L75_C8", "label": "if", "type": "if", "loc": [75, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L68_C4", "vector": [4, 2, 0.2525, 0.0067, 2, 0.39, 0.1667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not error_dict:\n error_dict = ErrorDict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L76_C12", "label": "error_dict = ErrorDict()", "type": "assigned_variable", "loc": [76, 76], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L75_C8", "vector": [14, 3, 0.2542, 0.0033, 3, 0.88, 0.0, 626, 3, 0, 0, 0, 801, 10, 1], "semantic": {"name": "error_dict", "arg_names": [], "import_names": [], "rhs_call_name": "ErrorDict", "annotation": ""}, "snippet": " error_dict = ErrorDict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L77_C8", "label": "response = HttpResponse()", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L68_C4", "vector": [14, 2, 0.2575, 0.0033, 2, 0.39, 0.3333, 511, 3, 1, 0, 0, 994, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "HttpResponse", "annotation": ""}, "snippet": " response = HttpResponse(mimetype = self.mimetype)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L78_C8", "label": "write()", "type": "expression", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L68_C4", "vector": [8, 2, 0.2609, 0.0033, 2, 0.39, 0.5, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " response.write('%d %s' % (status_code, STATUS_CODE_TEXT[status_code]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:If_L79_C8", "label": "if", "type": "if", "loc": [79, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L68_C4", "vector": [4, 2, 0.2676, 0.01, 2, 0.39, 0.6667, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if error_dict:\n response.write('\\n\\nErrors:\\n')\n response.write(error_dict.as_text())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L80_C12", "label": "write()", "type": "expression", "loc": [80, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L79_C8", "vector": [8, 3, 0.2676, 0.0033, 3, 0.42, 0.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " response.write('\\n\\nErrors:\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L81_C12", "label": "write()", "type": "expression", "loc": [81, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L79_C8", "vector": [8, 3, 0.2709, 0.0033, 3, 0.42, 1.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " response.write(error_dict.as_text())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L82_C8", "label": "response.status_code =", "type": "assigned_variable", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L68_C4", "vector": [14, 2, 0.2742, 0.0033, 2, 0.39, 0.8333, 942, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "response.status_code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.status_code = status_code"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L83_C8", "label": "return", "type": "return", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L68_C4", "vector": [13, 2, 0.2776, 0.0033, 2, 0.39, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L85_C4", "label": "list", "type": "function", "loc": [85, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L22_C0", "vector": [2, 1, 0.3144, 0.0635, 1, 0.88, 1.0, 430, 0, 4, 1, 0, 0, 0, 8], "semantic": {"name": "list", "arg_names": ["self", "request", "queryset", "page"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def list(self, request, queryset, page=None):\n \"\"\"\n Renders a list of model objects to HttpResponse.\n \"\"\"\n if self.paginate_by:\n paginator = QuerySetPaginator(queryset, self.paginate_by)\n if not page:\n page = request.GET.get('page', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L86_C8", "label": "expression", "type": "expression", "loc": [86, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L85_C4", "vector": [8, 2, 0.291, 0.01, 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 Renders a list of model objects to HttpResponse.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:If_L89_C8", "label": "if", "type": "if", "loc": [89, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L85_C4", "vector": [4, 2, 0.3194, 0.0468, 2, 0.41, 0.5, 0, 7, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.paginate_by:\n paginator = QuerySetPaginator(queryset, self.paginate_by)\n if not page:\n page = request.GET.get('page', 1)\n try:\n page = int(page)\n object_list = paginator.page(page).object_list\n except (InvalidPage, ValueError):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L90_C12", "label": "paginator = QuerySetPaginator()", "type": "assigned_variable", "loc": [90, 90], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L89_C8", "vector": [14, 3, 0.301, 0.0033, 3, 0.3, 0.0, 711, 3, 2, 0, 0, 735, 10, 1], "semantic": {"name": "paginator", "arg_names": [], "import_names": [], "rhs_call_name": "QuerySetPaginator", "annotation": ""}, "snippet": " paginator = QuerySetPaginator(queryset, self.paginate_by)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:If_L91_C12", "label": "if", "type": "if", "loc": [91, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L89_C8", "vector": [4, 3, 0.306, 0.0067, 3, 0.3, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not page:\n page = request.GET.get('page', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L92_C16", "label": "page = get()", "type": "assigned_variable", "loc": [92, 92], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L91_C12", "vector": [14, 4, 0.3077, 0.0033, 4, 0.67, 0.0, 623, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "page", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " page = request.GET.get('page', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Try_L93_C12", "label": "try", "type": "try", "loc": [93, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L89_C8", "vector": [7, 3, 0.3227, 0.0268, 3, 0.3, 0.6667, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n page = int(page)\n object_list = paginator.page(page).object_list\n except (InvalidPage, ValueError):\n if page == 1 and self.allow_empty:\n object_list = []\n else:\n return self.error(request, 404)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L94_C16", "label": "page = int()", "type": "assigned_variable", "loc": [94, 94], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:Try_L93_C12", "vector": [14, 4, 0.3144, 0.0033, 4, 0.9, 0.0, 623, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "page", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " page = int(page)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L95_C16", "label": "object_list =", "type": "assigned_variable", "loc": [95, 95], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:Try_L93_C12", "vector": [14, 4, 0.3177, 0.0033, 4, 0.9, 1.0, 809, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "object_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " object_list = paginator.page(page).object_list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:If_L97_C16", "label": "if", "type": "if", "loc": [97, 100], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:Try_L93_C12", "vector": [4, 4, 0.3294, 0.0134, 4, 0.9, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if page == 1 and self.allow_empty:\n object_list = []\n else:\n return self.error(request, 404)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L98_C20", "label": "object_list =", "type": "assigned_variable", "loc": [98, 98], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L97_C16", "vector": [14, 5, 0.3278, 0.0033, 5, 0.55, 0.0, 809, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "object_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " object_list = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L100_C20", "label": "return", "type": "return", "loc": [100, 100], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L97_C16", "vector": [13, 5, 0.3344, 0.0033, 5, 0.55, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.error(request, 404)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L102_C12", "label": "object_list = list()", "type": "assigned_variable", "loc": [102, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L89_C8", "vector": [14, 3, 0.3411, 0.0033, 3, 0.3, 1.0, 809, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "object_list", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " object_list = list(queryset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L103_C8", "label": "return", "type": "return", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L85_C4", "vector": [13, 2, 0.3445, 0.0033, 2, 0.41, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return HttpResponse(self.render(object_list), self.mimetype)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L105_C0", "label": "JSONResponder", "type": "class", "loc": [105, 129], "level": 0, "parent": null, "vector": [3, 0, 0.3913, 0.0836, 0, 0.66, 0.875, 26, 0, 2, 0, 0, 899, 0, 5], "semantic": {"name": "JSONResponder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class JSONResponder(SerializeResponder):\n \"\"\"\n JSON data format class.\n \"\"\"\n def __init__(self, paginate_by=None, allow_empty=False):\n SerializeResponder.__init__(self, 'json', 'application/json',\n paginate_by=paginate_by, allow_empty=allow_empty)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L106_C4", "label": "expression", "type": "expression", "loc": [106, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L105_C0", "vector": [8, 1, 0.3579, 0.01, 1, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n JSON data format class.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L109_C4", "label": "__init__", "type": "function", "loc": [109, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L105_C0", "vector": [2, 1, 0.3679, 0.01, 1, 0.83, 0.5, 555, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "paginate_by", "allow_empty"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, paginate_by=None, allow_empty=False):\n SerializeResponder.__init__(self, 'json', 'application/json',\n paginate_by=paginate_by, allow_empty=allow_empty)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L110_C8", "label": "__init__()", "type": "expression", "loc": [110, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L109_C4", "vector": [8, 2, 0.3696, 0.0067, 2, 0.52, 0.0, 555, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " SerializeResponder.__init__(self, 'json', 'application/json',\n paginate_by=paginate_by, allow_empty=allow_empty)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L113_C4", "label": "error", "type": "function", "loc": [113, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L105_C0", "vector": [2, 1, 0.4047, 0.0569, 1, 0.83, 1.0, 771, 0, 4, 1, 0, 0, 0, 4], "semantic": {"name": "error", "arg_names": ["self", "request", "status_code", "error_dict"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def error(self, request, status_code, error_dict=None):\n \"\"\"\n Return JSON error response that includes a human readable error\n message, application-specific errors and a machine readable\n status code.\n \"\"\"\n if not error_dict:\n error_dict = ErrorDict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L114_C8", "label": "expression", "type": "expression", "loc": [114, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L113_C4", "vector": [8, 2, 0.388, 0.0167, 2, 0.04, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Return JSON error response that includes a human readable error\n message, application-specific errors and a machine readable\n status code.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:If_L119_C8", "label": "if", "type": "if", "loc": [119, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L113_C4", "vector": [4, 2, 0.3997, 0.0067, 2, 0.04, 0.1667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not error_dict:\n error_dict = ErrorDict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L120_C12", "label": "error_dict = ErrorDict()", "type": "assigned_variable", "loc": [120, 120], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L119_C8", "vector": [14, 3, 0.4013, 0.0033, 3, 0.53, 0.0, 626, 3, 0, 0, 0, 801, 10, 1], "semantic": {"name": "error_dict", "arg_names": [], "import_names": [], "rhs_call_name": "ErrorDict", "annotation": ""}, "snippet": " error_dict = ErrorDict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L121_C8", "label": "response = HttpResponse()", "type": "assigned_variable", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L113_C4", "vector": [14, 2, 0.4047, 0.0033, 2, 0.04, 0.3333, 511, 3, 1, 0, 0, 994, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "HttpResponse", "annotation": ""}, "snippet": " response = HttpResponse(mimetype = self.mimetype)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L122_C8", "label": "response.status_code =", "type": "assigned_variable", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L113_C4", "vector": [14, 2, 0.408, 0.0033, 2, 0.04, 0.5, 942, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "response.status_code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.status_code = status_code"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L123_C8", "label": "response_dict =", "type": "assigned_variable", "loc": [123, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L113_C4", "vector": [14, 2, 0.4181, 0.0167, 2, 0.04, 0.6667, 932, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "response_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response_dict = {\n \"error-message\" : '%d %s' % (status_code, STATUS_CODE_TEXT[status_code]),\n \"status-code\" : status_code,\n \"model-errors\" : error_dict.as_ul()\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L128_C8", "label": "dump()", "type": "expression", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L113_C4", "vector": [8, 2, 0.4281, 0.0033, 2, 0.04, 0.8333, 952, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " simplejson.dump(response_dict, response)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L129_C8", "label": "return", "type": "return", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L113_C4", "vector": [13, 2, 0.4314, 0.0033, 2, 0.04, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L131_C0", "label": "XMLResponder", "type": "class", "loc": [131, 163], "level": 0, "parent": null, "vector": [3, 0, 0.4916, 0.1104, 0, 0.66, 0.9375, 84, 0, 2, 0, 0, 899, 0, 15], "semantic": {"name": "XMLResponder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class XMLResponder(SerializeResponder):\n \"\"\"\n XML data format class.\n \"\"\"\n def __init__(self, paginate_by=None, allow_empty=False):\n SerializeResponder.__init__(self, 'xml', 'application/xml',\n paginate_by=paginate_by, allow_empty=allow_empty)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L132_C4", "label": "expression", "type": "expression", "loc": [132, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L131_C0", "vector": [8, 1, 0.4448, 0.01, 1, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n XML data format class.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L135_C4", "label": "__init__", "type": "function", "loc": [135, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L131_C0", "vector": [2, 1, 0.4548, 0.01, 1, 0.2, 0.5, 555, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "paginate_by", "allow_empty"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, paginate_by=None, allow_empty=False):\n SerializeResponder.__init__(self, 'xml', 'application/xml',\n paginate_by=paginate_by, allow_empty=allow_empty)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L136_C8", "label": "__init__()", "type": "expression", "loc": [136, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L135_C4", "vector": [8, 2, 0.4565, 0.0067, 2, 0.27, 0.0, 555, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " SerializeResponder.__init__(self, 'xml', 'application/xml',\n paginate_by=paginate_by, allow_empty=allow_empty)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "label": "error", "type": "function", "loc": [139, 163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L131_C0", "vector": [2, 1, 0.505, 0.0836, 1, 0.2, 1.0, 771, 0, 4, 1, 0, 0, 0, 14], "semantic": {"name": "error", "arg_names": ["self", "request", "status_code", "error_dict"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def error(self, request, status_code, error_dict=None):\n \"\"\"\n Return XML error response that includes a human readable error\n message, application-specific errors and a machine readable\n status code.\n \"\"\"\n from django.conf import settings\n if not error_dict:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L140_C8", "label": "expression", "type": "expression", "loc": [140, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "vector": [8, 2, 0.4749, 0.0167, 2, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Return XML error response that includes a human readable error\n message, application-specific errors and a machine readable\n status code.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:ImportFrom_L145_C8", "label": "from django.conf import settings", "type": "import", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "vector": [1, 2, 0.4849, 0.0033, 2, 0.86, 0.0769, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:If_L146_C8", "label": "if", "type": "if", "loc": [146, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "vector": [4, 2, 0.49, 0.0067, 2, 0.86, 0.1538, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not error_dict:\n error_dict = ErrorDict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L147_C12", "label": "error_dict = ErrorDict()", "type": "assigned_variable", "loc": [147, 147], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L146_C8", "vector": [14, 3, 0.4916, 0.0033, 3, 0.48, 0.0, 626, 3, 0, 0, 0, 801, 10, 1], "semantic": {"name": "error_dict", "arg_names": [], "import_names": [], "rhs_call_name": "ErrorDict", "annotation": ""}, "snippet": " error_dict = ErrorDict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L148_C8", "label": "response = HttpResponse()", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "vector": [14, 2, 0.495, 0.0033, 2, 0.86, 0.2308, 511, 3, 1, 0, 0, 994, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "HttpResponse", "annotation": ""}, "snippet": " response = HttpResponse(mimetype = self.mimetype)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L149_C8", "label": "response.status_code =", "type": "assigned_variable", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "vector": [14, 2, 0.4983, 0.0033, 2, 0.86, 0.3077, 942, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "response.status_code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.status_code = status_code"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L150_C8", "label": "xml = SimplerXMLGenerator()", "type": "assigned_variable", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "vector": [14, 2, 0.5017, 0.0033, 2, 0.86, 0.3846, 324, 3, 2, 0, 0, 255, 10, 1], "semantic": {"name": "xml", "arg_names": [], "import_names": [], "rhs_call_name": "SimplerXMLGenerator", "annotation": ""}, "snippet": " xml = SimplerXMLGenerator(response, settings.DEFAULT_CHARSET)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L151_C8", "label": "startDocument()", "type": "expression", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "vector": [8, 2, 0.505, 0.0033, 2, 0.86, 0.4615, 326, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "startDocument", "arg_names": [], "import_names": [], "rhs_call_name": "startDocument", "annotation": ""}, "snippet": " xml.startDocument()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L152_C8", "label": "startElement()", "type": "expression", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "vector": [8, 2, 0.5084, 0.0033, 2, 0.86, 0.5385, 862, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "startElement", "arg_names": [], "import_names": [], "rhs_call_name": "startElement", "annotation": ""}, "snippet": " xml.startElement(\"django-error\", {})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L153_C8", "label": "addQuickElement()", "type": "expression", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "vector": [8, 2, 0.5117, 0.0033, 2, 0.86, 0.6154, 928, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "addQuickElement", "arg_names": [], "import_names": [], "rhs_call_name": "addQuickElement", "annotation": ""}, "snippet": " xml.addQuickElement(name=\"error-message\", contents='%d %s' % (status_code, STATUS_CODE_TEXT[status_code]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L154_C8", "label": "addQuickElement()", "type": "expression", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "vector": [8, 2, 0.5151, 0.0033, 2, 0.86, 0.6923, 928, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "addQuickElement", "arg_names": [], "import_names": [], "rhs_call_name": "addQuickElement", "annotation": ""}, "snippet": " xml.addQuickElement(name=\"status-code\", contents=str(status_code))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:If_L155_C8", "label": "if", "type": "if", "loc": [155, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "vector": [4, 2, 0.5268, 0.0201, 2, 0.86, 0.7692, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if error_dict:\n xml.startElement(\"model-errors\", {})\n for (model_field, errors) in error_dict.items():\n for error in errors:\n xml.addQuickElement(name=model_field, contents=error)\n xml.endElement(\"model-errors\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L156_C12", "label": "startElement()", "type": "expression", "loc": [156, 156], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L155_C8", "vector": [8, 3, 0.5217, 0.0033, 3, 0.22, 0.0, 862, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "startElement", "arg_names": [], "import_names": [], "rhs_call_name": "startElement", "annotation": ""}, "snippet": " xml.startElement(\"model-errors\", {})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:For_L157_C12", "label": "for model_field, errors", "type": "for", "loc": [157, 159], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L155_C8", "vector": [6, 3, 0.5284, 0.01, 3, 0.22, 0.5, 226, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "model_field, errors", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for (model_field, errors) in error_dict.items():\n for error in errors:\n xml.addQuickElement(name=model_field, contents=error)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:For_L158_C16", "label": "for error", "type": "for", "loc": [158, 159], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:For_L157_C12", "vector": [6, 4, 0.5301, 0.0067, 4, 0.22, 0.0, 771, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for error in errors:\n xml.addQuickElement(name=model_field, contents=error)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L159_C20", "label": "addQuickElement()", "type": "expression", "loc": [159, 159], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:For_L158_C16", "vector": [8, 5, 0.5318, 0.0033, 5, 0.17, 0.0, 928, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "addQuickElement", "arg_names": [], "import_names": [], "rhs_call_name": "addQuickElement", "annotation": ""}, "snippet": " xml.addQuickElement(name=model_field, contents=error)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L160_C12", "label": "endElement()", "type": "expression", "loc": [160, 160], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L155_C8", "vector": [8, 3, 0.5351, 0.0033, 3, 0.22, 1.0, 563, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "endElement", "arg_names": [], "import_names": [], "rhs_call_name": "endElement", "annotation": ""}, "snippet": " xml.endElement(\"model-errors\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L161_C8", "label": "endElement()", "type": "expression", "loc": [161, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "vector": [8, 2, 0.5385, 0.0033, 2, 0.86, 0.8462, 563, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "endElement", "arg_names": [], "import_names": [], "rhs_call_name": "endElement", "annotation": ""}, "snippet": " xml.endElement(\"django-error\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L162_C8", "label": "endDocument()", "type": "expression", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "vector": [8, 2, 0.5418, 0.0033, 2, 0.86, 0.9231, 761, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "endDocument", "arg_names": [], "import_names": [], "rhs_call_name": "endDocument", "annotation": ""}, "snippet": " xml.endDocument()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L163_C8", "label": "return", "type": "return", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "vector": [13, 2, 0.5452, 0.0033, 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 response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L165_C0", "label": "TemplateResponder", "type": "class", "loc": [165, 299], "level": 0, "parent": null, "vector": [3, 0, 0.7759, 0.4515, 0, 0.66, 1.0, 154, 0, 7, 0, 0, 186, 0, 42], "semantic": {"name": "TemplateResponder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TemplateResponder(object):\n \"\"\"\n Data format class that uses templates (similar to Django's\n generic views).\n \"\"\"\n def __init__(self, template_dir, paginate_by=None, template_loader=loader,\n extra_context=None, allow_empty=False, context_processors=None,\n template_object_name='object', mimetype=None):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L166_C4", "label": "expression", "type": "expression", "loc": [166, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L165_C0", "vector": [8, 1, 0.5602, 0.0134, 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 Data format class that uses templates (similar to Django's\n generic views).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "label": "__init__", "type": "function", "loc": [170, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L165_C0", "vector": [2, 1, 0.5953, 0.0569, 1, 0.22, 0.1429, 555, 0, 9, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "template_dir", "paginate_by", "template_loader", "extra_context", "allow_empty", "context_processors", "template_object_name", "mimetype"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, template_dir, paginate_by=None, template_loader=loader,\n extra_context=None, allow_empty=False, context_processors=None,\n template_object_name='object', mimetype=None):\n self.template_dir = template_dir\n self.paginate_by = paginate_by\n self.template_loader = template_loader\n if not extra_context:\n extra_context = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L173_C8", "label": "self.template_dir =", "type": "assigned_variable", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "vector": [14, 2, 0.5786, 0.0033, 2, 0.22, 0.0, 607, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.template_dir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.template_dir = template_dir"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L174_C8", "label": "self.paginate_by =", "type": "assigned_variable", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "vector": [14, 2, 0.5819, 0.0033, 2, 0.22, 0.1, 88, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.paginate_by", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.paginate_by = paginate_by"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L175_C8", "label": "self.template_loader =", "type": "assigned_variable", "loc": [175, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "vector": [14, 2, 0.5853, 0.0033, 2, 0.22, 0.2, 329, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.template_loader", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.template_loader = template_loader"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:If_L176_C8", "label": "if", "type": "if", "loc": [176, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "vector": [4, 2, 0.5903, 0.0067, 2, 0.22, 0.3, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not extra_context:\n extra_context = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L177_C12", "label": "extra_context =", "type": "assigned_variable", "loc": [177, 177], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L176_C8", "vector": [14, 3, 0.592, 0.0033, 3, 0.81, 0.0, 751, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "extra_context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " extra_context = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:For_L178_C8", "label": "for key, value", "type": "for", "loc": [178, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "vector": [6, 2, 0.5987, 0.01, 2, 0.22, 0.4, 839, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, value in extra_context.items():\n if callable(value):\n extra_context[key] = value()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:If_L179_C12", "label": "if", "type": "if", "loc": [179, 180], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:For_L178_C8", "vector": [4, 3, 0.6003, 0.0067, 3, 0.88, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if callable(value):\n extra_context[key] = value()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L180_C16", "label": " = value()", "type": "assigned_variable", "loc": [180, 180], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L179_C12", "vector": [14, 4, 0.602, 0.0033, 4, 0.71, 0.0, 0, 3, 0, 0, 0, 441, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "value", "annotation": ""}, "snippet": " extra_context[key] = value()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L181_C8", "label": "self.extra_context =", "type": "assigned_variable", "loc": [181, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "vector": [14, 2, 0.6054, 0.0033, 2, 0.22, 0.5, 195, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.extra_context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.extra_context = extra_context"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L182_C8", "label": "self.allow_empty =", "type": "assigned_variable", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "vector": [14, 2, 0.6087, 0.0033, 2, 0.22, 0.6, 140, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.allow_empty", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.allow_empty = allow_empty"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L183_C8", "label": "self.context_processors =", "type": "assigned_variable", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "vector": [14, 2, 0.612, 0.0033, 2, 0.22, 0.7, 947, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.context_processors", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.context_processors = context_processors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L184_C8", "label": "self.template_object_name =", "type": "assigned_variable", "loc": [184, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "vector": [14, 2, 0.6154, 0.0033, 2, 0.22, 0.8, 388, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.template_object_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.template_object_name = template_object_name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L185_C8", "label": "self.mimetype =", "type": "assigned_variable", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "vector": [14, 2, 0.6187, 0.0033, 2, 0.22, 0.9, 284, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.mimetype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mimetype = mimetype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L186_C8", "label": "self.expose_fields =", "type": "assigned_variable", "loc": [186, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "vector": [14, 2, 0.6221, 0.0033, 2, 0.22, 1.0, 240, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.expose_fields", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.expose_fields = None # Set by Collection.__init__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L188_C4", "label": "_hide_unexposed_fields", "type": "function", "loc": [188, 195], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L165_C0", "vector": [2, 1, 0.6405, 0.0268, 1, 0.22, 0.2857, 307, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "_hide_unexposed_fields", "arg_names": ["self", "obj", "allowed_fields"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _hide_unexposed_fields(self, obj, allowed_fields):\n \"\"\"\n Remove fields from a model that should not be public.\n \"\"\"\n for field in obj._meta.fields:\n if not field.name in allowed_fields and \\\n not field.name + '_id' in allowed_fields:\n obj.__dict__.pop(field.name) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L189_C8", "label": "expression", "type": "expression", "loc": [189, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L188_C4", "vector": [8, 2, 0.6355, 0.01, 2, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Remove fields from a model that should not be public.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:For_L192_C8", "label": "for field", "type": "for", "loc": [192, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L188_C4", "vector": [6, 2, 0.6472, 0.0134, 2, 0.46, 1.0, 480, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for field in obj._meta.fields:\n if not field.name in allowed_fields and \\\n not field.name + '_id' in allowed_fields:\n obj.__dict__.pop(field.name) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:If_L193_C12", "label": "if", "type": "if", "loc": [193, 195], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:For_L192_C8", "vector": [4, 3, 0.6488, 0.01, 3, 0.98, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not field.name in allowed_fields and \\\n not field.name + '_id' in allowed_fields:\n obj.__dict__.pop(field.name) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L195_C16", "label": "pop()", "type": "expression", "loc": [195, 195], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L193_C12", "vector": [8, 4, 0.6522, 0.0033, 4, 0.8, 0.0, 969, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pop", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " obj.__dict__.pop(field.name) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L197_C4", "label": "list", "type": "function", "loc": [197, 242], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L165_C0", "vector": [2, 1, 0.7341, 0.1538, 1, 0.22, 0.4286, 430, 0, 4, 1, 0, 0, 0, 17], "semantic": {"name": "list", "arg_names": ["self", "request", "queryset", "page"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def list(self, request, queryset, page=None):\n \"\"\"\n Renders a list of model objects to HttpResponse.\n \"\"\"\n template_name = '%s/%s_list.html' % (self.template_dir, queryset.model._meta.module_name)\n if self.paginate_by:\n paginator = QuerySetPaginator(queryset, self.paginate_by)\n if not page:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L198_C8", "label": "expression", "type": "expression", "loc": [198, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L197_C4", "vector": [8, 2, 0.6656, 0.01, 2, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Renders a list of model objects to HttpResponse.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L201_C8", "label": "template_name =", "type": "assigned_variable", "loc": [201, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L197_C4", "vector": [14, 2, 0.6722, 0.0033, 2, 0.79, 0.1667, 522, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "template_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " template_name = '%s/%s_list.html' % (self.template_dir, queryset.model._meta.module_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:If_L202_C8", "label": "if", "type": "if", "loc": [202, 236], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L197_C4", "vector": [4, 2, 0.7324, 0.1171, 2, 0.79, 0.3333, 0, 7, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.paginate_by:\n paginator = QuerySetPaginator(queryset, self.paginate_by)\n if not page:\n page = request.GET.get('page', 1)\n try:\n page = int(page)\n object_list = paginator.page(page).object_list\n except (InvalidPage, ValueError):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L203_C12", "label": "paginator = QuerySetPaginator()", "type": "assigned_variable", "loc": [203, 203], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L202_C8", "vector": [14, 3, 0.6789, 0.0033, 3, 0.53, 0.0, 711, 3, 2, 0, 0, 735, 10, 1], "semantic": {"name": "paginator", "arg_names": [], "import_names": [], "rhs_call_name": "QuerySetPaginator", "annotation": ""}, "snippet": " paginator = QuerySetPaginator(queryset, self.paginate_by)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:If_L204_C12", "label": "if", "type": "if", "loc": [204, 205], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L202_C8", "vector": [4, 3, 0.6839, 0.0067, 3, 0.53, 0.1429, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not page:\n page = request.GET.get('page', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L205_C16", "label": "page = get()", "type": "assigned_variable", "loc": [205, 205], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L204_C12", "vector": [14, 4, 0.6856, 0.0033, 4, 0.19, 0.0, 623, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "page", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " page = request.GET.get('page', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Try_L206_C12", "label": "try", "type": "try", "loc": [206, 213], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L202_C8", "vector": [7, 3, 0.7007, 0.0268, 3, 0.53, 0.2857, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n page = int(page)\n object_list = paginator.page(page).object_list\n except (InvalidPage, ValueError):\n if page == 1 and self.allow_empty:\n object_list = []\n else:\n raise Http404"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L207_C16", "label": "page = int()", "type": "assigned_variable", "loc": [207, 207], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:Try_L206_C12", "vector": [14, 4, 0.6923, 0.0033, 4, 0.26, 0.0, 623, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "page", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " page = int(page)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L208_C16", "label": "object_list =", "type": "assigned_variable", "loc": [208, 208], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:Try_L206_C12", "vector": [14, 4, 0.6957, 0.0033, 4, 0.26, 1.0, 809, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "object_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " object_list = paginator.page(page).object_list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:If_L210_C16", "label": "if", "type": "if", "loc": [210, 213], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:Try_L206_C12", "vector": [4, 4, 0.7074, 0.0134, 4, 0.26, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if page == 1 and self.allow_empty:\n object_list = []\n else:\n raise Http404"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L211_C20", "label": "object_list =", "type": "assigned_variable", "loc": [211, 211], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L210_C16", "vector": [14, 5, 0.7057, 0.0033, 5, 0.58, 0.0, 809, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "object_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " object_list = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L214_C12", "label": "current_page = page()", "type": "assigned_variable", "loc": [214, 214], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L202_C8", "vector": [14, 3, 0.7157, 0.0033, 3, 0.53, 0.4286, 906, 3, 1, 0, 0, 623, 10, 1], "semantic": {"name": "current_page", "arg_names": [], "import_names": [], "rhs_call_name": "page", "annotation": ""}, "snippet": " current_page = paginator.page(page)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L215_C12", "label": "c = RequestContext()", "type": "assigned_variable", "loc": [215, 228], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L202_C8", "vector": [14, 3, 0.7408, 0.0468, 3, 0.53, 0.5714, 411, 3, 3, 0, 0, 47, 10, 5], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "RequestContext", "annotation": ""}, "snippet": " c = RequestContext(request, {\n '%s_list' % self.template_object_name: object_list,\n 'is_paginated': paginator.num_pages > 1,\n 'results_per_page': self.paginate_by,\n 'has_next': current_page.has_next(),\n 'has_previous': current_page.has_previous(),\n 'page': page,\n 'next': page + 1,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L230_C12", "label": "object_list =", "type": "assigned_variable", "loc": [230, 230], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L202_C8", "vector": [14, 3, 0.7692, 0.0033, 3, 0.53, 0.7143, 809, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "object_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " object_list = queryset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L231_C12", "label": "c = RequestContext()", "type": "assigned_variable", "loc": [231, 234], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L202_C8", "vector": [14, 3, 0.7776, 0.0134, 3, 0.53, 0.8571, 411, 3, 3, 0, 0, 47, 10, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "RequestContext", "annotation": ""}, "snippet": " c = RequestContext(request, {\n '%s_list' % self.template_object_name: object_list,\n 'is_paginated': False\n }, self.context_processors)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:If_L235_C12", "label": "if", "type": "if", "loc": [235, 236], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L202_C8", "vector": [4, 3, 0.7876, 0.0067, 3, 0.53, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.allow_empty and len(queryset) == 0:\n raise Http404"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:For_L238_C8", "label": "for obj", "type": "for", "loc": [238, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L197_C4", "vector": [6, 2, 0.7977, 0.0067, 2, 0.79, 0.5, 505, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for obj in object_list:\n self._hide_unexposed_fields(obj, self.expose_fields)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L239_C12", "label": "_hide_unexposed_fields()", "type": "expression", "loc": [239, 239], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:For_L238_C8", "vector": [8, 3, 0.7993, 0.0033, 3, 0.53, 0.0, 307, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_hide_unexposed_fields", "arg_names": [], "import_names": [], "rhs_call_name": "_hide_unexposed_fields", "annotation": ""}, "snippet": " self._hide_unexposed_fields(obj, self.expose_fields)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L240_C8", "label": "update()", "type": "expression", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L197_C4", "vector": [8, 2, 0.8027, 0.0033, 2, 0.79, 0.6667, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " c.update(self.extra_context) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L241_C8", "label": "t = get_template()", "type": "assigned_variable", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L197_C4", "vector": [14, 2, 0.806, 0.0033, 2, 0.79, 0.8333, 15, 3, 1, 0, 0, 27, 10, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "get_template", "annotation": ""}, "snippet": " t = self.template_loader.get_template(template_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L242_C8", "label": "return", "type": "return", "loc": [242, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L197_C4", "vector": [13, 2, 0.8094, 0.0033, 2, 0.79, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return HttpResponse(t.render(c), mimetype=self.mimetype)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L244_C4", "label": "element", "type": "function", "loc": [244, 258], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L165_C0", "vector": [2, 1, 0.8395, 0.0502, 1, 0.22, 0.5714, 736, 0, 3, 1, 0, 0, 0, 8], "semantic": {"name": "element", "arg_names": ["self", "request", "elem"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def element(self, request, elem):\n \"\"\"\n Renders single model objects to HttpResponse.\n \"\"\"\n template_name = '%s/%s_detail.html' % (self.template_dir, elem._meta.module_name)\n t = self.template_loader.get_template(template_name)\n c = RequestContext(request, {\n self.template_object_name : elem,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L245_C8", "label": "expression", "type": "expression", "loc": [245, 247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L244_C4", "vector": [8, 2, 0.8227, 0.01, 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 Renders single model objects to HttpResponse.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L248_C8", "label": "template_name =", "type": "assigned_variable", "loc": [248, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L244_C4", "vector": [14, 2, 0.8294, 0.0033, 2, 0.41, 0.125, 522, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "template_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " template_name = '%s/%s_detail.html' % (self.template_dir, elem._meta.module_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L249_C8", "label": "t = get_template()", "type": "assigned_variable", "loc": [249, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L244_C4", "vector": [14, 2, 0.8328, 0.0033, 2, 0.41, 0.25, 15, 3, 1, 0, 0, 27, 10, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "get_template", "annotation": ""}, "snippet": " t = self.template_loader.get_template(template_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L250_C8", "label": "c = RequestContext()", "type": "assigned_variable", "loc": [250, 252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L244_C4", "vector": [14, 2, 0.8395, 0.01, 2, 0.41, 0.375, 411, 3, 3, 0, 0, 47, 10, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "RequestContext", "annotation": ""}, "snippet": " c = RequestContext(request, {\n self.template_object_name : elem,\n }, self.context_processors)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L254_C8", "label": "_hide_unexposed_fields()", "type": "expression", "loc": [254, 254], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L244_C4", "vector": [8, 2, 0.8495, 0.0033, 2, 0.41, 0.5, 307, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_hide_unexposed_fields", "arg_names": [], "import_names": [], "rhs_call_name": "_hide_unexposed_fields", "annotation": ""}, "snippet": " self._hide_unexposed_fields(elem, self.expose_fields)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L255_C8", "label": "update()", "type": "expression", "loc": [255, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L244_C4", "vector": [8, 2, 0.8528, 0.0033, 2, 0.41, 0.625, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " c.update(self.extra_context)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L256_C8", "label": "response = HttpResponse()", "type": "assigned_variable", "loc": [256, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L244_C4", "vector": [14, 2, 0.8562, 0.0033, 2, 0.41, 0.75, 511, 3, 2, 0, 0, 994, 10, 2], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "HttpResponse", "annotation": ""}, "snippet": " response = HttpResponse(t.render(c), mimetype=self.mimetype)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L257_C8", "label": "populate_xheaders()", "type": "expression", "loc": [257, 257], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L244_C4", "vector": [8, 2, 0.8595, 0.0033, 2, 0.41, 0.875, 146, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "populate_xheaders", "arg_names": [], "import_names": [], "rhs_call_name": "populate_xheaders", "annotation": ""}, "snippet": " populate_xheaders(request, response, elem.__class__, getattr(elem, elem._meta.pk.name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L258_C8", "label": "return", "type": "return", "loc": [258, 258], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L244_C4", "vector": [13, 2, 0.8629, 0.0033, 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 response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L260_C4", "label": "error", "type": "function", "loc": [260, 271], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L165_C0", "vector": [2, 1, 0.888, 0.0401, 1, 0.22, 0.7143, 771, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "error", "arg_names": ["self", "request", "status_code", "error_dict"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def error(self, request, status_code, error_dict=None):\n \"\"\"\n Renders error template (template name: error status code).\n \"\"\"\n if not error_dict:\n error_dict = ErrorDict()\n response = direct_to_template(request, \n template = '%s/%s.html' % (self.template_dir, str(status_code)),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L261_C8", "label": "expression", "type": "expression", "loc": [261, 263], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L260_C4", "vector": [8, 2, 0.8763, 0.01, 2, 0.23, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Renders error template (template name: error status code).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:If_L264_C8", "label": "if", "type": "if", "loc": [264, 265], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L260_C4", "vector": [4, 2, 0.8846, 0.0067, 2, 0.23, 0.25, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not error_dict:\n error_dict = ErrorDict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L265_C12", "label": "error_dict = ErrorDict()", "type": "assigned_variable", "loc": [265, 265], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L264_C8", "vector": [14, 3, 0.8863, 0.0033, 3, 0.06, 0.0, 626, 3, 0, 0, 0, 801, 10, 1], "semantic": {"name": "error_dict", "arg_names": [], "import_names": [], "rhs_call_name": "ErrorDict", "annotation": ""}, "snippet": " error_dict = ErrorDict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L266_C8", "label": "response = direct_to_template()", "type": "assigned_variable", "loc": [266, 269], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L260_C4", "vector": [14, 2, 0.8946, 0.0134, 2, 0.23, 0.5, 511, 3, 4, 0, 0, 134, 10, 2], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "direct_to_template", "annotation": ""}, "snippet": " response = direct_to_template(request, \n template = '%s/%s.html' % (self.template_dir, str(status_code)),\n extra_context = { 'errors' : error_dict },\n mimetype = self.mimetype)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L270_C8", "label": "response.status_code =", "type": "assigned_variable", "loc": [270, 270], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L260_C4", "vector": [14, 2, 0.903, 0.0033, 2, 0.23, 0.75, 942, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "response.status_code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.status_code = status_code"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L271_C8", "label": "return", "type": "return", "loc": [271, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L260_C4", "vector": [13, 2, 0.9064, 0.0033, 2, 0.23, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L273_C4", "label": "create_form", "type": "function", "loc": [273, 283], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L165_C0", "vector": [2, 1, 0.9298, 0.0368, 1, 0.22, 0.8571, 532, 0, 4, 1, 0, 0, 0, 4], "semantic": {"name": "create_form", "arg_names": ["self", "request", "queryset", "form_class"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def create_form(self, request, queryset, form_class):\n \"\"\"\n Render form for creation of new collection entry.\n \"\"\"\n ResourceForm = forms.form_for_model(queryset.model, form=form_class)\n if request.POST:\n form = ResourceForm(request.POST)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L274_C8", "label": "expression", "type": "expression", "loc": [274, 276], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L273_C4", "vector": [8, 2, 0.9197, 0.01, 2, 0.63, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Render form for creation of new collection entry.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L277_C8", "label": "ResourceForm = form_for_model()", "type": "assigned_variable", "loc": [277, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L273_C4", "vector": [14, 2, 0.9264, 0.0033, 2, 0.63, 0.25, 898, 3, 2, 0, 0, 904, 10, 1], "semantic": {"name": "ResourceForm", "arg_names": [], "import_names": [], "rhs_call_name": "form_for_model", "annotation": ""}, "snippet": " ResourceForm = forms.form_for_model(queryset.model, form=form_class)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:If_L278_C8", "label": "if", "type": "if", "loc": [278, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L273_C4", "vector": [4, 2, 0.9348, 0.0134, 2, 0.63, 0.5, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.POST:\n form = ResourceForm(request.POST)\n else:\n form = ResourceForm()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L279_C12", "label": "form = ResourceForm()", "type": "assigned_variable", "loc": [279, 279], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L278_C8", "vector": [14, 3, 0.9331, 0.0033, 3, 0.76, 0.0, 761, 3, 1, 0, 0, 898, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "ResourceForm", "annotation": ""}, "snippet": " form = ResourceForm(request.POST)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L281_C12", "label": "form = ResourceForm()", "type": "assigned_variable", "loc": [281, 281], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L278_C8", "vector": [14, 3, 0.9398, 0.0033, 3, 0.76, 1.0, 761, 3, 0, 0, 0, 898, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "ResourceForm", "annotation": ""}, "snippet": " form = ResourceForm()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L282_C8", "label": "template_name =", "type": "assigned_variable", "loc": [282, 282], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L273_C4", "vector": [14, 2, 0.9431, 0.0033, 2, 0.63, 0.75, 522, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "template_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " template_name = '%s/%s_form.html' % (self.template_dir, queryset.model._meta.module_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L283_C8", "label": "return", "type": "return", "loc": [283, 283], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L273_C4", "vector": [13, 2, 0.9465, 0.0033, 2, 0.63, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render_to_response(template_name, {'form':form})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L285_C4", "label": "update_form", "type": "function", "loc": [285, 299], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L165_C0", "vector": [2, 1, 0.9766, 0.0502, 1, 0.22, 1.0, 873, 0, 5, 1, 0, 0, 0, 6], "semantic": {"name": "update_form", "arg_names": ["self", "request", "pk", "queryset", "form_class"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update_form(self, request, pk, queryset, form_class):\n \"\"\"\n Render edit form for single entry.\n \"\"\"\n # Remove queryset cache by cloning the queryset\n queryset = queryset._clone()\n elem = queryset.get(**{queryset.model._meta.pk.name : pk})\n ResourceForm = forms.form_for_instance(elem, form=form_class)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L286_C8", "label": "expression", "type": "expression", "loc": [286, 288], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L285_C4", "vector": [8, 2, 0.9599, 0.01, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Render edit form for single entry.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L290_C8", "label": "queryset = _clone()", "type": "assigned_variable", "loc": [290, 290], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L285_C4", "vector": [14, 2, 0.9699, 0.0033, 2, 0.83, 0.1667, 38, 3, 0, 0, 0, 617, 10, 1], "semantic": {"name": "queryset", "arg_names": [], "import_names": [], "rhs_call_name": "_clone", "annotation": ""}, "snippet": " queryset = queryset._clone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L291_C8", "label": "elem = get()", "type": "assigned_variable", "loc": [291, 291], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L285_C4", "vector": [14, 2, 0.9732, 0.0033, 2, 0.83, 0.3333, 63, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "elem", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " elem = queryset.get(**{queryset.model._meta.pk.name : pk})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L292_C8", "label": "ResourceForm = form_for_instance()", "type": "assigned_variable", "loc": [292, 292], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L285_C4", "vector": [14, 2, 0.9766, 0.0033, 2, 0.83, 0.5, 898, 3, 2, 0, 0, 212, 10, 1], "semantic": {"name": "ResourceForm", "arg_names": [], "import_names": [], "rhs_call_name": "form_for_instance", "annotation": ""}, "snippet": " ResourceForm = forms.form_for_instance(elem, form=form_class)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:If_L293_C8", "label": "if", "type": "if", "loc": [293, 296], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L285_C4", "vector": [4, 2, 0.9849, 0.0134, 2, 0.83, 0.6667, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.PUT:\n form = ResourceForm(request.PUT)\n else:\n form = ResourceForm()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L294_C12", "label": "form = ResourceForm()", "type": "assigned_variable", "loc": [294, 294], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L293_C8", "vector": [14, 3, 0.9833, 0.0033, 3, 0.52, 0.0, 761, 3, 1, 0, 0, 898, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "ResourceForm", "annotation": ""}, "snippet": " form = ResourceForm(request.PUT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L296_C12", "label": "form = ResourceForm()", "type": "assigned_variable", "loc": [296, 296], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:If_L293_C8", "vector": [14, 3, 0.99, 0.0033, 3, 0.52, 1.0, 761, 3, 0, 0, 0, 898, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "ResourceForm", "annotation": ""}, "snippet": " form = ResourceForm()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L297_C8", "label": "template_name =", "type": "assigned_variable", "loc": [297, 297], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L285_C4", "vector": [14, 2, 0.9933, 0.0033, 2, 0.83, 0.8333, 522, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "template_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " template_name = '%s/%s_form.html' % (self.template_dir, elem._meta.module_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L298_C8", "label": "return", "type": "return", "loc": [298, 299], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L285_C4", "vector": [13, 2, 0.9983, 0.0067, 2, 0.83, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render_to_response(template_name, \n {'form':form, 'update':True, self.template_object_name:elem})"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:For_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:For_L51_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:For_L52_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:For_L52_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_994:If_L53_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L53_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L54_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L53_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L55_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:For_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:For_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:If_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L75_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:If_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L79_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L80_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L79_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L81_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:If_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L90_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:If_L91_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L91_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L92_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Try_L93_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:Try_L93_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L94_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:Try_L93_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L95_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:Try_L93_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_994:If_L97_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L97_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L98_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L97_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L100_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L102_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L105_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L105_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L105_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:If_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L120_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L131_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L131_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L131_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:ImportFrom_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:If_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L147_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:If_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L155_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L156_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L155_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:For_L157_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:For_L157_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_994:For_L158_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:For_L158_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L159_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L155_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L160_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L165_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L165_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L173_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L175_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:If_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L176_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L177_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:For_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:For_L178_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:If_L179_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L179_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L180_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L181_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L182_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L185_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L186_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L165_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:For_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:For_L192_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:If_L193_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L193_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L195_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L165_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L201_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:If_L202_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L202_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L203_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L202_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:If_L204_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L204_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L205_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L202_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Try_L206_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:Try_L206_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L207_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:Try_L206_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L208_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:Try_L206_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_994:If_L210_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L210_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L211_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L202_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L214_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L202_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L215_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L202_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L230_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L202_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L231_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L202_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:If_L235_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:For_L238_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:For_L238_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L239_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L241_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L242_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L165_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L244_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L245_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L248_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L250_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L254_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L255_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L256_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L257_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L244_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L258_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L165_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L260_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L260_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L261_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L260_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:If_L264_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L264_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L265_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L260_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L266_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L260_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L270_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L260_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L271_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L165_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L273_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L274_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:If_L278_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L278_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L279_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L278_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L281_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L282_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L283_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:ClassDef_L165_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L285_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L285_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Expr_L286_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L285_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L290_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L285_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L291_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L285_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L292_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L285_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:If_L293_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L293_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L294_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:If_L293_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L296_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L285_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Assign_L297_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_994:FunctionDef_L285_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_994:Return_L298_C8"}]
""" Generic resource class. """ from django.utils.translation import ugettext as _ from authentication import NoAuthentication from django.core.urlresolvers import reverse as _reverse from django.http import Http404, HttpResponse, HttpResponseNotAllowed def load_put_and_files(request): """ Populates request.PUT and request.FILES from request.raw_post_data. PUT and POST requests differ only in REQUEST_METHOD, not in the way data is encoded. Therefore we can use Django's POST data retrieval method for PUT. """ if request.method == 'PUT': request.method = 'POST' request._load_post_and_files() request.method = 'PUT' request.PUT = request.POST del request._post def reverse(viewname, args=(), kwargs=None): """ Return the URL associated with a view and specified parameters. If the regular expression used specifies an optional slash at the end of the URL, add the slash. """ if not kwargs: kwargs = {} url = _reverse(viewname, None, args, kwargs) if url[-2:] == '/?': url = url[:-1] return url class HttpMethodNotAllowed(Exception): """ Signals that request.method was not part of the list of permitted methods. """ class ResourceBase(object): """ Base class for both model-based and non-model-based resources. """ def __init__(self, authentication=None, permitted_methods=None): """ authentication: the authentication instance that checks whether a request is authenticated permitted_methods: the HTTP request methods that are allowed for this resource e.g. ('GET', 'PUT') """ # Access restrictions if not authentication: authentication = NoAuthentication() self.authentication = authentication if not permitted_methods: permitted_methods = ["GET"] self.permitted_methods = [m.upper() for m in permitted_methods] def dispatch(self, request, target, *args, **kwargs): """ """ request_method = request.method.upper() if request_method not in self.permitted_methods: raise HttpMethodNotAllowed if request_method == 'GET': return target.read(request, *args, **kwargs) elif request_method == 'POST': return target.create(request, *args, **kwargs) elif request_method == 'PUT': load_put_and_files(request) return target.update(request, *args, **kwargs) elif request_method == 'DELETE': return target.delete(request, *args, **kwargs) else: raise Http404 def get_url(self): """ Returns resource URL. """ return reverse(self) # The four CRUD methods that any class that # inherits from Resource may implement: def create(self, request): raise Http404 def read(self, request): raise Http404 def update(self, request): raise Http404 def delete(self, request): raise Http404 class Resource(ResourceBase): """ Generic resource class that can be used for resources that are not based on Django models. """ def __init__(self, authentication=None, permitted_methods=None, mimetype=None): """ authentication: the authentication instance that checks whether a request is authenticated permitted_methods: the HTTP request methods that are allowed for this resource e.g. ('GET', 'PUT') mimetype: if the default None is not changed, any HttpResponse calls use settings.DEFAULT_CONTENT_TYPE and settings.DEFAULT_CHARSET """ ResourceBase.__init__(self, authentication, permitted_methods) self.mimetype = mimetype def __call__(self, request, *args, **kwargs): """ Redirects to one of the CRUD methods depending on the HTTP method of the request. Checks whether the requested method is allowed for this resource. """ # Check permission if not self.authentication.is_authenticated(request): response = HttpResponse(_('Authorization Required'), mimetype=self.mimetype) challenge_headers = self.authentication.challenge_headers() for k,v in challenge_headers.items(): response[k] = v response.status_code = 401 return response try: return self.dispatch(request, self, *args, **kwargs) except HttpMethodNotAllowed: response = HttpResponseNotAllowed(self.permitted_methods) response.mimetype = self.mimetype return response
ajibawa-2023/Python-Code-Large/train/row_995
72
148
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0135, 0.0203, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nGeneric resource class.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:ImportFrom_L4_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.027, 0.0068, 0, 0.66, 0.1111, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [], "import_names": ["_"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation import ugettext as _"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:ImportFrom_L5_C0", "label": "from authentication import NoAuthentication", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0338, 0.0068, 0, 0.66, 0.2222, 281, 0, 1, 0, 0, 281, 0, 0], "semantic": {"name": "authentication", "arg_names": [], "import_names": ["NoAuthentication"], "rhs_call_name": "", "annotation": ""}, "snippet": "from authentication import NoAuthentication"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:ImportFrom_L6_C0", "label": "from django.core.urlresolvers import _reverse", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0405, 0.0068, 0, 0.66, 0.3333, 749, 0, 1, 0, 0, 749, 0, 0], "semantic": {"name": "django.core.urlresolvers", "arg_names": [], "import_names": ["_reverse"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.urlresolvers import reverse as _reverse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:ImportFrom_L7_C0", "label": "from django.http import Http404, HttpResponse, HttpResponseNotAllowed", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0473, 0.0068, 0, 0.66, 0.4444, 779, 0, 3, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_names": ["Http404", "HttpResponse", "HttpResponseNotAllowed"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.http import Http404, HttpResponse, HttpResponseNotAllowed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L9_C0", "label": "load_put_and_files", "type": "function", "loc": [9, 22], "level": 0, "parent": null, "vector": [2, 0, 0.1047, 0.0946, 0, 0.66, 0.5556, 833, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_put_and_files", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def load_put_and_files(request):\n \"\"\"\n Populates request.PUT and request.FILES from\n request.raw_post_data. PUT and POST requests differ \n only in REQUEST_METHOD, not in the way data is encoded. \n Therefore we can use Django's POST data retrieval method \n for PUT.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L10_C4", "label": "expression", "type": "expression", "loc": [10, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L9_C0", "vector": [8, 1, 0.0878, 0.0473, 1, 0.0, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Populates request.PUT and request.FILES from\n request.raw_post_data. PUT and POST requests differ \n only in REQUEST_METHOD, not in the way data is encoded. \n Therefore we can use Django's POST data retrieval method \n for PUT.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:If_L17_C4", "label": "if", "type": "if", "loc": [17, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L9_C0", "vector": [4, 1, 0.1318, 0.0405, 1, 0.0, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.method == 'PUT':\n request.method = 'POST'\n request._load_post_and_files()\n request.method = 'PUT'\n request.PUT = request.POST\n del request._post"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L18_C8", "label": "request.method =", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:If_L17_C4", "vector": [14, 2, 0.1216, 0.0068, 2, 0.83, 0.0, 11, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "request.method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request.method = 'POST'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L19_C8", "label": "_load_post_and_files()", "type": "expression", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:If_L17_C4", "vector": [8, 2, 0.1284, 0.0068, 2, 0.83, 0.3333, 153, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_load_post_and_files", "arg_names": [], "import_names": [], "rhs_call_name": "_load_post_and_files", "annotation": ""}, "snippet": " request._load_post_and_files()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L20_C8", "label": "request.method =", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:If_L17_C4", "vector": [14, 2, 0.1351, 0.0068, 2, 0.83, 0.6667, 11, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "request.method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request.method = 'PUT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L21_C8", "label": "request.PUT =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:If_L17_C4", "vector": [14, 2, 0.1419, 0.0068, 2, 0.83, 1.0, 951, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "request.PUT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request.PUT = request.POST"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L24_C0", "label": "reverse", "type": "function", "loc": [24, 35], "level": 0, "parent": null, "vector": [2, 0, 0.1993, 0.0811, 0, 0.66, 0.6667, 109, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "reverse", "arg_names": ["viewname", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def reverse(viewname, args=(), kwargs=None):\n \"\"\"\n Return the URL associated with a view and specified parameters.\n If the regular expression used specifies an optional slash at \n the end of the URL, add the slash.\n \"\"\"\n if not kwargs:\n kwargs = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L25_C4", "label": "expression", "type": "expression", "loc": [25, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L24_C0", "vector": [8, 1, 0.1824, 0.0338, 1, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Return the URL associated with a view and specified parameters.\n If the regular expression used specifies an optional slash at \n the end of the URL, add the slash.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:If_L30_C4", "label": "if", "type": "if", "loc": [30, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L24_C0", "vector": [4, 1, 0.2061, 0.0135, 1, 0.13, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not kwargs:\n kwargs = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L31_C8", "label": "kwargs =", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:If_L30_C4", "vector": [14, 2, 0.2095, 0.0068, 2, 0.8, 0.0, 987, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "kwargs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kwargs = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L32_C4", "label": "url = _reverse()", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L24_C0", "vector": [14, 1, 0.2162, 0.0068, 1, 0.13, 0.5, 789, 3, 4, 0, 0, 141, 10, 1], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "_reverse", "annotation": ""}, "snippet": " url = _reverse(viewname, None, args, kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:If_L33_C4", "label": "if", "type": "if", "loc": [33, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L24_C0", "vector": [4, 1, 0.2264, 0.0135, 1, 0.13, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if url[-2:] == '/?':\n url = url[:-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L34_C8", "label": "url =", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:If_L33_C4", "vector": [14, 2, 0.2297, 0.0068, 2, 0.72, 0.0, 789, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = url[:-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Return_L35_C4", "label": "return", "type": "return", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L24_C0", "vector": [13, 1, 0.2365, 0.0068, 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 url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L37_C0", "label": "HttpMethodNotAllowed", "type": "class", "loc": [37, 41], "level": 0, "parent": null, "vector": [3, 0, 0.2635, 0.0338, 0, 0.66, 0.7778, 126, 0, 0, 0, 0, 645, 0, 0], "semantic": {"name": "HttpMethodNotAllowed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class HttpMethodNotAllowed(Exception):\n \"\"\"\n Signals that request.method was not part of\n the list of permitted methods.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L38_C4", "label": "expression", "type": "expression", "loc": [38, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L37_C0", "vector": [8, 1, 0.2669, 0.027, 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 Signals that request.method was not part of\n the list of permitted methods.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L43_C0", "label": "ResourceBase", "type": "class", "loc": [43, 104], "level": 0, "parent": null, "vector": [3, 0, 0.4966, 0.4189, 0, 0.66, 0.8889, 480, 0, 7, 0, 0, 186, 0, 9], "semantic": {"name": "ResourceBase", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ResourceBase(object):\n \"\"\"\n Base class for both model-based and non-model-based \n resources.\n \"\"\"\n def __init__(self, authentication=None, permitted_methods=None):\n \"\"\"\n authentication:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L44_C4", "label": "expression", "type": "expression", "loc": [44, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L43_C0", "vector": [8, 1, 0.3074, 0.027, 1, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Base class for both model-based and non-model-based \n resources.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L48_C4", "label": "__init__", "type": "function", "loc": [48, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L43_C0", "vector": [2, 1, 0.3784, 0.1149, 1, 0.95, 0.1429, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "authentication", "permitted_methods"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, authentication=None, permitted_methods=None):\n \"\"\"\n authentication:\n the authentication instance that checks whether a\n request is authenticated\n permitted_methods:\n the HTTP request methods that are allowed for this \n resource e.g. ('GET', 'PUT')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L49_C8", "label": "expression", "type": "expression", "loc": [49, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L48_C4", "vector": [8, 2, 0.3547, 0.0541, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n authentication:\n the authentication instance that checks whether a\n request is authenticated\n permitted_methods:\n the HTTP request methods that are allowed for this \n resource e.g. ('GET', 'PUT')\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:If_L58_C8", "label": "if", "type": "if", "loc": [58, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L48_C4", "vector": [4, 2, 0.3953, 0.0135, 2, 0.83, 0.25, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not authentication:\n authentication = NoAuthentication()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L59_C12", "label": "authentication = NoAuthentication()", "type": "assigned_variable", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:If_L58_C8", "vector": [14, 3, 0.3986, 0.0068, 3, 0.3, 0.0, 281, 3, 0, 0, 0, 177, 10, 1], "semantic": {"name": "authentication", "arg_names": [], "import_names": [], "rhs_call_name": "NoAuthentication", "annotation": ""}, "snippet": " authentication = NoAuthentication()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L60_C8", "label": "self.authentication =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L48_C4", "vector": [14, 2, 0.4054, 0.0068, 2, 0.83, 0.5, 739, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.authentication", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.authentication = authentication"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:If_L62_C8", "label": "if", "type": "if", "loc": [62, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L48_C4", "vector": [4, 2, 0.4223, 0.0135, 2, 0.83, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not permitted_methods:\n permitted_methods = [\"GET\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L63_C12", "label": "permitted_methods =", "type": "assigned_variable", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:If_L62_C8", "vector": [14, 3, 0.4257, 0.0068, 3, 0.56, 0.0, 112, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "permitted_methods", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " permitted_methods = [\"GET\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L64_C8", "label": "self.permitted_methods =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L48_C4", "vector": [14, 2, 0.4324, 0.0068, 2, 0.83, 1.0, 442, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.permitted_methods", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.permitted_methods = [m.upper() for m in permitted_methods]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L66_C4", "label": "dispatch", "type": "function", "loc": [66, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L43_C0", "vector": [2, 1, 0.5034, 0.1216, 1, 0.95, 0.2857, 416, 0, 5, 1, 0, 0, 0, 6], "semantic": {"name": "dispatch", "arg_names": ["self", "request", "target", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def dispatch(self, request, target, *args, **kwargs):\n \"\"\"\n \"\"\"\n request_method = request.method.upper()\n if request_method not in self.permitted_methods:\n raise HttpMethodNotAllowed\n \n if request_method == 'GET':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L67_C8", "label": "expression", "type": "expression", "loc": [67, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L66_C4", "vector": [8, 2, 0.4561, 0.0135, 2, 0.24, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L69_C8", "label": "request_method = upper()", "type": "assigned_variable", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L66_C4", "vector": [14, 2, 0.4662, 0.0068, 2, 0.24, 0.3333, 587, 3, 0, 0, 0, 347, 10, 1], "semantic": {"name": "request_method", "arg_names": [], "import_names": [], "rhs_call_name": "upper", "annotation": ""}, "snippet": " request_method = request.method.upper()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:If_L70_C8", "label": "if", "type": "if", "loc": [70, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L66_C4", "vector": [4, 2, 0.4764, 0.0135, 2, 0.24, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request_method not in self.permitted_methods:\n raise HttpMethodNotAllowed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:If_L73_C8", "label": "if", "type": "if", "loc": [73, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L66_C4", "vector": [4, 2, 0.527, 0.0743, 2, 0.24, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request_method == 'GET':\n return target.read(request, *args, **kwargs)\n elif request_method == 'POST':\n return target.create(request, *args, **kwargs)\n elif request_method == 'PUT':\n load_put_and_files(request)\n return target.update(request, *args, **kwargs)\n elif request_method == 'DELETE':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Return_L74_C12", "label": "return", "type": "return", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:If_L73_C8", "vector": [13, 3, 0.5, 0.0068, 3, 0.84, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return target.read(request, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:If_L75_C8", "label": "if", "type": "if", "loc": [75, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:If_L73_C8", "vector": [4, 3, 0.5338, 0.0608, 3, 0.84, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif request_method == 'POST':\n return target.create(request, *args, **kwargs)\n elif request_method == 'PUT':\n load_put_and_files(request)\n return target.update(request, *args, **kwargs)\n elif request_method == 'DELETE':\n return target.delete(request, *args, **kwargs)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Return_L76_C12", "label": "return", "type": "return", "loc": [76, 76], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:If_L75_C8", "vector": [13, 4, 0.5135, 0.0068, 4, 0.62, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return target.create(request, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:If_L77_C8", "label": "if", "type": "if", "loc": [77, 83], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:If_L75_C8", "vector": [4, 4, 0.5405, 0.0473, 4, 0.62, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif request_method == 'PUT':\n load_put_and_files(request)\n return target.update(request, *args, **kwargs)\n elif request_method == 'DELETE':\n return target.delete(request, *args, **kwargs)\n else:\n raise Http404"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L78_C12", "label": "load_put_and_files()", "type": "expression", "loc": [78, 78], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:If_L77_C8", "vector": [8, 5, 0.527, 0.0068, 5, 0.53, 0.0, 833, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "load_put_and_files", "arg_names": [], "import_names": [], "rhs_call_name": "load_put_and_files", "annotation": ""}, "snippet": " load_put_and_files(request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Return_L79_C12", "label": "return", "type": "return", "loc": [79, 79], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:If_L77_C8", "vector": [13, 5, 0.5338, 0.0068, 5, 0.53, 0.5, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return target.update(request, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:If_L80_C8", "label": "if", "type": "if", "loc": [80, 83], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:If_L77_C8", "vector": [4, 5, 0.5507, 0.027, 5, 0.53, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif request_method == 'DELETE':\n return target.delete(request, *args, **kwargs)\n else:\n raise Http404"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Return_L81_C12", "label": "return", "type": "return", "loc": [81, 81], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:If_L80_C8", "vector": [13, 6, 0.5473, 0.0068, 6, 0.49, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return target.delete(request, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L85_C4", "label": "get_url", "type": "function", "loc": [85, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L43_C0", "vector": [2, 1, 0.5878, 0.0338, 1, 0.95, 0.4286, 662, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_url", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_url(self):\n \"\"\"\n Returns resource URL.\n \"\"\"\n return reverse(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L86_C8", "label": "expression", "type": "expression", "loc": [86, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L85_C4", "vector": [8, 2, 0.5878, 0.0203, 2, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns resource URL.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Return_L89_C8", "label": "return", "type": "return", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L85_C4", "vector": [13, 2, 0.6014, 0.0068, 2, 0.81, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return reverse(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L94_C4", "label": "create", "type": "function", "loc": [94, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L43_C0", "vector": [2, 1, 0.6385, 0.0135, 1, 0.95, 0.5714, 316, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "create", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def create(self, request):\n raise Http404"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L97_C4", "label": "read", "type": "function", "loc": [97, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L43_C0", "vector": [2, 1, 0.6588, 0.0135, 1, 0.95, 0.7143, 453, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "read", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def read(self, request):\n raise Http404"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L100_C4", "label": "update", "type": "function", "loc": [100, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L43_C0", "vector": [2, 1, 0.6791, 0.0135, 1, 0.95, 0.8571, 637, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "update", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update(self, request):\n raise Http404"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L103_C4", "label": "delete", "type": "function", "loc": [103, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L43_C0", "vector": [2, 1, 0.6993, 0.0135, 1, 0.95, 1.0, 266, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "delete", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def delete(self, request):\n raise Http404"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L106_C0", "label": "Resource", "type": "class", "loc": [106, 147], "level": 0, "parent": null, "vector": [3, 0, 0.8547, 0.2838, 0, 0.66, 1.0, 412, 0, 2, 0, 0, 480, 0, 8], "semantic": {"name": "Resource", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Resource(ResourceBase):\n \"\"\"\n Generic resource class that can be used for\n resources that are not based on Django models.\n \"\"\"\n def __init__(self, authentication=None, permitted_methods=None,\n mimetype=None):\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L107_C4", "label": "expression", "type": "expression", "loc": [107, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L106_C0", "vector": [8, 1, 0.7331, 0.027, 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 Generic resource class that can be used for\n resources that are not based on Django models.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L111_C4", "label": "__init__", "type": "function", "loc": [111, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L106_C0", "vector": [2, 1, 0.7973, 0.1014, 1, 0.01, 0.5, 555, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "authentication", "permitted_methods", "mimetype"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, authentication=None, permitted_methods=None,\n mimetype=None):\n \"\"\"\n authentication:\n the authentication instance that checks whether a\n request is authenticated\n permitted_methods:\n the HTTP request methods that are allowed for this "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L113_C8", "label": "expression", "type": "expression", "loc": [113, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L111_C4", "vector": [8, 2, 0.7973, 0.0743, 2, 0.36, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n authentication:\n the authentication instance that checks whether a\n request is authenticated\n permitted_methods:\n the HTTP request methods that are allowed for this \n resource e.g. ('GET', 'PUT')\n mimetype:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L124_C8", "label": "__init__()", "type": "expression", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L111_C4", "vector": [8, 2, 0.8378, 0.0068, 2, 0.36, 0.5, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " ResourceBase.__init__(self, authentication, permitted_methods)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L125_C8", "label": "self.mimetype =", "type": "assigned_variable", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L111_C4", "vector": [14, 2, 0.8446, 0.0068, 2, 0.36, 1.0, 284, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.mimetype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mimetype = mimetype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L127_C4", "label": "__call__", "type": "function", "loc": [127, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L106_C0", "vector": [2, 1, 0.9257, 0.1419, 1, 0.01, 1.0, 319, 0, 4, 1, 0, 0, 0, 7], "semantic": {"name": "__call__", "arg_names": ["self", "request", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __call__(self, request, *args, **kwargs):\n \"\"\"\n Redirects to one of the CRUD methods depending \n on the HTTP method of the request. Checks whether\n the requested method is allowed for this resource.\n \"\"\"\n # Check permission\n if not self.authentication.is_authenticated(request):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L128_C8", "label": "expression", "type": "expression", "loc": [128, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L127_C4", "vector": [8, 2, 0.8784, 0.0338, 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 Redirects to one of the CRUD methods depending \n on the HTTP method of the request. Checks whether\n the requested method is allowed for this resource.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:If_L134_C8", "label": "if", "type": "if", "loc": [134, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L127_C4", "vector": [4, 2, 0.9257, 0.0473, 2, 0.41, 0.5, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.authentication.is_authenticated(request):\n response = HttpResponse(_('Authorization Required'), mimetype=self.mimetype)\n challenge_headers = self.authentication.challenge_headers()\n for k,v in challenge_headers.items():\n response[k] = v\n response.status_code = 401\n return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L135_C12", "label": "response = HttpResponse()", "type": "assigned_variable", "loc": [135, 135], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:If_L134_C8", "vector": [14, 3, 0.9122, 0.0068, 3, 0.48, 0.0, 511, 3, 2, 0, 0, 994, 10, 2], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "HttpResponse", "annotation": ""}, "snippet": " response = HttpResponse(_('Authorization Required'), mimetype=self.mimetype)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L136_C12", "label": "challenge_headers = challenge_headers()", "type": "assigned_variable", "loc": [136, 136], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:If_L134_C8", "vector": [14, 3, 0.9189, 0.0068, 3, 0.48, 0.25, 25, 3, 0, 0, 0, 25, 10, 1], "semantic": {"name": "challenge_headers", "arg_names": [], "import_names": [], "rhs_call_name": "challenge_headers", "annotation": ""}, "snippet": " challenge_headers = self.authentication.challenge_headers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:For_L137_C12", "label": "for k, v", "type": "for", "loc": [137, 138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:If_L134_C8", "vector": [6, 3, 0.9291, 0.0135, 3, 0.48, 0.5, 867, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k,v in challenge_headers.items():\n response[k] = v"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L138_C16", "label": "assign", "type": "assigned_variable", "loc": [138, 138], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:For_L137_C12", "vector": [14, 4, 0.9324, 0.0068, 4, 0.65, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response[k] = v"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L139_C12", "label": "response.status_code =", "type": "assigned_variable", "loc": [139, 139], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:If_L134_C8", "vector": [14, 3, 0.9392, 0.0068, 3, 0.48, 0.75, 942, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "response.status_code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.status_code = 401"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Return_L140_C12", "label": "return", "type": "return", "loc": [140, 140], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:If_L134_C8", "vector": [13, 3, 0.9459, 0.0068, 3, 0.48, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Try_L142_C8", "label": "try", "type": "try", "loc": [142, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L127_C4", "vector": [7, 2, 0.9764, 0.0405, 2, 0.41, 1.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return self.dispatch(request, self, *args, **kwargs)\n except HttpMethodNotAllowed:\n response = HttpResponseNotAllowed(self.permitted_methods)\n response.mimetype = self.mimetype\n return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Return_L143_C12", "label": "return", "type": "return", "loc": [143, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:Try_L142_C8", "vector": [13, 3, 0.9662, 0.0068, 3, 0.75, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.dispatch(request, self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L145_C12", "label": "response = HttpResponseNotAllowed()", "type": "assigned_variable", "loc": [145, 145], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:Try_L142_C8", "vector": [14, 3, 0.9797, 0.0068, 3, 0.75, 0.0, 511, 3, 1, 0, 0, 724, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "HttpResponseNotAllowed", "annotation": ""}, "snippet": " response = HttpResponseNotAllowed(self.permitted_methods)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L146_C12", "label": "response.mimetype =", "type": "assigned_variable", "loc": [146, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:Try_L142_C8", "vector": [14, 3, 0.9865, 0.0068, 3, 0.75, 0.5, 152, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "response.mimetype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.mimetype = self.mimetype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_995:Return_L147_C12", "label": "return", "type": "return", "loc": [147, 147], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_995:Try_L142_C8", "vector": [13, 3, 0.9932, 0.0068, 3, 0.75, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_995:If_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:If_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:If_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:If_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:If_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_995:If_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_995:If_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:If_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Return_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:If_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:If_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:If_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L63_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:If_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:If_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:If_L73_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Return_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:If_L73_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_995:If_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:If_L75_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Return_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:If_L75_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_995:If_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:If_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:If_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Return_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:If_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_995:If_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:If_L80_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Return_L81_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Return_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:ClassDef_L106_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Expr_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:If_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:If_L134_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L135_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:If_L134_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L136_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:If_L134_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_995:For_L137_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:For_L137_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L138_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:If_L134_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L139_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:If_L134_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Return_L140_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:FunctionDef_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Try_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:Try_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Return_L143_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:Try_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L145_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:Try_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Assign_L146_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_995:Try_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_995:Return_L147_C12"}]
""" Data format classes that can be plugged into model_resource.ModelResource and determine how submissions of model data need to look like (e.g. form submission MIME types, XML, JSON, ...). """ from django.core import serializers from django.forms import model_to_dict class InvalidFormData(Exception): """ Raised if form data can not be decoded into key-value pairs. """ class Receiver(object): """ Base class for all "receiver" data format classes. All subclasses need to implement the method get_data(self, request, method). """ def get_data(self, request, method): raise Exception("Receiver subclass needs to implement get_data!") def get_post_data(self, request): return self.get_data(request, 'POST') def get_put_data(self, request): return self.get_data(request, 'PUT') class FormReceiver(Receiver): """ Data format class with standard Django behavior: POST and PUT data is in form submission format. """ def get_data(self, request, method): return getattr(request, method) class SerializeReceiver(Receiver): """ Base class for all data formats possible within Django's serializer framework. """ def __init__(self, format): self.format = format def get_data(self, request, method): try: deserialized_objects = list(serializers.deserialize(self.format, request.raw_post_data)) except serializers.base.DeserializationError: raise InvalidFormData if len(deserialized_objects) != 1: raise InvalidFormData model = deserialized_objects[0].object return model_to_dict(model) class JSONReceiver(SerializeReceiver): """ Data format class for form submission in JSON, e.g. for web browsers. """ def __init__(self): self.format = 'json' class XMLReceiver(SerializeReceiver): """ Data format class for form submission in XML, e.g. for software clients. """ def __init__(self): self.format = 'xml'
ajibawa-2023/Python-Code-Large/train/row_996
34
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_996:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0486, 0.0833, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nData format classes that can be plugged into \nmodel_resource.ModelResource and determine how submissions\nof model data need to look like (e.g. form submission MIME types,\nXML, JSON, ...).\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:ImportFrom_L7_C0", "label": "from django.core import serializers", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0972, 0.0139, 0, 0.66, 0.125, 913, 0, 1, 0, 0, 913, 0, 0], "semantic": {"name": "django.core", "arg_names": [], "import_names": ["serializers"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core import serializers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:ImportFrom_L8_C0", "label": "from django.forms import model_to_dict", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.0139, 0, 0.66, 0.25, 666, 0, 1, 0, 0, 666, 0, 0], "semantic": {"name": "django.forms", "arg_names": [], "import_names": ["model_to_dict"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.forms import model_to_dict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L10_C0", "label": "InvalidFormData", "type": "class", "loc": [10, 14], "level": 0, "parent": null, "vector": [3, 0, 0.1667, 0.0694, 0, 0.66, 0.375, 26, 0, 0, 0, 0, 645, 0, 0], "semantic": {"name": "InvalidFormData", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class InvalidFormData(Exception):\n \"\"\"\n Raised if form data can not be decoded into key-value\n pairs.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:Expr_L11_C4", "label": "expression", "type": "expression", "loc": [11, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L10_C0", "vector": [8, 1, 0.1736, 0.0556, 1, 0.34, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Raised if form data can not be decoded into key-value\n pairs.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L16_C0", "label": "Receiver", "type": "class", "loc": [16, 29], "level": 0, "parent": null, "vector": [3, 0, 0.3125, 0.1944, 0, 0.66, 0.5, 342, 0, 3, 0, 0, 186, 0, 3], "semantic": {"name": "Receiver", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Receiver(object):\n \"\"\"\n Base class for all \"receiver\" data format classes.\n All subclasses need to implement the method\n get_data(self, request, method).\n \"\"\"\n def get_data(self, request, method):\n raise Exception(\"Receiver subclass needs to implement get_data!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:Expr_L17_C4", "label": "expression", "type": "expression", "loc": [17, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L16_C0", "vector": [8, 1, 0.2639, 0.0694, 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 Base class for all \"receiver\" data format classes.\n All subclasses need to implement the method\n get_data(self, request, method).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L22_C4", "label": "get_data", "type": "function", "loc": [22, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L16_C0", "vector": [2, 1, 0.3125, 0.0278, 1, 0.03, 0.3333, 721, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "get_data", "arg_names": ["self", "request", "method"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_data(self, request, method):\n raise Exception(\"Receiver subclass needs to implement get_data!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L25_C4", "label": "get_post_data", "type": "function", "loc": [25, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L16_C0", "vector": [2, 1, 0.3542, 0.0278, 1, 0.03, 0.6667, 443, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_post_data", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_post_data(self, request):\n return self.get_data(request, 'POST')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:Return_L26_C8", "label": "return", "type": "return", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L25_C4", "vector": [13, 2, 0.3611, 0.0139, 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.get_data(request, 'POST')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L28_C4", "label": "get_put_data", "type": "function", "loc": [28, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L16_C0", "vector": [2, 1, 0.3958, 0.0278, 1, 0.03, 1.0, 543, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_put_data", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_put_data(self, request):\n return self.get_data(request, 'PUT')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:Return_L29_C8", "label": "return", "type": "return", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L28_C4", "vector": [13, 2, 0.4028, 0.0139, 2, 0.23, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_data(request, 'PUT')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L31_C0", "label": "FormReceiver", "type": "class", "loc": [31, 37], "level": 0, "parent": null, "vector": [3, 0, 0.4722, 0.0972, 0, 0.66, 0.625, 980, 0, 1, 0, 0, 342, 0, 1], "semantic": {"name": "FormReceiver", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FormReceiver(Receiver):\n \"\"\"\n Data format class with standard Django behavior: \n POST and PUT data is in form submission format.\n \"\"\"\n def get_data(self, request, method):\n return getattr(request, method)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:Expr_L32_C4", "label": "expression", "type": "expression", "loc": [32, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L31_C0", "vector": [8, 1, 0.4653, 0.0556, 1, 0.0, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Data format class with standard Django behavior: \n POST and PUT data is in form submission format.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L36_C4", "label": "get_data", "type": "function", "loc": [36, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L31_C0", "vector": [2, 1, 0.5069, 0.0278, 1, 0.0, 1.0, 721, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "get_data", "arg_names": ["self", "request", "method"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_data(self, request, method):\n return getattr(request, method)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:Return_L37_C8", "label": "return", "type": "return", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L36_C4", "vector": [13, 2, 0.5139, 0.0139, 2, 0.74, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return getattr(request, method)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L39_C0", "label": "SerializeReceiver", "type": "class", "loc": [39, 56], "level": 0, "parent": null, "vector": [3, 0, 0.6597, 0.25, 0, 0.66, 0.75, 493, 0, 2, 0, 0, 342, 0, 4], "semantic": {"name": "SerializeReceiver", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SerializeReceiver(Receiver):\n \"\"\"\n Base class for all data formats possible\n within Django's serializer framework.\n \"\"\"\n def __init__(self, format):\n self.format = format\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:Expr_L40_C4", "label": "expression", "type": "expression", "loc": [40, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L39_C0", "vector": [8, 1, 0.5764, 0.0556, 1, 0.69, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Base class for all data formats possible\n within Django's serializer framework.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L44_C4", "label": "__init__", "type": "function", "loc": [44, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L39_C0", "vector": [2, 1, 0.6181, 0.0278, 1, 0.69, 0.5, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "format"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, format):\n self.format = format"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:Assign_L45_C8", "label": "self.format =", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L44_C4", "vector": [14, 2, 0.625, 0.0139, 2, 0.02, 0.0, 896, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.format", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.format = format"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L47_C4", "label": "get_data", "type": "function", "loc": [47, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L39_C0", "vector": [2, 1, 0.7153, 0.1389, 1, 0.69, 1.0, 721, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "get_data", "arg_names": ["self", "request", "method"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_data(self, request, method):\n try:\n deserialized_objects = list(serializers.deserialize(self.format, request.raw_post_data))\n except serializers.base.DeserializationError:\n raise InvalidFormData\n if len(deserialized_objects) != 1:\n raise InvalidFormData\n model = deserialized_objects[0].object"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:Try_L48_C8", "label": "try", "type": "try", "loc": [48, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L47_C4", "vector": [7, 2, 0.6875, 0.0556, 2, 0.68, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n deserialized_objects = list(serializers.deserialize(self.format, request.raw_post_data))\n except serializers.base.DeserializationError:\n raise InvalidFormData"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:Assign_L49_C12", "label": "deserialized_objects = list()", "type": "assigned_variable", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:Try_L48_C8", "vector": [14, 3, 0.6806, 0.0139, 3, 0.44, 0.0, 493, 3, 1, 0, 0, 430, 10, 2], "semantic": {"name": "deserialized_objects", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " deserialized_objects = list(serializers.deserialize(self.format, request.raw_post_data))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:If_L52_C8", "label": "if", "type": "if", "loc": [52, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L47_C4", "vector": [4, 2, 0.7292, 0.0278, 2, 0.68, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(deserialized_objects) != 1:\n raise InvalidFormData"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:Assign_L54_C8", "label": "model =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L47_C4", "vector": [14, 2, 0.75, 0.0139, 2, 0.68, 0.6667, 722, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "model", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " model = deserialized_objects[0].object"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:Return_L56_C8", "label": "return", "type": "return", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L47_C4", "vector": [13, 2, 0.7778, 0.0139, 2, 0.68, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return model_to_dict(model)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L58_C0", "label": "JSONReceiver", "type": "class", "loc": [58, 64], "level": 0, "parent": null, "vector": [3, 0, 0.8472, 0.0972, 0, 0.66, 0.875, 200, 0, 1, 0, 0, 493, 0, 0], "semantic": {"name": "JSONReceiver", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class JSONReceiver(SerializeReceiver):\n \"\"\"\n Data format class for form submission in JSON, \n e.g. for web browsers.\n \"\"\"\n def __init__(self):\n self.format = 'json'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:Expr_L59_C4", "label": "expression", "type": "expression", "loc": [59, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L58_C0", "vector": [8, 1, 0.8403, 0.0556, 1, 0.42, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Data format class for form submission in JSON, \n e.g. for web browsers.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L63_C4", "label": "__init__", "type": "function", "loc": [63, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L58_C0", "vector": [2, 1, 0.8819, 0.0278, 1, 0.42, 1.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.format = 'json'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:Assign_L64_C8", "label": "self.format =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L63_C4", "vector": [14, 2, 0.8889, 0.0139, 2, 0.18, 0.0, 896, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.format", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.format = 'json'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L66_C0", "label": "XMLReceiver", "type": "class", "loc": [66, 72], "level": 0, "parent": null, "vector": [3, 0, 0.9583, 0.0972, 0, 0.66, 1.0, 864, 0, 1, 0, 0, 493, 0, 0], "semantic": {"name": "XMLReceiver", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class XMLReceiver(SerializeReceiver):\n \"\"\"\n Data format class for form submission in XML, \n e.g. for software clients.\n \"\"\"\n def __init__(self):\n self.format = 'xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:Expr_L67_C4", "label": "expression", "type": "expression", "loc": [67, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L66_C0", "vector": [8, 1, 0.9514, 0.0556, 1, 0.16, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Data format class for form submission in XML, \n e.g. for software clients.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L71_C4", "label": "__init__", "type": "function", "loc": [71, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L66_C0", "vector": [2, 1, 0.9931, 0.0278, 1, 0.16, 1.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.format = 'xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_996:Assign_L72_C8", "label": "self.format =", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L71_C4", "vector": [14, 2, 1.0, 0.0139, 2, 0.99, 0.0, 896, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.format", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.format = 'xml'"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_996:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_996:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_996:Return_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_996:Return_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_996:Expr_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_996:Return_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_996:Expr_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_996:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_996:Try_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:Try_L48_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_996:Assign_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_996:If_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_996:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_996:Return_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_996:Expr_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_996:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_996:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:ClassDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_996:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_996:Assign_L72_C8"}]
""" Model-bound resource class. """ from django import forms from django.conf.urls.defaults import patterns from django.http import * from django.forms import ModelForm, models from django.forms.util import ErrorDict from django.utils.functional import curry from django.utils.translation.trans_null import _ from resource import ResourceBase, load_put_and_files, reverse, HttpMethodNotAllowed from receiver import FormReceiver class InvalidModelData(Exception): """ Raised if create/update fails because the PUT/POST data is not appropriate. """ def __init__(self, errors=None): if not errors: errors = ErrorDict() self.errors = errors class Collection(ResourceBase): """ Resource for a collection of models (queryset). """ def __init__(self, queryset, responder, receiver=None, authentication=None, permitted_methods=None, expose_fields=None, entry_class=None, form_class=None): """ queryset: determines the subset of objects (of a Django model) that make up this resource responder: the data format instance that creates HttpResponse objects from single or multiple model objects and renders forms receiver: the data format instance that handles POST and PUT data authentication: the authentication instance that checks whether a request is authenticated permitted_methods: the HTTP request methods that are allowed for this resource e.g. ('GET', 'PUT') expose_fields: the model fields that can be accessed by the HTTP methods described in permitted_methods entry_class: class used for entries in create() and get_entry(); default: class Entry (see below) form_class: base form class used for data validation and conversion in self.create() and Entry.update() """ # Available data self.queryset = queryset # Input format if not receiver: receiver = FormReceiver() self.receiver = receiver # Input validation if not form_class: form_class = ModelForm self.form_class = form_class # Output format / responder setup self.responder = responder if not expose_fields: expose_fields = [field.name for field in queryset.model._meta.fields] responder.expose_fields = expose_fields if hasattr(responder, 'create_form'): responder.create_form = curry(responder.create_form, queryset=queryset, form_class=form_class) if hasattr(responder, 'update_form'): responder.update_form = curry(responder.update_form, queryset=queryset, form_class=form_class) # Resource class for individual objects of the collection if not entry_class: entry_class = Entry self.entry_class = entry_class ResourceBase.__init__(self, authentication, permitted_methods) def __call__(self, request, *args, **kwargs): """ Redirects to one of the CRUD methods depending on the HTTP method of the request. Checks whether the requested method is allowed for this resource. Catches errors. """ # Check authentication if not self.authentication.is_authenticated(request): response = self.responder.error(request, 401) challenge_headers = self.authentication.challenge_headers() for k,v in challenge_headers.items(): response[k] = v return response # Remove queryset cache self.queryset = self.queryset._clone() # Determine whether the collection or a specific # entry is requested. If not specified as a keyword # argument, assume that any args/kwargs are used to # select a specific entry from the collection. if kwargs.has_key('is_entry'): is_entry = kwargs.pop('is_entry') else: eval_args = tuple(x for x in args if x != '' and x != None) eval_kwargs = tuple(x for x in kwargs.values() if x != '' and x != None) is_entry = bool(eval_args or eval_kwargs) # Redirect either to entry method # or to collection method. Catch errors. try: if is_entry: entry = self.get_entry(*args, **kwargs) return self.dispatch(request, entry) else: return self.dispatch(request, self) except HttpMethodNotAllowed: response = self.responder.error(request, 405) response['Allow'] = ', '.join(self.permitted_methods) return response except (self.queryset.model.DoesNotExist, Http404): return self.responder.error(request, 404) except InvalidModelData, i: return self.responder.error(request, 400, i.errors) # No other methods allowed: 400 Bad Request return self.responder.error(request, 400) def create(self, request): """ Creates a resource with attributes given by POST, then redirects to the resource URI. """ # Create form filled with POST data ResourceForm = models.modelform_factory(self.queryset.model, form=self.form_class) data = self.receiver.get_post_data(request) form = ResourceForm(data) # If the data contains no errors, save the model, # return a "201 Created" response with the model's # URI in the location header and a representation # of the model in the response body. if form.is_valid(): new_model = form.save() model_entry = self.entry_class(self, new_model) response = model_entry.read(request) response.status_code = 201 response['Location'] = model_entry.get_url() return response # Otherwise return a 400 Bad Request error. raise InvalidModelData(form.errors) def read(self, request): """ Returns a representation of the queryset. The format depends on which responder (e.g. JSONResponder) is assigned to this ModelResource instance. Usually called by a HTTP request to the factory URI with method GET. """ return self.responder.list(request, self.queryset) def get_entry(self, pk_value): """ Returns a single entry retrieved by filtering the collection queryset by primary key value. """ model = self.queryset.get(**{self.queryset.model._meta.pk.name : pk_value}) entry = self.entry_class(self, model) return entry class Entry(object): """ Resource for a single model. """ def __init__(self, collection, model): self.collection = collection self.model = model def get_url(self): """ Returns the URL for this resource object. """ pk_value = getattr(self.model, self.model._meta.pk.name) return reverse(self.collection, (pk_value,)) def create(self, request): raise Http404 def read(self, request): """ Returns a representation of a single model. The format depends on which responder (e.g. JSONResponder) is assigned to this ModelResource instance. Usually called by a HTTP request to the resource URI with method GET. """ return self.collection.responder.element(request, self.model) def update(self, request): """ Changes the attributes of the resource identified by 'ident' and redirects to the resource URI. Usually called by a HTTP request to the resource URI with method PUT. """ # Create a form from the model/PUT data ResourceForm = models.modelform_factory(self.model.__class__, form=self.collection.form_class) data = self.collection.receiver.get_put_data(request) form = ResourceForm(data, instance=self.model) # If the data contains no errors, save the model, # return a "200 Ok" response with the model's # URI in the location header and a representation # of the model in the response body. if form.is_valid(): form.save() response = self.read(request) response.status_code = 200 response['Location'] = self.get_url() return response # Otherwise return a 400 Bad Request error. raise InvalidModelData(form.errors) def delete(self, request): """ Deletes the model associated with the current entry. Usually called by a HTTP request to the entry URI with method DELETE. """ self.model.delete() return HttpResponse(_("Object successfully deleted."), self.collection.responder.mimetype)
ajibawa-2023/Python-Code-Large/train/row_997
112
243
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0082, 0.0123, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nModel-bound resource class.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:ImportFrom_L4_C0", "label": "from django import forms", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0165, 0.0041, 0, 0.66, 0.0833, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["forms"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django import forms"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:ImportFrom_L5_C0", "label": "from django.conf.urls.defaults import patterns", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0206, 0.0041, 0, 0.66, 0.1667, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names": [], "import_names": ["patterns"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf.urls.defaults import patterns"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:ImportFrom_L6_C0", "label": "from django.http import *", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0247, 0.0041, 0, 0.66, 0.25, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.http import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:ImportFrom_L7_C0", "label": "from django.forms import ModelForm, models", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0288, 0.0041, 0, 0.66, 0.3333, 666, 0, 2, 0, 0, 666, 0, 0], "semantic": {"name": "django.forms", "arg_names": [], "import_names": ["ModelForm", "models"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.forms import ModelForm, models"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:ImportFrom_L8_C0", "label": "from django.forms.util import ErrorDict", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0329, 0.0041, 0, 0.66, 0.4167, 332, 0, 1, 0, 0, 332, 0, 0], "semantic": {"name": "django.forms.util", "arg_names": [], "import_names": ["ErrorDict"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.forms.util import ErrorDict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:ImportFrom_L9_C0", "label": "from django.utils.functional import curry", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.037, 0.0041, 0, 0.66, 0.5, 375, 0, 1, 0, 0, 375, 0, 0], "semantic": {"name": "django.utils.functional", "arg_names": [], "import_names": ["curry"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.functional import curry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:ImportFrom_L10_C0", "label": "from django.utils.translation.trans_null import _", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0412, 0.0041, 0, 0.66, 0.5833, 751, 0, 1, 0, 0, 751, 0, 0], "semantic": {"name": "django.utils.translation.trans_null", "arg_names": [], "import_names": ["_"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation.trans_null import _"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:ImportFrom_L11_C0", "label": "from resource import ResourceBase, load_put_and_files, reverse\u2026", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0453, 0.0041, 0, 0.66, 0.6667, 559, 0, 4, 0, 0, 559, 0, 0], "semantic": {"name": "resource", "arg_names": [], "import_names": ["ResourceBase", "load_put_and_files", "reverse", "HttpMethodNotAllowed"], "rhs_call_name": "", "annotation": ""}, "snippet": "from resource import ResourceBase, load_put_and_files, reverse, HttpMethodNotAllowed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:ImportFrom_L12_C0", "label": "from receiver import FormReceiver", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0494, 0.0041, 0, 0.66, 0.75, 513, 0, 1, 0, 0, 513, 0, 0], "semantic": {"name": "receiver", "arg_names": [], "import_names": ["FormReceiver"], "rhs_call_name": "", "annotation": ""}, "snippet": "from receiver import FormReceiver"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L14_C0", "label": "InvalidModelData", "type": "class", "loc": [14, 22], "level": 0, "parent": null, "vector": [3, 0, 0.0741, 0.037, 0, 0.66, 0.8333, 81, 0, 1, 0, 0, 645, 0, 1], "semantic": {"name": "InvalidModelData", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class InvalidModelData(Exception):\n \"\"\"\n Raised if create/update fails because the PUT/POST \n data is not appropriate.\n \"\"\"\n def __init__(self, errors=None):\n if not errors:\n errors = ErrorDict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L15_C4", "label": "expression", "type": "expression", "loc": [15, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L14_C0", "vector": [8, 1, 0.0679, 0.0165, 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 Raised if create/update fails because the PUT/POST \n data is not appropriate.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L19_C4", "label": "__init__", "type": "function", "loc": [19, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L14_C0", "vector": [2, 1, 0.0844, 0.0165, 1, 0.55, 1.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "errors"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, errors=None):\n if not errors:\n errors = ErrorDict()\n self.errors = errors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:If_L20_C8", "label": "if", "type": "if", "loc": [20, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L19_C4", "vector": [4, 2, 0.0844, 0.0082, 2, 0.92, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not errors:\n errors = ErrorDict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L21_C12", "label": "errors = ErrorDict()", "type": "assigned_variable", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L20_C8", "vector": [14, 3, 0.0864, 0.0041, 3, 0.54, 0.0, 841, 3, 0, 0, 0, 801, 10, 1], "semantic": {"name": "errors", "arg_names": [], "import_names": [], "rhs_call_name": "ErrorDict", "annotation": ""}, "snippet": " errors = ErrorDict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L22_C8", "label": "self.errors =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L19_C4", "vector": [14, 2, 0.0905, 0.0041, 2, 0.92, 1.0, 165, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.errors", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.errors = errors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L24_C0", "label": "Collection", "type": "class", "loc": [24, 178], "level": 0, "parent": null, "vector": [3, 0, 0.4156, 0.6379, 0, 0.66, 0.9167, 432, 0, 5, 0, 0, 480, 0, 37], "semantic": {"name": "Collection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Collection(ResourceBase):\n \"\"\"\n Resource for a collection of models (queryset).\n \"\"\"\n def __init__(self, queryset, responder, receiver=None, authentication=None,\n permitted_methods=None, expose_fields=None, entry_class=None,\n form_class=None):\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L25_C4", "label": "expression", "type": "expression", "loc": [25, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L24_C0", "vector": [8, 1, 0.107, 0.0123, 1, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Resource for a collection of models (queryset).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "label": "__init__", "type": "function", "loc": [28, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L24_C0", "vector": [2, 1, 0.2346, 0.2428, 1, 0.38, 0.2, 555, 0, 9, 0, 0, 0, 0, 6], "semantic": {"name": "__init__", "arg_names": ["self", "queryset", "responder", "receiver", "authentication", "permitted_methods", "expose_fields", "entry_class", "form_class"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, queryset, responder, receiver=None, authentication=None,\n permitted_methods=None, expose_fields=None, entry_class=None,\n form_class=None):\n \"\"\"\n queryset:\n determines the subset of objects (of a Django model)\n that make up this resource\n responder:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L31_C8", "label": "expression", "type": "expression", "loc": [31, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "vector": [8, 2, 0.1811, 0.1111, 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 queryset:\n determines the subset of objects (of a Django model)\n that make up this resource\n responder:\n the data format instance that creates HttpResponse\n objects from single or multiple model objects and\n renders forms"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L59_C8", "label": "self.queryset =", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "vector": [14, 2, 0.2428, 0.0041, 2, 0.17, 0.0769, 135, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.queryset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.queryset = queryset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:If_L62_C8", "label": "if", "type": "if", "loc": [62, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "vector": [4, 2, 0.2572, 0.0082, 2, 0.17, 0.1538, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not receiver:\n receiver = FormReceiver()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L63_C12", "label": "receiver = FormReceiver()", "type": "assigned_variable", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L62_C8", "vector": [14, 3, 0.2593, 0.0041, 3, 0.48, 0.0, 513, 3, 0, 0, 0, 980, 10, 1], "semantic": {"name": "receiver", "arg_names": [], "import_names": [], "rhs_call_name": "FormReceiver", "annotation": ""}, "snippet": " receiver = FormReceiver()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L64_C8", "label": "self.receiver =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "vector": [14, 2, 0.2634, 0.0041, 2, 0.17, 0.2308, 61, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.receiver", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.receiver = receiver"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:If_L67_C8", "label": "if", "type": "if", "loc": [67, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "vector": [4, 2, 0.2778, 0.0082, 2, 0.17, 0.3077, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not form_class:\n form_class = ModelForm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L68_C12", "label": "form_class =", "type": "assigned_variable", "loc": [68, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L67_C8", "vector": [14, 3, 0.2798, 0.0041, 3, 0.47, 0.0, 393, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "form_class", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " form_class = ModelForm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L69_C8", "label": "self.form_class =", "type": "assigned_variable", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "vector": [14, 2, 0.284, 0.0041, 2, 0.17, 0.3846, 307, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.form_class", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.form_class = form_class"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L72_C8", "label": "self.responder =", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "vector": [14, 2, 0.2963, 0.0041, 2, 0.17, 0.4615, 532, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.responder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.responder = responder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:If_L73_C8", "label": "if", "type": "if", "loc": [73, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "vector": [4, 2, 0.3025, 0.0082, 2, 0.17, 0.5385, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not expose_fields:\n expose_fields = [field.name for field in queryset.model._meta.fields]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L74_C12", "label": "expose_fields =", "type": "assigned_variable", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L73_C8", "vector": [14, 3, 0.3045, 0.0041, 3, 0.13, 0.0, 924, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "expose_fields", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expose_fields = [field.name for field in queryset.model._meta.fields]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L75_C8", "label": "responder.expose_fields =", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "vector": [14, 2, 0.3086, 0.0041, 2, 0.17, 0.6154, 768, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "responder.expose_fields", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " responder.expose_fields = expose_fields"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:If_L76_C8", "label": "if", "type": "if", "loc": [76, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "vector": [4, 2, 0.3148, 0.0082, 2, 0.17, 0.6923, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(responder, 'create_form'):\n responder.create_form = curry(responder.create_form, queryset=queryset, form_class=form_class)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L77_C12", "label": "responder.create_form = curry()", "type": "assigned_variable", "loc": [77, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L76_C8", "vector": [14, 3, 0.3169, 0.0041, 3, 0.58, 0.0, 376, 3, 3, 0, 0, 553, 10, 1], "semantic": {"name": "responder.create_form", "arg_names": [], "import_names": [], "rhs_call_name": "curry", "annotation": ""}, "snippet": " responder.create_form = curry(responder.create_form, queryset=queryset, form_class=form_class)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:If_L78_C8", "label": "if", "type": "if", "loc": [78, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "vector": [4, 2, 0.323, 0.0082, 2, 0.17, 0.7692, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(responder, 'update_form'):\n responder.update_form = curry(responder.update_form, queryset=queryset, form_class=form_class)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L79_C12", "label": "responder.update_form = curry()", "type": "assigned_variable", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L78_C8", "vector": [14, 3, 0.3251, 0.0041, 3, 0.92, 0.0, 466, 3, 3, 0, 0, 553, 10, 1], "semantic": {"name": "responder.update_form", "arg_names": [], "import_names": [], "rhs_call_name": "curry", "annotation": ""}, "snippet": " responder.update_form = curry(responder.update_form, queryset=queryset, form_class=form_class)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:If_L82_C8", "label": "if", "type": "if", "loc": [82, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "vector": [4, 2, 0.3395, 0.0082, 2, 0.17, 0.8462, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not entry_class:\n entry_class = Entry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L83_C12", "label": "entry_class =", "type": "assigned_variable", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L82_C8", "vector": [14, 3, 0.3416, 0.0041, 3, 0.7, 0.0, 407, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "entry_class", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " entry_class = Entry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L84_C8", "label": "self.entry_class =", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "vector": [14, 2, 0.3457, 0.0041, 2, 0.17, 0.9231, 62, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.entry_class", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.entry_class = entry_class"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L86_C8", "label": "__init__()", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "vector": [8, 2, 0.3539, 0.0041, 2, 0.17, 1.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " ResourceBase.__init__(self, authentication, permitted_methods)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L88_C4", "label": "__call__", "type": "function", "loc": [88, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L24_C0", "vector": [2, 1, 0.4588, 0.1975, 1, 0.38, 0.4, 319, 0, 4, 1, 0, 0, 0, 19], "semantic": {"name": "__call__", "arg_names": ["self", "request", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __call__(self, request, *args, **kwargs):\n \"\"\"\n Redirects to one of the CRUD methods depending \n on the HTTP method of the request. Checks whether\n the requested method is allowed for this resource.\n Catches errors.\n \"\"\"\n # Check authentication"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L89_C8", "label": "expression", "type": "expression", "loc": [89, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L88_C4", "vector": [8, 2, 0.3765, 0.0247, 2, 0.51, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Redirects to one of the CRUD methods depending \n on the HTTP method of the request. Checks whether\n the requested method is allowed for this resource.\n Catches errors.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:If_L96_C8", "label": "if", "type": "if", "loc": [96, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L88_C4", "vector": [4, 2, 0.4053, 0.0247, 2, 0.51, 0.2, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.authentication.is_authenticated(request):\n response = self.responder.error(request, 401)\n challenge_headers = self.authentication.challenge_headers()\n for k,v in challenge_headers.items():\n response[k] = v\n return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L97_C12", "label": "response = error()", "type": "assigned_variable", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L96_C8", "vector": [14, 3, 0.3992, 0.0041, 3, 0.55, 0.0, 511, 3, 2, 0, 0, 771, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " response = self.responder.error(request, 401)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L98_C12", "label": "challenge_headers = challenge_headers()", "type": "assigned_variable", "loc": [98, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L96_C8", "vector": [14, 3, 0.4033, 0.0041, 3, 0.55, 0.3333, 25, 3, 0, 0, 0, 25, 10, 1], "semantic": {"name": "challenge_headers", "arg_names": [], "import_names": [], "rhs_call_name": "challenge_headers", "annotation": ""}, "snippet": " challenge_headers = self.authentication.challenge_headers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:For_L99_C12", "label": "for k, v", "type": "for", "loc": [99, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L96_C8", "vector": [6, 3, 0.4095, 0.0082, 3, 0.55, 0.6667, 867, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k,v in challenge_headers.items():\n response[k] = v"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L100_C16", "label": "assign", "type": "assigned_variable", "loc": [100, 100], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:For_L99_C12", "vector": [14, 4, 0.4115, 0.0041, 4, 0.89, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response[k] = v"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L101_C12", "label": "return", "type": "return", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L96_C8", "vector": [13, 3, 0.4156, 0.0041, 3, 0.55, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L104_C8", "label": "self.queryset = _clone()", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L88_C4", "vector": [14, 2, 0.428, 0.0041, 2, 0.51, 0.4, 135, 3, 0, 0, 0, 617, 10, 1], "semantic": {"name": "self.queryset", "arg_names": [], "import_names": [], "rhs_call_name": "_clone", "annotation": ""}, "snippet": " self.queryset = self.queryset._clone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:If_L110_C8", "label": "if", "type": "if", "loc": [110, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L88_C4", "vector": [4, 2, 0.465, 0.0288, 2, 0.51, 0.6, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if kwargs.has_key('is_entry'):\n is_entry = kwargs.pop('is_entry')\n else:\n eval_args = tuple(x for x in args if x != '' and x != None)\n eval_kwargs = tuple(x for x in kwargs.values()\n if x != '' and x != None)\n is_entry = bool(eval_args or eval_kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L111_C12", "label": "is_entry = pop()", "type": "assigned_variable", "loc": [111, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L110_C8", "vector": [14, 3, 0.4568, 0.0041, 3, 0.26, 0.0, 507, 3, 1, 0, 0, 969, 10, 1], "semantic": {"name": "is_entry", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " is_entry = kwargs.pop('is_entry')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L113_C12", "label": "eval_args = tuple()", "type": "assigned_variable", "loc": [113, 113], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L110_C8", "vector": [14, 3, 0.465, 0.0041, 3, 0.26, 0.3333, 17, 3, 1, 0, 0, 259, 10, 1], "semantic": {"name": "eval_args", "arg_names": [], "import_names": [], "rhs_call_name": "tuple", "annotation": ""}, "snippet": " eval_args = tuple(x for x in args if x != '' and x != None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L114_C12", "label": "eval_kwargs = tuple()", "type": "assigned_variable", "loc": [114, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L110_C8", "vector": [14, 3, 0.4712, 0.0082, 3, 0.26, 0.6667, 238, 3, 1, 0, 0, 259, 10, 2], "semantic": {"name": "eval_kwargs", "arg_names": [], "import_names": [], "rhs_call_name": "tuple", "annotation": ""}, "snippet": " eval_kwargs = tuple(x for x in kwargs.values()\n if x != '' and x != None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L116_C12", "label": "is_entry = bool()", "type": "assigned_variable", "loc": [116, 116], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L110_C8", "vector": [14, 3, 0.4774, 0.0041, 3, 0.26, 1.0, 507, 3, 1, 0, 0, 337, 10, 1], "semantic": {"name": "is_entry", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " is_entry = bool(eval_args or eval_kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Try_L120_C8", "label": "try", "type": "try", "loc": [120, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L88_C4", "vector": [7, 2, 0.5185, 0.0535, 2, 0.51, 0.8, 0, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if is_entry:\n entry = self.get_entry(*args, **kwargs)\n return self.dispatch(request, entry)\n else:\n return self.dispatch(request, self)\n except HttpMethodNotAllowed:\n response = self.responder.error(request, 405)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:If_L121_C12", "label": "if", "type": "if", "loc": [121, 125], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:Try_L120_C8", "vector": [4, 3, 0.5062, 0.0206, 3, 0.81, 0.0, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if is_entry:\n entry = self.get_entry(*args, **kwargs)\n return self.dispatch(request, entry)\n else:\n return self.dispatch(request, self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L122_C16", "label": "entry = get_entry()", "type": "assigned_variable", "loc": [122, 122], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L121_C12", "vector": [14, 4, 0.5021, 0.0041, 4, 0.86, 0.0, 812, 3, 2, 0, 0, 35, 10, 1], "semantic": {"name": "entry", "arg_names": [], "import_names": [], "rhs_call_name": "get_entry", "annotation": ""}, "snippet": " entry = self.get_entry(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L123_C16", "label": "return", "type": "return", "loc": [123, 123], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L121_C12", "vector": [13, 4, 0.5062, 0.0041, 4, 0.86, 0.5, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.dispatch(request, entry)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L125_C16", "label": "return", "type": "return", "loc": [125, 125], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L121_C12", "vector": [13, 4, 0.5144, 0.0041, 4, 0.86, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.dispatch(request, self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L127_C12", "label": "response = error()", "type": "assigned_variable", "loc": [127, 127], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:Try_L120_C8", "vector": [14, 3, 0.5226, 0.0041, 3, 0.81, 0.0, 511, 3, 2, 0, 0, 771, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " response = self.responder.error(request, 405)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L128_C12", "label": " = join()", "type": "assigned_variable", "loc": [128, 128], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:Try_L120_C8", "vector": [14, 3, 0.5267, 0.0041, 3, 0.81, 0.5, 0, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " response['Allow'] = ', '.join(self.permitted_methods)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L129_C12", "label": "return", "type": "return", "loc": [129, 129], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:Try_L120_C8", "vector": [13, 3, 0.5309, 0.0041, 3, 0.81, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L131_C12", "label": "return", "type": "return", "loc": [131, 131], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:Try_L120_C8", "vector": [13, 3, 0.5391, 0.0041, 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 self.responder.error(request, 404)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L132_C12", "label": "return", "type": "return", "loc": [132, 132], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:Try_L120_C8", "vector": [13, 3, 0.5432, 0.0041, 3, 0.81, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.responder.error(request, 400, i.errors)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L135_C8", "label": "return", "type": "return", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L88_C4", "vector": [13, 2, 0.5556, 0.0041, 2, 0.51, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.responder.error(request, 400)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L137_C4", "label": "create", "type": "function", "loc": [137, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L24_C0", "vector": [2, 1, 0.6111, 0.0988, 1, 0.38, 0.6, 316, 0, 2, 1, 0, 0, 0, 9], "semantic": {"name": "create", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def create(self, request):\n \"\"\"\n Creates a resource with attributes given by POST, then\n redirects to the resource URI. \n \"\"\"\n # Create form filled with POST data\n ResourceForm = models.modelform_factory(self.queryset.model, form=self.form_class)\n data = self.receiver.get_post_data(request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L138_C8", "label": "expression", "type": "expression", "loc": [138, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L137_C4", "vector": [8, 2, 0.5741, 0.0165, 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 Creates a resource with attributes given by POST, then\n redirects to the resource URI. \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L143_C8", "label": "ResourceForm = modelform_factory()", "type": "assigned_variable", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L137_C4", "vector": [14, 2, 0.5885, 0.0041, 2, 0.68, 0.25, 898, 3, 2, 0, 0, 171, 10, 1], "semantic": {"name": "ResourceForm", "arg_names": [], "import_names": [], "rhs_call_name": "modelform_factory", "annotation": ""}, "snippet": " ResourceForm = models.modelform_factory(self.queryset.model, form=self.form_class)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L144_C8", "label": "data = get_post_data()", "type": "assigned_variable", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L137_C4", "vector": [14, 2, 0.5926, 0.0041, 2, 0.68, 0.5, 929, 3, 1, 0, 0, 443, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "get_post_data", "annotation": ""}, "snippet": " data = self.receiver.get_post_data(request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L145_C8", "label": "form = ResourceForm()", "type": "assigned_variable", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L137_C4", "vector": [14, 2, 0.5967, 0.0041, 2, 0.68, 0.75, 761, 3, 1, 0, 0, 898, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "ResourceForm", "annotation": ""}, "snippet": " form = ResourceForm(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:If_L151_C8", "label": "if", "type": "if", "loc": [151, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L137_C4", "vector": [4, 2, 0.6337, 0.0288, 2, 0.68, 1.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if form.is_valid():\n new_model = form.save()\n model_entry = self.entry_class(self, new_model)\n response = model_entry.read(request)\n response.status_code = 201\n response['Location'] = model_entry.get_url()\n return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L152_C12", "label": "new_model = save()", "type": "assigned_variable", "loc": [152, 152], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L151_C8", "vector": [14, 3, 0.6255, 0.0041, 3, 0.03, 0.0, 795, 3, 0, 0, 0, 928, 10, 1], "semantic": {"name": "new_model", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " new_model = form.save()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L153_C12", "label": "model_entry = entry_class()", "type": "assigned_variable", "loc": [153, 153], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L151_C8", "vector": [14, 3, 0.6296, 0.0041, 3, 0.03, 0.2, 971, 3, 2, 0, 0, 407, 10, 1], "semantic": {"name": "model_entry", "arg_names": [], "import_names": [], "rhs_call_name": "entry_class", "annotation": ""}, "snippet": " model_entry = self.entry_class(self, new_model)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L154_C12", "label": "response = read()", "type": "assigned_variable", "loc": [154, 154], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L151_C8", "vector": [14, 3, 0.6337, 0.0041, 3, 0.03, 0.4, 511, 3, 1, 0, 0, 453, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " response = model_entry.read(request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L155_C12", "label": "response.status_code =", "type": "assigned_variable", "loc": [155, 155], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L151_C8", "vector": [14, 3, 0.6379, 0.0041, 3, 0.03, 0.6, 942, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "response.status_code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.status_code = 201"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L156_C12", "label": " = get_url()", "type": "assigned_variable", "loc": [156, 156], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L151_C8", "vector": [14, 3, 0.642, 0.0041, 3, 0.03, 0.8, 0, 3, 0, 0, 0, 662, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get_url", "annotation": ""}, "snippet": " response['Location'] = model_entry.get_url()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L157_C12", "label": "return", "type": "return", "loc": [157, 157], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L151_C8", "vector": [13, 3, 0.6461, 0.0041, 3, 0.03, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L162_C4", "label": "read", "type": "function", "loc": [162, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L24_C0", "vector": [2, 1, 0.6811, 0.0329, 1, 0.38, 0.8, 453, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "read", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def read(self, request):\n \"\"\"\n Returns a representation of the queryset.\n The format depends on which responder (e.g. JSONResponder)\n is assigned to this ModelResource instance. Usually called by a\n HTTP request to the factory URI with method GET.\n \"\"\"\n return self.responder.list(request, self.queryset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L163_C8", "label": "expression", "type": "expression", "loc": [163, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L162_C4", "vector": [8, 2, 0.6811, 0.0247, 2, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a representation of the queryset.\n The format depends on which responder (e.g. JSONResponder)\n is assigned to this ModelResource instance. Usually called by a\n HTTP request to the factory URI with method GET.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L169_C8", "label": "return", "type": "return", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L162_C4", "vector": [13, 2, 0.6955, 0.0041, 2, 0.95, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.responder.list(request, self.queryset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L171_C4", "label": "get_entry", "type": "function", "loc": [171, 178], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L24_C0", "vector": [2, 1, 0.7181, 0.0329, 1, 0.38, 1.0, 35, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "get_entry", "arg_names": ["self", "pk_value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_entry(self, pk_value):\n \"\"\"\n Returns a single entry retrieved by filtering the \n collection queryset by primary key value.\n \"\"\"\n model = self.queryset.get(**{self.queryset.model._meta.pk.name : pk_value})\n entry = self.entry_class(self, model)\n return entry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L172_C8", "label": "expression", "type": "expression", "loc": [172, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L171_C4", "vector": [8, 2, 0.714, 0.0165, 2, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a single entry retrieved by filtering the \n collection queryset by primary key value.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L176_C8", "label": "model = get()", "type": "assigned_variable", "loc": [176, 176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L171_C4", "vector": [14, 2, 0.7243, 0.0041, 2, 0.84, 0.3333, 722, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "model", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " model = self.queryset.get(**{self.queryset.model._meta.pk.name : pk_value})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L177_C8", "label": "entry = entry_class()", "type": "assigned_variable", "loc": [177, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L171_C4", "vector": [14, 2, 0.7284, 0.0041, 2, 0.84, 0.6667, 812, 3, 2, 0, 0, 407, 10, 1], "semantic": {"name": "entry", "arg_names": [], "import_names": [], "rhs_call_name": "entry_class", "annotation": ""}, "snippet": " entry = self.entry_class(self, model)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L178_C8", "label": "return", "type": "return", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L171_C4", "vector": [13, 2, 0.7325, 0.0041, 2, 0.84, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return entry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L180_C0", "label": "Entry", "type": "class", "loc": [180, 241], "level": 0, "parent": null, "vector": [3, 0, 0.8663, 0.2551, 0, 0.66, 1.0, 197, 0, 6, 0, 0, 186, 0, 14], "semantic": {"name": "Entry", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Entry(object):\n \"\"\"\n Resource for a single model.\n \"\"\"\n def __init__(self, collection, model):\n self.collection = collection\n self.model = model\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L181_C4", "label": "expression", "type": "expression", "loc": [181, 183], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L180_C0", "vector": [8, 1, 0.749, 0.0123, 1, 0.23, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Resource for a single model.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L184_C4", "label": "__init__", "type": "function", "loc": [184, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L180_C0", "vector": [2, 1, 0.7613, 0.0123, 1, 0.23, 0.1667, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "collection", "model"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, collection, model):\n self.collection = collection\n self.model = model"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L185_C8", "label": "self.collection =", "type": "assigned_variable", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L184_C4", "vector": [14, 2, 0.7613, 0.0041, 2, 0.51, 0.0, 102, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.collection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.collection = collection"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L186_C8", "label": "self.model =", "type": "assigned_variable", "loc": [186, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L184_C4", "vector": [14, 2, 0.7654, 0.0041, 2, 0.51, 1.0, 81, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.model", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.model = model"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L188_C4", "label": "get_url", "type": "function", "loc": [188, 193], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L180_C0", "vector": [2, 1, 0.784, 0.0247, 1, 0.23, 0.3333, 662, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "get_url", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_url(self):\n \"\"\"\n Returns the URL for this resource object.\n \"\"\"\n pk_value = getattr(self.model, self.model._meta.pk.name)\n return reverse(self.collection, (pk_value,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L189_C8", "label": "expression", "type": "expression", "loc": [189, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L188_C4", "vector": [8, 2, 0.7819, 0.0123, 2, 0.3, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the URL for this resource object.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L192_C8", "label": "pk_value = getattr()", "type": "assigned_variable", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L188_C4", "vector": [14, 2, 0.7901, 0.0041, 2, 0.3, 0.5, 538, 3, 2, 0, 0, 121, 10, 1], "semantic": {"name": "pk_value", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " pk_value = getattr(self.model, self.model._meta.pk.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L193_C8", "label": "return", "type": "return", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L188_C4", "vector": [13, 2, 0.7942, 0.0041, 2, 0.3, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return reverse(self.collection, (pk_value,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L195_C4", "label": "create", "type": "function", "loc": [195, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L180_C0", "vector": [2, 1, 0.8045, 0.0082, 1, 0.23, 0.5, 316, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "create", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def create(self, request):\n raise Http404"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L198_C4", "label": "read", "type": "function", "loc": [198, 205], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L180_C0", "vector": [2, 1, 0.8292, 0.0329, 1, 0.23, 0.6667, 453, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "read", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def read(self, request):\n \"\"\"\n Returns a representation of a single model.\n The format depends on which responder (e.g. JSONResponder)\n is assigned to this ModelResource instance. Usually called by a\n HTTP request to the resource URI with method GET.\n \"\"\"\n return self.collection.responder.element(request, self.model)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L199_C8", "label": "expression", "type": "expression", "loc": [199, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L198_C4", "vector": [8, 2, 0.8292, 0.0247, 2, 0.34, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a representation of a single model.\n The format depends on which responder (e.g. JSONResponder)\n is assigned to this ModelResource instance. Usually called by a\n HTTP request to the resource URI with method GET.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L205_C8", "label": "return", "type": "return", "loc": [205, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L198_C4", "vector": [13, 2, 0.8436, 0.0041, 2, 0.34, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.collection.responder.element(request, self.model)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L207_C4", "label": "update", "type": "function", "loc": [207, 232], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L180_C0", "vector": [2, 1, 0.9033, 0.107, 1, 0.23, 0.8333, 637, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "update", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update(self, request):\n \"\"\"\n Changes the attributes of the resource identified by 'ident'\n and redirects to the resource URI. Usually called by a HTTP\n request to the resource URI with method PUT.\n \"\"\"\n # Create a form from the model/PUT data\n ResourceForm = models.modelform_factory(self.model.__class__, form=self.collection.form_class)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L208_C8", "label": "expression", "type": "expression", "loc": [208, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L207_C4", "vector": [8, 2, 0.8642, 0.0206, 2, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Changes the attributes of the resource identified by 'ident'\n and redirects to the resource URI. Usually called by a HTTP\n request to the resource URI with method PUT.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L214_C8", "label": "ResourceForm = modelform_factory()", "type": "assigned_variable", "loc": [214, 214], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L207_C4", "vector": [14, 2, 0.8807, 0.0041, 2, 0.65, 0.25, 898, 3, 2, 0, 0, 171, 10, 1], "semantic": {"name": "ResourceForm", "arg_names": [], "import_names": [], "rhs_call_name": "modelform_factory", "annotation": ""}, "snippet": " ResourceForm = models.modelform_factory(self.model.__class__, form=self.collection.form_class)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L215_C8", "label": "data = get_put_data()", "type": "assigned_variable", "loc": [215, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L207_C4", "vector": [14, 2, 0.8848, 0.0041, 2, 0.65, 0.5, 929, 3, 1, 0, 0, 543, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "get_put_data", "annotation": ""}, "snippet": " data = self.collection.receiver.get_put_data(request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L217_C8", "label": "form = ResourceForm()", "type": "assigned_variable", "loc": [217, 217], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L207_C4", "vector": [14, 2, 0.893, 0.0041, 2, 0.65, 0.75, 761, 3, 2, 0, 0, 898, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "ResourceForm", "annotation": ""}, "snippet": " form = ResourceForm(data, instance=self.model)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:If_L224_C8", "label": "if", "type": "if", "loc": [224, 229], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L207_C4", "vector": [4, 2, 0.9321, 0.0247, 2, 0.65, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if form.is_valid():\n form.save()\n response = self.read(request)\n response.status_code = 200\n response['Location'] = self.get_url()\n return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L225_C12", "label": "save()", "type": "expression", "loc": [225, 225], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L224_C8", "vector": [8, 3, 0.9259, 0.0041, 3, 0.84, 0.0, 928, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " form.save()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L226_C12", "label": "response = read()", "type": "assigned_variable", "loc": [226, 226], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L224_C8", "vector": [14, 3, 0.93, 0.0041, 3, 0.84, 0.25, 511, 3, 1, 0, 0, 453, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " response = self.read(request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L227_C12", "label": "response.status_code =", "type": "assigned_variable", "loc": [227, 227], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L224_C8", "vector": [14, 3, 0.9342, 0.0041, 3, 0.84, 0.5, 942, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "response.status_code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.status_code = 200"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L228_C12", "label": " = get_url()", "type": "assigned_variable", "loc": [228, 228], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L224_C8", "vector": [14, 3, 0.9383, 0.0041, 3, 0.84, 0.75, 0, 3, 0, 0, 0, 662, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get_url", "annotation": ""}, "snippet": " response['Location'] = self.get_url()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L229_C12", "label": "return", "type": "return", "loc": [229, 229], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:If_L224_C8", "vector": [13, 3, 0.9424, 0.0041, 3, 0.84, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L234_C4", "label": "delete", "type": "function", "loc": [234, 241], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L180_C0", "vector": [2, 1, 0.9774, 0.0329, 1, 0.23, 1.0, 266, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "delete", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def delete(self, request):\n \"\"\"\n Deletes the model associated with the current entry.\n Usually called by a HTTP request to the entry URI\n with method DELETE.\n \"\"\"\n self.model.delete()\n return HttpResponse(_(\"Object successfully deleted.\"), self.collection.responder.mimetype)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L235_C8", "label": "expression", "type": "expression", "loc": [235, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L234_C4", "vector": [8, 2, 0.9753, 0.0206, 2, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Deletes the model associated with the current entry.\n Usually called by a HTTP request to the entry URI\n with method DELETE.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L240_C8", "label": "delete()", "type": "expression", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L234_C4", "vector": [8, 2, 0.9877, 0.0041, 2, 0.45, 0.5, 266, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " self.model.delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L241_C8", "label": "return", "type": "return", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L234_C4", "vector": [13, 2, 0.9918, 0.0041, 2, 0.45, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return HttpResponse(_(\"Object successfully deleted.\"), self.collection.responder.mimetype)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:If_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L20_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:If_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L63_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:If_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L67_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L68_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:If_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L73_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:If_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L76_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L77_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:If_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L78_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:If_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L83_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:If_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L96_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L96_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L98_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L96_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:For_L99_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:For_L99_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L100_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L96_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:If_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L110_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L110_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L113_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L110_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L114_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L110_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L116_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Try_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:Try_L120_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:If_L121_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L121_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L122_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L121_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L123_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L121_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L125_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:Try_L120_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L127_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:Try_L120_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L128_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:Try_L120_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L129_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:Try_L120_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L131_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:Try_L120_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L132_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:If_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L151_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L152_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L151_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L151_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L154_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L151_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L155_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L151_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L156_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L151_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L157_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L171_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L171_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L172_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L171_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L171_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L171_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L180_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L180_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L185_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L184_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L186_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L180_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L180_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L180_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L199_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L205_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L180_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L207_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L207_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L208_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L207_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L214_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L207_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L215_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L207_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L217_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L207_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:If_L224_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L224_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L225_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L224_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L226_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L224_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L227_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L224_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Assign_L228_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:If_L224_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L229_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:ClassDef_L180_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L234_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L235_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Expr_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_997:FunctionDef_L234_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_997:Return_L241_C8"}]
VERSION = (1, 1)
ajibawa-2023/Python-Code-Large/train/row_998
1
1
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_998:Assign_L1_C0", "label": "VERSION =", "type": "assigned_variable", "loc": [1, 1], "level": 0, "parent": null, "vector": [14, 0, 1.0, 1.0, 0, 0.66, 0.0, 557, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "VERSION = (1, 1)"}]
[]
from django.http import HttpResponse from django.utils.translation import ugettext as _ import hashlib, time, random def djangouser_auth(username, password): """ Check username and password against django.contrib.auth.models.User """ from django.contrib.auth.models import User try: user = User.objects.get(username=username) if user.check_password(password): return True else: return False except User.DoesNotExist: return False class NoAuthentication(object): """ No authentication: Permit every request. """ def is_authenticated(self, request): return True def challenge_headers(self): return {} class HttpBasicAuthentication(object): """ HTTP/1.0 basic authentication. """ def __init__(self, authfunc=djangouser_auth, realm=_('Restricted Access')): """ authfunc: A user-defined function which takes a username and password as its first and second arguments respectively and returns True if the user is authenticated realm: An identifier for the authority that is requesting authorization """ self.realm = realm self.authfunc = authfunc def challenge_headers(self): """ Returns the http headers that ask for appropriate authorization. """ return {'WWW-Authenticate' : 'Basic realm="%s"' % self.realm} def is_authenticated(self, request): """ Checks whether a request comes from an authorized user. """ if not request.META.has_key('HTTP_AUTHORIZATION'): return False (authmeth, auth) = request.META['HTTP_AUTHORIZATION'].split(' ', 1) if authmeth.lower() != 'basic': return False auth = auth.strip().decode('base64') username, password = auth.split(':', 1) return self.authfunc(username=username, password=password) def digest_password(realm, username, password): """ Construct the appropriate hashcode needed for HTTP digest """ return hashlib.md5("%s:%s:%s" % (username, realm, password)).hexdigest() class HttpDigestAuthentication(object): """ HTTP/1.1 digest authentication (RFC 2617). Uses code from the Python Paste Project (MIT Licence). """ def __init__(self, authfunc, realm=_('Restricted Access')): """ authfunc: A user-defined function which takes a username and a realm as its first and second arguments respectively and returns the combined md5 hash of username, authentication realm and password. realm: An identifier for the authority that is requesting authorization """ self.realm = realm self.authfunc = authfunc self.nonce = {} # prevention of replay attacks def get_auth_dict(self, auth_string): """ Splits WWW-Authenticate and HTTP_AUTHORIZATION strings into a dictionaries, e.g. { nonce : "951abe58eddbb49c1ed77a3a5fb5fc2e"', opaque : "34de40e4f2e4f4eda2a3952fd2abab16"', realm : "realm1"', qop : "auth"' } """ amap = {} for itm in auth_string.split(", "): (k, v) = [s.strip() for s in itm.split("=", 1)] amap[k] = v.replace('"', '') return amap def get_auth_response(self, http_method, fullpath, username, nonce, realm, qop, cnonce, nc): """ Returns the server-computed digest response key. http_method: The request method, e.g. GET username: The user to be authenticated fullpath: The absolute URI to be accessed by the user nonce: A server-specified data string which should be uniquely generated each time a 401 response is made realm: A string to be displayed to users so they know which username and password to use qop: Indicates the "quality of protection" values supported by the server. The value "auth" indicates authentication. cnonce: An opaque quoted string value provided by the client and used by both client and server to avoid chosen plaintext attacks, to provide mutual authentication, and to provide some message integrity protection. nc: Hexadecimal request counter """ ha1 = self.authfunc(realm, username) ha2 = hashlib.md5('%s:%s' % (http_method, fullpath)).hexdigest() if qop: chk = "%s:%s:%s:%s:%s:%s" % (ha1, nonce, nc, cnonce, qop, ha2) else: chk = "%s:%s:%s" % (ha1, nonce, ha2) computed_response = hashlib.md5(chk).hexdigest() return computed_response def challenge_headers(self, stale=''): """ Returns the http headers that ask for appropriate authorization. """ nonce = hashlib.md5( "%s:%s" % (time.time(), random.random())).hexdigest() opaque = hashlib.md5( "%s:%s" % (time.time(), random.random())).hexdigest() self.nonce[nonce] = None parts = {'realm': self.realm, 'qop': 'auth', 'nonce': nonce, 'opaque': opaque } if stale: parts['stale'] = 'true' head = ", ".join(['%s="%s"' % (k, v) for (k, v) in parts.items()]) return {'WWW-Authenticate':'Digest %s' % head} def is_authenticated(self, request): """ Checks whether a request comes from an authorized user. """ # Make sure the request is a valid HttpDigest request if not request.META.has_key('HTTP_AUTHORIZATION'): return False fullpath = request.META['SCRIPT_NAME'] + request.META['PATH_INFO'] (authmeth, auth) = request.META['HTTP_AUTHORIZATION'].split(" ", 1) if authmeth.lower() != 'digest': return False # Extract auth parameters from request amap = self.get_auth_dict(auth) try: username = amap['username'] authpath = amap['uri'] nonce = amap['nonce'] realm = amap['realm'] response = amap['response'] assert authpath.split("?", 1)[0] in fullpath assert realm == self.realm qop = amap.get('qop', '') cnonce = amap.get('cnonce', '') nc = amap.get('nc', '00000000') if qop: assert 'auth' == qop assert nonce and nc except: return False # Compute response key computed_response = self.get_auth_response(request.method, fullpath, username, nonce, realm, qop, cnonce, nc) # Compare server-side key with key from client # Prevent replay attacks if not computed_response or computed_response != response: if nonce in self.nonce: del self.nonce[nonce] return False pnc = self.nonce.get(nonce,'00000000') if nc <= pnc: if nonce in self.nonce: del self.nonce[nonce] return False # stale = True self.nonce[nonce] = nc return True
ajibawa-2023/Python-Code-Large/train/row_999
103
211
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_999:ImportFrom_L1_C0", "label": "from django.http import HttpResponse", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0047, 0.0047, 0, 0.66, 0.0, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_names": ["HttpResponse"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.http import HttpResponse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:ImportFrom_L2_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0095, 0.0047, 0, 0.66, 0.1429, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [], "import_names": ["_"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation import ugettext as _"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Import_L3_C0", "label": "hashlib import hashlib, time, random", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0142, 0.0047, 0, 0.66, 0.2857, 154, 0, 3, 0, 0, 154, 0, 0], "semantic": {"name": "hashlib", "arg_names": [], "import_names": ["hashlib", "time", "random"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hashlib, time, random"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L5_C0", "label": "djangouser_auth", "type": "function", "loc": [5, 18], "level": 0, "parent": null, "vector": [2, 0, 0.0545, 0.0664, 0, 0.66, 0.4286, 289, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "djangouser_auth", "arg_names": ["username", "password"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def djangouser_auth(username, password):\n \"\"\"\n Check username and password against\n django.contrib.auth.models.User\n \"\"\"\n from django.contrib.auth.models import User\n try:\n user = User.objects.get(username=username)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L6_C4", "label": "expression", "type": "expression", "loc": [6, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L5_C0", "vector": [8, 1, 0.0355, 0.019, 1, 0.23, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Check username and password against\n django.contrib.auth.models.User\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:ImportFrom_L10_C4", "label": "from django.contrib.auth.models import User", "type": "import", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L5_C0", "vector": [1, 1, 0.0474, 0.0047, 1, 0.23, 0.5, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "django.contrib.auth.models", "arg_names": [], "import_names": ["User"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.contrib.auth.models import User"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L11_C4", "label": "try", "type": "try", "loc": [11, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L5_C0", "vector": [7, 1, 0.0687, 0.0379, 1, 0.23, 1.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n user = User.objects.get(username=username)\n if user.check_password(password):\n return True\n else:\n return False\n except User.DoesNotExist:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L12_C8", "label": "user = get()", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L11_C4", "vector": [14, 2, 0.0569, 0.0047, 2, 0.97, 0.0, 503, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " user = User.objects.get(username=username)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:If_L13_C8", "label": "if", "type": "if", "loc": [13, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L11_C4", "vector": [4, 2, 0.0687, 0.019, 2, 0.97, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user.check_password(password):\n return True\n else:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L14_C12", "label": "return", "type": "return", "loc": [14, 14], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:If_L13_C8", "vector": [13, 3, 0.0664, 0.0047, 3, 0.55, 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_999:Return_L16_C12", "label": "return", "type": "return", "loc": [16, 16], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:If_L13_C8", "vector": [13, 3, 0.0758, 0.0047, 3, 0.55, 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_999:Return_L18_C8", "label": "return", "type": "return", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L11_C4", "vector": [13, 2, 0.0853, 0.0047, 2, 0.97, 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_999:ClassDef_L20_C0", "label": "NoAuthentication", "type": "class", "loc": [20, 28], "level": 0, "parent": null, "vector": [3, 0, 0.1137, 0.0427, 0, 0.66, 0.5714, 177, 0, 2, 0, 0, 186, 0, 0], "semantic": {"name": "NoAuthentication", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class NoAuthentication(object):\n \"\"\"\n No authentication: Permit every request.\n \"\"\"\n def is_authenticated(self, request):\n return True\n\n def challenge_headers(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L21_C4", "label": "expression", "type": "expression", "loc": [21, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L20_C0", "vector": [8, 1, 0.1043, 0.0142, 1, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n No authentication: Permit every request.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L24_C4", "label": "is_authenticated", "type": "function", "loc": [24, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L20_C0", "vector": [2, 1, 0.1161, 0.0095, 1, 0.71, 0.5, 458, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "is_authenticated", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_authenticated(self, request):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L25_C8", "label": "return", "type": "return", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L24_C4", "vector": [13, 2, 0.1185, 0.0047, 2, 0.25, 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_999:FunctionDef_L27_C4", "label": "challenge_headers", "type": "function", "loc": [27, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L20_C0", "vector": [2, 1, 0.1303, 0.0095, 1, 0.71, 1.0, 25, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "challenge_headers", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def challenge_headers(self):\n return {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L28_C8", "label": "return", "type": "return", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L27_C4", "vector": [13, 2, 0.1327, 0.0047, 2, 0.38, 0.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L30_C0", "label": "HttpBasicAuthentication", "type": "class", "loc": [30, 65], "level": 0, "parent": null, "vector": [3, 0, 0.2251, 0.1706, 0, 0.66, 0.7143, 159, 0, 3, 0, 0, 186, 0, 8], "semantic": {"name": "HttpBasicAuthentication", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class HttpBasicAuthentication(object):\n \"\"\"\n HTTP/1.0 basic authentication.\n \"\"\" \n def __init__(self, authfunc=djangouser_auth, realm=_('Restricted Access')):\n \"\"\"\n authfunc:\n A user-defined function which takes a username and"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L31_C4", "label": "expression", "type": "expression", "loc": [31, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L30_C0", "vector": [8, 1, 0.1517, 0.0142, 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 HTTP/1.0 basic authentication.\n \"\"\" "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L34_C4", "label": "__init__", "type": "function", "loc": [34, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L30_C0", "vector": [2, 1, 0.1872, 0.0569, 1, 0.03, 0.3333, 555, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "authfunc", "realm"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, authfunc=djangouser_auth, realm=_('Restricted Access')):\n \"\"\"\n authfunc:\n A user-defined function which takes a username and\n password as its first and second arguments respectively\n and returns True if the user is authenticated\n realm:\n An identifier for the authority that is requesting"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L35_C8", "label": "expression", "type": "expression", "loc": [35, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L34_C4", "vector": [8, 2, 0.1848, 0.0427, 2, 0.7, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n authfunc:\n A user-defined function which takes a username and\n password as its first and second arguments respectively\n and returns True if the user is authenticated\n realm:\n An identifier for the authority that is requesting\n authorization"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L44_C8", "label": "self.realm =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L34_C4", "vector": [14, 2, 0.2085, 0.0047, 2, 0.7, 0.5, 905, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.realm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.realm = realm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L45_C8", "label": "self.authfunc =", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L34_C4", "vector": [14, 2, 0.2133, 0.0047, 2, 0.7, 1.0, 738, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.authfunc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.authfunc = authfunc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L47_C4", "label": "challenge_headers", "type": "function", "loc": [47, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L30_C0", "vector": [2, 1, 0.2346, 0.0284, 1, 0.03, 0.6667, 25, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "challenge_headers", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def challenge_headers(self):\n \"\"\"\n Returns the http headers that ask for appropriate\n authorization.\n \"\"\"\n return {'WWW-Authenticate' : 'Basic realm=\"%s\"' % self.realm}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L48_C8", "label": "expression", "type": "expression", "loc": [48, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L47_C4", "vector": [8, 2, 0.2346, 0.019, 2, 0.87, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the http headers that ask for appropriate\n authorization.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L52_C8", "label": "return", "type": "return", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L47_C4", "vector": [13, 2, 0.2464, 0.0047, 2, 0.87, 1.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'WWW-Authenticate' : 'Basic realm=\"%s\"' % self.realm}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L54_C4", "label": "is_authenticated", "type": "function", "loc": [54, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L30_C0", "vector": [2, 1, 0.282, 0.0569, 1, 0.03, 1.0, 458, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "is_authenticated", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_authenticated(self, request):\n \"\"\"\n Checks whether a request comes from an authorized user.\n \"\"\"\n if not request.META.has_key('HTTP_AUTHORIZATION'):\n return False\n (authmeth, auth) = request.META['HTTP_AUTHORIZATION'].split(' ', 1)\n if authmeth.lower() != 'basic':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L55_C8", "label": "expression", "type": "expression", "loc": [55, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L54_C4", "vector": [8, 2, 0.2654, 0.0142, 2, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Checks whether a request comes from an authorized user.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:If_L58_C8", "label": "if", "type": "if", "loc": [58, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L54_C4", "vector": [4, 2, 0.2773, 0.0095, 2, 0.86, 0.1667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not request.META.has_key('HTTP_AUTHORIZATION'):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L59_C12", "label": "return", "type": "return", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:If_L58_C8", "vector": [13, 3, 0.2796, 0.0047, 3, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L60_C8", "label": "authmeth, auth = split()", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L54_C4", "vector": [14, 2, 0.2844, 0.0047, 2, 0.86, 0.3333, 381, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "authmeth, auth", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " (authmeth, auth) = request.META['HTTP_AUTHORIZATION'].split(' ', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:If_L61_C8", "label": "if", "type": "if", "loc": [61, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L54_C4", "vector": [4, 2, 0.2915, 0.0095, 2, 0.86, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if authmeth.lower() != 'basic':\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L62_C12", "label": "return", "type": "return", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:If_L61_C8", "vector": [13, 3, 0.2938, 0.0047, 3, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L63_C8", "label": "auth = decode()", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L54_C4", "vector": [14, 2, 0.2986, 0.0047, 2, 0.86, 0.6667, 280, 3, 1, 0, 0, 528, 10, 2], "semantic": {"name": "auth", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " auth = auth.strip().decode('base64')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L64_C8", "label": "username, password = split()", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L54_C4", "vector": [14, 2, 0.3033, 0.0047, 2, 0.86, 0.8333, 368, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "username, password", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " username, password = auth.split(':', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L65_C8", "label": "return", "type": "return", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L54_C4", "vector": [13, 2, 0.3081, 0.0047, 2, 0.86, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.authfunc(username=username, password=password)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L67_C0", "label": "digest_password", "type": "function", "loc": [67, 71], "level": 0, "parent": null, "vector": [2, 0, 0.327, 0.0237, 0, 0.66, 0.8571, 840, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "digest_password", "arg_names": ["realm", "username", "password"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def digest_password(realm, username, password):\n \"\"\"\n Construct the appropriate hashcode needed for HTTP digest\n \"\"\"\n return hashlib.md5(\"%s:%s:%s\" % (username, realm, password)).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L68_C4", "label": "expression", "type": "expression", "loc": [68, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L67_C0", "vector": [8, 1, 0.327, 0.0142, 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 Construct the appropriate hashcode needed for HTTP digest\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L71_C4", "label": "return", "type": "return", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L67_C0", "vector": [13, 1, 0.3365, 0.0047, 1, 0.12, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return hashlib.md5(\"%s:%s:%s\" % (username, realm, password)).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L73_C0", "label": "HttpDigestAuthentication", "type": "class", "loc": [73, 210], "level": 0, "parent": null, "vector": [3, 0, 0.6706, 0.654, 0, 0.66, 1.0, 938, 0, 5, 0, 0, 186, 0, 30], "semantic": {"name": "HttpDigestAuthentication", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class HttpDigestAuthentication(object):\n \"\"\"\n HTTP/1.1 digest authentication (RFC 2617).\n Uses code from the Python Paste Project (MIT Licence).\n \"\"\" \n def __init__(self, authfunc, realm=_('Restricted Access')):\n \"\"\"\n authfunc:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L74_C4", "label": "expression", "type": "expression", "loc": [74, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L73_C0", "vector": [8, 1, 0.3578, 0.019, 1, 0.09, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n HTTP/1.1 digest authentication (RFC 2617).\n Uses code from the Python Paste Project (MIT Licence).\n \"\"\" "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L78_C4", "label": "__init__", "type": "function", "loc": [78, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L73_C0", "vector": [2, 1, 0.4005, 0.0664, 1, 0.09, 0.2, 555, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "authfunc", "realm"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, authfunc, realm=_('Restricted Access')):\n \"\"\"\n authfunc:\n A user-defined function which takes a username and\n a realm as its first and second arguments respectively\n and returns the combined md5 hash of username,\n authentication realm and password.\n realm:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L79_C8", "label": "expression", "type": "expression", "loc": [79, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L78_C4", "vector": [8, 2, 0.3957, 0.0474, 2, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n authfunc:\n A user-defined function which takes a username and\n a realm as its first and second arguments respectively\n and returns the combined md5 hash of username,\n authentication realm and password.\n realm:\n An identifier for the authority that is requesting"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L89_C8", "label": "self.realm =", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L78_C4", "vector": [14, 2, 0.4218, 0.0047, 2, 0.79, 0.3333, 905, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.realm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.realm = realm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L90_C8", "label": "self.authfunc =", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L78_C4", "vector": [14, 2, 0.4265, 0.0047, 2, 0.79, 0.6667, 738, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.authfunc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.authfunc = authfunc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L91_C8", "label": "self.nonce =", "type": "assigned_variable", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L78_C4", "vector": [14, 2, 0.4313, 0.0047, 2, 0.79, 1.0, 345, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.nonce", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.nonce = {} # prevention of replay attacks"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L93_C4", "label": "get_auth_dict", "type": "function", "loc": [93, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L73_C0", "vector": [2, 1, 0.4763, 0.0758, 1, 0.09, 0.4, 115, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "get_auth_dict", "arg_names": ["self", "auth_string"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_auth_dict(self, auth_string):\n \"\"\"\n Splits WWW-Authenticate and HTTP_AUTHORIZATION strings\n into a dictionaries, e.g.\n {\n nonce : \"951abe58eddbb49c1ed77a3a5fb5fc2e\"',\n opaque : \"34de40e4f2e4f4eda2a3952fd2abab16\"',\n realm : \"realm1\"',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L94_C8", "label": "expression", "type": "expression", "loc": [94, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L93_C4", "vector": [8, 2, 0.4668, 0.0474, 2, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Splits WWW-Authenticate and HTTP_AUTHORIZATION strings\n into a dictionaries, e.g.\n {\n nonce : \"951abe58eddbb49c1ed77a3a5fb5fc2e\"',\n opaque : \"34de40e4f2e4f4eda2a3952fd2abab16\"',\n realm : \"realm1\"',\n qop : \"auth\"'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L104_C8", "label": "amap =", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L93_C4", "vector": [14, 2, 0.4929, 0.0047, 2, 0.18, 0.3333, 515, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "amap", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " amap = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:For_L105_C8", "label": "for itm", "type": "for", "loc": [105, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L93_C4", "vector": [6, 2, 0.5024, 0.0142, 2, 0.18, 0.6667, 769, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "itm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for itm in auth_string.split(\", \"):\n (k, v) = [s.strip() for s in itm.split(\"=\", 1)]\n amap[k] = v.replace('\"', '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L106_C12", "label": "k, v =", "type": "assigned_variable", "loc": [106, 106], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:For_L105_C8", "vector": [14, 3, 0.5024, 0.0047, 3, 0.28, 0.0, 867, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (k, v) = [s.strip() for s in itm.split(\"=\", 1)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L107_C12", "label": " = replace()", "type": "assigned_variable", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:For_L105_C8", "vector": [14, 3, 0.5071, 0.0047, 3, 0.28, 1.0, 0, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " amap[k] = v.replace('\"', '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L108_C8", "label": "return", "type": "return", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L93_C4", "vector": [13, 2, 0.5118, 0.0047, 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 amap"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L110_C4", "label": "get_auth_response", "type": "function", "loc": [110, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L73_C0", "vector": [2, 1, 0.6019, 0.1659, 1, 0.09, 0.6, 488, 0, 9, 1, 0, 0, 0, 5], "semantic": {"name": "get_auth_response", "arg_names": ["self", "http_method", "fullpath", "username", "nonce", "realm", "qop", "cnonce", "nc"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_auth_response(self, http_method, fullpath, username, nonce, realm, qop, cnonce, nc):\n \"\"\"\n Returns the server-computed digest response key.\n \n http_method:\n The request method, e.g. GET\n username:\n The user to be authenticated"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L111_C8", "label": "expression", "type": "expression", "loc": [111, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L110_C4", "vector": [8, 2, 0.5853, 0.1232, 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 Returns the server-computed digest response key.\n \n http_method:\n The request method, e.g. GET\n username:\n The user to be authenticated\n fullpath:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L137_C8", "label": "ha1 = authfunc()", "type": "assigned_variable", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L110_C4", "vector": [14, 2, 0.6493, 0.0047, 2, 0.33, 0.2, 932, 3, 2, 0, 0, 782, 10, 1], "semantic": {"name": "ha1", "arg_names": [], "import_names": [], "rhs_call_name": "authfunc", "annotation": ""}, "snippet": " ha1 = self.authfunc(realm, username)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L138_C8", "label": "ha2 = hexdigest()", "type": "assigned_variable", "loc": [138, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L110_C4", "vector": [14, 2, 0.654, 0.0047, 2, 0.33, 0.4, 342, 3, 0, 0, 0, 89, 10, 2], "semantic": {"name": "ha2", "arg_names": [], "import_names": [], "rhs_call_name": "hexdigest", "annotation": ""}, "snippet": " ha2 = hashlib.md5('%s:%s' % (http_method, fullpath)).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:If_L139_C8", "label": "if", "type": "if", "loc": [139, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L110_C4", "vector": [4, 2, 0.6659, 0.019, 2, 0.33, 0.6, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if qop:\n chk = \"%s:%s:%s:%s:%s:%s\" % (ha1, nonce, nc, cnonce, qop, ha2)\n else:\n chk = \"%s:%s:%s\" % (ha1, nonce, ha2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L140_C12", "label": "chk =", "type": "assigned_variable", "loc": [140, 140], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:If_L139_C8", "vector": [14, 3, 0.6635, 0.0047, 3, 0.69, 0.0, 365, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "chk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " chk = \"%s:%s:%s:%s:%s:%s\" % (ha1, nonce, nc, cnonce, qop, ha2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L142_C12", "label": "chk =", "type": "assigned_variable", "loc": [142, 142], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:If_L139_C8", "vector": [14, 3, 0.673, 0.0047, 3, 0.69, 1.0, 365, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "chk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " chk = \"%s:%s:%s\" % (ha1, nonce, ha2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L143_C8", "label": "computed_response = hexdigest()", "type": "assigned_variable", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L110_C4", "vector": [14, 2, 0.6777, 0.0047, 2, 0.33, 0.8, 748, 3, 0, 0, 0, 89, 10, 2], "semantic": {"name": "computed_response", "arg_names": [], "import_names": [], "rhs_call_name": "hexdigest", "annotation": ""}, "snippet": " computed_response = hashlib.md5(chk).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L144_C8", "label": "return", "type": "return", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L110_C4", "vector": [13, 2, 0.6825, 0.0047, 2, 0.33, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return computed_response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L146_C4", "label": "challenge_headers", "type": "function", "loc": [146, 161], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L73_C0", "vector": [2, 1, 0.7275, 0.0758, 1, 0.09, 0.8, 25, 0, 2, 1, 0, 0, 0, 10], "semantic": {"name": "challenge_headers", "arg_names": ["self", "stale"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def challenge_headers(self, stale=''):\n \"\"\"\n Returns the http headers that ask for appropriate\n authorization.\n \"\"\"\n nonce = hashlib.md5(\n \"%s:%s\" % (time.time(), random.random())).hexdigest()\n opaque = hashlib.md5("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L147_C8", "label": "expression", "type": "expression", "loc": [147, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L146_C4", "vector": [8, 2, 0.7038, 0.019, 2, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the http headers that ask for appropriate\n authorization.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L151_C8", "label": "nonce = hexdigest()", "type": "assigned_variable", "loc": [151, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L146_C4", "vector": [14, 2, 0.718, 0.0095, 2, 0.79, 0.1429, 116, 3, 0, 0, 0, 89, 10, 4], "semantic": {"name": "nonce", "arg_names": [], "import_names": [], "rhs_call_name": "hexdigest", "annotation": ""}, "snippet": " nonce = hashlib.md5(\n \"%s:%s\" % (time.time(), random.random())).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L153_C8", "label": "opaque = hexdigest()", "type": "assigned_variable", "loc": [153, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L146_C4", "vector": [14, 2, 0.7275, 0.0095, 2, 0.79, 0.2857, 561, 3, 0, 0, 0, 89, 10, 4], "semantic": {"name": "opaque", "arg_names": [], "import_names": [], "rhs_call_name": "hexdigest", "annotation": ""}, "snippet": " opaque = hashlib.md5(\n \"%s:%s\" % (time.time(), random.random())).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L155_C8", "label": "assign", "type": "assigned_variable", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L146_C4", "vector": [14, 2, 0.7346, 0.0047, 2, 0.79, 0.4286, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.nonce[nonce] = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L156_C8", "label": "parts =", "type": "assigned_variable", "loc": [156, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L146_C4", "vector": [14, 2, 0.7417, 0.0095, 2, 0.79, 0.5714, 13, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "parts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parts = {'realm': self.realm, 'qop': 'auth',\n 'nonce': nonce, 'opaque': opaque }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:If_L158_C8", "label": "if", "type": "if", "loc": [158, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L146_C4", "vector": [4, 2, 0.7512, 0.0095, 2, 0.79, 0.7143, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if stale:\n parts['stale'] = 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L159_C12", "label": "assign", "type": "assigned_variable", "loc": [159, 159], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:If_L158_C8", "vector": [14, 3, 0.7536, 0.0047, 3, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parts['stale'] = 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L160_C8", "label": "head = join()", "type": "assigned_variable", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L146_C4", "vector": [14, 2, 0.7583, 0.0047, 2, 0.79, 0.8571, 217, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "head", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " head = \", \".join(['%s=\"%s\"' % (k, v) for (k, v) in parts.items()])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L161_C8", "label": "return", "type": "return", "loc": [161, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L146_C4", "vector": [13, 2, 0.763, 0.0047, 2, 0.79, 1.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'WWW-Authenticate':'Digest %s' % head}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "label": "is_authenticated", "type": "function", "loc": [163, 210], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L73_C0", "vector": [2, 1, 0.8839, 0.2275, 1, 0.09, 1.0, 458, 0, 2, 1, 0, 0, 0, 10], "semantic": {"name": "is_authenticated", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_authenticated(self, request):\n \"\"\"\n Checks whether a request comes from an authorized user.\n \"\"\"\n \n # Make sure the request is a valid HttpDigest request\n if not request.META.has_key('HTTP_AUTHORIZATION'):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L164_C8", "label": "expression", "type": "expression", "loc": [164, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "vector": [8, 2, 0.782, 0.0142, 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 Checks whether a request comes from an authorized user.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:If_L169_C8", "label": "if", "type": "if", "loc": [169, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "vector": [4, 2, 0.8033, 0.0095, 2, 0.62, 0.0833, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not request.META.has_key('HTTP_AUTHORIZATION'):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L170_C12", "label": "return", "type": "return", "loc": [170, 170], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:If_L169_C8", "vector": [13, 3, 0.8057, 0.0047, 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_999:Assign_L171_C8", "label": "fullpath =", "type": "assigned_variable", "loc": [171, 171], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "vector": [14, 2, 0.8104, 0.0047, 2, 0.62, 0.1667, 858, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fullpath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fullpath = request.META['SCRIPT_NAME'] + request.META['PATH_INFO']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L172_C8", "label": "authmeth, auth = split()", "type": "assigned_variable", "loc": [172, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "vector": [14, 2, 0.8152, 0.0047, 2, 0.62, 0.25, 381, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "authmeth, auth", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " (authmeth, auth) = request.META['HTTP_AUTHORIZATION'].split(\" \", 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:If_L173_C8", "label": "if", "type": "if", "loc": [173, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "vector": [4, 2, 0.8223, 0.0095, 2, 0.62, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if authmeth.lower() != 'digest':\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L174_C12", "label": "return", "type": "return", "loc": [174, 174], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:If_L173_C8", "vector": [13, 3, 0.8246, 0.0047, 3, 0.54, 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_999:Assign_L177_C8", "label": "amap = get_auth_dict()", "type": "assigned_variable", "loc": [177, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "vector": [14, 2, 0.8389, 0.0047, 2, 0.62, 0.4167, 515, 3, 1, 0, 0, 115, 10, 1], "semantic": {"name": "amap", "arg_names": [], "import_names": [], "rhs_call_name": "get_auth_dict", "annotation": ""}, "snippet": " amap = self.get_auth_dict(auth)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L178_C8", "label": "try", "type": "try", "loc": [178, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "vector": [7, 2, 0.8791, 0.0758, 2, 0.62, 0.5, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n username = amap['username']\n authpath = amap['uri']\n nonce = amap['nonce']\n realm = amap['realm']\n response = amap['response']\n assert authpath.split(\"?\", 1)[0] in fullpath\n assert realm == self.realm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L179_C12", "label": "username =", "type": "assigned_variable", "loc": [179, 179], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L178_C8", "vector": [14, 3, 0.8483, 0.0047, 3, 0.86, 0.0, 718, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "username", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " username = amap['username']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L180_C12", "label": "authpath =", "type": "assigned_variable", "loc": [180, 180], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L178_C8", "vector": [14, 3, 0.8531, 0.0047, 3, 0.86, 0.125, 730, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "authpath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " authpath = amap['uri']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L181_C12", "label": "nonce =", "type": "assigned_variable", "loc": [181, 181], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L178_C8", "vector": [14, 3, 0.8578, 0.0047, 3, 0.86, 0.25, 116, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "nonce", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nonce = amap['nonce']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L182_C12", "label": "realm =", "type": "assigned_variable", "loc": [182, 182], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L178_C8", "vector": [14, 3, 0.8626, 0.0047, 3, 0.86, 0.375, 939, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "realm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " realm = amap['realm']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L183_C12", "label": "response =", "type": "assigned_variable", "loc": [183, 183], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L178_C8", "vector": [14, 3, 0.8673, 0.0047, 3, 0.86, 0.5, 511, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response = amap['response']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L186_C12", "label": "qop = get()", "type": "assigned_variable", "loc": [186, 186], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L178_C8", "vector": [14, 3, 0.8815, 0.0047, 3, 0.86, 0.625, 901, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "qop", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " qop = amap.get('qop', '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L187_C12", "label": "cnonce = get()", "type": "assigned_variable", "loc": [187, 187], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L178_C8", "vector": [14, 3, 0.8863, 0.0047, 3, 0.86, 0.75, 384, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "cnonce", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " cnonce = amap.get('cnonce', '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L188_C12", "label": "nc = get()", "type": "assigned_variable", "loc": [188, 188], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L178_C8", "vector": [14, 3, 0.891, 0.0047, 3, 0.86, 0.875, 692, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "nc", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " nc = amap.get('nc', '00000000')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:If_L189_C12", "label": "if", "type": "if", "loc": [189, 191], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L178_C8", "vector": [4, 3, 0.9005, 0.0142, 3, 0.86, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if qop:\n assert 'auth' == qop\n assert nonce and nc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L193_C12", "label": "return", "type": "return", "loc": [193, 193], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L178_C8", "vector": [13, 3, 0.9147, 0.0047, 3, 0.86, 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_999:Assign_L196_C8", "label": "computed_response = get_auth_response()", "type": "assigned_variable", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "vector": [14, 2, 0.9289, 0.0047, 2, 0.62, 0.5833, 748, 3, 8, 0, 0, 488, 10, 1], "semantic": {"name": "computed_response", "arg_names": [], "import_names": [], "rhs_call_name": "get_auth_response", "annotation": ""}, "snippet": " computed_response = self.get_auth_response(request.method, fullpath, username, nonce, realm, qop, cnonce, nc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:If_L200_C8", "label": "if", "type": "if", "loc": [200, 203], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "vector": [4, 2, 0.955, 0.019, 2, 0.62, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not computed_response or computed_response != response:\n if nonce in self.nonce:\n del self.nonce[nonce]\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:If_L201_C12", "label": "if", "type": "if", "loc": [201, 202], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:If_L200_C8", "vector": [4, 3, 0.955, 0.0095, 3, 0.7, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if nonce in self.nonce:\n del self.nonce[nonce]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L203_C12", "label": "return", "type": "return", "loc": [203, 203], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:If_L200_C8", "vector": [13, 3, 0.9621, 0.0047, 3, 0.7, 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_999:Assign_L204_C8", "label": "pnc = get()", "type": "assigned_variable", "loc": [204, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "vector": [14, 2, 0.9668, 0.0047, 2, 0.62, 0.75, 442, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "pnc", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " pnc = self.nonce.get(nonce,'00000000')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:If_L205_C8", "label": "if", "type": "if", "loc": [205, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "vector": [4, 2, 0.9787, 0.019, 2, 0.62, 0.8333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if nc <= pnc:\n if nonce in self.nonce:\n del self.nonce[nonce]\n return False # stale = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:If_L206_C12", "label": "if", "type": "if", "loc": [206, 207], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:If_L205_C8", "vector": [4, 3, 0.9787, 0.0095, 3, 0.38, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if nonce in self.nonce:\n del self.nonce[nonce]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L208_C12", "label": "return", "type": "return", "loc": [208, 208], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:If_L205_C8", "vector": [13, 3, 0.9858, 0.0047, 3, 0.38, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False # stale = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L209_C8", "label": "assign", "type": "assigned_variable", "loc": [209, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "vector": [14, 2, 0.9905, 0.0047, 2, 0.62, 0.9167, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.nonce[nonce] = nc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L210_C8", "label": "return", "type": "return", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "vector": [13, 2, 0.9953, 0.0047, 2, 0.62, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_999:ImportFrom_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:If_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:If_L13_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L14_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:If_L13_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L16_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:If_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:If_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L62_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:For_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:For_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L106_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:For_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:If_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:If_L139_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L140_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:If_L139_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L142_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:If_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:If_L158_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L159_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:ClassDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Expr_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:If_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:If_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L170_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L171_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L172_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:If_L173_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:If_L173_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L174_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L178_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L179_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L178_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L180_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L178_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L181_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L178_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L182_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L178_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L183_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L178_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L186_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L178_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L187_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L178_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L188_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L178_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:If_L189_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:Try_L178_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L193_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L196_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:If_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:If_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:If_L201_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:If_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L203_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L204_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:If_L205_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:If_L205_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:If_L206_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:If_L205_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L208_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Assign_L209_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_999:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_999:Return_L210_C8"}]
from distutils.core import setup version = '%s.%s' % __import__('django_restapi').VERSION[:2] setup(name='django-rest', version=version, packages=['django_restapi'], author='Andriy Drozdyuk', author_email='drozzy@gmail.com', )
ajibawa-2023/Python-Code-Large/train/row_1000
3
10
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1000:ImportFrom_L1_C0", "label": "from distutils.core import setup", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1, 0.1, 0, 0.66, 0.0, 152, 0, 1, 0, 0, 152, 0, 0], "semantic": {"name": "distutils.core", "arg_names": [], "import_names": ["setup"], "rhs_call_name": "", "annotation": ""}, "snippet": "from distutils.core import setup"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1000:Assign_L3_C0", "label": "version =", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.3, 0.1, 0, 0.66, 0.5, 623, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "version = '%s.%s' % __import__('django_restapi').VERSION[:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1000:Expr_L5_C0", "label": "setup()", "type": "expression", "loc": [5, 10], "level": 0, "parent": null, "vector": [8, 0, 0.75, 0.6, 0, 0.66, 1.0, 234, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "setup", "arg_names": [], "import_names": [], "rhs_call_name": "setup", "annotation": ""}, "snippet": "setup(name='django-rest',\n\t\tversion=version,\n\t\tpackages=['django_restapi'],\n\t\tauthor='Andriy Drozdyuk',\n\t\tauthor_email='drozzy@gmail.com',\n\t)"}]
[]
from os.path import realpath DEBUG = True TEMPLATE_DEBUG = True INSTALLED_APPS = ( 'django.contrib.contenttypes', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.sessions', 'django.contrib.sites', 'django_restapi_tests.polls', 'django_restapi_tests.people' ) SITE_ID=1 ROOT_URLCONF = 'django_restapi_tests.urls' DATABASE_NAME = realpath('testdata') DATABASE_ENGINE = 'sqlite3' TEMPLATE_DIRS = 'templates' MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', # 'django.middleware.common.CommonMiddleware', # 'django.middleware.doc.XViewMiddleware', )
ajibawa-2023/Python-Code-Large/train/row_1001
10
27
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1001:ImportFrom_L1_C0", "label": "from os.path import realpath", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.037, 0.037, 0, 0.66, 0.0, 79, 0, 1, 0, 0, 79, 0, 0], "semantic": {"name": "os.path", "arg_names": [], "import_names": ["realpath"], "rhs_call_name": "", "annotation": ""}, "snippet": "from os.path import realpath"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1001:Assign_L3_C0", "label": "DEBUG =", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.1111, 0.037, 0, 0.66, 0.1111, 309, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "DEBUG", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DEBUG = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1001:Assign_L4_C0", "label": "TEMPLATE_DEBUG =", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.1481, 0.037, 0, 0.66, 0.2222, 7, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "TEMPLATE_DEBUG", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEMPLATE_DEBUG = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1001:Assign_L6_C0", "label": "INSTALLED_APPS =", "type": "assigned_variable", "loc": [6, 14], "level": 0, "parent": null, "vector": [14, 0, 0.3704, 0.3333, 0, 0.66, 0.3333, 648, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "INSTALLED_APPS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "INSTALLED_APPS = (\n 'django.contrib.contenttypes',\n 'django.contrib.admin',\n 'django.contrib.auth',\n 'django.contrib.sessions',\n 'django.contrib.sites',\n 'django_restapi_tests.polls',\n 'django_restapi_tests.people'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1001:Assign_L15_C0", "label": "SITE_ID =", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.5556, 0.037, 0, 0.66, 0.4444, 122, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "SITE_ID", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SITE_ID=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1001:Assign_L16_C0", "label": "ROOT_URLCONF =", "type": "assigned_variable", "loc": [16, 16], "level": 0, "parent": null, "vector": [14, 0, 0.5926, 0.037, 0, 0.66, 0.5556, 281, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROOT_URLCONF", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROOT_URLCONF = 'django_restapi_tests.urls'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1001:Assign_L18_C0", "label": "DATABASE_NAME = realpath()", "type": "assigned_variable", "loc": [18, 18], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.037, 0, 0.66, 0.6667, 982, 3, 1, 0, 0, 45, 10, 1], "semantic": {"name": "DATABASE_NAME", "arg_names": [], "import_names": [], "rhs_call_name": "realpath", "annotation": ""}, "snippet": "DATABASE_NAME = realpath('testdata')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1001:Assign_L19_C0", "label": "DATABASE_ENGINE =", "type": "assigned_variable", "loc": [19, 19], "level": 0, "parent": null, "vector": [14, 0, 0.7037, 0.037, 0, 0.66, 0.7778, 96, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DATABASE_ENGINE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DATABASE_ENGINE = 'sqlite3'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1001:Assign_L20_C0", "label": "TEMPLATE_DIRS =", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.7407, 0.037, 0, 0.66, 0.8889, 910, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TEMPLATE_DIRS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEMPLATE_DIRS = 'templates'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1001:Assign_L22_C0", "label": "MIDDLEWARE_CLASSES =", "type": "assigned_variable", "loc": [22, 27], "level": 0, "parent": null, "vector": [14, 0, 0.9074, 0.2222, 0, 0.66, 1.0, 641, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "MIDDLEWARE_CLASSES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MIDDLEWARE_CLASSES = (\n 'django.contrib.sessions.middleware.SessionMiddleware',\n 'django.contrib.auth.middleware.AuthenticationMiddleware',\n# 'django.middleware.common.CommonMiddleware',\n# 'django.middleware.doc.XViewMiddleware',\n)"}]
[]
#!/usr/bin/env python from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) sys.exit(1) if __name__ == "__main__": execute_manager(settings)
ajibawa-2023/Python-Code-Large/train/row_1002
8
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_1002:ImportFrom_L2_C0", "label": "from django.core.management import execute_manager", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0909, 0, 0.66, 0.0, 879, 0, 1, 0, 0, 879, 0, 0], "semantic": {"name": "django.core.management", "arg_names": [], "import_names": ["execute_manager"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.management import execute_manager"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1002:Try_L3_C0", "label": "try", "type": "try", "loc": [3, 8], "level": 0, "parent": null, "vector": [7, 0, 0.5, 0.5455, 0, 0.66, 0.5, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n import settings # Assumed to be in the same directory.\nexcept ImportError:\n import sys\n sys.stderr.write(\"Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\\nYou'll have to run django-admin.py, passing it your settings module.\\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\\n\" % __file__)\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1002:Import_L4_C4", "label": "settings import settings", "type": "import", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1002:Try_L3_C0", "vector": [1, 1, 0.3636, 0.0909, 1, 0.49, 0.0, 168, 0, 1, 0, 0, 168, 0, 0], "semantic": {"name": "settings", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": " import settings # Assumed to be in the same directory."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1002:Import_L6_C4", "label": "sys import sys", "type": "import", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1002:Try_L3_C0", "vector": [1, 1, 0.5455, 0.0909, 1, 0.49, 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_1002:Expr_L7_C4", "label": "write()", "type": "expression", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1002:Try_L3_C0", "vector": [8, 1, 0.6364, 0.0909, 1, 0.49, 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(\"Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\\nYou'll have to run django-admin.py, passing it your settings module.\\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\\n\" % __file__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1002:Expr_L8_C4", "label": "exit()", "type": "expression", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1002:Try_L3_C0", "vector": [8, 1, 0.7273, 0.0909, 1, 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_1002:If_L10_C0", "label": "if", "type": "if", "loc": [10, 11], "level": 0, "parent": null, "vector": [4, 0, 0.9545, 0.1818, 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 execute_manager(settings)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1002:Expr_L11_C4", "label": "execute_manager()", "type": "expression", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1002:If_L10_C0", "vector": [8, 1, 1.0, 0.0909, 1, 0.59, 0.0, 383, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute_manager", "arg_names": [], "import_names": [], "rhs_call_name": "execute_manager", "annotation": ""}, "snippet": " execute_manager(settings)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1002:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1002:Import_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1002:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1002:Import_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1002:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1002:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1002:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1002:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1002:If_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1002:Expr_L11_C4"}]
from datetime import datetime from django.db import models from django.utils.translation import gettext_lazy as _ class Poll(models.Model): question = models.CharField(max_length=200) password = models.CharField(max_length=200) pub_date = models.DateTimeField(_('date published'), default=datetime.now) class Admin: pass def __str__(self): return self.question def get_choice_list(self): return list(self.choice_set.order_by('id')) def get_choice_from_num(self, choice_num): try: return self.get_choice_list()[int(choice_num)-1] except IndexError: raise Choice.DoesNotExist class Choice(models.Model): poll = models.ForeignKey(Poll) choice = models.CharField(max_length=200) votes = models.IntegerField() class Admin: pass def __str__(self): return self.choice def get_num(self): try: return self.poll.get_choice_list().index(self)+1 except ValueError: raise Choice.DoesNotExist
ajibawa-2023/Python-Code-Large/train/row_1003
25
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_1003:ImportFrom_L1_C0", "label": "from datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0303, 0.0303, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime"], "rhs_call_name": "", "annotation": ""}, "snippet": "from datetime import datetime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:ImportFrom_L2_C0", "label": "from django.db import models", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0606, 0.0303, 0, 0.66, 0.25, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["models"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db import models"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:ImportFrom_L3_C0", "label": "from django.utils.translation import _", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0303, 0, 0.66, 0.5, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "django.utils.translation", "arg_names": [], "import_names": ["_"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.translation import gettext_lazy as _"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L5_C0", "label": "Poll", "type": "class", "loc": [5, 19], "level": 0, "parent": null, "vector": [3, 0, 0.3636, 0.4545, 0, 0.66, 0.75, 856, 0, 3, 0, 0, 996, 0, 8], "semantic": {"name": "Poll", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Poll(models.Model):\n question = models.CharField(max_length=200)\n password = models.CharField(max_length=200)\n pub_date = models.DateTimeField(_('date published'), default=datetime.now)\n class Admin:\n pass\n def __str__(self):\n return self.question"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:Assign_L6_C4", "label": "question = CharField()", "type": "assigned_variable", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L5_C0", "vector": [14, 1, 0.1818, 0.0303, 1, 0.41, 0.0, 785, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "question", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " question = models.CharField(max_length=200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:Assign_L7_C4", "label": "password = CharField()", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L5_C0", "vector": [14, 1, 0.2121, 0.0303, 1, 0.41, 0.1667, 489, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "password", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " password = models.CharField(max_length=200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:Assign_L8_C4", "label": "pub_date = DateTimeField()", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L5_C0", "vector": [14, 1, 0.2424, 0.0303, 1, 0.41, 0.3333, 365, 3, 2, 0, 0, 789, 10, 2], "semantic": {"name": "pub_date", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeField", "annotation": ""}, "snippet": " pub_date = models.DateTimeField(_('date published'), default=datetime.now)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L9_C4", "label": "Admin", "type": "class", "loc": [9, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L5_C0", "vector": [3, 1, 0.2879, 0.0606, 1, 0.41, 0.5, 969, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Admin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Admin:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:FunctionDef_L11_C4", "label": "__str__", "type": "function", "loc": [11, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L5_C0", "vector": [2, 1, 0.3485, 0.0606, 1, 0.41, 0.6667, 527, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n return self.question"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:Return_L12_C8", "label": "return", "type": "return", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1003:FunctionDef_L11_C4", "vector": [13, 2, 0.3636, 0.0303, 2, 0.91, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.question"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:FunctionDef_L13_C4", "label": "get_choice_list", "type": "function", "loc": [13, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L5_C0", "vector": [2, 1, 0.4091, 0.0606, 1, 0.41, 0.8333, 578, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "get_choice_list", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_choice_list(self):\n return list(self.choice_set.order_by('id'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:Return_L14_C8", "label": "return", "type": "return", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1003:FunctionDef_L13_C4", "vector": [13, 2, 0.4242, 0.0303, 2, 0.42, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return list(self.choice_set.order_by('id'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:FunctionDef_L15_C4", "label": "get_choice_from_num", "type": "function", "loc": [15, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L5_C0", "vector": [2, 1, 0.5152, 0.1515, 1, 0.41, 1.0, 550, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "get_choice_from_num", "arg_names": ["self", "choice_num"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_choice_from_num(self, choice_num):\n try:\n return self.get_choice_list()[int(choice_num)-1]\n except IndexError:\n raise Choice.DoesNotExist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:Try_L16_C8", "label": "try", "type": "try", "loc": [16, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1003:FunctionDef_L15_C4", "vector": [7, 2, 0.5303, 0.1212, 2, 0.02, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return self.get_choice_list()[int(choice_num)-1]\n except IndexError:\n raise Choice.DoesNotExist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:Return_L17_C12", "label": "return", "type": "return", "loc": [17, 17], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1003:Try_L16_C8", "vector": [13, 3, 0.5152, 0.0303, 3, 0.65, 0.0, 0, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_choice_list()[int(choice_num)-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L21_C0", "label": "Choice", "type": "class", "loc": [21, 33], "level": 0, "parent": null, "vector": [3, 0, 0.8182, 0.3939, 0, 0.66, 1.0, 811, 0, 2, 0, 0, 996, 0, 5], "semantic": {"name": "Choice", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Choice(models.Model):\n poll = models.ForeignKey(Poll)\n choice = models.CharField(max_length=200)\n votes = models.IntegerField()\n class Admin:\n pass\n def __str__(self):\n return self.choice"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:Assign_L22_C4", "label": "poll = ForeignKey()", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L21_C0", "vector": [14, 1, 0.6667, 0.0303, 1, 0.42, 0.0, 182, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "poll", "arg_names": [], "import_names": [], "rhs_call_name": "ForeignKey", "annotation": ""}, "snippet": " poll = models.ForeignKey(Poll)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:Assign_L23_C4", "label": "choice = CharField()", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L21_C0", "vector": [14, 1, 0.697, 0.0303, 1, 0.42, 0.2, 30, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "choice", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " choice = models.CharField(max_length=200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:Assign_L24_C4", "label": "votes = IntegerField()", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L21_C0", "vector": [14, 1, 0.7273, 0.0303, 1, 0.42, 0.4, 872, 3, 0, 0, 0, 877, 10, 1], "semantic": {"name": "votes", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerField", "annotation": ""}, "snippet": " votes = models.IntegerField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L25_C4", "label": "Admin", "type": "class", "loc": [25, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L21_C0", "vector": [3, 1, 0.7727, 0.0606, 1, 0.42, 0.6, 969, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Admin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Admin:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:FunctionDef_L27_C4", "label": "__str__", "type": "function", "loc": [27, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L21_C0", "vector": [2, 1, 0.8333, 0.0606, 1, 0.42, 0.8, 527, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n return self.choice"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:Return_L28_C8", "label": "return", "type": "return", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1003:FunctionDef_L27_C4", "vector": [13, 2, 0.8485, 0.0303, 2, 0.02, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.choice"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:FunctionDef_L29_C4", "label": "get_num", "type": "function", "loc": [29, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L21_C0", "vector": [2, 1, 0.9394, 0.1515, 1, 0.42, 1.0, 389, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "get_num", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_num(self):\n try:\n return self.poll.get_choice_list().index(self)+1\n except ValueError:\n raise Choice.DoesNotExist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:Try_L30_C8", "label": "try", "type": "try", "loc": [30, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1003:FunctionDef_L29_C4", "vector": [7, 2, 0.9545, 0.1212, 2, 0.15, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return self.poll.get_choice_list().index(self)+1\n except ValueError:\n raise Choice.DoesNotExist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1003:Return_L31_C12", "label": "return", "type": "return", "loc": [31, 31], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1003:Try_L30_C8", "vector": [13, 3, 0.9394, 0.0303, 3, 0.97, 0.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.poll.get_choice_list().index(self)+1"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1003:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1003:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1003:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1003:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1003:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1003:Return_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1003:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1003:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1003:Return_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1003:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1003:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1003:Try_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1003:Try_L16_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1003:Return_L17_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1003:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1003:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1003:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1003:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1003:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1003:Return_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1003:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1003:FunctionDef_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1003:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1003:Try_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1003:Try_L30_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1003:Return_L31_C12"}]
from binascii import b2a_base64 from datetime import datetime from django.core import serializers from django.test import TestCase from django.utils.functional import curry from django_restapi.authentication import HttpDigestAuthentication from django_restapi_tests.examples.authentication import digest_authfunc from django_restapi_tests.polls.models import Poll import webbrowser, re DIGEST_AUTH = 'Digest username="%(username)s", realm="%(realm)s", nonce="%(nonce)s", uri="%(fullpath)s", algorithm=MD5, response="%(response)s", qop=%(qop)s, nc=%(nc)s, cnonce="%(cnonce)s"' SHOW_ERRORS_IN_BROWSER = False def show_in_browser(content): if SHOW_ERRORS_IN_BROWSER: f = open("/tmp/djangorest_error", "w") f.write(content) f.close() webbrowser.open_new("file:///tmp/djangorest_error") class BasicTest(TestCase): fixtures = ['initial_data.json'] def setUp(self): self.client.put = curry(self.client.post, REQUEST_METHOD='PUT') self.client.delete = curry(self.client.get, REQUEST_METHOD='DELETE') def test_basics(self): for format in ['xml', 'html']: # Get list of polls url = '/%s/polls/' % format response = self.client.get(url) self.failUnlessEqual(response.status_code, 200) self.failUnlessEqual(response.content.find('secret'), -1) # Get list of choices url = '/%s/choices/' % format response = self.client.get(url) self.failUnlessEqual(response.status_code, 200) # Second page of choices must exist. response = self.client.get(url, {'page' : 2}) self.failUnlessEqual(response.status_code, 200) # Third page must not exist. response = self.client.get(url, {'page' : 3}) self.failUnlessEqual(response.status_code, 404) # Try to create poll with insufficient data # (needs to fail) url = '/%s/polls/' % format params = { 'question' : 'Does this not work?', } response = self.client.post(url, params) self.failUnlessEqual(response.status_code, 400) # Create poll params = { 'question' : 'Does this work?', 'password' : 'secret', 'pub_date' : '2001-01-01' } response = self.client.post(url, params) self.failUnlessEqual(response.status_code, 201) location = response['Location'] poll_id = int(re.findall("\d+", location)[0]) # Try to change poll with inappropriate data # (needs to fail) url = '/%s/polls/%d/' % (format, poll_id) params = { 'question' : 'Yes, it works.', 'password' : 'newsecret', 'pub_date' : '2007-07-07-123' } response = self.client.put(url, params) self.failUnlessEqual(response.status_code, 400) # Change poll url = '/%s/polls/%d/' % (format, poll_id) params = { 'question' : 'Yes, it works.', 'password' : 'newsecret', 'pub_date' : '2007-07-07' } response = self.client.put(url, params) self.failUnlessEqual(response.status_code, 200) # Read poll response = self.client.get(url) self.failUnlessEqual(response.status_code, 200) self.failUnlessEqual(response.content.find('secret'), -1) # Delete poll response = self.client.delete(url) self.failUnlessEqual(response.status_code, 200) # Read choice url = '/%s/choices/1/' % format response = self.client.get(url) self.failUnlessEqual(response.status_code, 200) # Try to delete choice (must fail) response = self.client.delete(url) self.failUnlessEqual(response.status_code, 405) def test_urlpatterns(self): url = '/json/polls/' response = self.client.get(url) self.failUnlessEqual(response.status_code, 200) self.failUnlessEqual(response.content.find('secret'), -1) # Get poll url = '/json/polls/1/' response = self.client.get(url) self.failUnlessEqual(response.status_code, 200) self.failUnlessEqual(response.content.find('secret'), -1) # Get filtered list of choices url = '/json/polls/1/choices/' response = self.client.get(url) self.failUnlessEqual(len(eval(response.content)), 3) self.failUnlessEqual(response.status_code, 200) self.failUnlessEqual(response.content.find('secret'), -1) # Get choice url = '/json/polls/1/choices/1/' response = self.client.get(url) self.failUnlessEqual(response.status_code, 200) self.failUnlessEqual(response.content.find('secret'), -1) # Get choice (failure) url = '/json/polls/1/choices/12/' response = self.client.get(url) self.failUnlessEqual(response.status_code, 404) self.failUnlessEqual(response.content.find('secret'), -1) # Try to create poll with insufficient data # (needs to fail) url = '/json/polls/' params = { 'question' : 'Does this not work?', } response = self.client.post(url, params) self.failUnlessEqual(response.status_code, 400) # Create choice url = '/json/polls/1/choices/' params = { 'poll' : 1, # TODO: Should be taken from URL 'choice' : 'New choice', 'votes' : 0 } response = self.client.post(url, params) self.failUnlessEqual(response.status_code, 201) location = response['location'] poll_id = int(re.findall("\d+", location)[0]) self.failUnlessEqual(poll_id, 1) # Try to update choice with insufficient data (needs to fail) url = location[17:] # strip the protocol head and base url: # only working with paths! (note: bad variable name choice!!!) params = { 'poll' : poll_id, 'choice' : 'New choice', 'votes' : 'Should be an integer' } response = self.client.put(url, params) self.failUnlessEqual(response.status_code, 400) # Update choice params = { 'poll' : poll_id, 'choice' : 'New choice', 'votes' : '712' } response = self.client.put(url, params) self.failIfEqual(response.content.find("712"), -1) self.failUnlessEqual(response.status_code, 200) # Delete choice response = self.client.delete(url) self.failUnlessEqual(response.status_code, 200) def test_submission(self): # XML url = '/fullxml/polls/' response = self.client.get(url) self.failUnlessEqual(response.status_code, 200) # Create new_poll = Poll( question = 'Does XML submission work?', password = 'secret', pub_date = datetime.now() ) serialized_poll = serializers.serialize('xml', [new_poll]) serialized_poll = serialized_poll.replace('pk="None"', 'pk="1"') # Is ignored, but needs to be an integer response = self.client.post(url, data=serialized_poll, content_type='application/xml') self.failUnlessEqual(response.status_code, 201) response_content = re.sub('pk="\d+"', 'pk="1"', response.content) self.failUnlessEqual(serialized_poll, response_content) response = self.client.get(url) self.failUnlessEqual(response.status_code, 200) self.failIfEqual(response_content.find("XML submission"), -1) # Update url = '/fullxml/polls/1/' updated_poll = Poll( question = 'New question', password = 'new_secret', pub_date = datetime.now() ) serialized_poll = serializers.serialize('xml', [updated_poll]) serialized_poll = serialized_poll.replace('pk="None"', 'pk="1"') # Is ignored, but needs to be an integer response = self.client.put(url, data=serialized_poll, content_type='application/xml') updated_poll = Poll.objects.get(id=1) self.failUnlessEqual(updated_poll.question, "New question") self.failUnlessEqual(updated_poll.password, "new_secret") # JSON url = '/fulljson/polls/' response = self.client.get(url) self.failUnlessEqual(response.status_code, 200) # Create new_poll = Poll( question = 'Does JSON submission work?', password = 'secret', pub_date = datetime.now() ) serialized_poll = serializers.serialize('json', [new_poll]) serialized_poll = serialized_poll.replace('"pk": null', '"pk": 1') # Is ignored, but needs to be an integer response = self.client.post(url, data=serialized_poll, content_type='application/json') self.failUnlessEqual(response.status_code, 201) response_content = re.sub('"pk": \d+,', '"pk": 1,', response.content) self.failUnlessEqual(serialized_poll, response_content) response = self.client.get(url) self.failUnlessEqual(response.status_code, 200) self.failIfEqual(response_content.find("JSON submission"), -1) # Update url = '/fulljson/polls/2/' updated_poll = Poll( question = 'Another question', password = 'another_secret', pub_date = datetime.now() ) serialized_poll = serializers.serialize('json', [updated_poll]) serialized_poll = serialized_poll.replace('"pk": "None"', '"pk": "1"') # Is ignored, but needs to be an integer response = self.client.put(url, data=serialized_poll, content_type='application/json') updated_poll = Poll.objects.get(id=2) self.failUnlessEqual(updated_poll.question, "Another question") self.failUnlessEqual(updated_poll.password, "another_secret") class AuthenticationTest(TestCase): fixtures = ['initial_data.json'] def get_digest_test_params(self, response, url, auth_helper): """ Extract authentication variables from server response e.g. {'nonce': '477be2a405a439cdba5227be89ba0f76', 'qop': 'auth', 'realm': 'realm1', 'opaque': '67d958f952de6bd4c1a88686f1b8a896'} and add missing params (method, path, username, cnonce, nc). """ www_auth_response = response['WWW-Authenticate'] self.failUnlessEqual(www_auth_response[:7].lower(), 'digest ') auth_params = auth_helper.get_auth_dict(www_auth_response[7:]) self.failUnlessEqual(len(auth_params), 4) auth_params.pop('opaque') auth_params.update({'http_method': 'GET', 'fullpath': url, 'username': 'john', 'cnonce': '12345678', 'nc': '00000001'}) return auth_params def test_basic_authentication(self): # Basic authentication, no password url = '/basic/polls/' response = self.client.get(url) self.failUnlessEqual(response.status_code, 401) # Basic authentication, wrong password headers = { 'HTTP_AUTHORIZATION': 'Basic %s' % b2a_base64('rest:somepass')[:-1] } response = self.client.get(url, **headers) self.failUnlessEqual(response.status_code, 401) # Basic authentication, right password headers = { 'HTTP_AUTHORIZATION': 'Basic %s' % b2a_base64('rest:rest')[:-1] } response = self.client.get(url, **headers) self.failUnlessEqual(response.status_code, 200) def test_digest_authentication(self): # 1) Digest authentication, no password url = '/digest/polls/' response = self.client.get(url) self.failUnlessEqual(response.status_code, 401) self.failUnlessEqual(response.has_header('WWW-Authenticate'), True) # Set up an auth class in order to avoid duplicate # authentication code. auth_helper = HttpDigestAuthentication(authfunc=digest_authfunc, realm='realm1') # 2) Digest authentication, wrong response (=wrong password) auth_params = self.get_digest_test_params(response, url, auth_helper) auth_params['response'] = 'wrongresponse' headers = { 'SCRIPT_NAME' : '', 'HTTP_AUTHORIZATION': DIGEST_AUTH % auth_params } response = self.client.get(url, **headers) self.failUnlessEqual(response.status_code, 401) # 3) Digest authentication, right password auth_params = self.get_digest_test_params(response, url, auth_helper) response = auth_helper.get_auth_response(**auth_params) auth_params['response'] = response headers = { 'SCRIPT_NAME' : '', 'HTTP_AUTHORIZATION': DIGEST_AUTH % auth_params } response = self.client.get(url, **headers) self.failUnlessEqual(response.status_code, 200)
ajibawa-2023/Python-Code-Large/train/row_1004
186
333
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1004:ImportFrom_L1_C0", "label": "from binascii import b2a_base64", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.003, 0.003, 0, 0.66, 0.0, 984, 0, 1, 0, 0, 984, 0, 0], "semantic": {"name": "binascii", "arg_names": [], "import_names": ["b2a_base64"], "rhs_call_name": "", "annotation": ""}, "snippet": "from binascii import b2a_base64"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:ImportFrom_L2_C0", "label": "from datetime import datetime", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.006, 0.003, 0, 0.66, 0.0769, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime"], "rhs_call_name": "", "annotation": ""}, "snippet": "from datetime import datetime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:ImportFrom_L3_C0", "label": "from django.core import serializers", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.009, 0.003, 0, 0.66, 0.1538, 913, 0, 1, 0, 0, 913, 0, 0], "semantic": {"name": "django.core", "arg_names": [], "import_names": ["serializers"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core import serializers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:ImportFrom_L4_C0", "label": "from django.test import TestCase", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.012, 0.003, 0, 0.66, 0.2308, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.test", "arg_names": [], "import_names": ["TestCase"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.test import TestCase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:ImportFrom_L5_C0", "label": "from django.utils.functional import curry", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.015, 0.003, 0, 0.66, 0.3077, 375, 0, 1, 0, 0, 375, 0, 0], "semantic": {"name": "django.utils.functional", "arg_names": [], "import_names": ["curry"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.functional import curry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:ImportFrom_L6_C0", "label": "from django_restapi.authentication import HttpDigestAuthentication", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.018, 0.003, 0, 0.66, 0.3846, 976, 0, 1, 0, 0, 976, 0, 0], "semantic": {"name": "django_restapi.authentication", "arg_names": [], "import_names": ["HttpDigestAuthentication"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi.authentication import HttpDigestAuthentication"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:ImportFrom_L7_C0", "label": "from django_restapi_tests.examples.authentication import digest_authfunc", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.021, 0.003, 0, 0.66, 0.4615, 165, 0, 1, 0, 0, 165, 0, 0], "semantic": {"name": "django_restapi_tests.examples.authentication", "arg_names": [], "import_names": ["digest_authfunc"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi_tests.examples.authentication import digest_authfunc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:ImportFrom_L8_C0", "label": "from django_restapi_tests.polls.models import Poll", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.024, 0.003, 0, 0.66, 0.5385, 988, 0, 1, 0, 0, 988, 0, 0], "semantic": {"name": "django_restapi_tests.polls.models", "arg_names": [], "import_names": ["Poll"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi_tests.polls.models import Poll"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Import_L9_C0", "label": "webbrowser import webbrowser, re", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.027, 0.003, 0, 0.66, 0.6154, 461, 0, 2, 0, 0, 461, 0, 0], "semantic": {"name": "webbrowser", "arg_names": [], "import_names": ["webbrowser", "re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import webbrowser, re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L11_C0", "label": "DIGEST_AUTH =", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.033, 0.003, 0, 0.66, 0.6923, 691, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DIGEST_AUTH", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DIGEST_AUTH = 'Digest username=\"%(username)s\", realm=\"%(realm)s\", nonce=\"%(nonce)s\", uri=\"%(fullpath)s\", algorithm=MD5, response=\"%(response)s\", qop=%(qop)s, nc=%(nc)s, cnonce=\"%(cnonce)s\"'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L13_C0", "label": "SHOW_ERRORS_IN_BROWSER =", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.039, 0.003, 0, 0.66, 0.7692, 362, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "SHOW_ERRORS_IN_BROWSER", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SHOW_ERRORS_IN_BROWSER = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L15_C0", "label": "show_in_browser", "type": "function", "loc": [15, 20], "level": 0, "parent": null, "vector": [2, 0, 0.0526, 0.018, 0, 0.66, 0.8462, 177, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "show_in_browser", "arg_names": ["content"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def show_in_browser(content):\n if SHOW_ERRORS_IN_BROWSER:\n f = open(\"/tmp/djangorest_error\", \"w\")\n f.write(content)\n f.close()\n webbrowser.open_new(\"file:///tmp/djangorest_error\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:If_L16_C4", "label": "if", "type": "if", "loc": [16, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L15_C0", "vector": [4, 1, 0.0541, 0.015, 1, 0.17, 0.0, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if SHOW_ERRORS_IN_BROWSER:\n f = open(\"/tmp/djangorest_error\", \"w\")\n f.write(content)\n f.close()\n webbrowser.open_new(\"file:///tmp/djangorest_error\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L17_C8", "label": "f = open()", "type": "assigned_variable", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:If_L16_C4", "vector": [14, 2, 0.0511, 0.003, 2, 0.79, 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(\"/tmp/djangorest_error\", \"w\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L18_C8", "label": "write()", "type": "expression", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:If_L16_C4", "vector": [8, 2, 0.0541, 0.003, 2, 0.79, 0.3333, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write(content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L19_C8", "label": "close()", "type": "expression", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:If_L16_C4", "vector": [8, 2, 0.0571, 0.003, 2, 0.79, 0.6667, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L20_C8", "label": "open_new()", "type": "expression", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:If_L16_C4", "vector": [8, 2, 0.0601, 0.003, 2, 0.79, 1.0, 794, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "open_new", "arg_names": [], "import_names": [], "rhs_call_name": "open_new", "annotation": ""}, "snippet": " webbrowser.open_new(\"file:///tmp/djangorest_error\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:ClassDef_L22_C0", "label": "BasicTest", "type": "class", "loc": [22, 262], "level": 0, "parent": null, "vector": [3, 0, 0.4264, 0.7237, 0, 0.66, 0.9231, 752, 0, 4, 0, 0, 3, 0, 99], "semantic": {"name": "BasicTest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BasicTest(TestCase):\n\n fixtures = ['initial_data.json']\n \n def setUp(self):\n self.client.put = curry(self.client.post, REQUEST_METHOD='PUT')\n self.client.delete = curry(self.client.get, REQUEST_METHOD='DELETE')\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L24_C4", "label": "fixtures =", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:ClassDef_L22_C0", "vector": [14, 1, 0.0721, 0.003, 1, 0.82, 0.0, 752, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "fixtures", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fixtures = ['initial_data.json']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L26_C4", "label": "setUp", "type": "function", "loc": [26, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:ClassDef_L22_C0", "vector": [2, 1, 0.0811, 0.009, 1, 0.82, 0.25, 952, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "setUp", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setUp(self):\n self.client.put = curry(self.client.post, REQUEST_METHOD='PUT')\n self.client.delete = curry(self.client.get, REQUEST_METHOD='DELETE')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L27_C8", "label": "self.client.put = curry()", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L26_C4", "vector": [14, 2, 0.0811, 0.003, 2, 0.05, 0.0, 169, 3, 2, 0, 0, 553, 10, 1], "semantic": {"name": "self.client.put", "arg_names": [], "import_names": [], "rhs_call_name": "curry", "annotation": ""}, "snippet": " self.client.put = curry(self.client.post, REQUEST_METHOD='PUT')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L28_C8", "label": "self.client.delete = curry()", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L26_C4", "vector": [14, 2, 0.0841, 0.003, 2, 0.05, 1.0, 613, 3, 2, 0, 0, 553, 10, 1], "semantic": {"name": "self.client.delete", "arg_names": [], "import_names": [], "rhs_call_name": "curry", "annotation": ""}, "snippet": " self.client.delete = curry(self.client.get, REQUEST_METHOD='DELETE')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L30_C4", "label": "test_basics", "type": "function", "loc": [30, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:ClassDef_L22_C0", "vector": [2, 1, 0.2117, 0.2462, 1, 0.82, 0.5, 636, 0, 1, 0, 0, 0, 0, 30], "semantic": {"name": "test_basics", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_basics(self):\n \n for format in ['xml', 'html']:\n \n # Get list of polls\n url = '/%s/polls/' % format\n \n response = self.client.get(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "label": "for format", "type": "for", "loc": [32, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L30_C4", "vector": [6, 2, 0.2147, 0.2402, 2, 0.31, 0.0, 293, 0, 0, 0, 0, 0, 0, 30], "semantic": {"name": "format", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for format in ['xml', 'html']:\n \n # Get list of polls\n url = '/%s/polls/' % format\n \n response = self.client.get(url)\n self.failUnlessEqual(response.status_code, 200)\n self.failUnlessEqual(response.content.find('secret'), -1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L35_C12", "label": "url =", "type": "assigned_variable", "loc": [35, 35], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.1051, 0.003, 3, 0.33, 0.0, 789, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = '/%s/polls/' % format"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L37_C12", "label": "response = get()", "type": "assigned_variable", "loc": [37, 37], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.1111, 0.003, 3, 0.33, 0.027, 511, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L38_C12", "label": "failUnlessEqual()", "type": "expression", "loc": [38, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [8, 3, 0.1141, 0.003, 3, 0.33, 0.0541, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L39_C12", "label": "failUnlessEqual()", "type": "expression", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [8, 3, 0.1171, 0.003, 3, 0.33, 0.0811, 21, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.content.find('secret'), -1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L42_C12", "label": "url =", "type": "assigned_variable", "loc": [42, 42], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.1261, 0.003, 3, 0.33, 0.1081, 789, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = '/%s/choices/' % format"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L43_C12", "label": "response = get()", "type": "assigned_variable", "loc": [43, 43], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.1291, 0.003, 3, 0.33, 0.1351, 511, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L44_C12", "label": "failUnlessEqual()", "type": "expression", "loc": [44, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [8, 3, 0.1321, 0.003, 3, 0.33, 0.1622, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L47_C12", "label": "response = get()", "type": "assigned_variable", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.1411, 0.003, 3, 0.33, 0.1892, 511, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url, {'page' : 2})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L48_C12", "label": "failUnlessEqual()", "type": "expression", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [8, 3, 0.1441, 0.003, 3, 0.33, 0.2162, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L51_C12", "label": "response = get()", "type": "assigned_variable", "loc": [51, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.1532, 0.003, 3, 0.33, 0.2432, 511, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url, {'page' : 3})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L52_C12", "label": "failUnlessEqual()", "type": "expression", "loc": [52, 52], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [8, 3, 0.1562, 0.003, 3, 0.33, 0.2703, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 404)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L56_C12", "label": "url =", "type": "assigned_variable", "loc": [56, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.1682, 0.003, 3, 0.33, 0.2973, 789, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = '/%s/polls/' % format"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L57_C12", "label": "params =", "type": "assigned_variable", "loc": [57, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.1742, 0.009, 3, 0.33, 0.3243, 206, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = {\n 'question' : 'Does this not work?',\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L60_C12", "label": "response = post()", "type": "assigned_variable", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.1802, 0.003, 3, 0.33, 0.3514, 511, 3, 2, 0, 0, 304, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "post", "annotation": ""}, "snippet": " response = self.client.post(url, params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L61_C12", "label": "failUnlessEqual()", "type": "expression", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [8, 3, 0.1832, 0.003, 3, 0.33, 0.3784, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 400)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L64_C12", "label": "params =", "type": "assigned_variable", "loc": [64, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.1982, 0.015, 3, 0.33, 0.4054, 206, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = {\n 'question' : 'Does this work?',\n 'password' : 'secret',\n 'pub_date' : '2001-01-01'\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L69_C12", "label": "response = post()", "type": "assigned_variable", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.2072, 0.003, 3, 0.33, 0.4324, 511, 3, 2, 0, 0, 304, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "post", "annotation": ""}, "snippet": " response = self.client.post(url, params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L70_C12", "label": "failUnlessEqual()", "type": "expression", "loc": [70, 70], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [8, 3, 0.2102, 0.003, 3, 0.33, 0.4595, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 201)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L71_C12", "label": "location =", "type": "assigned_variable", "loc": [71, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.2132, 0.003, 3, 0.33, 0.4865, 771, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "location", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " location = response['Location']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L72_C12", "label": "poll_id = int()", "type": "assigned_variable", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.2162, 0.003, 3, 0.33, 0.5135, 961, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "poll_id", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " poll_id = int(re.findall(\"\\d+\", location)[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L76_C12", "label": "url =", "type": "assigned_variable", "loc": [76, 76], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.2282, 0.003, 3, 0.33, 0.5405, 789, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = '/%s/polls/%d/' % (format, poll_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L77_C12", "label": "params =", "type": "assigned_variable", "loc": [77, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.2372, 0.015, 3, 0.33, 0.5676, 206, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = {\n 'question' : 'Yes, it works.',\n 'password' : 'newsecret',\n 'pub_date' : '2007-07-07-123'\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L82_C12", "label": "response = put()", "type": "assigned_variable", "loc": [82, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.2462, 0.003, 3, 0.33, 0.5946, 511, 3, 2, 0, 0, 636, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " response = self.client.put(url, params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L83_C12", "label": "failUnlessEqual()", "type": "expression", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [8, 3, 0.2492, 0.003, 3, 0.33, 0.6216, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 400)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L86_C12", "label": "url =", "type": "assigned_variable", "loc": [86, 86], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.2583, 0.003, 3, 0.33, 0.6486, 789, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = '/%s/polls/%d/' % (format, poll_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L87_C12", "label": "params =", "type": "assigned_variable", "loc": [87, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.2673, 0.015, 3, 0.33, 0.6757, 206, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = {\n 'question' : 'Yes, it works.',\n 'password' : 'newsecret',\n 'pub_date' : '2007-07-07'\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L92_C12", "label": "response = put()", "type": "assigned_variable", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.2763, 0.003, 3, 0.33, 0.7027, 511, 3, 2, 0, 0, 636, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " response = self.client.put(url, params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L93_C12", "label": "failUnlessEqual()", "type": "expression", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [8, 3, 0.2793, 0.003, 3, 0.33, 0.7297, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L96_C12", "label": "response = get()", "type": "assigned_variable", "loc": [96, 96], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.2883, 0.003, 3, 0.33, 0.7568, 511, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L97_C12", "label": "failUnlessEqual()", "type": "expression", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [8, 3, 0.2913, 0.003, 3, 0.33, 0.7838, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L98_C12", "label": "failUnlessEqual()", "type": "expression", "loc": [98, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [8, 3, 0.2943, 0.003, 3, 0.33, 0.8108, 21, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.content.find('secret'), -1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L101_C12", "label": "response = delete()", "type": "assigned_variable", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.3033, 0.003, 3, 0.33, 0.8378, 511, 3, 1, 0, 0, 266, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " response = self.client.delete(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L102_C12", "label": "failUnlessEqual()", "type": "expression", "loc": [102, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [8, 3, 0.3063, 0.003, 3, 0.33, 0.8649, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L105_C12", "label": "url =", "type": "assigned_variable", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.3153, 0.003, 3, 0.33, 0.8919, 789, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = '/%s/choices/1/' % format"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L106_C12", "label": "response = get()", "type": "assigned_variable", "loc": [106, 106], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.3183, 0.003, 3, 0.33, 0.9189, 511, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L107_C12", "label": "failUnlessEqual()", "type": "expression", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [8, 3, 0.3213, 0.003, 3, 0.33, 0.9459, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L110_C12", "label": "response = delete()", "type": "assigned_variable", "loc": [110, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [14, 3, 0.3303, 0.003, 3, 0.33, 0.973, 511, 3, 1, 0, 0, 266, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " response = self.client.delete(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L111_C12", "label": "failUnlessEqual()", "type": "expression", "loc": [111, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "vector": [8, 3, 0.3333, 0.003, 3, 0.33, 1.0, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 405)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "label": "test_urlpatterns", "type": "function", "loc": [113, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:ClassDef_L22_C0", "vector": [2, 1, 0.455, 0.2342, 1, 0.82, 0.75, 450, 0, 1, 0, 0, 0, 0, 38], "semantic": {"name": "test_urlpatterns", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_urlpatterns(self):\n url = '/json/polls/'\n response = self.client.get(url)\n self.failUnlessEqual(response.status_code, 200)\n self.failUnlessEqual(response.content.find('secret'), -1)\n \n # Get poll\n url = '/json/polls/1/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L114_C8", "label": "url =", "type": "assigned_variable", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.3423, 0.003, 2, 0.25, 0.0, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = '/json/polls/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L115_C8", "label": "response = get()", "type": "assigned_variable", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.3453, 0.003, 2, 0.25, 0.0244, 511, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L116_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [8, 2, 0.3483, 0.003, 2, 0.25, 0.0488, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L117_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [8, 2, 0.3514, 0.003, 2, 0.25, 0.0732, 21, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.content.find('secret'), -1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L120_C8", "label": "url =", "type": "assigned_variable", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.3604, 0.003, 2, 0.25, 0.0976, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = '/json/polls/1/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L121_C8", "label": "response = get()", "type": "assigned_variable", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.3634, 0.003, 2, 0.25, 0.122, 511, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L122_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [8, 2, 0.3664, 0.003, 2, 0.25, 0.1463, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L123_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [8, 2, 0.3694, 0.003, 2, 0.25, 0.1707, 21, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.content.find('secret'), -1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L126_C8", "label": "url =", "type": "assigned_variable", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.3784, 0.003, 2, 0.25, 0.1951, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = '/json/polls/1/choices/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L127_C8", "label": "response = get()", "type": "assigned_variable", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.3814, 0.003, 2, 0.25, 0.2195, 511, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L128_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [8, 2, 0.3844, 0.003, 2, 0.25, 0.2439, 21, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(len(eval(response.content)), 3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L129_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [8, 2, 0.3874, 0.003, 2, 0.25, 0.2683, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L130_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [8, 2, 0.3904, 0.003, 2, 0.25, 0.2927, 21, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.content.find('secret'), -1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L133_C8", "label": "url =", "type": "assigned_variable", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.3994, 0.003, 2, 0.25, 0.3171, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = '/json/polls/1/choices/1/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L134_C8", "label": "response = get()", "type": "assigned_variable", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.4024, 0.003, 2, 0.25, 0.3415, 511, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L135_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [8, 2, 0.4054, 0.003, 2, 0.25, 0.3659, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L136_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [8, 2, 0.4084, 0.003, 2, 0.25, 0.3902, 21, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.content.find('secret'), -1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L139_C8", "label": "url =", "type": "assigned_variable", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.4174, 0.003, 2, 0.25, 0.4146, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = '/json/polls/1/choices/12/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L140_C8", "label": "response = get()", "type": "assigned_variable", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.4204, 0.003, 2, 0.25, 0.439, 511, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L141_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [8, 2, 0.4234, 0.003, 2, 0.25, 0.4634, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 404)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L142_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [8, 2, 0.4264, 0.003, 2, 0.25, 0.4878, 21, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.content.find('secret'), -1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L146_C8", "label": "url =", "type": "assigned_variable", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.4384, 0.003, 2, 0.25, 0.5122, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = '/json/polls/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L147_C8", "label": "params =", "type": "assigned_variable", "loc": [147, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.4444, 0.009, 2, 0.25, 0.5366, 206, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = {\n 'question' : 'Does this not work?',\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L150_C8", "label": "response = post()", "type": "assigned_variable", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.4505, 0.003, 2, 0.25, 0.561, 511, 3, 2, 0, 0, 304, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "post", "annotation": ""}, "snippet": " response = self.client.post(url, params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L151_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [8, 2, 0.4535, 0.003, 2, 0.25, 0.5854, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 400)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L154_C8", "label": "url =", "type": "assigned_variable", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.4625, 0.003, 2, 0.25, 0.6098, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = '/json/polls/1/choices/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L155_C8", "label": "params =", "type": "assigned_variable", "loc": [155, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.4715, 0.015, 2, 0.25, 0.6341, 206, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = {\n 'poll' : 1, # TODO: Should be taken from URL\n 'choice' : 'New choice',\n 'votes' : 0\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L160_C8", "label": "response = post()", "type": "assigned_variable", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.4805, 0.003, 2, 0.25, 0.6585, 511, 3, 2, 0, 0, 304, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "post", "annotation": ""}, "snippet": " response = self.client.post(url, params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L161_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [161, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [8, 2, 0.4835, 0.003, 2, 0.25, 0.6829, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 201)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L162_C8", "label": "location =", "type": "assigned_variable", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.4865, 0.003, 2, 0.25, 0.7073, 771, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "location", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " location = response['location']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L163_C8", "label": "poll_id = int()", "type": "assigned_variable", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.4895, 0.003, 2, 0.25, 0.7317, 961, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "poll_id", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " poll_id = int(re.findall(\"\\d+\", location)[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L164_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [8, 2, 0.4925, 0.003, 2, 0.25, 0.7561, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(poll_id, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L167_C8", "label": "url =", "type": "assigned_variable", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.5015, 0.003, 2, 0.25, 0.7805, 789, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = location[17:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L170_C8", "label": "params =", "type": "assigned_variable", "loc": [170, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.5165, 0.015, 2, 0.25, 0.8049, 206, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = {\n 'poll' : poll_id,\n 'choice' : 'New choice',\n 'votes' : 'Should be an integer'\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L175_C8", "label": "response = put()", "type": "assigned_variable", "loc": [175, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.5255, 0.003, 2, 0.25, 0.8293, 511, 3, 2, 0, 0, 636, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " response = self.client.put(url, params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L176_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [176, 176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [8, 2, 0.5285, 0.003, 2, 0.25, 0.8537, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 400)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L179_C8", "label": "params =", "type": "assigned_variable", "loc": [179, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.5435, 0.015, 2, 0.25, 0.878, 206, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = {\n 'poll' : poll_id,\n 'choice' : 'New choice',\n 'votes' : '712'\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L184_C8", "label": "response = put()", "type": "assigned_variable", "loc": [184, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.5526, 0.003, 2, 0.25, 0.9024, 511, 3, 2, 0, 0, 636, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " response = self.client.put(url, params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L185_C8", "label": "failIfEqual()", "type": "expression", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [8, 2, 0.5556, 0.003, 2, 0.25, 0.9268, 443, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "failIfEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failIfEqual", "annotation": ""}, "snippet": " self.failIfEqual(response.content.find(\"712\"), -1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L186_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [186, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [8, 2, 0.5586, 0.003, 2, 0.25, 0.9512, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L189_C8", "label": "response = delete()", "type": "assigned_variable", "loc": [189, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [14, 2, 0.5676, 0.003, 2, 0.25, 0.9756, 511, 3, 1, 0, 0, 266, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " response = self.client.delete(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L190_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "vector": [8, 2, 0.5706, 0.003, 2, 0.25, 1.0, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "label": "test_submission", "type": "function", "loc": [192, 262], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:ClassDef_L22_C0", "vector": [2, 1, 0.6817, 0.2132, 1, 0.82, 1.0, 131, 0, 1, 0, 0, 0, 0, 44], "semantic": {"name": "test_submission", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_submission(self):\n \n # XML\n url = '/fullxml/polls/'\n response = self.client.get(url)\n self.failUnlessEqual(response.status_code, 200)\n \n # Create"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L195_C8", "label": "url =", "type": "assigned_variable", "loc": [195, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.5856, 0.003, 2, 0.91, 0.0, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = '/fullxml/polls/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L196_C8", "label": "response = get()", "type": "assigned_variable", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.5886, 0.003, 2, 0.91, 0.0244, 511, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L197_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [8, 2, 0.5916, 0.003, 2, 0.91, 0.0488, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L200_C8", "label": "new_poll = Poll()", "type": "assigned_variable", "loc": [200, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.6066, 0.015, 2, 0.91, 0.0732, 266, 3, 3, 0, 0, 856, 10, 2], "semantic": {"name": "new_poll", "arg_names": [], "import_names": [], "rhs_call_name": "Poll", "annotation": ""}, "snippet": " new_poll = Poll(\n question = 'Does XML submission work?',\n password = 'secret',\n pub_date = datetime.now()\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L205_C8", "label": "serialized_poll = serialize()", "type": "assigned_variable", "loc": [205, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.6156, 0.003, 2, 0.91, 0.0976, 199, 3, 2, 0, 0, 50, 10, 1], "semantic": {"name": "serialized_poll", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " serialized_poll = serializers.serialize('xml', [new_poll])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L206_C8", "label": "serialized_poll = replace()", "type": "assigned_variable", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.6186, 0.003, 2, 0.91, 0.122, 199, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "serialized_poll", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " serialized_poll = serialized_poll.replace('pk=\"None\"', 'pk=\"1\"') # Is ignored, but needs to be an integer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L207_C8", "label": "response = post()", "type": "assigned_variable", "loc": [207, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.6216, 0.003, 2, 0.91, 0.1463, 511, 3, 3, 0, 0, 304, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "post", "annotation": ""}, "snippet": " response = self.client.post(url, data=serialized_poll, content_type='application/xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L208_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [208, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [8, 2, 0.6246, 0.003, 2, 0.91, 0.1707, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 201)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L209_C8", "label": "response_content = sub()", "type": "assigned_variable", "loc": [209, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.6276, 0.003, 2, 0.91, 0.1951, 319, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "response_content", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " response_content = re.sub('pk=\"\\d+\"', 'pk=\"1\"', response.content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L210_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [8, 2, 0.6306, 0.003, 2, 0.91, 0.2195, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(serialized_poll, response_content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L211_C8", "label": "response = get()", "type": "assigned_variable", "loc": [211, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.6336, 0.003, 2, 0.91, 0.2439, 511, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L212_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [212, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [8, 2, 0.6366, 0.003, 2, 0.91, 0.2683, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L213_C8", "label": "failIfEqual()", "type": "expression", "loc": [213, 213], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [8, 2, 0.6396, 0.003, 2, 0.91, 0.2927, 443, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "failIfEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failIfEqual", "annotation": ""}, "snippet": " self.failIfEqual(response_content.find(\"XML submission\"), -1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L216_C8", "label": "url =", "type": "assigned_variable", "loc": [216, 216], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.6486, 0.003, 2, 0.91, 0.3171, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = '/fullxml/polls/1/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L217_C8", "label": "updated_poll = Poll()", "type": "assigned_variable", "loc": [217, 221], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.6577, 0.015, 2, 0.91, 0.3415, 416, 3, 3, 0, 0, 856, 10, 2], "semantic": {"name": "updated_poll", "arg_names": [], "import_names": [], "rhs_call_name": "Poll", "annotation": ""}, "snippet": " updated_poll = Poll(\n question = 'New question',\n password = 'new_secret',\n pub_date = datetime.now()\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L222_C8", "label": "serialized_poll = serialize()", "type": "assigned_variable", "loc": [222, 222], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.6667, 0.003, 2, 0.91, 0.3659, 199, 3, 2, 0, 0, 50, 10, 1], "semantic": {"name": "serialized_poll", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " serialized_poll = serializers.serialize('xml', [updated_poll])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L223_C8", "label": "serialized_poll = replace()", "type": "assigned_variable", "loc": [223, 223], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.6697, 0.003, 2, 0.91, 0.3902, 199, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "serialized_poll", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " serialized_poll = serialized_poll.replace('pk=\"None\"', 'pk=\"1\"') # Is ignored, but needs to be an integer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L224_C8", "label": "response = put()", "type": "assigned_variable", "loc": [224, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.6727, 0.003, 2, 0.91, 0.4146, 511, 3, 3, 0, 0, 636, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " response = self.client.put(url, data=serialized_poll, content_type='application/xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L225_C8", "label": "updated_poll = get()", "type": "assigned_variable", "loc": [225, 225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.6757, 0.003, 2, 0.91, 0.439, 416, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "updated_poll", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " updated_poll = Poll.objects.get(id=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L226_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [226, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [8, 2, 0.6787, 0.003, 2, 0.91, 0.4634, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(updated_poll.question, \"New question\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L227_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [227, 227], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [8, 2, 0.6817, 0.003, 2, 0.91, 0.4878, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(updated_poll.password, \"new_secret\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L230_C8", "label": "url =", "type": "assigned_variable", "loc": [230, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.6907, 0.003, 2, 0.91, 0.5122, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = '/fulljson/polls/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L231_C8", "label": "response = get()", "type": "assigned_variable", "loc": [231, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.6937, 0.003, 2, 0.91, 0.5366, 511, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L232_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [232, 232], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [8, 2, 0.6967, 0.003, 2, 0.91, 0.561, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L235_C8", "label": "new_poll = Poll()", "type": "assigned_variable", "loc": [235, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.7117, 0.015, 2, 0.91, 0.5854, 266, 3, 3, 0, 0, 856, 10, 2], "semantic": {"name": "new_poll", "arg_names": [], "import_names": [], "rhs_call_name": "Poll", "annotation": ""}, "snippet": " new_poll = Poll(\n question = 'Does JSON submission work?',\n password = 'secret',\n pub_date = datetime.now()\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L240_C8", "label": "serialized_poll = serialize()", "type": "assigned_variable", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.7207, 0.003, 2, 0.91, 0.6098, 199, 3, 2, 0, 0, 50, 10, 1], "semantic": {"name": "serialized_poll", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " serialized_poll = serializers.serialize('json', [new_poll])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L241_C8", "label": "serialized_poll = replace()", "type": "assigned_variable", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.7237, 0.003, 2, 0.91, 0.6341, 199, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "serialized_poll", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " serialized_poll = serialized_poll.replace('\"pk\": null', '\"pk\": 1') # Is ignored, but needs to be an integer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L242_C8", "label": "response = post()", "type": "assigned_variable", "loc": [242, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.7267, 0.003, 2, 0.91, 0.6585, 511, 3, 3, 0, 0, 304, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "post", "annotation": ""}, "snippet": " response = self.client.post(url, data=serialized_poll, content_type='application/json')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L243_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [243, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [8, 2, 0.7297, 0.003, 2, 0.91, 0.6829, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 201)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L244_C8", "label": "response_content = sub()", "type": "assigned_variable", "loc": [244, 244], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.7327, 0.003, 2, 0.91, 0.7073, 319, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "response_content", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " response_content = re.sub('\"pk\": \\d+,', '\"pk\": 1,', response.content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L245_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [245, 245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [8, 2, 0.7357, 0.003, 2, 0.91, 0.7317, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(serialized_poll, response_content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L246_C8", "label": "response = get()", "type": "assigned_variable", "loc": [246, 246], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.7387, 0.003, 2, 0.91, 0.7561, 511, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L247_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [247, 247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [8, 2, 0.7417, 0.003, 2, 0.91, 0.7805, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L248_C8", "label": "failIfEqual()", "type": "expression", "loc": [248, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [8, 2, 0.7447, 0.003, 2, 0.91, 0.8049, 443, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "failIfEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failIfEqual", "annotation": ""}, "snippet": " self.failIfEqual(response_content.find(\"JSON submission\"), -1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L251_C8", "label": "url =", "type": "assigned_variable", "loc": [251, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.7538, 0.003, 2, 0.91, 0.8293, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = '/fulljson/polls/2/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L252_C8", "label": "updated_poll = Poll()", "type": "assigned_variable", "loc": [252, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.7628, 0.015, 2, 0.91, 0.8537, 416, 3, 3, 0, 0, 856, 10, 2], "semantic": {"name": "updated_poll", "arg_names": [], "import_names": [], "rhs_call_name": "Poll", "annotation": ""}, "snippet": " updated_poll = Poll(\n question = 'Another question',\n password = 'another_secret',\n pub_date = datetime.now()\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L257_C8", "label": "serialized_poll = serialize()", "type": "assigned_variable", "loc": [257, 257], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.7718, 0.003, 2, 0.91, 0.878, 199, 3, 2, 0, 0, 50, 10, 1], "semantic": {"name": "serialized_poll", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " serialized_poll = serializers.serialize('json', [updated_poll])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L258_C8", "label": "serialized_poll = replace()", "type": "assigned_variable", "loc": [258, 258], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.7748, 0.003, 2, 0.91, 0.9024, 199, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "serialized_poll", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " serialized_poll = serialized_poll.replace('\"pk\": \"None\"', '\"pk\": \"1\"') # Is ignored, but needs to be an integer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L259_C8", "label": "response = put()", "type": "assigned_variable", "loc": [259, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.7778, 0.003, 2, 0.91, 0.9268, 511, 3, 3, 0, 0, 636, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " response = self.client.put(url, data=serialized_poll, content_type='application/json')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L260_C8", "label": "updated_poll = get()", "type": "assigned_variable", "loc": [260, 260], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [14, 2, 0.7808, 0.003, 2, 0.91, 0.9512, 416, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "updated_poll", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " updated_poll = Poll.objects.get(id=2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L261_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [261, 261], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [8, 2, 0.7838, 0.003, 2, 0.91, 0.9756, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(updated_poll.question, \"Another question\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L262_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [262, 262], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "vector": [8, 2, 0.7868, 0.003, 2, 0.91, 1.0, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(updated_poll.password, \"another_secret\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:ClassDef_L264_C0", "label": "AuthenticationTest", "type": "class", "loc": [264, 333], "level": 0, "parent": null, "vector": [3, 0, 0.8964, 0.2102, 0, 0.66, 1.0, 206, 0, 3, 0, 0, 3, 0, 27], "semantic": {"name": "AuthenticationTest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class AuthenticationTest(TestCase):\n \n fixtures = ['initial_data.json']\n \n def get_digest_test_params(self, response, url, auth_helper):\n \"\"\"\n Extract authentication variables from server response\n e.g. {'nonce': '477be2a405a439cdba5227be89ba0f76', 'qop': 'auth', 'realm': 'realm1', 'opaque': '67d958f952de6bd4c1a88686f1b8a896'}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L266_C4", "label": "fixtures =", "type": "assigned_variable", "loc": [266, 266], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:ClassDef_L264_C0", "vector": [14, 1, 0.7988, 0.003, 1, 0.97, 0.0, 752, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "fixtures", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fixtures = ['initial_data.json']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L268_C4", "label": "get_digest_test_params", "type": "function", "loc": [268, 280], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:ClassDef_L264_C0", "vector": [2, 1, 0.8228, 0.039, 1, 0.97, 0.3333, 785, 0, 4, 1, 0, 0, 0, 7], "semantic": {"name": "get_digest_test_params", "arg_names": ["self", "response", "url", "auth_helper"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_digest_test_params(self, response, url, auth_helper):\n \"\"\"\n Extract authentication variables from server response\n e.g. {'nonce': '477be2a405a439cdba5227be89ba0f76', 'qop': 'auth', 'realm': 'realm1', 'opaque': '67d958f952de6bd4c1a88686f1b8a896'}\n and add missing params (method, path, username, cnonce, nc).\n \"\"\"\n www_auth_response = response['WWW-Authenticate']\n self.failUnlessEqual(www_auth_response[:7].lower(), 'digest ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L269_C8", "label": "expression", "type": "expression", "loc": [269, 273], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L268_C4", "vector": [8, 2, 0.8138, 0.015, 2, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Extract authentication variables from server response\n e.g. {'nonce': '477be2a405a439cdba5227be89ba0f76', 'qop': 'auth', 'realm': 'realm1', 'opaque': '67d958f952de6bd4c1a88686f1b8a896'}\n and add missing params (method, path, username, cnonce, nc).\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L274_C8", "label": "www_auth_response =", "type": "assigned_variable", "loc": [274, 274], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L268_C4", "vector": [14, 2, 0.8228, 0.003, 2, 0.03, 0.1429, 905, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "www_auth_response", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " www_auth_response = response['WWW-Authenticate']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L275_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [275, 275], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L268_C4", "vector": [8, 2, 0.8258, 0.003, 2, 0.03, 0.2857, 21, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(www_auth_response[:7].lower(), 'digest ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L276_C8", "label": "auth_params = get_auth_dict()", "type": "assigned_variable", "loc": [276, 276], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L268_C4", "vector": [14, 2, 0.8288, 0.003, 2, 0.03, 0.4286, 601, 3, 1, 0, 0, 115, 10, 1], "semantic": {"name": "auth_params", "arg_names": [], "import_names": [], "rhs_call_name": "get_auth_dict", "annotation": ""}, "snippet": " auth_params = auth_helper.get_auth_dict(www_auth_response[7:])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L277_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [277, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L268_C4", "vector": [8, 2, 0.8318, 0.003, 2, 0.03, 0.5714, 21, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(len(auth_params), 4)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L278_C8", "label": "pop()", "type": "expression", "loc": [278, 278], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L268_C4", "vector": [8, 2, 0.8348, 0.003, 2, 0.03, 0.7143, 969, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pop", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " auth_params.pop('opaque')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L279_C8", "label": "update()", "type": "expression", "loc": [279, 279], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L268_C4", "vector": [8, 2, 0.8378, 0.003, 2, 0.03, 0.8571, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " auth_params.update({'http_method': 'GET', 'fullpath': url, 'username': 'john', 'cnonce': '12345678', 'nc': '00000001'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Return_L280_C8", "label": "return", "type": "return", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L268_C4", "vector": [13, 2, 0.8408, 0.003, 2, 0.03, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return auth_params"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L282_C4", "label": "test_basic_authentication", "type": "function", "loc": [282, 300], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:ClassDef_L264_C0", "vector": [2, 1, 0.8739, 0.0571, 1, 0.97, 0.6667, 412, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "test_basic_authentication", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_basic_authentication(self):\n # Basic authentication, no password\n url = '/basic/polls/'\n response = self.client.get(url)\n self.failUnlessEqual(response.status_code, 401)\n \n # Basic authentication, wrong password\n headers = {"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L284_C8", "label": "url =", "type": "assigned_variable", "loc": [284, 284], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L282_C4", "vector": [14, 2, 0.8529, 0.003, 2, 0.33, 0.0, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = '/basic/polls/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L285_C8", "label": "response = get()", "type": "assigned_variable", "loc": [285, 285], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L282_C4", "vector": [14, 2, 0.8559, 0.003, 2, 0.33, 0.125, 511, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L286_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [286, 286], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L282_C4", "vector": [8, 2, 0.8589, 0.003, 2, 0.33, 0.25, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 401)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L289_C8", "label": "headers =", "type": "assigned_variable", "loc": [289, 291], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L282_C4", "vector": [14, 2, 0.8709, 0.009, 2, 0.33, 0.375, 950, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "headers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headers = {\n 'HTTP_AUTHORIZATION': 'Basic %s' % b2a_base64('rest:somepass')[:-1]\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L292_C8", "label": "response = get()", "type": "assigned_variable", "loc": [292, 292], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L282_C4", "vector": [14, 2, 0.8769, 0.003, 2, 0.33, 0.5, 511, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url, **headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L293_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [293, 293], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L282_C4", "vector": [8, 2, 0.8799, 0.003, 2, 0.33, 0.625, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 401)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L296_C8", "label": "headers =", "type": "assigned_variable", "loc": [296, 298], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L282_C4", "vector": [14, 2, 0.8919, 0.009, 2, 0.33, 0.75, 950, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "headers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headers = {\n 'HTTP_AUTHORIZATION': 'Basic %s' % b2a_base64('rest:rest')[:-1]\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L299_C8", "label": "response = get()", "type": "assigned_variable", "loc": [299, 299], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L282_C4", "vector": [14, 2, 0.8979, 0.003, 2, 0.33, 0.875, 511, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url, **headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L300_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [300, 300], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L282_C4", "vector": [8, 2, 0.9009, 0.003, 2, 0.33, 1.0, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "label": "test_digest_authentication", "type": "function", "loc": [302, 333], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:ClassDef_L264_C0", "vector": [2, 1, 0.9535, 0.0961, 1, 0.97, 1.0, 519, 0, 1, 0, 0, 0, 0, 12], "semantic": {"name": "test_digest_authentication", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_digest_authentication(self):\n\n # 1) Digest authentication, no password\n url = '/digest/polls/'\n response = self.client.get(url)\n self.failUnlessEqual(response.status_code, 401)\n self.failUnlessEqual(response.has_header('WWW-Authenticate'), True)\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L305_C8", "label": "url =", "type": "assigned_variable", "loc": [305, 305], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "vector": [14, 2, 0.9159, 0.003, 2, 0.82, 0.0, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = '/digest/polls/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L306_C8", "label": "response = get()", "type": "assigned_variable", "loc": [306, 306], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "vector": [14, 2, 0.9189, 0.003, 2, 0.82, 0.0667, 511, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L307_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [307, 307], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "vector": [8, 2, 0.9219, 0.003, 2, 0.82, 0.1333, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 401)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L308_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [308, 308], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "vector": [8, 2, 0.9249, 0.003, 2, 0.82, 0.2, 21, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.has_header('WWW-Authenticate'), True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L312_C8", "label": "auth_helper = HttpDigestAuthentication()", "type": "assigned_variable", "loc": [312, 312], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "vector": [14, 2, 0.9369, 0.003, 2, 0.82, 0.2667, 994, 3, 2, 0, 0, 938, 10, 1], "semantic": {"name": "auth_helper", "arg_names": [], "import_names": [], "rhs_call_name": "HttpDigestAuthentication", "annotation": ""}, "snippet": " auth_helper = HttpDigestAuthentication(authfunc=digest_authfunc, realm='realm1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L315_C8", "label": "auth_params = get_digest_test_params()", "type": "assigned_variable", "loc": [315, 315], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "vector": [14, 2, 0.9459, 0.003, 2, 0.82, 0.3333, 601, 3, 3, 0, 0, 785, 10, 1], "semantic": {"name": "auth_params", "arg_names": [], "import_names": [], "rhs_call_name": "get_digest_test_params", "annotation": ""}, "snippet": " auth_params = self.get_digest_test_params(response, url, auth_helper)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L316_C8", "label": "assign", "type": "assigned_variable", "loc": [316, 316], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "vector": [14, 2, 0.9489, 0.003, 2, 0.82, 0.4, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " auth_params['response'] = 'wrongresponse'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L317_C8", "label": "headers =", "type": "assigned_variable", "loc": [317, 320], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "vector": [14, 2, 0.9565, 0.012, 2, 0.82, 0.4667, 950, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "headers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headers = {\n 'SCRIPT_NAME' : '',\n 'HTTP_AUTHORIZATION': DIGEST_AUTH % auth_params\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L321_C8", "label": "response = get()", "type": "assigned_variable", "loc": [321, 321], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "vector": [14, 2, 0.964, 0.003, 2, 0.82, 0.5333, 511, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url, **headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L322_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [322, 322], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "vector": [8, 2, 0.967, 0.003, 2, 0.82, 0.6, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 401)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L325_C8", "label": "auth_params = get_digest_test_params()", "type": "assigned_variable", "loc": [325, 325], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "vector": [14, 2, 0.976, 0.003, 2, 0.82, 0.6667, 601, 3, 3, 0, 0, 785, 10, 1], "semantic": {"name": "auth_params", "arg_names": [], "import_names": [], "rhs_call_name": "get_digest_test_params", "annotation": ""}, "snippet": " auth_params = self.get_digest_test_params(response, url, auth_helper)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L326_C8", "label": "response = get_auth_response()", "type": "assigned_variable", "loc": [326, 326], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "vector": [14, 2, 0.979, 0.003, 2, 0.82, 0.7333, 511, 3, 1, 0, 0, 488, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get_auth_response", "annotation": ""}, "snippet": " response = auth_helper.get_auth_response(**auth_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L327_C8", "label": "assign", "type": "assigned_variable", "loc": [327, 327], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "vector": [14, 2, 0.982, 0.003, 2, 0.82, 0.8, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " auth_params['response'] = response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L328_C8", "label": "headers =", "type": "assigned_variable", "loc": [328, 331], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "vector": [14, 2, 0.9895, 0.012, 2, 0.82, 0.8667, 950, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "headers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headers = {\n 'SCRIPT_NAME' : '',\n 'HTTP_AUTHORIZATION': DIGEST_AUTH % auth_params\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L332_C8", "label": "response = get()", "type": "assigned_variable", "loc": [332, 332], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "vector": [14, 2, 0.997, 0.003, 2, 0.82, 0.9333, 511, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url, **headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L333_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [333, 333], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "vector": [8, 2, 1.0, 0.003, 2, 0.82, 1.0, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 200)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:If_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:If_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:If_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:If_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:If_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L35_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L37_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L42_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L44_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L52_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L56_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L60_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L64_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L70_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L72_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L77_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L82_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L83_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L86_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L87_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L92_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L93_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L96_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L98_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L102_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L105_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L106_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L110_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:For_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L175_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L185_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L186_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L195_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L196_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L205_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L206_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L207_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L208_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L209_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L210_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L211_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L213_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L216_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L217_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L222_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L223_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L224_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L225_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L226_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L227_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L230_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L231_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L232_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L235_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L241_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L242_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L243_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L244_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L245_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L246_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L247_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L248_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L252_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L257_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L258_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L259_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L260_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L261_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L262_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L266_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L268_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L268_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L269_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L268_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L274_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L268_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L275_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L268_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L276_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L268_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L268_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L278_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L268_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L279_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L268_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Return_L280_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L282_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L284_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L285_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L286_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L289_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L292_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L293_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L296_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L299_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L300_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L305_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L306_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L307_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L308_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L312_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L315_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L316_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L317_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L321_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L322_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L325_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L326_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L327_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L328_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Assign_L332_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1004:FunctionDef_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1004:Expr_L333_C8"}]
from django.conf.urls.defaults import * from django.contrib import admin urlpatterns = patterns('', url(r'', include('django_restapi_tests.examples.simple')), url(r'', include('django_restapi_tests.examples.basic')), url(r'', include('django_restapi_tests.examples.template')), url(r'', include('django_restapi_tests.examples.custom_urls')), url(r'', include('django_restapi_tests.examples.fixedend_urls')), url(r'', include('django_restapi_tests.examples.authentication')), url(r'', include('django_restapi_tests.examples.submission')), url(r'', include('django_restapi_tests.examples.generic_resource')), url(r'^admin/(.*)', admin.site.root) )
ajibawa-2023/Python-Code-Large/train/row_1005
3
14
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1005:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0714, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf.urls.defaults import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1005:ImportFrom_L2_C0", "label": "from django.contrib import admin", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0714, 0, 0.66, 0.5, 302, 0, 1, 0, 0, 302, 0, 0], "semantic": {"name": "django.contrib", "arg_names": [], "import_names": ["admin"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib import admin"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1005:Assign_L4_C0", "label": "urlpatterns = patterns()", "type": "assigned_variable", "loc": [4, 14], "level": 0, "parent": null, "vector": [14, 0, 0.6429, 0.7857, 0, 0.66, 1.0, 990, 3, 10, 0, 0, 75, 10, 18], "semantic": {"name": "urlpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "patterns", "annotation": ""}, "snippet": "urlpatterns = patterns('',\n url(r'', include('django_restapi_tests.examples.simple')),\n url(r'', include('django_restapi_tests.examples.basic')),\n url(r'', include('django_restapi_tests.examples.template')),\n url(r'', include('django_restapi_tests.examples.custom_urls')),\n url(r'', include('django_restapi_tests.examples.fixedend_urls')),\n url(r'', include('django_restapi_tests.examples.authentication')),\n url(r'', include('django_restapi_tests.examples.submission')),"}]
[]
from django.conf.urls.defaults import * from django_restapi.model_resource import Collection from django_restapi.responder import * from django_restapi.receiver import * from django_restapi_tests.polls.models import Poll fullxml_poll_resource = Collection( queryset = Poll.objects.all(), permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'), receiver = XMLReceiver(), responder = XMLResponder(), ) fulljson_poll_resource = Collection( queryset = Poll.objects.all(), permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'), receiver = JSONReceiver(), responder = JSONResponder() ) urlpatterns = patterns('', url(r'^fullxml/polls/(.*?)/?$', fullxml_poll_resource), url(r'^fulljson/polls/(.*?)/?$', fulljson_poll_resource) )
ajibawa-2023/Python-Code-Large/train/row_1006
8
23
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1006:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0435, 0.0435, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf.urls.defaults import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1006:ImportFrom_L2_C0", "label": "from django_restapi.model_resource import Collection", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.087, 0.0435, 0, 0.66, 0.1429, 272, 0, 1, 0, 0, 272, 0, 0], "semantic": {"name": "django_restapi.model_resource", "arg_names": [], "import_names": ["Collection"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi.model_resource import Collection"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1006:ImportFrom_L3_C0", "label": "from django_restapi.responder import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1304, 0.0435, 0, 0.66, 0.2857, 429, 0, 1, 0, 0, 429, 0, 0], "semantic": {"name": "django_restapi.responder", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi.responder import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1006:ImportFrom_L4_C0", "label": "from django_restapi.receiver import *", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1739, 0.0435, 0, 0.66, 0.4286, 474, 0, 1, 0, 0, 474, 0, 0], "semantic": {"name": "django_restapi.receiver", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi.receiver import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1006:ImportFrom_L5_C0", "label": "from django_restapi_tests.polls.models import Poll", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.2174, 0.0435, 0, 0.66, 0.5714, 988, 0, 1, 0, 0, 988, 0, 0], "semantic": {"name": "django_restapi_tests.polls.models", "arg_names": [], "import_names": ["Poll"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi_tests.polls.models import Poll"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1006:Assign_L7_C0", "label": "fullxml_poll_resource = Collection()", "type": "assigned_variable", "loc": [7, 12], "level": 0, "parent": null, "vector": [14, 0, 0.413, 0.2609, 0, 0.66, 0.7143, 164, 3, 4, 0, 0, 432, 10, 4], "semantic": {"name": "fullxml_poll_resource", "arg_names": [], "import_names": [], "rhs_call_name": "Collection", "annotation": ""}, "snippet": "fullxml_poll_resource = Collection(\n queryset = Poll.objects.all(), \n permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'),\n receiver = XMLReceiver(),\n responder = XMLResponder(),\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1006:Assign_L13_C0", "label": "fulljson_poll_resource = Collection()", "type": "assigned_variable", "loc": [13, 18], "level": 0, "parent": null, "vector": [14, 0, 0.6739, 0.2609, 0, 0.66, 0.8571, 268, 3, 4, 0, 0, 432, 10, 4], "semantic": {"name": "fulljson_poll_resource", "arg_names": [], "import_names": [], "rhs_call_name": "Collection", "annotation": ""}, "snippet": "fulljson_poll_resource = Collection(\n queryset = Poll.objects.all(),\n permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'),\n receiver = JSONReceiver(),\n responder = JSONResponder()\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1006:Assign_L20_C0", "label": "urlpatterns = patterns()", "type": "assigned_variable", "loc": [20, 23], "level": 0, "parent": null, "vector": [14, 0, 0.9348, 0.1739, 0, 0.66, 1.0, 990, 3, 3, 0, 0, 75, 10, 3], "semantic": {"name": "urlpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "patterns", "annotation": ""}, "snippet": "urlpatterns = patterns('',\n url(r'^fullxml/polls/(.*?)/?$', fullxml_poll_resource),\n url(r'^fulljson/polls/(.*?)/?$', fulljson_poll_resource)\n)"}]
[]
from django.conf.urls.defaults import * from django_restapi.model_resource import Collection from django_restapi.responder import * from django_restapi_tests.polls.models import Poll, Choice xml_poll_resource = Collection( queryset = Poll.objects.all(), permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'), expose_fields = ('id', 'question', 'pub_date'), responder = XMLResponder(paginate_by = 10) ) xml_choice_resource = Collection( queryset = Choice.objects.all(), permitted_methods = ('GET',), expose_fields = ('id', 'poll_id', 'choice'), responder = XMLResponder(paginate_by = 5) ) urlpatterns = patterns('', url(r'^xml/polls/(.*?)/?$', xml_poll_resource), url(r'^xml/choices/(.*?)/?$', xml_choice_resource) )
ajibawa-2023/Python-Code-Large/train/row_1007
7
24
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1007:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0417, 0.0417, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf.urls.defaults import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1007:ImportFrom_L2_C0", "label": "from django_restapi.model_resource import Collection", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0417, 0, 0.66, 0.1667, 272, 0, 1, 0, 0, 272, 0, 0], "semantic": {"name": "django_restapi.model_resource", "arg_names": [], "import_names": ["Collection"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi.model_resource import Collection"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1007:ImportFrom_L3_C0", "label": "from django_restapi.responder import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.0417, 0, 0.66, 0.3333, 429, 0, 1, 0, 0, 429, 0, 0], "semantic": {"name": "django_restapi.responder", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi.responder import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1007:ImportFrom_L4_C0", "label": "from django_restapi_tests.polls.models import Poll, Choice", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0417, 0, 0.66, 0.5, 988, 0, 2, 0, 0, 988, 0, 0], "semantic": {"name": "django_restapi_tests.polls.models", "arg_names": [], "import_names": ["Poll", "Choice"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi_tests.polls.models import Poll, Choice"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1007:Assign_L6_C0", "label": "xml_poll_resource = Collection()", "type": "assigned_variable", "loc": [6, 11], "level": 0, "parent": null, "vector": [14, 0, 0.3542, 0.25, 0, 0.66, 0.6667, 53, 3, 4, 0, 0, 432, 10, 3], "semantic": {"name": "xml_poll_resource", "arg_names": [], "import_names": [], "rhs_call_name": "Collection", "annotation": ""}, "snippet": "xml_poll_resource = Collection(\n queryset = Poll.objects.all(),\n permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'),\n expose_fields = ('id', 'question', 'pub_date'),\n responder = XMLResponder(paginate_by = 10)\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1007:Assign_L13_C0", "label": "xml_choice_resource = Collection()", "type": "assigned_variable", "loc": [13, 18], "level": 0, "parent": null, "vector": [14, 0, 0.6458, 0.25, 0, 0.66, 0.8333, 695, 3, 4, 0, 0, 432, 10, 3], "semantic": {"name": "xml_choice_resource", "arg_names": [], "import_names": [], "rhs_call_name": "Collection", "annotation": ""}, "snippet": "xml_choice_resource = Collection(\n queryset = Choice.objects.all(),\n permitted_methods = ('GET',),\n expose_fields = ('id', 'poll_id', 'choice'),\n responder = XMLResponder(paginate_by = 5)\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1007:Assign_L20_C0", "label": "urlpatterns = patterns()", "type": "assigned_variable", "loc": [20, 23], "level": 0, "parent": null, "vector": [14, 0, 0.8958, 0.1667, 0, 0.66, 1.0, 990, 3, 3, 0, 0, 75, 10, 3], "semantic": {"name": "urlpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "patterns", "annotation": ""}, "snippet": "urlpatterns = patterns('',\n url(r'^xml/polls/(.*?)/?$', xml_poll_resource),\n url(r'^xml/choices/(.*?)/?$', xml_choice_resource)\n)"}]
[]
from django.conf.urls.defaults import * from django.http import HttpResponseRedirect from django.shortcuts import render_to_response from django_restapi.resource import Resource from django_restapi_tests.people.models import * # Urls for a resource that does not map 1:1 # to Django models. class FriendshipCollection(Resource): def read(self, request): friendships = get_friendship_list() context = {'friendships':friendships} return render_to_response('people/friends_list.html', context) class FriendshipEntry(Resource): def read(self, request, person_id, friend_id): friendship = get_friendship(person_id, friend_id) context = {'friendship':friendship} return render_to_response('people/friends_detail.html', context) def delete(self, request, person_id, friend_id): friendship = get_friendship(person_id, friend_id) friendship[0].friends.remove(friendship[1]) return HttpResponseRedirect('/friends/') urlpatterns = patterns('', url(r'^friends/$', FriendshipCollection()), url(r'^friends/(?P<person_id>\d+)-(?P<friend_id>\d+)/$', FriendshipEntry(permitted_methods=('GET','DELETE'))), )
ajibawa-2023/Python-Code-Large/train/row_1008
20
29
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1008:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0345, 0.0345, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf.urls.defaults import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1008:ImportFrom_L2_C0", "label": "from django.http import HttpResponseRedirect", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.069, 0.0345, 0, 0.66, 0.1429, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_names": ["HttpResponseRedirect"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.http import HttpResponseRedirect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1008:ImportFrom_L3_C0", "label": "from django.shortcuts import render_to_response", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1034, 0.0345, 0, 0.66, 0.2857, 852, 0, 1, 0, 0, 852, 0, 0], "semantic": {"name": "django.shortcuts", "arg_names": [], "import_names": ["render_to_response"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.shortcuts import render_to_response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1008:ImportFrom_L4_C0", "label": "from django_restapi.resource import Resource", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1379, 0.0345, 0, 0.66, 0.4286, 109, 0, 1, 0, 0, 109, 0, 0], "semantic": {"name": "django_restapi.resource", "arg_names": [], "import_names": ["Resource"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi.resource import Resource"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1008:ImportFrom_L5_C0", "label": "from django_restapi_tests.people.models import *", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1724, 0.0345, 0, 0.66, 0.5714, 574, 0, 1, 0, 0, 574, 0, 0], "semantic": {"name": "django_restapi_tests.people.models", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi_tests.people.models import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1008:ClassDef_L10_C0", "label": "FriendshipCollection", "type": "class", "loc": [10, 14], "level": 0, "parent": null, "vector": [3, 0, 0.4138, 0.1724, 0, 0.66, 0.7143, 497, 0, 1, 0, 0, 412, 0, 2], "semantic": {"name": "FriendshipCollection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FriendshipCollection(Resource):\n def read(self, request):\n friendships = get_friendship_list()\n context = {'friendships':friendships}\n return render_to_response('people/friends_list.html', context)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L11_C4", "label": "read", "type": "function", "loc": [11, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1008:ClassDef_L10_C0", "vector": [2, 1, 0.431, 0.1379, 1, 0.76, 0.0, 453, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "read", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def read(self, request):\n friendships = get_friendship_list()\n context = {'friendships':friendships}\n return render_to_response('people/friends_list.html', context)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1008:Assign_L12_C8", "label": "friendships = get_friendship_list()", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L11_C4", "vector": [14, 2, 0.4138, 0.0345, 2, 0.56, 0.0, 755, 3, 0, 0, 0, 53, 10, 1], "semantic": {"name": "friendships", "arg_names": [], "import_names": [], "rhs_call_name": "get_friendship_list", "annotation": ""}, "snippet": " friendships = get_friendship_list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1008:Assign_L13_C8", "label": "context =", "type": "assigned_variable", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L11_C4", "vector": [14, 2, 0.4483, 0.0345, 2, 0.56, 0.5, 954, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " context = {'friendships':friendships}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1008:Return_L14_C8", "label": "return", "type": "return", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L11_C4", "vector": [13, 2, 0.4828, 0.0345, 2, 0.56, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render_to_response('people/friends_list.html', context)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1008:ClassDef_L16_C0", "label": "FriendshipEntry", "type": "class", "loc": [16, 24], "level": 0, "parent": null, "vector": [3, 0, 0.6897, 0.3103, 0, 0.66, 0.8571, 733, 0, 2, 0, 0, 412, 0, 5], "semantic": {"name": "FriendshipEntry", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FriendshipEntry(Resource):\n def read(self, request, person_id, friend_id):\n friendship = get_friendship(person_id, friend_id)\n context = {'friendship':friendship}\n return render_to_response('people/friends_detail.html', context)\n def delete(self, request, person_id, friend_id):\n friendship = get_friendship(person_id, friend_id)\n friendship[0].friends.remove(friendship[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L17_C4", "label": "read", "type": "function", "loc": [17, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1008:ClassDef_L16_C0", "vector": [2, 1, 0.6379, 0.1379, 1, 0.38, 0.0, 453, 0, 4, 1, 0, 0, 0, 2], "semantic": {"name": "read", "arg_names": ["self", "request", "person_id", "friend_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def read(self, request, person_id, friend_id):\n friendship = get_friendship(person_id, friend_id)\n context = {'friendship':friendship}\n return render_to_response('people/friends_detail.html', context)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1008:Assign_L18_C8", "label": "friendship = get_friendship()", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L17_C4", "vector": [14, 2, 0.6207, 0.0345, 2, 0.99, 0.0, 778, 3, 2, 0, 0, 634, 10, 1], "semantic": {"name": "friendship", "arg_names": [], "import_names": [], "rhs_call_name": "get_friendship", "annotation": ""}, "snippet": " friendship = get_friendship(person_id, friend_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1008:Assign_L19_C8", "label": "context =", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L17_C4", "vector": [14, 2, 0.6552, 0.0345, 2, 0.99, 0.5, 954, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " context = {'friendship':friendship}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1008:Return_L20_C8", "label": "return", "type": "return", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L17_C4", "vector": [13, 2, 0.6897, 0.0345, 2, 0.99, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render_to_response('people/friends_detail.html', context)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L21_C4", "label": "delete", "type": "function", "loc": [21, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1008:ClassDef_L16_C0", "vector": [2, 1, 0.7759, 0.1379, 1, 0.38, 1.0, 266, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "delete", "arg_names": ["self", "request", "person_id", "friend_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def delete(self, request, person_id, friend_id):\n friendship = get_friendship(person_id, friend_id)\n friendship[0].friends.remove(friendship[1])\n return HttpResponseRedirect('/friends/')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1008:Assign_L22_C8", "label": "friendship = get_friendship()", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L21_C4", "vector": [14, 2, 0.7586, 0.0345, 2, 0.6, 0.0, 778, 3, 2, 0, 0, 634, 10, 1], "semantic": {"name": "friendship", "arg_names": [], "import_names": [], "rhs_call_name": "get_friendship", "annotation": ""}, "snippet": " friendship = get_friendship(person_id, friend_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1008:Expr_L23_C8", "label": "remove()", "type": "expression", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L21_C4", "vector": [8, 2, 0.7931, 0.0345, 2, 0.6, 0.5, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " friendship[0].friends.remove(friendship[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1008:Return_L24_C8", "label": "return", "type": "return", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L21_C4", "vector": [13, 2, 0.8276, 0.0345, 2, 0.6, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return HttpResponseRedirect('/friends/')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1008:Assign_L26_C0", "label": "urlpatterns = patterns()", "type": "assigned_variable", "loc": [26, 29], "level": 0, "parent": null, "vector": [14, 0, 0.9483, 0.1379, 0, 0.66, 1.0, 990, 3, 3, 0, 0, 75, 10, 5], "semantic": {"name": "urlpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "patterns", "annotation": ""}, "snippet": "urlpatterns = patterns('',\n url(r'^friends/$', FriendshipCollection()),\n url(r'^friends/(?P<person_id>\\d+)-(?P<friend_id>\\d+)/$', FriendshipEntry(permitted_methods=('GET','DELETE'))),\n)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1008:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1008:Assign_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1008:Assign_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1008:Return_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1008:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1008:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1008:Assign_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1008:Return_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1008:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1008:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1008:Expr_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1008:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1008:Return_L24_C8"}]
from django.conf.urls.defaults import * from django_restapi.model_resource import Collection, Entry, reverse from django_restapi.responder import * from django_restapi_tests.polls.models import Poll, Choice # JSON Test API URLs # # Polls are available at /json/polls/ and # /json/polls/[poll_id]/. # # Different (manual) URL structure for choices: # /json/polls/[poll_id]/choices/[number of choice]/ # Example: /json/polls/121/choices/2/ identifies the second # choice for the poll with ID 121. class ChoiceCollection(Collection): def read(self, request): poll_id = int(request.path.split("/")[3]) filtered_set = self.queryset._clone() filtered_set = filtered_set.filter(poll__id=poll_id) return self.responder.list(request, filtered_set) def get_entry(self, poll_id, choice_num): poll = Poll.objects.get(id=int(poll_id)) choice = poll.get_choice_from_num(int(choice_num)) return ChoiceEntry(self, choice) def get_url(self): return reverse(self, (), {'poll_id':self.model.poll.id}) class ChoiceEntry(Entry): def get_url(self): choice_num = self.model.get_num() return reverse(self.collection, (), {'poll_id':self.model.poll.id, 'choice_num':choice_num}) json_poll_resource = Collection( queryset = Poll.objects.all(), permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'), expose_fields = ('id', 'question', 'pub_date'), responder = JSONResponder(paginate_by=10) ) json_choice_resource = ChoiceCollection( queryset = Choice.objects.all(), permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'), expose_fields = ('id', 'poll_id', 'choice', 'votes'), responder = JSONResponder(paginate_by=5), entry_class = ChoiceEntry ) urlpatterns = patterns('', url(r'^json/polls/(?P<poll_id>\d+)/choices/(?P<choice_num>\d+)/$', json_choice_resource, {'is_entry':True}), url(r'^json/polls/(?P<poll_id>\d+)/choices/$', json_choice_resource, {'is_entry':False}), url(r'^json/polls/(.*?)/?$', json_poll_resource) )
ajibawa-2023/Python-Code-Large/train/row_1009
23
57
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1009:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0175, 0.0175, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf.urls.defaults import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1009:ImportFrom_L2_C0", "label": "from django_restapi.model_resource import Collection, Entry, reverse", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0351, 0.0175, 0, 0.66, 0.125, 272, 0, 3, 0, 0, 272, 0, 0], "semantic": {"name": "django_restapi.model_resource", "arg_names": [], "import_names": ["Collection", "Entry", "reverse"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi.model_resource import Collection, Entry, reverse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1009:ImportFrom_L3_C0", "label": "from django_restapi.responder import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0526, 0.0175, 0, 0.66, 0.25, 429, 0, 1, 0, 0, 429, 0, 0], "semantic": {"name": "django_restapi.responder", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi.responder import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1009:ImportFrom_L4_C0", "label": "from django_restapi_tests.polls.models import Poll, Choice", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0702, 0.0175, 0, 0.66, 0.375, 988, 0, 2, 0, 0, 988, 0, 0], "semantic": {"name": "django_restapi_tests.polls.models", "arg_names": [], "import_names": ["Poll", "Choice"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi_tests.polls.models import Poll, Choice"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1009:ClassDef_L16_C0", "label": "ChoiceCollection", "type": "class", "loc": [16, 30], "level": 0, "parent": null, "vector": [3, 0, 0.4035, 0.2632, 0, 0.66, 0.5, 547, 0, 3, 0, 0, 432, 0, 11], "semantic": {"name": "ChoiceCollection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ChoiceCollection(Collection):\n \n def read(self, request):\n poll_id = int(request.path.split(\"/\")[3])\n filtered_set = self.queryset._clone()\n filtered_set = filtered_set.filter(poll__id=poll_id)\n return self.responder.list(request, filtered_set)\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L18_C4", "label": "read", "type": "function", "loc": [18, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1009:ClassDef_L16_C0", "vector": [2, 1, 0.3509, 0.0877, 1, 0.92, 0.0, 453, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "read", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def read(self, request):\n poll_id = int(request.path.split(\"/\")[3])\n filtered_set = self.queryset._clone()\n filtered_set = filtered_set.filter(poll__id=poll_id)\n return self.responder.list(request, filtered_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1009:Assign_L19_C8", "label": "poll_id = int()", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L18_C4", "vector": [14, 2, 0.3333, 0.0175, 2, 0.2, 0.0, 961, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "poll_id", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " poll_id = int(request.path.split(\"/\")[3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1009:Assign_L20_C8", "label": "filtered_set = _clone()", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L18_C4", "vector": [14, 2, 0.3509, 0.0175, 2, 0.2, 0.3333, 855, 3, 0, 0, 0, 617, 10, 1], "semantic": {"name": "filtered_set", "arg_names": [], "import_names": [], "rhs_call_name": "_clone", "annotation": ""}, "snippet": " filtered_set = self.queryset._clone()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1009:Assign_L21_C8", "label": "filtered_set = filter()", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L18_C4", "vector": [14, 2, 0.3684, 0.0175, 2, 0.2, 0.6667, 855, 3, 1, 0, 0, 526, 10, 1], "semantic": {"name": "filtered_set", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " filtered_set = filtered_set.filter(poll__id=poll_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1009:Return_L22_C8", "label": "return", "type": "return", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L18_C4", "vector": [13, 2, 0.386, 0.0175, 2, 0.2, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.responder.list(request, filtered_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L24_C4", "label": "get_entry", "type": "function", "loc": [24, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1009:ClassDef_L16_C0", "vector": [2, 1, 0.4474, 0.0702, 1, 0.92, 0.5, 35, 0, 3, 1, 0, 0, 0, 5], "semantic": {"name": "get_entry", "arg_names": ["self", "poll_id", "choice_num"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_entry(self, poll_id, choice_num):\n poll = Poll.objects.get(id=int(poll_id))\n choice = poll.get_choice_from_num(int(choice_num))\n return ChoiceEntry(self, choice)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1009:Assign_L25_C8", "label": "poll = get()", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L24_C4", "vector": [14, 2, 0.4386, 0.0175, 2, 0.8, 0.0, 182, 3, 1, 0, 0, 607, 10, 2], "semantic": {"name": "poll", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " poll = Poll.objects.get(id=int(poll_id))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1009:Assign_L26_C8", "label": "choice = get_choice_from_num()", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L24_C4", "vector": [14, 2, 0.4561, 0.0175, 2, 0.8, 0.5, 30, 3, 1, 0, 0, 550, 10, 2], "semantic": {"name": "choice", "arg_names": [], "import_names": [], "rhs_call_name": "get_choice_from_num", "annotation": ""}, "snippet": " choice = poll.get_choice_from_num(int(choice_num))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1009:Return_L27_C8", "label": "return", "type": "return", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L24_C4", "vector": [13, 2, 0.4737, 0.0175, 2, 0.8, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ChoiceEntry(self, choice)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L29_C4", "label": "get_url", "type": "function", "loc": [29, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1009:ClassDef_L16_C0", "vector": [2, 1, 0.5175, 0.0351, 1, 0.92, 1.0, 662, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_url", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_url(self):\n return reverse(self, (), {'poll_id':self.model.poll.id})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1009:Return_L30_C8", "label": "return", "type": "return", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L29_C4", "vector": [13, 2, 0.5263, 0.0175, 2, 0.43, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return reverse(self, (), {'poll_id':self.model.poll.id})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1009:ClassDef_L32_C0", "label": "ChoiceEntry", "type": "class", "loc": [32, 36], "level": 0, "parent": null, "vector": [3, 0, 0.5965, 0.0877, 0, 0.66, 0.625, 364, 0, 1, 0, 0, 197, 0, 2], "semantic": {"name": "ChoiceEntry", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ChoiceEntry(Entry):\n \n def get_url(self):\n choice_num = self.model.get_num()\n return reverse(self.collection, (), {'poll_id':self.model.poll.id, 'choice_num':choice_num})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L34_C4", "label": "get_url", "type": "function", "loc": [34, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1009:ClassDef_L32_C0", "vector": [2, 1, 0.614, 0.0526, 1, 0.99, 0.0, 662, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "get_url", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_url(self):\n choice_num = self.model.get_num()\n return reverse(self.collection, (), {'poll_id':self.model.poll.id, 'choice_num':choice_num})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1009:Assign_L35_C8", "label": "choice_num = get_num()", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L34_C4", "vector": [14, 2, 0.614, 0.0175, 2, 0.36, 0.0, 651, 3, 0, 0, 0, 389, 10, 1], "semantic": {"name": "choice_num", "arg_names": [], "import_names": [], "rhs_call_name": "get_num", "annotation": ""}, "snippet": " choice_num = self.model.get_num()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1009:Return_L36_C8", "label": "return", "type": "return", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L34_C4", "vector": [13, 2, 0.6316, 0.0175, 2, 0.36, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return reverse(self.collection, (), {'poll_id':self.model.poll.id, 'choice_num':choice_num})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1009:Assign_L38_C0", "label": "json_poll_resource = Collection()", "type": "assigned_variable", "loc": [38, 43], "level": 0, "parent": null, "vector": [14, 0, 0.7105, 0.1053, 0, 0.66, 0.75, 269, 3, 4, 0, 0, 432, 10, 3], "semantic": {"name": "json_poll_resource", "arg_names": [], "import_names": [], "rhs_call_name": "Collection", "annotation": ""}, "snippet": "json_poll_resource = Collection(\n queryset = Poll.objects.all(),\n permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'),\n expose_fields = ('id', 'question', 'pub_date'),\n responder = JSONResponder(paginate_by=10)\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1009:Assign_L45_C0", "label": "json_choice_resource = ChoiceCollection()", "type": "assigned_variable", "loc": [45, 51], "level": 0, "parent": null, "vector": [14, 0, 0.8421, 0.1228, 0, 0.66, 0.875, 26, 3, 5, 0, 0, 547, 10, 3], "semantic": {"name": "json_choice_resource", "arg_names": [], "import_names": [], "rhs_call_name": "ChoiceCollection", "annotation": ""}, "snippet": "json_choice_resource = ChoiceCollection(\n queryset = Choice.objects.all(),\n permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'),\n expose_fields = ('id', 'poll_id', 'choice', 'votes'),\n responder = JSONResponder(paginate_by=5),\n entry_class = ChoiceEntry\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1009:Assign_L53_C0", "label": "urlpatterns = patterns()", "type": "assigned_variable", "loc": [53, 57], "level": 0, "parent": null, "vector": [14, 0, 0.9649, 0.0877, 0, 0.66, 1.0, 990, 3, 4, 0, 0, 75, 10, 4], "semantic": {"name": "urlpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "patterns", "annotation": ""}, "snippet": "urlpatterns = patterns('',\n url(r'^json/polls/(?P<poll_id>\\d+)/choices/(?P<choice_num>\\d+)/$', json_choice_resource, {'is_entry':True}),\n url(r'^json/polls/(?P<poll_id>\\d+)/choices/$', json_choice_resource, {'is_entry':False}),\n url(r'^json/polls/(.*?)/?$', json_poll_resource)\n)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1009:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1009:Assign_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1009:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1009:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1009:Return_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1009:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1009:Assign_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1009:Assign_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1009:Return_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1009:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1009:Return_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1009:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1009:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1009:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1009:Return_L36_C8"}]
from django.conf.urls.defaults import * from django_restapi.model_resource import Collection from django_restapi.responder import * from django_restapi_tests.polls.models import Poll, Choice template_poll_resource = Collection( queryset = Poll.objects.all(), permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'), expose_fields = ('id', 'question', 'pub_date'), responder = TemplateResponder( template_dir = 'polls', template_object_name = 'poll', paginate_by = 10 ) ) template_choice_resource = Collection( queryset = Choice.objects.all(), permitted_methods = ('GET',), expose_fields = ('id', 'poll_id', 'choice', 'votes'), responder = TemplateResponder( template_dir = 'polls', template_object_name = 'choice', paginate_by = 5 ) ) urlpatterns = patterns('', url(r'^html/polls/creator/$', template_poll_resource.responder.create_form), url(r'^html/polls/(?P<pk>\d+)/editor/$', template_poll_resource.responder.update_form), url(r'^html/polls/(.*?)/?$', template_poll_resource), url(r'^html/choices/(.*?)/?$', template_choice_resource), )
ajibawa-2023/Python-Code-Large/train/row_1010
7
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_1010:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0303, 0.0303, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf.urls.defaults import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1010:ImportFrom_L2_C0", "label": "from django_restapi.model_resource import Collection", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0606, 0.0303, 0, 0.66, 0.1667, 272, 0, 1, 0, 0, 272, 0, 0], "semantic": {"name": "django_restapi.model_resource", "arg_names": [], "import_names": ["Collection"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi.model_resource import Collection"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1010:ImportFrom_L3_C0", "label": "from django_restapi.responder import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0303, 0, 0.66, 0.3333, 429, 0, 1, 0, 0, 429, 0, 0], "semantic": {"name": "django_restapi.responder", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi.responder import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1010:ImportFrom_L4_C0", "label": "from django_restapi_tests.polls.models import Poll, Choice", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1212, 0.0303, 0, 0.66, 0.5, 988, 0, 2, 0, 0, 988, 0, 0], "semantic": {"name": "django_restapi_tests.polls.models", "arg_names": [], "import_names": ["Poll", "Choice"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi_tests.polls.models import Poll, Choice"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1010:Assign_L6_C0", "label": "template_poll_resource = Collection()", "type": "assigned_variable", "loc": [6, 15], "level": 0, "parent": null, "vector": [14, 0, 0.3182, 0.303, 0, 0.66, 0.6667, 884, 3, 4, 0, 0, 432, 10, 3], "semantic": {"name": "template_poll_resource", "arg_names": [], "import_names": [], "rhs_call_name": "Collection", "annotation": ""}, "snippet": "template_poll_resource = Collection(\n queryset = Poll.objects.all(),\n permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'),\n expose_fields = ('id', 'question', 'pub_date'),\n responder = TemplateResponder(\n template_dir = 'polls',\n template_object_name = 'poll',\n paginate_by = 10"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1010:Assign_L17_C0", "label": "template_choice_resource = Collection()", "type": "assigned_variable", "loc": [17, 26], "level": 0, "parent": null, "vector": [14, 0, 0.6515, 0.303, 0, 0.66, 0.8333, 304, 3, 4, 0, 0, 432, 10, 3], "semantic": {"name": "template_choice_resource", "arg_names": [], "import_names": [], "rhs_call_name": "Collection", "annotation": ""}, "snippet": "template_choice_resource = Collection(\n queryset = Choice.objects.all(),\n permitted_methods = ('GET',),\n expose_fields = ('id', 'poll_id', 'choice', 'votes'),\n responder = TemplateResponder(\n template_dir = 'polls',\n template_object_name = 'choice',\n paginate_by = 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1010:Assign_L28_C0", "label": "urlpatterns = patterns()", "type": "assigned_variable", "loc": [28, 33], "level": 0, "parent": null, "vector": [14, 0, 0.9242, 0.1818, 0, 0.66, 1.0, 990, 3, 5, 0, 0, 75, 10, 5], "semantic": {"name": "urlpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "patterns", "annotation": ""}, "snippet": "urlpatterns = patterns('',\n url(r'^html/polls/creator/$', template_poll_resource.responder.create_form),\n url(r'^html/polls/(?P<pk>\\d+)/editor/$', template_poll_resource.responder.update_form),\n url(r'^html/polls/(.*?)/?$', template_poll_resource),\n url(r'^html/choices/(.*?)/?$', template_choice_resource),\n)"}]
[]
from django.conf.urls.defaults import * from django_restapi.model_resource import Collection from django_restapi.responder import * from django_restapi_tests.polls.models import Poll, Choice simple_poll_resource = Collection( queryset = Poll.objects.all(), responder = XMLResponder(), ) simple_choice_resource = Collection( queryset = Choice.objects.all(), responder = XMLResponder() ) urlpatterns = patterns('', url(r'^api/poll/(.*?)/?$', simple_poll_resource), url(r'^api/choice/(.*?)/?$', simple_choice_resource) )
ajibawa-2023/Python-Code-Large/train/row_1011
7
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_1011:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0556, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf.urls.defaults import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1011:ImportFrom_L2_C0", "label": "from django_restapi.model_resource import Collection", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.0556, 0, 0.66, 0.1667, 272, 0, 1, 0, 0, 272, 0, 0], "semantic": {"name": "django_restapi.model_resource", "arg_names": [], "import_names": ["Collection"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi.model_resource import Collection"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1011:ImportFrom_L3_C0", "label": "from django_restapi.responder import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0556, 0, 0.66, 0.3333, 429, 0, 1, 0, 0, 429, 0, 0], "semantic": {"name": "django_restapi.responder", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi.responder import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1011:ImportFrom_L4_C0", "label": "from django_restapi_tests.polls.models import Poll, Choice", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.2222, 0.0556, 0, 0.66, 0.5, 988, 0, 2, 0, 0, 988, 0, 0], "semantic": {"name": "django_restapi_tests.polls.models", "arg_names": [], "import_names": ["Poll", "Choice"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi_tests.polls.models import Poll, Choice"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1011:Assign_L6_C0", "label": "simple_poll_resource = Collection()", "type": "assigned_variable", "loc": [6, 9], "level": 0, "parent": null, "vector": [14, 0, 0.4167, 0.2222, 0, 0.66, 0.6667, 735, 3, 2, 0, 0, 432, 10, 3], "semantic": {"name": "simple_poll_resource", "arg_names": [], "import_names": [], "rhs_call_name": "Collection", "annotation": ""}, "snippet": "simple_poll_resource = Collection(\n queryset = Poll.objects.all(), \n responder = XMLResponder(),\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1011:Assign_L10_C0", "label": "simple_choice_resource = Collection()", "type": "assigned_variable", "loc": [10, 13], "level": 0, "parent": null, "vector": [14, 0, 0.6389, 0.2222, 0, 0.66, 0.8333, 827, 3, 2, 0, 0, 432, 10, 3], "semantic": {"name": "simple_choice_resource", "arg_names": [], "import_names": [], "rhs_call_name": "Collection", "annotation": ""}, "snippet": "simple_choice_resource = Collection(\n queryset = Choice.objects.all(),\n responder = XMLResponder()\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1011:Assign_L15_C0", "label": "urlpatterns = patterns()", "type": "assigned_variable", "loc": [15, 18], "level": 0, "parent": null, "vector": [14, 0, 0.9167, 0.2222, 0, 0.66, 1.0, 990, 3, 3, 0, 0, 75, 10, 3], "semantic": {"name": "urlpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "patterns", "annotation": ""}, "snippet": "urlpatterns = patterns('',\n url(r'^api/poll/(.*?)/?$', simple_poll_resource),\n url(r'^api/choice/(.*?)/?$', simple_choice_resource)\n)"}]
[]
from django.conf.urls.defaults import * from django_restapi.model_resource import Collection from django_restapi.responder import * from django_restapi_tests.polls.models import Poll, Choice fixedend_poll_resource = Collection( queryset = Poll.objects.all(), responder = XMLResponder(), ) fixedend_choice_resource = Collection( queryset = Choice.objects.all(), responder = XMLResponder() ) urlpatterns = patterns('', url(r'^polls/xml/$', fixedend_poll_resource), url(r'^polls/(.*)/xml/$', fixedend_poll_resource), url(r'^choices/xml/$', fixedend_choice_resource), url(r'^choices/(.*)/xml/$', fixedend_choice_resource) )
ajibawa-2023/Python-Code-Large/train/row_1012
7
20
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1012:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.05, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf.urls.defaults import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1012:ImportFrom_L2_C0", "label": "from django_restapi.model_resource import Collection", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1, 0.05, 0, 0.66, 0.1667, 272, 0, 1, 0, 0, 272, 0, 0], "semantic": {"name": "django_restapi.model_resource", "arg_names": [], "import_names": ["Collection"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi.model_resource import Collection"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1012:ImportFrom_L3_C0", "label": "from django_restapi.responder import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.15, 0.05, 0, 0.66, 0.3333, 429, 0, 1, 0, 0, 429, 0, 0], "semantic": {"name": "django_restapi.responder", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi.responder import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1012:ImportFrom_L4_C0", "label": "from django_restapi_tests.polls.models import Poll, Choice", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.05, 0, 0.66, 0.5, 988, 0, 2, 0, 0, 988, 0, 0], "semantic": {"name": "django_restapi_tests.polls.models", "arg_names": [], "import_names": ["Poll", "Choice"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi_tests.polls.models import Poll, Choice"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1012:Assign_L6_C0", "label": "fixedend_poll_resource = Collection()", "type": "assigned_variable", "loc": [6, 9], "level": 0, "parent": null, "vector": [14, 0, 0.375, 0.2, 0, 0.66, 0.6667, 438, 3, 2, 0, 0, 432, 10, 3], "semantic": {"name": "fixedend_poll_resource", "arg_names": [], "import_names": [], "rhs_call_name": "Collection", "annotation": ""}, "snippet": "fixedend_poll_resource = Collection(\n queryset = Poll.objects.all(), \n responder = XMLResponder(),\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1012:Assign_L10_C0", "label": "fixedend_choice_resource = Collection()", "type": "assigned_variable", "loc": [10, 13], "level": 0, "parent": null, "vector": [14, 0, 0.575, 0.2, 0, 0.66, 0.8333, 344, 3, 2, 0, 0, 432, 10, 3], "semantic": {"name": "fixedend_choice_resource", "arg_names": [], "import_names": [], "rhs_call_name": "Collection", "annotation": ""}, "snippet": "fixedend_choice_resource = Collection(\n queryset = Choice.objects.all(),\n responder = XMLResponder()\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1012:Assign_L15_C0", "label": "urlpatterns = patterns()", "type": "assigned_variable", "loc": [15, 20], "level": 0, "parent": null, "vector": [14, 0, 0.875, 0.3, 0, 0.66, 1.0, 990, 3, 5, 0, 0, 75, 10, 5], "semantic": {"name": "urlpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "patterns", "annotation": ""}, "snippet": "urlpatterns = patterns('',\n url(r'^polls/xml/$', fixedend_poll_resource),\n url(r'^polls/(.*)/xml/$', fixedend_poll_resource),\n url(r'^choices/xml/$', fixedend_choice_resource),\n url(r'^choices/(.*)/xml/$', fixedend_choice_resource)\n)"}]
[]
from django.conf.urls.defaults import * from django_restapi.model_resource import Collection from django_restapi.responder import * from django_restapi.authentication import * from django_restapi_tests.polls.models import Poll # HTTP Basic # # No auth function specified # -> django.contrib.auth.models.User is used. # Test with username 'rest', password 'rest'. basicauth_poll_resource = Collection( queryset = Poll.objects.all(), responder = XMLResponder(), authentication = HttpBasicAuthentication() ) # HTTP Digest def digest_authfunc(username, realm): """ Exemplary authfunc for HTTP Digest. In production situations, the combined hashes of realm, username and password are usually stored in an external file/db. """ hashes = { ('realm1', 'john') : '3014aff1d0d0f0038e23c1195301def3', # Password: johnspass ('realm2', 'jim') : '5bae77fe607e161b831c8f8026a2ceb2' # Password: jimspass } return hashes[(username, realm)] digestauth_poll_resource = Collection( queryset = Poll.objects.all(), responder = XMLResponder(), authentication = HttpDigestAuthentication(digest_authfunc, 'realm1') ) urlpatterns = patterns('', url(r'^basic/polls/(.*?)/?$', basicauth_poll_resource), url(r'^digest/polls/(.*?)/?$', digestauth_poll_resource) )
ajibawa-2023/Python-Code-Large/train/row_1013
12
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_1013:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0238, 0.0238, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf.urls.defaults import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1013:ImportFrom_L2_C0", "label": "from django_restapi.model_resource import Collection", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0476, 0.0238, 0, 0.66, 0.125, 272, 0, 1, 0, 0, 272, 0, 0], "semantic": {"name": "django_restapi.model_resource", "arg_names": [], "import_names": ["Collection"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi.model_resource import Collection"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1013:ImportFrom_L3_C0", "label": "from django_restapi.responder import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0238, 0, 0.66, 0.25, 429, 0, 1, 0, 0, 429, 0, 0], "semantic": {"name": "django_restapi.responder", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi.responder import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1013:ImportFrom_L4_C0", "label": "from django_restapi.authentication import *", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0952, 0.0238, 0, 0.66, 0.375, 976, 0, 1, 0, 0, 976, 0, 0], "semantic": {"name": "django_restapi.authentication", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi.authentication import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1013:ImportFrom_L5_C0", "label": "from django_restapi_tests.polls.models import Poll", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.119, 0.0238, 0, 0.66, 0.5, 988, 0, 1, 0, 0, 988, 0, 0], "semantic": {"name": "django_restapi_tests.polls.models", "arg_names": [], "import_names": ["Poll"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django_restapi_tests.polls.models import Poll"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1013:Assign_L13_C0", "label": "basicauth_poll_resource = Collection()", "type": "assigned_variable", "loc": [13, 17], "level": 0, "parent": null, "vector": [14, 0, 0.3571, 0.119, 0, 0.66, 0.625, 838, 3, 3, 0, 0, 432, 10, 4], "semantic": {"name": "basicauth_poll_resource", "arg_names": [], "import_names": [], "rhs_call_name": "Collection", "annotation": ""}, "snippet": "basicauth_poll_resource = Collection(\n queryset = Poll.objects.all(), \n responder = XMLResponder(),\n authentication = HttpBasicAuthentication()\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1013:FunctionDef_L21_C0", "label": "digest_authfunc", "type": "function", "loc": [21, 31], "level": 0, "parent": null, "vector": [2, 0, 0.619, 0.2619, 0, 0.66, 0.75, 129, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "digest_authfunc", "arg_names": ["username", "realm"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def digest_authfunc(username, realm):\n \"\"\"\n Exemplary authfunc for HTTP Digest. In production situations,\n the combined hashes of realm, username and password are usually\n stored in an external file/db.\n \"\"\"\n hashes = {\n ('realm1', 'john') : '3014aff1d0d0f0038e23c1195301def3', # Password: johnspass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1013:Expr_L22_C4", "label": "expression", "type": "expression", "loc": [22, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1013:FunctionDef_L21_C0", "vector": [8, 1, 0.5714, 0.119, 1, 0.09, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Exemplary authfunc for HTTP Digest. In production situations,\n the combined hashes of realm, username and password are usually\n stored in an external file/db.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1013:Assign_L27_C4", "label": "hashes =", "type": "assigned_variable", "loc": [27, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1013:FunctionDef_L21_C0", "vector": [14, 1, 0.6786, 0.0952, 1, 0.09, 0.5, 576, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "hashes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hashes = {\n ('realm1', 'john') : '3014aff1d0d0f0038e23c1195301def3', # Password: johnspass\n ('realm2', 'jim') : '5bae77fe607e161b831c8f8026a2ceb2' # Password: jimspass\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1013:Return_L31_C4", "label": "return", "type": "return", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1013:FunctionDef_L21_C0", "vector": [13, 1, 0.7381, 0.0238, 1, 0.09, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return hashes[(username, realm)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1013:Assign_L33_C0", "label": "digestauth_poll_resource = Collection()", "type": "assigned_variable", "loc": [33, 37], "level": 0, "parent": null, "vector": [14, 0, 0.8333, 0.119, 0, 0.66, 0.875, 777, 3, 3, 0, 0, 432, 10, 4], "semantic": {"name": "digestauth_poll_resource", "arg_names": [], "import_names": [], "rhs_call_name": "Collection", "annotation": ""}, "snippet": "digestauth_poll_resource = Collection(\n queryset = Poll.objects.all(),\n responder = XMLResponder(),\n authentication = HttpDigestAuthentication(digest_authfunc, 'realm1')\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1013:Assign_L39_C0", "label": "urlpatterns = patterns()", "type": "assigned_variable", "loc": [39, 42], "level": 0, "parent": null, "vector": [14, 0, 0.9643, 0.0952, 0, 0.66, 1.0, 990, 3, 3, 0, 0, 75, 10, 3], "semantic": {"name": "urlpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "patterns", "annotation": ""}, "snippet": "urlpatterns = patterns('',\n url(r'^basic/polls/(.*?)/?$', basicauth_poll_resource),\n url(r'^digest/polls/(.*?)/?$', digestauth_poll_resource)\n)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1013:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1013:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1013:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1013:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1013:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1013:Return_L31_C4"}]
from django.db import models from django.http import Http404 class Person(models.Model): name = models.CharField(max_length=20) friends = models.ManyToManyField('self') idols = models.ManyToManyField('self', symmetrical=False, related_name='stalkers') def __unicode__(self): return self.name def get_friendship_list(): people = Person.objects.filter(friends__isnull=False) friendships = [] for person in people: for friend in person.friends.all(): friendship = [person, friend] friendship.sort(cmp=lambda x, y: cmp(x.name, y.name)) if friendship not in friendships: friendships.append(friendship) friendships.sort(cmp=lambda x, y: cmp(x[0].name, y[0].name)) return friendships def get_friendship(person_id, friend_id): person = Person.objects.get(id=person_id) try: friend = person.friends.get(id=friend_id) except Person.DoesNotExist: raise Http404 friendship = [person, friend] friendship.sort(cmp=lambda x,y: cmp(x.name, y.name)) return friendship
ajibawa-2023/Python-Code-Large/train/row_1014
26
32
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1014:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0312, 0.0312, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["models"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db import models"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:ImportFrom_L2_C0", "label": "from django.http import Http404", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0312, 0, 0.66, 0.25, 779, 0, 1, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_names": ["Http404"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.http import Http404"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:ClassDef_L4_C0", "label": "Person", "type": "class", "loc": [4, 10], "level": 0, "parent": null, "vector": [3, 0, 0.2188, 0.2188, 0, 0.66, 0.5, 362, 0, 1, 0, 0, 996, 0, 3], "semantic": {"name": "Person", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Person(models.Model):\n name = models.CharField(max_length=20)\n friends = models.ManyToManyField('self')\n idols = models.ManyToManyField('self', symmetrical=False, related_name='stalkers')\n\n def __unicode__(self):\n return self.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:Assign_L5_C4", "label": "name = CharField()", "type": "assigned_variable", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1014:ClassDef_L4_C0", "vector": [14, 1, 0.1562, 0.0312, 1, 0.83, 0.0, 57, 3, 1, 0, 0, 952, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "CharField", "annotation": ""}, "snippet": " name = models.CharField(max_length=20)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:Assign_L6_C4", "label": "friends = ManyToManyField()", "type": "assigned_variable", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1014:ClassDef_L4_C0", "vector": [14, 1, 0.1875, 0.0312, 1, 0.83, 0.3333, 875, 3, 1, 0, 0, 941, 10, 1], "semantic": {"name": "friends", "arg_names": [], "import_names": [], "rhs_call_name": "ManyToManyField", "annotation": ""}, "snippet": " friends = models.ManyToManyField('self')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:Assign_L7_C4", "label": "idols = ManyToManyField()", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1014:ClassDef_L4_C0", "vector": [14, 1, 0.2188, 0.0312, 1, 0.83, 0.6667, 737, 3, 3, 0, 0, 941, 10, 1], "semantic": {"name": "idols", "arg_names": [], "import_names": [], "rhs_call_name": "ManyToManyField", "annotation": ""}, "snippet": " idols = models.ManyToManyField('self', symmetrical=False, related_name='stalkers')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L9_C4", "label": "__unicode__", "type": "function", "loc": [9, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1014:ClassDef_L4_C0", "vector": [2, 1, 0.2969, 0.0625, 1, 0.83, 1.0, 318, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__unicode__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __unicode__(self):\n return self.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:Return_L10_C8", "label": "return", "type": "return", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L9_C4", "vector": [13, 2, 0.3125, 0.0312, 2, 0.12, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L12_C0", "label": "get_friendship_list", "type": "function", "loc": [12, 22], "level": 0, "parent": null, "vector": [2, 0, 0.5312, 0.3438, 0, 0.66, 0.75, 53, 0, 0, 1, 0, 0, 0, 7], "semantic": {"name": "get_friendship_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_friendship_list():\n people = Person.objects.filter(friends__isnull=False)\n friendships = []\n for person in people:\n for friend in person.friends.all():\n friendship = [person, friend]\n friendship.sort(cmp=lambda x, y: cmp(x.name, y.name))\n if friendship not in friendships:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:Assign_L13_C4", "label": "people = filter()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L12_C0", "vector": [14, 1, 0.4062, 0.0312, 1, 0.41, 0.0, 724, 3, 1, 0, 0, 526, 10, 1], "semantic": {"name": "people", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " people = Person.objects.filter(friends__isnull=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:Assign_L14_C4", "label": "friendships =", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L12_C0", "vector": [14, 1, 0.4375, 0.0312, 1, 0.41, 0.25, 755, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "friendships", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " friendships = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:For_L15_C4", "label": "for person", "type": "for", "loc": [15, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L12_C0", "vector": [6, 1, 0.5469, 0.1875, 1, 0.41, 0.5, 583, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "person", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for person in people:\n for friend in person.friends.all():\n friendship = [person, friend]\n friendship.sort(cmp=lambda x, y: cmp(x.name, y.name))\n if friendship not in friendships:\n friendships.append(friendship)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:For_L16_C8", "label": "for friend", "type": "for", "loc": [16, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1014:For_L15_C4", "vector": [6, 2, 0.5625, 0.1562, 2, 0.98, 0.0, 20, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "friend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for friend in person.friends.all():\n friendship = [person, friend]\n friendship.sort(cmp=lambda x, y: cmp(x.name, y.name))\n if friendship not in friendships:\n friendships.append(friendship)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:Assign_L17_C12", "label": "friendship =", "type": "assigned_variable", "loc": [17, 17], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1014:For_L16_C8", "vector": [14, 3, 0.5312, 0.0312, 3, 0.55, 0.0, 778, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "friendship", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " friendship = [person, friend]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:Expr_L18_C12", "label": "sort()", "type": "expression", "loc": [18, 18], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1014:For_L16_C8", "vector": [8, 3, 0.5625, 0.0312, 3, 0.55, 0.5, 489, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " friendship.sort(cmp=lambda x, y: cmp(x.name, y.name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:If_L19_C12", "label": "if", "type": "if", "loc": [19, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1014:For_L16_C8", "vector": [4, 3, 0.6094, 0.0625, 3, 0.55, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if friendship not in friendships:\n friendships.append(friendship)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:Expr_L20_C16", "label": "append()", "type": "expression", "loc": [20, 20], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1014:If_L19_C12", "vector": [8, 4, 0.625, 0.0312, 4, 0.43, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " friendships.append(friendship)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:Expr_L21_C4", "label": "sort()", "type": "expression", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L12_C0", "vector": [8, 1, 0.6562, 0.0312, 1, 0.41, 0.75, 489, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " friendships.sort(cmp=lambda x, y: cmp(x[0].name, y[0].name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:Return_L22_C4", "label": "return", "type": "return", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L12_C0", "vector": [13, 1, 0.6875, 0.0312, 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 friendships"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L24_C0", "label": "get_friendship", "type": "function", "loc": [24, 32], "level": 0, "parent": null, "vector": [2, 0, 0.875, 0.2812, 0, 0.66, 1.0, 634, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "get_friendship", "arg_names": ["person_id", "friend_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_friendship(person_id, friend_id):\n person = Person.objects.get(id=person_id)\n try:\n friend = person.friends.get(id=friend_id)\n except Person.DoesNotExist:\n raise Http404\n friendship = [person, friend]\n friendship.sort(cmp=lambda x,y: cmp(x.name, y.name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:Assign_L25_C4", "label": "person = get()", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L24_C0", "vector": [14, 1, 0.7812, 0.0312, 1, 0.9, 0.0, 583, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "person", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " person = Person.objects.get(id=person_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:Try_L26_C4", "label": "try", "type": "try", "loc": [26, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L24_C0", "vector": [7, 1, 0.8594, 0.125, 1, 0.9, 0.25, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n friend = person.friends.get(id=friend_id)\n except Person.DoesNotExist:\n raise Http404"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:Assign_L27_C8", "label": "friend = get()", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1014:Try_L26_C4", "vector": [14, 2, 0.8438, 0.0312, 2, 0.48, 0.0, 20, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "friend", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " friend = person.friends.get(id=friend_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:Assign_L30_C4", "label": "friendship =", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L24_C0", "vector": [14, 1, 0.9375, 0.0312, 1, 0.9, 0.5, 778, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "friendship", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " friendship = [person, friend]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:Expr_L31_C4", "label": "sort()", "type": "expression", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L24_C0", "vector": [8, 1, 0.9688, 0.0312, 1, 0.9, 0.75, 489, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " friendship.sort(cmp=lambda x,y: cmp(x.name, y.name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1014:Return_L32_C4", "label": "return", "type": "return", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L24_C0", "vector": [13, 1, 1.0, 0.0312, 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 friendship"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1014:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1014:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1014:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1014:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1014:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1014:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1014:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1014:Return_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1014:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1014:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1014:For_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1014:For_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1014:For_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1014:For_L16_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1014:Assign_L17_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1014:For_L16_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1014:Expr_L18_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1014:For_L16_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1014:If_L19_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1014:If_L19_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1014:Expr_L20_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1014:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1014:Return_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1014:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1014:Try_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1014:Try_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1014:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1014:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1014:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1014:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1014:Return_L32_C4"}]
from django.test import TestCase from django.utils.functional import curry class GenericTest(TestCase): fixtures = ['initial_data.json'] def setUp(self): self.client.put = curry(self.client.post, REQUEST_METHOD='PUT') self.client.delete = curry(self.client.get, REQUEST_METHOD='DELETE') def test_resource(self): url = '/friends/' response = self.client.post(url) self.failUnlessEqual(response.status_code, 405) response = self.client.put(url) self.failUnlessEqual(response.status_code, 405) response = self.client.delete(url) self.failUnlessEqual(response.status_code, 405) response = self.client.get(url) self.failUnlessEqual(response.status_code, 200) url = '/friends/1-2/' response = self.client.post(url) self.failUnlessEqual(response.status_code, 405) response = self.client.put(url) self.failUnlessEqual(response.status_code, 405) response = self.client.get(url) self.failUnlessEqual(response.status_code, 200) response = self.client.delete(url) self.failUnlessEqual(response.status_code, 302) response = self.client.get(url) self.failUnlessEqual(response.status_code, 404)
ajibawa-2023/Python-Code-Large/train/row_1015
28
34
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1015:ImportFrom_L1_C0", "label": "from django.test import TestCase", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0294, 0.0294, 0, 0.66, 0.0, 944, 0, 1, 0, 0, 944, 0, 0], "semantic": {"name": "django.test", "arg_names": [], "import_names": ["TestCase"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.test import TestCase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:ImportFrom_L2_C0", "label": "from django.utils.functional import curry", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0294, 0, 0.66, 0.5, 375, 0, 1, 0, 0, 375, 0, 0], "semantic": {"name": "django.utils.functional", "arg_names": [], "import_names": ["curry"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.functional import curry"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:ClassDef_L4_C0", "label": "GenericTest", "type": "class", "loc": [4, 34], "level": 0, "parent": null, "vector": [3, 0, 0.5588, 0.9118, 0, 0.66, 1.0, 5, 0, 2, 0, 0, 3, 0, 20], "semantic": {"name": "GenericTest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GenericTest(TestCase):\n\n fixtures = ['initial_data.json']\n \n def setUp(self):\n self.client.put = curry(self.client.post, REQUEST_METHOD='PUT')\n self.client.delete = curry(self.client.get, REQUEST_METHOD='DELETE')\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L6_C4", "label": "fixtures =", "type": "assigned_variable", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:ClassDef_L4_C0", "vector": [14, 1, 0.1765, 0.0294, 1, 0.59, 0.0, 752, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "fixtures", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fixtures = ['initial_data.json']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L8_C4", "label": "setUp", "type": "function", "loc": [8, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:ClassDef_L4_C0", "vector": [2, 1, 0.2647, 0.0882, 1, 0.59, 0.5, 952, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "setUp", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setUp(self):\n self.client.put = curry(self.client.post, REQUEST_METHOD='PUT')\n self.client.delete = curry(self.client.get, REQUEST_METHOD='DELETE')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L9_C8", "label": "self.client.put = curry()", "type": "assigned_variable", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L8_C4", "vector": [14, 2, 0.2647, 0.0294, 2, 0.06, 0.0, 169, 3, 2, 0, 0, 553, 10, 1], "semantic": {"name": "self.client.put", "arg_names": [], "import_names": [], "rhs_call_name": "curry", "annotation": ""}, "snippet": " self.client.put = curry(self.client.post, REQUEST_METHOD='PUT')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L10_C8", "label": "self.client.delete = curry()", "type": "assigned_variable", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L8_C4", "vector": [14, 2, 0.2941, 0.0294, 2, 0.06, 1.0, 613, 3, 2, 0, 0, 553, 10, 1], "semantic": {"name": "self.client.delete", "arg_names": [], "import_names": [], "rhs_call_name": "curry", "annotation": ""}, "snippet": " self.client.delete = curry(self.client.get, REQUEST_METHOD='DELETE')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "label": "test_resource", "type": "function", "loc": [12, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:ClassDef_L4_C0", "vector": [2, 1, 0.6765, 0.6765, 1, 0.59, 1.0, 753, 0, 1, 0, 0, 0, 0, 18], "semantic": {"name": "test_resource", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def test_resource(self):\n url = '/friends/'\n response = self.client.post(url)\n self.failUnlessEqual(response.status_code, 405)\n response = self.client.put(url)\n self.failUnlessEqual(response.status_code, 405)\n response = self.client.delete(url)\n self.failUnlessEqual(response.status_code, 405)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L13_C8", "label": "url =", "type": "assigned_variable", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "vector": [14, 2, 0.3824, 0.0294, 2, 0.61, 0.0, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = '/friends/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L14_C8", "label": "response = post()", "type": "assigned_variable", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "vector": [14, 2, 0.4118, 0.0294, 2, 0.61, 0.0526, 511, 3, 1, 0, 0, 304, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "post", "annotation": ""}, "snippet": " response = self.client.post(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Expr_L15_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "vector": [8, 2, 0.4412, 0.0294, 2, 0.61, 0.1053, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 405)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L16_C8", "label": "response = put()", "type": "assigned_variable", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "vector": [14, 2, 0.4706, 0.0294, 2, 0.61, 0.1579, 511, 3, 1, 0, 0, 636, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " response = self.client.put(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Expr_L17_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "vector": [8, 2, 0.5, 0.0294, 2, 0.61, 0.2105, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 405)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L18_C8", "label": "response = delete()", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "vector": [14, 2, 0.5294, 0.0294, 2, 0.61, 0.2632, 511, 3, 1, 0, 0, 266, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " response = self.client.delete(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Expr_L19_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "vector": [8, 2, 0.5588, 0.0294, 2, 0.61, 0.3158, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 405)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L20_C8", "label": "response = get()", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "vector": [14, 2, 0.5882, 0.0294, 2, 0.61, 0.3684, 511, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Expr_L21_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "vector": [8, 2, 0.6176, 0.0294, 2, 0.61, 0.4211, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L23_C8", "label": "url =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "vector": [14, 2, 0.6765, 0.0294, 2, 0.61, 0.4737, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = '/friends/1-2/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L24_C8", "label": "response = post()", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "vector": [14, 2, 0.7059, 0.0294, 2, 0.61, 0.5263, 511, 3, 1, 0, 0, 304, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "post", "annotation": ""}, "snippet": " response = self.client.post(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Expr_L25_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "vector": [8, 2, 0.7353, 0.0294, 2, 0.61, 0.5789, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 405)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L26_C8", "label": "response = put()", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "vector": [14, 2, 0.7647, 0.0294, 2, 0.61, 0.6316, 511, 3, 1, 0, 0, 636, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " response = self.client.put(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Expr_L27_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "vector": [8, 2, 0.7941, 0.0294, 2, 0.61, 0.6842, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 405)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L28_C8", "label": "response = get()", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "vector": [14, 2, 0.8235, 0.0294, 2, 0.61, 0.7368, 511, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Expr_L29_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "vector": [8, 2, 0.8529, 0.0294, 2, 0.61, 0.7895, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L30_C8", "label": "response = delete()", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "vector": [14, 2, 0.8824, 0.0294, 2, 0.61, 0.8421, 511, 3, 1, 0, 0, 266, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " response = self.client.delete(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Expr_L31_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "vector": [8, 2, 0.9118, 0.0294, 2, 0.61, 0.8947, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 302)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L33_C8", "label": "response = get()", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "vector": [14, 2, 0.9706, 0.0294, 2, 0.61, 0.9474, 511, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " response = self.client.get(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1015:Expr_L34_C8", "label": "failUnlessEqual()", "type": "expression", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "vector": [8, 2, 1.0, 0.0294, 2, 0.61, 1.0, 21, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "failUnlessEqual", "arg_names": [], "import_names": [], "rhs_call_name": "failUnlessEqual", "annotation": ""}, "snippet": " self.failUnlessEqual(response.status_code, 404)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1015:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Expr_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Expr_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Expr_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Expr_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Expr_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Expr_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Expr_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Expr_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1015:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1015:Expr_L34_C8"}]
from django.db import models # Create your models here.
ajibawa-2023/Python-Code-Large/train/row_1016
1
3
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1016:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.3333, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["models"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db import models"}]
[]
# Create your views here.
ajibawa-2023/Python-Code-Large/train/row_1017
0
1
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[]
[]
#!/usr/bin/env python from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) sys.exit(1) if __name__ == "__main__": execute_manager(settings)
ajibawa-2023/Python-Code-Large/train/row_1018
8
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_1018:ImportFrom_L2_C0", "label": "from django.core.management import execute_manager", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0909, 0, 0.66, 0.0, 879, 0, 1, 0, 0, 879, 0, 0], "semantic": {"name": "django.core.management", "arg_names": [], "import_names": ["execute_manager"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.management import execute_manager"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1018:Try_L3_C0", "label": "try", "type": "try", "loc": [3, 8], "level": 0, "parent": null, "vector": [7, 0, 0.5, 0.5455, 0, 0.66, 0.5, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n import settings # Assumed to be in the same directory.\nexcept ImportError:\n import sys\n sys.stderr.write(\"Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\\nYou'll have to run django-admin.py, passing it your settings module.\\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\\n\" % __file__)\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1018:Import_L4_C4", "label": "settings import settings", "type": "import", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1018:Try_L3_C0", "vector": [1, 1, 0.3636, 0.0909, 1, 0.98, 0.0, 168, 0, 1, 0, 0, 168, 0, 0], "semantic": {"name": "settings", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": " import settings # Assumed to be in the same directory."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1018:Import_L6_C4", "label": "sys import sys", "type": "import", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1018:Try_L3_C0", "vector": [1, 1, 0.5455, 0.0909, 1, 0.98, 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_1018:Expr_L7_C4", "label": "write()", "type": "expression", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1018:Try_L3_C0", "vector": [8, 1, 0.6364, 0.0909, 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": " sys.stderr.write(\"Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\\nYou'll have to run django-admin.py, passing it your settings module.\\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\\n\" % __file__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1018:Expr_L8_C4", "label": "exit()", "type": "expression", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1018:Try_L3_C0", "vector": [8, 1, 0.7273, 0.0909, 1, 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_1018:If_L10_C0", "label": "if", "type": "if", "loc": [10, 11], "level": 0, "parent": null, "vector": [4, 0, 0.9545, 0.1818, 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 execute_manager(settings)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1018:Expr_L11_C4", "label": "execute_manager()", "type": "expression", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1018:If_L10_C0", "vector": [8, 1, 1.0, 0.0909, 1, 0.55, 0.0, 383, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute_manager", "arg_names": [], "import_names": [], "rhs_call_name": "execute_manager", "annotation": ""}, "snippet": " execute_manager(settings)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1018:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1018:Import_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1018:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1018:Import_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1018:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1018:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1018:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1018:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1018:If_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1018:Expr_L11_C4"}]
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # 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. '''The setup and build script for the python-twitter library.''' __author__ = 'python-twitter@googlegroups.com' __version__ = '0.8.3' # The base package metadata to be used by both distutils and setuptools METADATA = dict( name = "python-twitter", version = __version__, py_modules = ['twitter'], author='The Python-Twitter Developers', author_email='python-twitter@googlegroups.com', description='A python wrapper around the Twitter API', license='Apache License 2.0', url='http://code.google.com/p/python-twitter/', keywords='twitter api', ) # Extra package metadata to be used only if setuptools is installed SETUPTOOLS_METADATA = dict( install_requires = ['setuptools', 'simplejson', 'oauth2'], include_package_data = True, classifiers = [ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'License :: OSI Approved :: Apache Software License', 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Communications :: Chat', 'Topic :: Internet', ], test_suite = 'twitter_test.suite', ) def Read(file): return open(file).read() def BuildLongDescription(): return '\n'.join([Read('README'), Read('CHANGES')]) def Main(): # Build the long_description from the README and CHANGES METADATA['long_description'] = BuildLongDescription() # Use setuptools if available, otherwise fallback and use distutils try: import setuptools METADATA.update(SETUPTOOLS_METADATA) setuptools.setup(**METADATA) except ImportError: import distutils.core distutils.core.setup(**METADATA) if __name__ == '__main__': Main()
ajibawa-2023/Python-Code-Large/train/row_1019
19
73
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1019:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.2329, 0.0137, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''The setup and build script for the python-twitter library.'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1019:Assign_L19_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [19, 19], "level": 0, "parent": null, "vector": [14, 0, 0.2603, 0.0137, 0, 0.66, 0.125, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = 'python-twitter@googlegroups.com'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1019:Assign_L20_C0", "label": "__version__ =", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.274, 0.0137, 0, 0.66, 0.25, 162, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__version__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__version__ = '0.8.3'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1019:Assign_L24_C0", "label": "METADATA = dict()", "type": "assigned_variable", "loc": [24, 34], "level": 0, "parent": null, "vector": [14, 0, 0.3973, 0.1507, 0, 0.66, 0.375, 622, 3, 9, 0, 0, 827, 10, 1], "semantic": {"name": "METADATA", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": "METADATA = dict(\n name = \"python-twitter\",\n version = __version__,\n py_modules = ['twitter'],\n author='The Python-Twitter Developers',\n author_email='python-twitter@googlegroups.com',\n description='A python wrapper around the Twitter API',\n license='Apache License 2.0',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1019:Assign_L37_C0", "label": "SETUPTOOLS_METADATA = dict()", "type": "assigned_variable", "loc": [37, 49], "level": 0, "parent": null, "vector": [14, 0, 0.589, 0.1781, 0, 0.66, 0.5, 22, 3, 4, 0, 0, 827, 10, 1], "semantic": {"name": "SETUPTOOLS_METADATA", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": "SETUPTOOLS_METADATA = dict(\n install_requires = ['setuptools', 'simplejson', 'oauth2'],\n include_package_data = True,\n classifiers = [\n 'Development Status :: 4 - Beta',\n 'Intended Audience :: Developers',\n 'License :: OSI Approved :: Apache Software License',\n 'Topic :: Software Development :: Libraries :: Python Modules',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1019:FunctionDef_L52_C0", "label": "Read", "type": "function", "loc": [52, 53], "level": 0, "parent": null, "vector": [2, 0, 0.7192, 0.0274, 0, 0.66, 0.625, 771, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "Read", "arg_names": ["file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Read(file):\n return open(file).read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1019:Return_L53_C2", "label": "return", "type": "return", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1019:FunctionDef_L52_C0", "vector": [13, 1, 0.726, 0.0137, 1, 0.84, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return open(file).read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1019:FunctionDef_L55_C0", "label": "BuildLongDescription", "type": "function", "loc": [55, 56], "level": 0, "parent": null, "vector": [2, 0, 0.7603, 0.0274, 0, 0.66, 0.75, 383, 0, 0, 1, 0, 0, 0, 3], "semantic": {"name": "BuildLongDescription", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def BuildLongDescription():\n return '\\n'.join([Read('README'), Read('CHANGES')])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1019:Return_L56_C2", "label": "return", "type": "return", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1019:FunctionDef_L55_C0", "vector": [13, 1, 0.7671, 0.0137, 1, 0.84, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\\n'.join([Read('README'), Read('CHANGES')])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1019:FunctionDef_L58_C0", "label": "Main", "type": "function", "loc": [58, 69], "level": 0, "parent": null, "vector": [2, 0, 0.8699, 0.1644, 0, 0.66, 0.875, 16, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "Main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Main():\n # Build the long_description from the README and CHANGES\n METADATA['long_description'] = BuildLongDescription()\n\n # Use setuptools if available, otherwise fallback and use distutils\n try:\n import setuptools\n METADATA.update(SETUPTOOLS_METADATA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1019:Assign_L60_C2", "label": " = BuildLongDescription()", "type": "assigned_variable", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1019:FunctionDef_L58_C0", "vector": [14, 1, 0.8219, 0.0137, 1, 0.35, 0.0, 0, 3, 0, 0, 0, 383, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "BuildLongDescription", "annotation": ""}, "snippet": " METADATA['long_description'] = BuildLongDescription()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1019:Try_L63_C2", "label": "try", "type": "try", "loc": [63, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1019:FunctionDef_L58_C0", "vector": [7, 1, 0.9041, 0.0959, 1, 0.35, 1.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n import setuptools\n METADATA.update(SETUPTOOLS_METADATA)\n setuptools.setup(**METADATA)\n except ImportError:\n import distutils.core\n distutils.core.setup(**METADATA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1019:Import_L64_C4", "label": "setuptools import setuptools", "type": "import", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1019:Try_L63_C2", "vector": [1, 2, 0.8767, 0.0137, 2, 0.35, 0.0, 182, 0, 1, 0, 0, 182, 0, 0], "semantic": {"name": "setuptools", "arg_names": [], "import_names": ["setuptools"], "rhs_call_name": "", "annotation": ""}, "snippet": " import setuptools"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1019:Expr_L65_C4", "label": "update()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1019:Try_L63_C2", "vector": [8, 2, 0.8904, 0.0137, 2, 0.35, 0.5, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " METADATA.update(SETUPTOOLS_METADATA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1019:Expr_L66_C4", "label": "setup()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1019:Try_L63_C2", "vector": [8, 2, 0.9041, 0.0137, 2, 0.35, 1.0, 234, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setup", "arg_names": [], "import_names": [], "rhs_call_name": "setup", "annotation": ""}, "snippet": " setuptools.setup(**METADATA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1019:Import_L68_C4", "label": "distutils.core import distutils.core", "type": "import", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1019:Try_L63_C2", "vector": [1, 2, 0.9315, 0.0137, 2, 0.35, 0.0, 152, 0, 1, 0, 0, 152, 0, 0], "semantic": {"name": "distutils.core", "arg_names": [], "import_names": ["distutils.core"], "rhs_call_name": "", "annotation": ""}, "snippet": " import distutils.core"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1019:Expr_L69_C4", "label": "setup()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1019:Try_L63_C2", "vector": [8, 2, 0.9452, 0.0137, 2, 0.35, 1.0, 234, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setup", "arg_names": [], "import_names": [], "rhs_call_name": "setup", "annotation": ""}, "snippet": " distutils.core.setup(**METADATA)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1019:If_L72_C0", "label": "if", "type": "if", "loc": [72, 73], "level": 0, "parent": null, "vector": [4, 0, 0.9932, 0.0274, 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_1019:Expr_L73_C2", "label": "Main()", "type": "expression", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1019:If_L72_C0", "vector": [8, 1, 1.0, 0.0137, 1, 0.45, 0.0, 16, 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_1019:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1019:Return_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1019:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1019:Return_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1019:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1019:Assign_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1019:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1019:Try_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1019:Try_L63_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1019:Import_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1019:Try_L63_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1019:Expr_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1019:Try_L63_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1019:Expr_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1019:Try_L63_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1019:Import_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1019:Try_L63_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1019:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1019:If_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1019:Expr_L73_C2"}]
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import os import sys # parse_qsl moved to urlparse module in v2.6 try: from urlparse import parse_qsl except: from cgi import parse_qsl import oauth2 as oauth REQUEST_TOKEN_URL = 'https://api.twitter.com/oauth/request_token' ACCESS_TOKEN_URL = 'https://api.twitter.com/oauth/access_token' AUTHORIZATION_URL = 'https://api.twitter.com/oauth/authorize' SIGNIN_URL = 'https://api.twitter.com/oauth/authenticate' consumer_key = None consumer_secret = None if consumer_key is None or consumer_secret is None: print 'You need to edit this script and provide values for the' print 'consumer_key and also consumer_secret.' print '' print 'The values you need come from Twitter - you need to register' print 'as a developer your "application". This is needed only until' print 'Twitter finishes the idea they have of a way to allow open-source' print 'based libraries to have a token that can be used to generate a' print 'one-time use key that will allow the library to make the request' print 'on your behalf.' print '' sys.exit(1) signature_method_hmac_sha1 = oauth.SignatureMethod_HMAC_SHA1() oauth_consumer = oauth.Consumer(key=consumer_key, secret=consumer_secret) oauth_client = oauth.Client(oauth_consumer) print 'Requesting temp token from Twitter' resp, content = oauth_client.request(REQUEST_TOKEN_URL, 'GET') if resp['status'] != '200': print 'Invalid respond from Twitter requesting temp token: %s' % resp['status'] else: request_token = dict(parse_qsl(content)) print '' print 'Please visit this Twitter page and retrieve the pincode to be used' print 'in the next step to obtaining an Authentication Token:' print '' print '%s?oauth_token=%s' % (AUTHORIZATION_URL, request_token['oauth_token']) print '' pincode = raw_input('Pincode? ') token = oauth.Token(request_token['oauth_token'], request_token['oauth_token_secret']) token.set_verifier(pincode) print '' print 'Generating and signing request for an access token' print '' oauth_client = oauth.Client(oauth_consumer, token) resp, content = oauth_client.request(ACCESS_TOKEN_URL, method='POST', body='oauth_verifier=%s' % pincode) access_token = dict(parse_qsl(content)) if resp['status'] != '200': print 'The request for a Token did not succeed: %s' % resp['status'] print access_token else: print 'Your Twitter Access Token key: %s' % access_token['oauth_token'] print ' Access Token secret: %s' % access_token['oauth_token_secret'] print ''
ajibawa-2023/Python-Code-Large/train/row_1020
53
90
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Import_L18_C0", "label": "os import os", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.0111, 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_1020:Import_L19_C0", "label": "sys import sys", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.2111, 0.0111, 0, 0.66, 0.0625, 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_1020:Try_L22_C0", "label": "try", "type": "try", "loc": [22, 25], "level": 0, "parent": null, "vector": [7, 0, 0.2611, 0.0444, 0, 0.66, 0.125, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from urlparse import parse_qsl\nexcept:\n from cgi import parse_qsl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:ImportFrom_L23_C2", "label": "from urlparse import parse_qsl", "type": "import", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:Try_L22_C0", "vector": [1, 1, 0.2556, 0.0111, 1, 0.47, 0.0, 857, 0, 1, 0, 0, 857, 0, 0], "semantic": {"name": "urlparse", "arg_names": [], "import_names": ["parse_qsl"], "rhs_call_name": "", "annotation": ""}, "snippet": " from urlparse import parse_qsl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:ImportFrom_L25_C2", "label": "from cgi import parse_qsl", "type": "import", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:Try_L22_C0", "vector": [1, 1, 0.2778, 0.0111, 1, 0.47, 0.0, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["parse_qsl"], "rhs_call_name": "", "annotation": ""}, "snippet": " from cgi import parse_qsl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Import_L27_C0", "label": "oauth2 import oauth", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.3, 0.0111, 0, 0.66, 0.1875, 311, 0, 1, 0, 0, 311, 0, 0], "semantic": {"name": "oauth2", "arg_names": [], "import_names": ["oauth"], "rhs_call_name": "", "annotation": ""}, "snippet": "import oauth2 as oauth"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Assign_L29_C0", "label": "REQUEST_TOKEN_URL =", "type": "assigned_variable", "loc": [29, 29], "level": 0, "parent": null, "vector": [14, 0, 0.3222, 0.0111, 0, 0.66, 0.25, 456, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "REQUEST_TOKEN_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "REQUEST_TOKEN_URL = 'https://api.twitter.com/oauth/request_token'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Assign_L30_C0", "label": "ACCESS_TOKEN_URL =", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.3333, 0.0111, 0, 0.66, 0.3125, 469, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ACCESS_TOKEN_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ACCESS_TOKEN_URL = 'https://api.twitter.com/oauth/access_token'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Assign_L31_C0", "label": "AUTHORIZATION_URL =", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.3444, 0.0111, 0, 0.66, 0.375, 473, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "AUTHORIZATION_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "AUTHORIZATION_URL = 'https://api.twitter.com/oauth/authorize'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Assign_L32_C0", "label": "SIGNIN_URL =", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.3556, 0.0111, 0, 0.66, 0.4375, 800, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SIGNIN_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SIGNIN_URL = 'https://api.twitter.com/oauth/authenticate'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Assign_L34_C0", "label": "consumer_key =", "type": "assigned_variable", "loc": [34, 34], "level": 0, "parent": null, "vector": [14, 0, 0.3778, 0.0111, 0, 0.66, 0.5, 353, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "consumer_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "consumer_key = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Assign_L35_C0", "label": "consumer_secret =", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 0.3889, 0.0111, 0, 0.66, 0.5625, 734, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "consumer_secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "consumer_secret = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "label": "if", "type": "if", "loc": [37, 48], "level": 0, "parent": null, "vector": [4, 0, 0.4722, 0.1333, 0, 0.66, 0.625, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if consumer_key is None or consumer_secret is None:\n print('You need to edit this script and provide values for the')\n print('consumer_key and also consumer_secret.')\n print('')\n print('The values you need come from Twitter - you need to register')\n print('as a developer your \"application\". This is needed only until')\n print('Twitter finishes the idea they have of a way to allow open-source')\n print('based libraries to have a token that can be used to generate a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L38_C2", "label": "print()", "type": "expression", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "vector": [8, 1, 0.4222, 0.0111, 1, 0.66, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('You need to edit this script and provide values for the')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L39_C2", "label": "print()", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "vector": [8, 1, 0.4333, 0.0111, 1, 0.66, 0.1, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('consumer_key and also consumer_secret.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L40_C2", "label": "print()", "type": "expression", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "vector": [8, 1, 0.4444, 0.0111, 1, 0.66, 0.2, 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_1020:Expr_L41_C2", "label": "print()", "type": "expression", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "vector": [8, 1, 0.4556, 0.0111, 1, 0.66, 0.3, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('The values you need come from Twitter - you need to register')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L42_C2", "label": "print()", "type": "expression", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "vector": [8, 1, 0.4667, 0.0111, 1, 0.66, 0.4, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('as a developer your \"application\". This is needed only until')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L43_C2", "label": "print()", "type": "expression", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "vector": [8, 1, 0.4778, 0.0111, 1, 0.66, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Twitter finishes the idea they have of a way to allow open-source')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L44_C2", "label": "print()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "vector": [8, 1, 0.4889, 0.0111, 1, 0.66, 0.6, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('based libraries to have a token that can be used to generate a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L45_C2", "label": "print()", "type": "expression", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "vector": [8, 1, 0.5, 0.0111, 1, 0.66, 0.7, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('one-time use key that will allow the library to make the request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L46_C2", "label": "print()", "type": "expression", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "vector": [8, 1, 0.5111, 0.0111, 1, 0.66, 0.8, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('on your behalf.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L47_C2", "label": "print()", "type": "expression", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "vector": [8, 1, 0.5222, 0.0111, 1, 0.66, 0.9, 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_1020:Expr_L48_C2", "label": "exit()", "type": "expression", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "vector": [8, 1, 0.5333, 0.0111, 1, 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_1020:Assign_L50_C0", "label": "signature_method_hmac_sha1 = SignatureMethod_HMAC_SHA1()", "type": "assigned_variable", "loc": [50, 50], "level": 0, "parent": null, "vector": [14, 0, 0.5556, 0.0111, 0, 0.66, 0.6875, 705, 3, 0, 0, 0, 948, 10, 1], "semantic": {"name": "signature_method_hmac_sha1", "arg_names": [], "import_names": [], "rhs_call_name": "SignatureMethod_HMAC_SHA1", "annotation": ""}, "snippet": "signature_method_hmac_sha1 = oauth.SignatureMethod_HMAC_SHA1()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Assign_L51_C0", "label": "oauth_consumer = Consumer()", "type": "assigned_variable", "loc": [51, 51], "level": 0, "parent": null, "vector": [14, 0, 0.5667, 0.0111, 0, 0.66, 0.75, 316, 3, 2, 0, 0, 881, 10, 1], "semantic": {"name": "oauth_consumer", "arg_names": [], "import_names": [], "rhs_call_name": "Consumer", "annotation": ""}, "snippet": "oauth_consumer = oauth.Consumer(key=consumer_key, secret=consumer_secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Assign_L52_C0", "label": "oauth_client = Client()", "type": "assigned_variable", "loc": [52, 52], "level": 0, "parent": null, "vector": [14, 0, 0.5778, 0.0111, 0, 0.66, 0.8125, 671, 3, 1, 0, 0, 412, 10, 1], "semantic": {"name": "oauth_client", "arg_names": [], "import_names": [], "rhs_call_name": "Client", "annotation": ""}, "snippet": "oauth_client = oauth.Client(oauth_consumer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L54_C0", "label": "print()", "type": "expression", "loc": [54, 54], "level": 0, "parent": null, "vector": [8, 0, 0.6, 0.0111, 0, 0.66, 0.875, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('Requesting temp token from Twitter')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Assign_L56_C0", "label": "resp, content = request()", "type": "assigned_variable", "loc": [56, 56], "level": 0, "parent": null, "vector": [14, 0, 0.6222, 0.0111, 0, 0.66, 0.9375, 339, 3, 2, 0, 0, 50, 10, 1], "semantic": {"name": "resp, content", "arg_names": [], "import_names": [], "rhs_call_name": "request", "annotation": ""}, "snippet": "resp, content = oauth_client.request(REQUEST_TOKEN_URL, 'GET')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "label": "if", "type": "if", "loc": [58, 89], "level": 0, "parent": null, "vector": [4, 0, 0.8167, 0.3556, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 24], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if resp['status'] != '200':\n print('Invalid respond from Twitter requesting temp token: %s' % resp['status'])\nelse:\n request_token = dict(parse_qsl(content))\n\n print('')\n print('Please visit this Twitter page and retrieve the pincode to be used')\n print('in the next step to obtaining an Authentication Token:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L59_C2", "label": "print()", "type": "expression", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "vector": [8, 1, 0.6556, 0.0111, 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('Invalid respond from Twitter requesting temp token: %s' % resp['status'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Assign_L61_C2", "label": "request_token = dict()", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "vector": [14, 1, 0.6778, 0.0111, 1, 0.96, 0.0588, 279, 3, 1, 0, 0, 827, 10, 2], "semantic": {"name": "request_token", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " request_token = dict(parse_qsl(content))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L63_C2", "label": "print()", "type": "expression", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "vector": [8, 1, 0.7, 0.0111, 1, 0.96, 0.1176, 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_1020:Expr_L64_C2", "label": "print()", "type": "expression", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "vector": [8, 1, 0.7111, 0.0111, 1, 0.96, 0.1765, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Please visit this Twitter page and retrieve the pincode to be used')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L65_C2", "label": "print()", "type": "expression", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "vector": [8, 1, 0.7222, 0.0111, 1, 0.96, 0.2353, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('in the next step to obtaining an Authentication Token:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L66_C2", "label": "print()", "type": "expression", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "vector": [8, 1, 0.7333, 0.0111, 1, 0.96, 0.2941, 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_1020:Expr_L67_C2", "label": "print()", "type": "expression", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "vector": [8, 1, 0.7444, 0.0111, 1, 0.96, 0.3529, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%s?oauth_token=%s' % (AUTHORIZATION_URL, request_token['oauth_token']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L68_C2", "label": "print()", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "vector": [8, 1, 0.7556, 0.0111, 1, 0.96, 0.4118, 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_1020:Assign_L70_C2", "label": "pincode = raw_input()", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "vector": [14, 1, 0.7778, 0.0111, 1, 0.96, 0.4706, 437, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "pincode", "arg_names": [], "import_names": [], "rhs_call_name": "raw_input", "annotation": ""}, "snippet": " pincode = raw_input('Pincode? ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Assign_L72_C2", "label": "token = Token()", "type": "assigned_variable", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "vector": [14, 1, 0.8, 0.0111, 1, 0.96, 0.5294, 129, 3, 2, 0, 0, 92, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "Token", "annotation": ""}, "snippet": " token = oauth.Token(request_token['oauth_token'], request_token['oauth_token_secret'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L73_C2", "label": "set_verifier()", "type": "expression", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "vector": [8, 1, 0.8111, 0.0111, 1, 0.96, 0.5882, 943, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_verifier", "arg_names": [], "import_names": [], "rhs_call_name": "set_verifier", "annotation": ""}, "snippet": " token.set_verifier(pincode)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L75_C2", "label": "print()", "type": "expression", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "vector": [8, 1, 0.8333, 0.0111, 1, 0.96, 0.6471, 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_1020:Expr_L76_C2", "label": "print()", "type": "expression", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "vector": [8, 1, 0.8444, 0.0111, 1, 0.96, 0.7059, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Generating and signing request for an access token')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L77_C2", "label": "print()", "type": "expression", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "vector": [8, 1, 0.8556, 0.0111, 1, 0.96, 0.7647, 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_1020:Assign_L79_C2", "label": "oauth_client = Client()", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "vector": [14, 1, 0.8778, 0.0111, 1, 0.96, 0.8235, 671, 3, 2, 0, 0, 412, 10, 1], "semantic": {"name": "oauth_client", "arg_names": [], "import_names": [], "rhs_call_name": "Client", "annotation": ""}, "snippet": " oauth_client = oauth.Client(oauth_consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Assign_L80_C2", "label": "resp, content = request()", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "vector": [14, 1, 0.8889, 0.0111, 1, 0.96, 0.8824, 339, 3, 3, 0, 0, 50, 10, 1], "semantic": {"name": "resp, content", "arg_names": [], "import_names": [], "rhs_call_name": "request", "annotation": ""}, "snippet": " resp, content = oauth_client.request(ACCESS_TOKEN_URL, method='POST', body='oauth_verifier=%s' % pincode)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Assign_L81_C2", "label": "access_token = dict()", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "vector": [14, 1, 0.9, 0.0111, 1, 0.96, 0.9412, 797, 3, 1, 0, 0, 827, 10, 2], "semantic": {"name": "access_token", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " access_token = dict(parse_qsl(content))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L83_C2", "label": "if", "type": "if", "loc": [83, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "vector": [4, 1, 0.9556, 0.0778, 1, 0.96, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if resp['status'] != '200':\n print('The request for a Token did not succeed: %s' % resp['status'])\n print(access_token)\n else:\n print('Your Twitter Access Token key: %s' % access_token['oauth_token'])\n print(' Access Token secret: %s' % access_token['oauth_token_secret'])\n print('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L84_C4", "label": "print()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L83_C2", "vector": [8, 2, 0.9333, 0.0111, 2, 0.15, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('The request for a Token did not succeed: %s' % resp['status'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L85_C4", "label": "print()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L83_C2", "vector": [8, 2, 0.9444, 0.0111, 2, 0.15, 0.25, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(access_token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L87_C4", "label": "print()", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L83_C2", "vector": [8, 2, 0.9667, 0.0111, 2, 0.15, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Your Twitter Access Token key: %s' % access_token['oauth_token'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L88_C4", "label": "print()", "type": "expression", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L83_C2", "vector": [8, 2, 0.9778, 0.0111, 2, 0.15, 0.75, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(' Access Token secret: %s' % access_token['oauth_token_secret'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L89_C4", "label": "print()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L83_C2", "vector": [8, 2, 0.9889, 0.0111, 2, 0.15, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('')"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1020:Try_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:ImportFrom_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:Try_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:ImportFrom_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Assign_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L68_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Assign_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Assign_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Assign_L79_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Assign_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Assign_L81_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1020:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1020:Expr_L89_C4"}]
"""Implementation of JSONEncoder """ import re try: from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii except ImportError: c_encode_basestring_ascii = None try: from simplejson._speedups import make_encoder as c_make_encoder except ImportError: c_make_encoder = None ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]') ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])') HAS_UTF8 = re.compile(r'[\x80-\xff]') ESCAPE_DCT = { '\\': '\\\\', '"': '\\"', '\b': '\\b', '\f': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t', } for i in range(0x20): ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,)) # Assume this produces an infinity on all machines (probably not guaranteed) INFINITY = float('1e66666') FLOAT_REPR = repr def encode_basestring(s): """Return a JSON representation of a Python string """ def replace(match): return ESCAPE_DCT[match.group(0)] return '"' + ESCAPE.sub(replace, s) + '"' def py_encode_basestring_ascii(s): """Return an ASCII-only JSON representation of a Python string """ if isinstance(s, str) and HAS_UTF8.search(s) is not None: s = s.decode('utf-8') def replace(match): s = match.group(0) try: return ESCAPE_DCT[s] except KeyError: n = ord(s) if n < 0x10000: return '\\u%04x' % (n,) else: # surrogate pair n -= 0x10000 s1 = 0xd800 | ((n >> 10) & 0x3ff) s2 = 0xdc00 | (n & 0x3ff) return '\\u%04x\\u%04x' % (s1, s2) return '"' + str(ESCAPE_ASCII.sub(replace, s)) + '"' encode_basestring_ascii = c_encode_basestring_ascii or py_encode_basestring_ascii class JSONEncoder(object): """Extensible JSON <http://json.org> encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str, unicode | string | +-------------------+---------------+ | int, long, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). """ item_separator = ', ' key_separator = ': ' def __init__(self, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, encoding='utf-8', default=None): """Constructor for JSONEncoder, with sensible defaults. If skipkeys is False, then it is a TypeError to attempt encoding of keys that are not str, int, long, float or None. If skipkeys is True, such items are simply skipped. If ensure_ascii is True, the output is guaranteed to be str objects with all incoming unicode characters escaped. If ensure_ascii is false, the output will be unicode object. If check_circular is True, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place. If allow_nan is True, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is True, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. If specified, separators should be a (item_separator, key_separator) tuple. The default is (', ', ': '). To get the most compact JSON representation you should specify (',', ':') to eliminate whitespace. If specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. If encoding is not None, then all input strings will be transformed into unicode using that encoding prior to JSON-encoding. The default is UTF-8. """ self.skipkeys = skipkeys self.ensure_ascii = ensure_ascii self.check_circular = check_circular self.allow_nan = allow_nan self.sort_keys = sort_keys self.indent = indent if separators is not None: self.item_separator, self.key_separator = separators if default is not None: self.default = default self.encoding = encoding def default(self, o): """Implement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) return JSONEncoder.default(self, o) """ raise TypeError("%r is not JSON serializable" % (o,)) def encode(self, o): """Return a JSON string representation of a Python data structure. >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' """ # This is for extremely simple cases and benchmarks. if isinstance(o, basestring): if isinstance(o, str): _encoding = self.encoding if (_encoding is not None and not (_encoding == 'utf-8')): o = o.decode(_encoding) if self.ensure_ascii: return encode_basestring_ascii(o) else: return encode_basestring(o) # This doesn't pass the iterator directly to ''.join() because the # exceptions aren't as detailed. The list call should be roughly # equivalent to the PySequence_Fast that ''.join() would do. chunks = self.iterencode(o, _one_shot=True) if not isinstance(chunks, (list, tuple)): chunks = list(chunks) return ''.join(chunks) def iterencode(self, o, _one_shot=False): """Encode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) """ if self.check_circular: markers = {} else: markers = None if self.ensure_ascii: _encoder = encode_basestring_ascii else: _encoder = encode_basestring if self.encoding != 'utf-8': def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding): if isinstance(o, str): o = o.decode(_encoding) return _orig_encoder(o) def floatstr(o, allow_nan=self.allow_nan, _repr=FLOAT_REPR, _inf=INFINITY, _neginf=-INFINITY): # Check for specials. Note that this type of test is processor- and/or # platform-specific, so do tests which don't depend on the internals. if o != o: text = 'NaN' elif o == _inf: text = 'Infinity' elif o == _neginf: text = '-Infinity' else: return _repr(o) if not allow_nan: raise ValueError("Out of range float values are not JSON compliant: %r" % (o,)) return text if _one_shot and c_make_encoder is not None and not self.indent and not self.sort_keys: _iterencode = c_make_encoder( markers, self.default, _encoder, self.indent, self.key_separator, self.item_separator, self.sort_keys, self.skipkeys, self.allow_nan) else: _iterencode = _make_iterencode( markers, self.default, _encoder, self.indent, floatstr, self.key_separator, self.item_separator, self.sort_keys, self.skipkeys, _one_shot) return _iterencode(o, 0) def _make_iterencode(markers, _default, _encoder, _indent, _floatstr, _key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot, ## HACK: hand-optimized bytecode; turn globals into locals False=False, True=True, ValueError=ValueError, basestring=basestring, dict=dict, float=float, id=id, int=int, isinstance=isinstance, list=list, long=long, str=str, tuple=tuple, ): def _iterencode_list(lst, _current_indent_level): if not lst: yield '[]' return if markers is not None: markerid = id(lst) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = lst buf = '[' if _indent is not None: _current_indent_level += 1 newline_indent = '\n' + (' ' * (_indent * _current_indent_level)) separator = _item_separator + newline_indent buf += newline_indent else: newline_indent = None separator = _item_separator first = True for value in lst: if first: first = False else: buf = separator if isinstance(value, basestring): yield buf + _encoder(value) elif value is None: yield buf + 'null' elif value is True: yield buf + 'true' elif value is False: yield buf + 'false' elif isinstance(value, (int, long)): yield buf + str(value) elif isinstance(value, float): yield buf + _floatstr(value) else: yield buf if isinstance(value, (list, tuple)): chunks = _iterencode_list(value, _current_indent_level) elif isinstance(value, dict): chunks = _iterencode_dict(value, _current_indent_level) else: chunks = _iterencode(value, _current_indent_level) for chunk in chunks: yield chunk if newline_indent is not None: _current_indent_level -= 1 yield '\n' + (' ' * (_indent * _current_indent_level)) yield ']' if markers is not None: del markers[markerid] def _iterencode_dict(dct, _current_indent_level): if not dct: yield '{}' return if markers is not None: markerid = id(dct) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = dct yield '{' if _indent is not None: _current_indent_level += 1 newline_indent = '\n' + (' ' * (_indent * _current_indent_level)) item_separator = _item_separator + newline_indent yield newline_indent else: newline_indent = None item_separator = _item_separator first = True if _sort_keys: items = dct.items() items.sort(key=lambda kv: kv[0]) else: items = dct.iteritems() for key, value in items: if isinstance(key, basestring): pass # JavaScript is weakly typed for these, so it makes sense to # also allow them. Many encoders seem to do something like this. elif isinstance(key, float): key = _floatstr(key) elif isinstance(key, (int, long)): key = str(key) elif key is True: key = 'true' elif key is False: key = 'false' elif key is None: key = 'null' elif _skipkeys: continue else: raise TypeError("key %r is not a string" % (key,)) if first: first = False else: yield item_separator yield _encoder(key) yield _key_separator if isinstance(value, basestring): yield _encoder(value) elif value is None: yield 'null' elif value is True: yield 'true' elif value is False: yield 'false' elif isinstance(value, (int, long)): yield str(value) elif isinstance(value, float): yield _floatstr(value) else: if isinstance(value, (list, tuple)): chunks = _iterencode_list(value, _current_indent_level) elif isinstance(value, dict): chunks = _iterencode_dict(value, _current_indent_level) else: chunks = _iterencode(value, _current_indent_level) for chunk in chunks: yield chunk if newline_indent is not None: _current_indent_level -= 1 yield '\n' + (' ' * (_indent * _current_indent_level)) yield '}' if markers is not None: del markers[markerid] def _iterencode(o, _current_indent_level): if isinstance(o, basestring): yield _encoder(o) elif o is None: yield 'null' elif o is True: yield 'true' elif o is False: yield 'false' elif isinstance(o, (int, long)): yield str(o) elif isinstance(o, float): yield _floatstr(o) elif isinstance(o, (list, tuple)): for chunk in _iterencode_list(o, _current_indent_level): yield chunk elif isinstance(o, dict): for chunk in _iterencode_dict(o, _current_indent_level): yield chunk else: if markers is not None: markerid = id(o) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = o o = _default(o) for chunk in _iterencode(o, _current_indent_level): yield chunk if markers is not None: del markers[markerid] return _iterencode
ajibawa-2023/Python-Code-Large/train/row_1021
230
434
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 2], "level": 0, "parent": null, "vector": [8, 0, 0.0035, 0.0046, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Implementation of JSONEncoder\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Import_L3_C0", "label": "re import re", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0069, 0.0023, 0, 0.66, 0.0667, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Try_L5_C0", "label": "try", "type": "try", "loc": [5, 8], "level": 0, "parent": null, "vector": [7, 0, 0.015, 0.0092, 0, 0.66, 0.1333, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii\nexcept ImportError:\n c_encode_basestring_ascii = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:ImportFrom_L6_C4", "label": "from simplejson._speedups import c_encode_basestring_ascii", "type": "import", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:Try_L5_C0", "vector": [1, 1, 0.0138, 0.0023, 1, 0.82, 0.0, 976, 0, 1, 0, 0, 976, 0, 0], "semantic": {"name": "simplejson._speedups", "arg_names": [], "import_names": ["c_encode_basestring_ascii"], "rhs_call_name": "", "annotation": ""}, "snippet": " from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L8_C4", "label": "c_encode_basestring_ascii =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:Try_L5_C0", "vector": [14, 1, 0.0184, 0.0023, 1, 0.82, 0.0, 485, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "c_encode_basestring_ascii", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_encode_basestring_ascii = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Try_L9_C0", "label": "try", "type": "try", "loc": [9, 12], "level": 0, "parent": null, "vector": [7, 0, 0.0242, 0.0092, 0, 0.66, 0.2, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from simplejson._speedups import make_encoder as c_make_encoder\nexcept ImportError:\n c_make_encoder = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:ImportFrom_L10_C4", "label": "from simplejson._speedups import c_make_encoder", "type": "import", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:Try_L9_C0", "vector": [1, 1, 0.023, 0.0023, 1, 0.77, 0.0, 976, 0, 1, 0, 0, 976, 0, 0], "semantic": {"name": "simplejson._speedups", "arg_names": [], "import_names": ["c_make_encoder"], "rhs_call_name": "", "annotation": ""}, "snippet": " from simplejson._speedups import make_encoder as c_make_encoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L12_C4", "label": "c_make_encoder =", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:Try_L9_C0", "vector": [14, 1, 0.0276, 0.0023, 1, 0.77, 0.0, 30, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "c_make_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_make_encoder = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L14_C0", "label": "ESCAPE = compile()", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.0323, 0.0023, 0, 0.66, 0.2667, 562, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "ESCAPE", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "ESCAPE = re.compile(r'[\\x00-\\x1f\\\\\"\\b\\f\\n\\r\\t]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L15_C0", "label": "ESCAPE_ASCII = compile()", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.0346, 0.0023, 0, 0.66, 0.3333, 214, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "ESCAPE_ASCII", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "ESCAPE_ASCII = re.compile(r'([\\\\\"]|[^\\ -~])')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L16_C0", "label": "HAS_UTF8 = compile()", "type": "assigned_variable", "loc": [16, 16], "level": 0, "parent": null, "vector": [14, 0, 0.0369, 0.0023, 0, 0.66, 0.4, 954, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "HAS_UTF8", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "HAS_UTF8 = re.compile(r'[\\x80-\\xff]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L17_C0", "label": "ESCAPE_DCT =", "type": "assigned_variable", "loc": [17, 25], "level": 0, "parent": null, "vector": [14, 0, 0.0484, 0.0207, 0, 0.66, 0.4667, 404, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "ESCAPE_DCT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ESCAPE_DCT = {\n '\\\\': '\\\\\\\\',\n '\"': '\\\\\"',\n '\\b': '\\\\b',\n '\\f': '\\\\f',\n '\\n': '\\\\n',\n '\\r': '\\\\r',\n '\\t': '\\\\t',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L26_C0", "label": "for i", "type": "for", "loc": [26, 27], "level": 0, "parent": null, "vector": [6, 0, 0.0611, 0.0046, 0, 0.66, 0.5333, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(0x20):\n ESCAPE_DCT.setdefault(chr(i), '\\\\u%04x' % (i,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L27_C4", "label": "setdefault()", "type": "expression", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L26_C0", "vector": [8, 1, 0.0622, 0.0023, 1, 0.1, 0.0, 262, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " ESCAPE_DCT.setdefault(chr(i), '\\\\u%04x' % (i,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L30_C0", "label": "INFINITY = float()", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.0691, 0.0023, 0, 0.66, 0.6, 681, 3, 1, 0, 0, 639, 10, 1], "semantic": {"name": "INFINITY", "arg_names": [], "import_names": [], "rhs_call_name": "float", "annotation": ""}, "snippet": "INFINITY = float('1e66666')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L31_C0", "label": "FLOAT_REPR =", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.0714, 0.0023, 0, 0.66, 0.6667, 39, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "FLOAT_REPR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "FLOAT_REPR = repr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L33_C0", "label": "encode_basestring", "type": "function", "loc": [33, 39], "level": 0, "parent": null, "vector": [2, 0, 0.0829, 0.0161, 0, 0.66, 0.7333, 207, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "encode_basestring", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def encode_basestring(s):\n \"\"\"Return a JSON representation of a Python string\n\n \"\"\"\n def replace(match):\n return ESCAPE_DCT[match.group(0)]\n return '\"' + ESCAPE.sub(replace, s) + '\"'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L34_C4", "label": "expression", "type": "expression", "loc": [34, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L33_C0", "vector": [8, 1, 0.0806, 0.0069, 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 JSON representation of a Python string\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L37_C4", "label": "replace", "type": "function", "loc": [37, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L33_C0", "vector": [2, 1, 0.0864, 0.0046, 1, 0.11, 0.5, 293, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "replace", "arg_names": ["match"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def replace(match):\n return ESCAPE_DCT[match.group(0)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L38_C8", "label": "return", "type": "return", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L37_C4", "vector": [13, 2, 0.0876, 0.0023, 2, 0.08, 0.0, 0, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ESCAPE_DCT[match.group(0)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L39_C4", "label": "return", "type": "return", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L33_C0", "vector": [13, 1, 0.0899, 0.0023, 1, 0.11, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\"' + ESCAPE.sub(replace, s) + '\"'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L42_C0", "label": "py_encode_basestring_ascii", "type": "function", "loc": [42, 62], "level": 0, "parent": null, "vector": [2, 0, 0.1198, 0.0484, 0, 0.66, 0.8, 438, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "py_encode_basestring_ascii", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def py_encode_basestring_ascii(s):\n \"\"\"Return an ASCII-only JSON representation of a Python string\n\n \"\"\"\n if isinstance(s, str) and HAS_UTF8.search(s) is not None:\n s = s.decode('utf-8')\n def replace(match):\n s = match.group(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L43_C4", "label": "expression", "type": "expression", "loc": [43, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L42_C0", "vector": [8, 1, 0.1014, 0.0069, 1, 0.51, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return an ASCII-only JSON representation of a Python string\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L46_C4", "label": "if", "type": "if", "loc": [46, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L42_C0", "vector": [4, 1, 0.1071, 0.0046, 1, 0.51, 0.3333, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(s, str) and HAS_UTF8.search(s) is not None:\n s = s.decode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L47_C8", "label": "s = decode()", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L46_C4", "vector": [14, 2, 0.1083, 0.0023, 2, 0.76, 0.0, 553, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " s = s.decode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L48_C4", "label": "replace", "type": "function", "loc": [48, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L42_C0", "vector": [2, 1, 0.1256, 0.0323, 1, 0.51, 0.6667, 293, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": ["match"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def replace(match):\n s = match.group(0)\n try:\n return ESCAPE_DCT[s]\n except KeyError:\n n = ord(s)\n if n < 0x10000:\n return '\\\\u%04x' % (n,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L49_C8", "label": "s = group()", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L48_C4", "vector": [14, 2, 0.1129, 0.0023, 2, 0.6, 0.0, 553, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": " s = match.group(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Try_L50_C8", "label": "try", "type": "try", "loc": [50, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L48_C4", "vector": [7, 2, 0.1279, 0.0276, 2, 0.6, 1.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return ESCAPE_DCT[s]\n except KeyError:\n n = ord(s)\n if n < 0x10000:\n return '\\\\u%04x' % (n,)\n else:\n # surrogate pair"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L51_C12", "label": "return", "type": "return", "loc": [51, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:Try_L50_C8", "vector": [13, 3, 0.1175, 0.0023, 3, 0.14, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ESCAPE_DCT[s]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L53_C12", "label": "n = ord()", "type": "assigned_variable", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:Try_L50_C8", "vector": [14, 3, 0.1221, 0.0023, 3, 0.14, 0.0, 773, 3, 1, 0, 0, 171, 10, 1], "semantic": {"name": "n", "arg_names": [], "import_names": [], "rhs_call_name": "ord", "annotation": ""}, "snippet": " n = ord(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L54_C12", "label": "if", "type": "if", "loc": [54, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:Try_L50_C8", "vector": [4, 3, 0.1325, 0.0184, 3, 0.14, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if n < 0x10000:\n return '\\\\u%04x' % (n,)\n else:\n # surrogate pair\n n -= 0x10000\n s1 = 0xd800 | ((n >> 10) & 0x3ff)\n s2 = 0xdc00 | (n & 0x3ff)\n return '\\\\u%04x\\\\u%04x' % (s1, s2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L55_C16", "label": "return", "type": "return", "loc": [55, 55], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L54_C12", "vector": [13, 4, 0.1267, 0.0023, 4, 0.23, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\\\\u%04x' % (n,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L59_C16", "label": "s1 =", "type": "assigned_variable", "loc": [59, 59], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L54_C12", "vector": [14, 4, 0.1359, 0.0023, 4, 0.23, 0.3333, 745, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "s1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s1 = 0xd800 | ((n >> 10) & 0x3ff)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L60_C16", "label": "s2 =", "type": "assigned_variable", "loc": [60, 60], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L54_C12", "vector": [14, 4, 0.1382, 0.0023, 4, 0.23, 0.6667, 448, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "s2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s2 = 0xdc00 | (n & 0x3ff)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L61_C16", "label": "return", "type": "return", "loc": [61, 61], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L54_C12", "vector": [13, 4, 0.1406, 0.0023, 4, 0.23, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\\\\u%04x\\\\u%04x' % (s1, s2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L62_C4", "label": "return", "type": "return", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L42_C0", "vector": [13, 1, 0.1429, 0.0023, 1, 0.51, 1.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\"' + str(ESCAPE_ASCII.sub(replace, s)) + '\"'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L65_C0", "label": "encode_basestring_ascii =", "type": "assigned_variable", "loc": [65, 65], "level": 0, "parent": null, "vector": [14, 0, 0.1498, 0.0023, 0, 0.66, 0.8667, 105, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "encode_basestring_ascii", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "encode_basestring_ascii = c_encode_basestring_ascii or py_encode_basestring_ascii"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:ClassDef_L67_C0", "label": "JSONEncoder", "type": "class", "loc": [67, 256], "level": 0, "parent": null, "vector": [3, 0, 0.3721, 0.4378, 0, 0.66, 0.9333, 228, 0, 6, 0, 0, 186, 0, 18], "semantic": {"name": "JSONEncoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class JSONEncoder(object):\n \"\"\"Extensible JSON <http://json.org> encoder for Python data structures.\n\n Supports the following objects and types by default:\n\n +-------------------+---------------+\n | Python | JSON |\n +===================+===============+"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L68_C4", "label": "expression", "type": "expression", "loc": [68, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:ClassDef_L67_C0", "vector": [8, 1, 0.1878, 0.0645, 1, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Extensible JSON <http://json.org> encoder for Python data structures.\n\n Supports the following objects and types by default:\n\n +-------------------+---------------+\n | Python | JSON |\n +===================+===============+\n | dict | object |"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L96_C4", "label": "item_separator =", "type": "assigned_variable", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:ClassDef_L67_C0", "vector": [14, 1, 0.2212, 0.0023, 1, 0.91, 0.1667, 330, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "item_separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item_separator = ', '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L97_C4", "label": "key_separator =", "type": "assigned_variable", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:ClassDef_L67_C0", "vector": [14, 1, 0.2235, 0.0023, 1, 0.91, 0.3333, 294, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "key_separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key_separator = ': '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L98_C4", "label": "__init__", "type": "function", "loc": [98, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:ClassDef_L67_C0", "vector": [2, 1, 0.2903, 0.1313, 1, 0.91, 0.5, 555, 0, 10, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "skipkeys", "ensure_ascii", "check_circular", "allow_nan", "sort_keys", "indent", "separators", "encoding", "default"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, skipkeys=False, ensure_ascii=True,\n check_circular=True, allow_nan=True, sort_keys=False,\n indent=None, separators=None, encoding='utf-8', default=None):\n \"\"\"Constructor for JSONEncoder, with sensible defaults.\n\n If skipkeys is False, then it is a TypeError to attempt\n encoding of keys that are not str, int, long, float or None. If\n skipkeys is True, such items are simply skipped."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L101_C8", "label": "expression", "type": "expression", "loc": [101, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L98_C4", "vector": [8, 2, 0.28, 0.0968, 2, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Constructor for JSONEncoder, with sensible defaults.\n\n If skipkeys is False, then it is a TypeError to attempt\n encoding of keys that are not str, int, long, float or None. If\n skipkeys is True, such items are simply skipped.\n\n If ensure_ascii is True, the output is guaranteed to be str\n objects with all incoming unicode characters escaped. If"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L144_C8", "label": "self.skipkeys =", "type": "assigned_variable", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L98_C4", "vector": [14, 2, 0.3318, 0.0023, 2, 0.03, 0.1111, 853, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.skipkeys", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.skipkeys = skipkeys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L145_C8", "label": "self.ensure_ascii =", "type": "assigned_variable", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L98_C4", "vector": [14, 2, 0.3341, 0.0023, 2, 0.03, 0.2222, 255, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.ensure_ascii", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ensure_ascii = ensure_ascii"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L146_C8", "label": "self.check_circular =", "type": "assigned_variable", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L98_C4", "vector": [14, 2, 0.3364, 0.0023, 2, 0.03, 0.3333, 698, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.check_circular", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.check_circular = check_circular"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L147_C8", "label": "self.allow_nan =", "type": "assigned_variable", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L98_C4", "vector": [14, 2, 0.3387, 0.0023, 2, 0.03, 0.4444, 507, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.allow_nan", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.allow_nan = allow_nan"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L148_C8", "label": "self.sort_keys =", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L98_C4", "vector": [14, 2, 0.341, 0.0023, 2, 0.03, 0.5556, 911, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.sort_keys", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.sort_keys = sort_keys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L149_C8", "label": "self.indent =", "type": "assigned_variable", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L98_C4", "vector": [14, 2, 0.3433, 0.0023, 2, 0.03, 0.6667, 771, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.indent = indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L150_C8", "label": "if", "type": "if", "loc": [150, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L98_C4", "vector": [4, 2, 0.3468, 0.0046, 2, 0.03, 0.7778, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if separators is not None:\n self.item_separator, self.key_separator = separators"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L151_C12", "label": "assign", "type": "assigned_variable", "loc": [151, 151], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L150_C8", "vector": [14, 3, 0.3479, 0.0023, 3, 0.48, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.item_separator, self.key_separator = separators"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L152_C8", "label": "if", "type": "if", "loc": [152, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L98_C4", "vector": [4, 2, 0.3514, 0.0046, 2, 0.03, 0.8889, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if default is not None:\n self.default = default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L153_C12", "label": "self.default =", "type": "assigned_variable", "loc": [153, 153], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L152_C8", "vector": [14, 3, 0.3525, 0.0023, 3, 0.39, 0.0, 762, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.default", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.default = default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L154_C8", "label": "self.encoding =", "type": "assigned_variable", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L98_C4", "vector": [14, 2, 0.3548, 0.0023, 2, 0.03, 1.0, 564, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.encoding = encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L156_C4", "label": "default", "type": "function", "loc": [156, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:ClassDef_L67_C0", "vector": [2, 1, 0.3802, 0.0438, 1, 0.91, 0.6667, 977, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "default", "arg_names": ["self", "o"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def default(self, o):\n \"\"\"Implement this method in a subclass such that it returns\n a serializable object for ``o``, or calls the base implementation\n (to raise a ``TypeError``).\n\n For example, to support arbitrary iterators, you could\n implement default like this::\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L157_C8", "label": "expression", "type": "expression", "loc": [157, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L156_C4", "vector": [8, 2, 0.3802, 0.0392, 2, 0.77, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Implement this method in a subclass such that it returns\n a serializable object for ``o``, or calls the base implementation\n (to raise a ``TypeError``).\n\n For example, to support arbitrary iterators, you could\n implement default like this::\n\n def default(self, o):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L176_C4", "label": "encode", "type": "function", "loc": [176, 200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:ClassDef_L67_C0", "vector": [2, 1, 0.4332, 0.0576, 1, 0.91, 0.8333, 623, 0, 2, 1, 0, 0, 0, 9], "semantic": {"name": "encode", "arg_names": ["self", "o"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def encode(self, o):\n \"\"\"Return a JSON string representation of a Python data structure.\n\n >>> JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n '{\"foo\": [\"bar\", \"baz\"]}'\n\n \"\"\"\n # This is for extremely simple cases and benchmarks."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L177_C8", "label": "expression", "type": "expression", "loc": [177, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L176_C4", "vector": [8, 2, 0.4136, 0.0138, 2, 0.01, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a JSON string representation of a Python data structure.\n\n >>> JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n '{\"foo\": [\"bar\", \"baz\"]}'\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L184_C8", "label": "if", "type": "if", "loc": [184, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L176_C4", "vector": [4, 2, 0.4343, 0.023, 2, 0.01, 0.25, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(o, basestring):\n if isinstance(o, str):\n _encoding = self.encoding\n if (_encoding is not None\n and not (_encoding == 'utf-8')):\n o = o.decode(_encoding)\n if self.ensure_ascii:\n return encode_basestring_ascii(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L185_C12", "label": "if", "type": "if", "loc": [185, 189], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L184_C8", "vector": [4, 3, 0.4309, 0.0115, 3, 0.87, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(o, str):\n _encoding = self.encoding\n if (_encoding is not None\n and not (_encoding == 'utf-8')):\n o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L186_C16", "label": "_encoding =", "type": "assigned_variable", "loc": [186, 186], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L185_C12", "vector": [14, 4, 0.4286, 0.0023, 4, 0.68, 0.0, 410, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _encoding = self.encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L187_C16", "label": "if", "type": "if", "loc": [187, 189], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L185_C12", "vector": [4, 4, 0.4332, 0.0069, 4, 0.68, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (_encoding is not None\n and not (_encoding == 'utf-8')):\n o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L189_C20", "label": "o = decode()", "type": "assigned_variable", "loc": [189, 189], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L187_C16", "vector": [14, 5, 0.4355, 0.0023, 5, 0.25, 0.0, 926, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "o", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L190_C12", "label": "if", "type": "if", "loc": [190, 193], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L184_C8", "vector": [4, 3, 0.4412, 0.0092, 3, 0.87, 1.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.ensure_ascii:\n return encode_basestring_ascii(o)\n else:\n return encode_basestring(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L191_C16", "label": "return", "type": "return", "loc": [191, 191], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L190_C12", "vector": [13, 4, 0.4401, 0.0023, 4, 0.77, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return encode_basestring_ascii(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L193_C16", "label": "return", "type": "return", "loc": [193, 193], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L190_C12", "vector": [13, 4, 0.4447, 0.0023, 4, 0.77, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return encode_basestring(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L197_C8", "label": "chunks = iterencode()", "type": "assigned_variable", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L176_C4", "vector": [14, 2, 0.4539, 0.0023, 2, 0.01, 0.5, 284, 3, 2, 0, 0, 315, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "iterencode", "annotation": ""}, "snippet": " chunks = self.iterencode(o, _one_shot=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L198_C8", "label": "if", "type": "if", "loc": [198, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L176_C4", "vector": [4, 2, 0.4574, 0.0046, 2, 0.01, 0.75, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(chunks, (list, tuple)):\n chunks = list(chunks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L199_C12", "label": "chunks = list()", "type": "assigned_variable", "loc": [199, 199], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L198_C8", "vector": [14, 3, 0.4585, 0.0023, 3, 0.88, 0.0, 284, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " chunks = list(chunks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L200_C8", "label": "return", "type": "return", "loc": [200, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L176_C4", "vector": [13, 2, 0.4608, 0.0023, 2, 0.01, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''.join(chunks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L202_C4", "label": "iterencode", "type": "function", "loc": [202, 256], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:ClassDef_L67_C0", "vector": [2, 1, 0.5276, 0.1267, 1, 0.91, 1.0, 315, 0, 3, 1, 0, 0, 0, 8], "semantic": {"name": "iterencode", "arg_names": ["self", "o", "_one_shot"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def iterencode(self, o, _one_shot=False):\n \"\"\"Encode the given object and yield each string\n representation as available.\n\n For example::\n\n for chunk in JSONEncoder().iterencode(bigobject):\n mysocket.write(chunk)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L203_C8", "label": "expression", "type": "expression", "loc": [203, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L202_C4", "vector": [8, 2, 0.477, 0.0207, 2, 0.22, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Encode the given object and yield each string\n representation as available.\n\n For example::\n\n for chunk in JSONEncoder().iterencode(bigobject):\n mysocket.write(chunk)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L212_C8", "label": "if", "type": "if", "loc": [212, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L202_C4", "vector": [4, 2, 0.4919, 0.0092, 2, 0.22, 0.1667, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.check_circular:\n markers = {}\n else:\n markers = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L213_C12", "label": "markers =", "type": "assigned_variable", "loc": [213, 213], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L212_C8", "vector": [14, 3, 0.4908, 0.0023, 3, 0.82, 0.0, 586, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "markers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L215_C12", "label": "markers =", "type": "assigned_variable", "loc": [215, 215], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L212_C8", "vector": [14, 3, 0.4954, 0.0023, 3, 0.82, 1.0, 586, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "markers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L216_C8", "label": "if", "type": "if", "loc": [216, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L202_C4", "vector": [4, 2, 0.5012, 0.0092, 2, 0.22, 0.3333, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.ensure_ascii:\n _encoder = encode_basestring_ascii\n else:\n _encoder = encode_basestring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L217_C12", "label": "_encoder =", "type": "assigned_variable", "loc": [217, 217], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L216_C8", "vector": [14, 3, 0.5, 0.0023, 3, 0.15, 0.0, 153, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _encoder = encode_basestring_ascii"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L219_C12", "label": "_encoder =", "type": "assigned_variable", "loc": [219, 219], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L216_C8", "vector": [14, 3, 0.5046, 0.0023, 3, 0.15, 1.0, 153, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _encoder = encode_basestring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L220_C8", "label": "if", "type": "if", "loc": [220, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L202_C4", "vector": [4, 2, 0.5115, 0.0115, 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 self.encoding != 'utf-8':\n def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding):\n if isinstance(o, str):\n o = o.decode(_encoding)\n return _orig_encoder(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L221_C12", "label": "_encoder", "type": "function", "loc": [221, 224], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L220_C8", "vector": [2, 3, 0.5127, 0.0092, 3, 0.42, 0.0, 153, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "_encoder", "arg_names": ["o", "_orig_encoder", "_encoding"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding):\n if isinstance(o, str):\n o = o.decode(_encoding)\n return _orig_encoder(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L222_C16", "label": "if", "type": "if", "loc": [222, 223], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L221_C12", "vector": [4, 4, 0.5127, 0.0046, 4, 0.69, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(o, str):\n o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L223_C20", "label": "o = decode()", "type": "assigned_variable", "loc": [223, 223], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L222_C16", "vector": [14, 5, 0.5138, 0.0023, 5, 0.66, 0.0, 926, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "o", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L224_C16", "label": "return", "type": "return", "loc": [224, 224], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L221_C12", "vector": [13, 4, 0.5161, 0.0023, 4, 0.69, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _orig_encoder(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L226_C8", "label": "floatstr", "type": "function", "loc": [226, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L202_C4", "vector": [2, 2, 0.5403, 0.0415, 2, 0.22, 0.6667, 122, 0, 5, 1, 0, 0, 0, 2], "semantic": {"name": "floatstr", "arg_names": ["o", "allow_nan", "_repr", "_inf", "_neginf"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def floatstr(o, allow_nan=self.allow_nan, _repr=FLOAT_REPR, _inf=INFINITY, _neginf=-INFINITY):\n # Check for specials. Note that this type of test is processor- and/or\n # platform-specific, so do tests which don't depend on the internals.\n\n if o != o:\n text = 'NaN'\n elif o == _inf:\n text = 'Infinity'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L230_C12", "label": "if", "type": "if", "loc": [230, 237], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L226_C8", "vector": [4, 3, 0.538, 0.0184, 3, 0.31, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o != o:\n text = 'NaN'\n elif o == _inf:\n text = 'Infinity'\n elif o == _neginf:\n text = '-Infinity'\n else:\n return _repr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L231_C16", "label": "text =", "type": "assigned_variable", "loc": [231, 231], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L230_C12", "vector": [14, 4, 0.5323, 0.0023, 4, 0.5, 0.0, 439, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = 'NaN'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L232_C12", "label": "if", "type": "if", "loc": [232, 237], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L230_C12", "vector": [4, 4, 0.5403, 0.0138, 4, 0.5, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o == _inf:\n text = 'Infinity'\n elif o == _neginf:\n text = '-Infinity'\n else:\n return _repr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L233_C16", "label": "text =", "type": "assigned_variable", "loc": [233, 233], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L232_C12", "vector": [14, 5, 0.5369, 0.0023, 5, 0.0, 0.0, 439, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = 'Infinity'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L234_C12", "label": "if", "type": "if", "loc": [234, 237], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L232_C12", "vector": [4, 5, 0.5426, 0.0092, 5, 0.0, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o == _neginf:\n text = '-Infinity'\n else:\n return _repr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L235_C16", "label": "text =", "type": "assigned_variable", "loc": [235, 235], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L234_C12", "vector": [14, 6, 0.5415, 0.0023, 6, 0.69, 0.0, 439, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = '-Infinity'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L237_C16", "label": "return", "type": "return", "loc": [237, 237], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L234_C12", "vector": [13, 6, 0.5461, 0.0023, 6, 0.69, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _repr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L239_C12", "label": "if", "type": "if", "loc": [239, 241], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L226_C8", "vector": [4, 3, 0.553, 0.0069, 3, 0.31, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not allow_nan:\n raise ValueError(\"Out of range float values are not JSON compliant: %r\"\n % (o,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L243_C12", "label": "return", "type": "return", "loc": [243, 243], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L226_C8", "vector": [13, 3, 0.5599, 0.0023, 3, 0.31, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L246_C8", "label": "if", "type": "if", "loc": [246, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L202_C4", "vector": [4, 2, 0.5772, 0.023, 2, 0.22, 0.8333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _one_shot and c_make_encoder is not None and not self.indent and not self.sort_keys:\n _iterencode = c_make_encoder(\n markers, self.default, _encoder, self.indent,\n self.key_separator, self.item_separator, self.sort_keys,\n self.skipkeys, self.allow_nan)\n else:\n _iterencode = _make_iterencode(\n markers, self.default, _encoder, self.indent, floatstr,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L247_C12", "label": "_iterencode = c_make_encoder()", "type": "assigned_variable", "loc": [247, 250], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L246_C8", "vector": [14, 3, 0.5726, 0.0092, 3, 0.73, 0.0, 136, 3, 9, 0, 0, 30, 10, 1], "semantic": {"name": "_iterencode", "arg_names": [], "import_names": [], "rhs_call_name": "c_make_encoder", "annotation": ""}, "snippet": " _iterencode = c_make_encoder(\n markers, self.default, _encoder, self.indent,\n self.key_separator, self.item_separator, self.sort_keys,\n self.skipkeys, self.allow_nan)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L252_C12", "label": "_iterencode = _make_iterencode()", "type": "assigned_variable", "loc": [252, 255], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L246_C8", "vector": [14, 3, 0.5841, 0.0092, 3, 0.73, 1.0, 136, 3, 10, 0, 0, 845, 10, 1], "semantic": {"name": "_iterencode", "arg_names": [], "import_names": [], "rhs_call_name": "_make_iterencode", "annotation": ""}, "snippet": " _iterencode = _make_iterencode(\n markers, self.default, _encoder, self.indent, floatstr,\n self.key_separator, self.item_separator, self.sort_keys,\n self.skipkeys, _one_shot)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L256_C8", "label": "return", "type": "return", "loc": [256, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L202_C4", "vector": [13, 2, 0.5899, 0.0023, 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 _iterencode(o, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L258_C0", "label": "_make_iterencode", "type": "function", "loc": [258, 434], "level": 0, "parent": null, "vector": [2, 0, 0.7972, 0.4078, 0, 0.66, 1.0, 845, 0, 21, 1, 0, 0, 0, 50], "semantic": {"name": "_make_iterencode", "arg_names": ["markers", "_default", "_encoder", "_indent", "_floatstr", "_key_separator", "_item_separator", "_sort_keys", "_skipkeys", "_one_shot", "ValueError", "basestring", "dict", "float", "id", "int", "isinstance", "list", "long", "str", "tuple"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _make_iterencode(markers, _default, _encoder, _indent, _floatstr, _key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot,\n ## HACK: hand-optimized bytecode; turn globals into locals\n ValueError=ValueError,\n basestring=basestring,\n dict=dict,\n float=float,\n id=id,\n int=int,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L273_C4", "label": "_iterencode_list", "type": "function", "loc": [273, 324], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L258_C0", "vector": [2, 1, 0.6878, 0.1198, 1, 0.82, 0.0, 1, 0, 2, 0, 0, 0, 0, 13], "semantic": {"name": "_iterencode_list", "arg_names": ["lst", "_current_indent_level"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _iterencode_list(lst, _current_indent_level):\n if not lst:\n yield '[]'\n return\n if markers is not None:\n markerid = id(lst)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L274_C8", "label": "if", "type": "if", "loc": [274, 276], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L273_C4", "vector": [4, 2, 0.6336, 0.0069, 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 lst:\n yield '[]'\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L275_C12", "label": "expression", "type": "expression", "loc": [275, 275], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L274_C8", "vector": [8, 3, 0.6336, 0.0023, 3, 0.45, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '[]'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L276_C12", "label": "return", "type": "return", "loc": [276, 276], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L274_C8", "vector": [13, 3, 0.6359, 0.0023, 3, 0.45, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L277_C8", "label": "if", "type": "if", "loc": [277, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L273_C4", "vector": [4, 2, 0.6429, 0.0115, 2, 0.23, 0.125, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n markerid = id(lst)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")\n markers[markerid] = lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L278_C12", "label": "markerid = id()", "type": "assigned_variable", "loc": [278, 278], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L277_C8", "vector": [14, 3, 0.6406, 0.0023, 3, 0.45, 0.0, 105, 3, 1, 0, 0, 941, 10, 1], "semantic": {"name": "markerid", "arg_names": [], "import_names": [], "rhs_call_name": "id", "annotation": ""}, "snippet": " markerid = id(lst)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L279_C12", "label": "if", "type": "if", "loc": [279, 280], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L277_C8", "vector": [4, 3, 0.644, 0.0046, 3, 0.45, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L281_C12", "label": "assign", "type": "assigned_variable", "loc": [281, 281], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L277_C8", "vector": [14, 3, 0.6475, 0.0023, 3, 0.45, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers[markerid] = lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L282_C8", "label": "buf =", "type": "assigned_variable", "loc": [282, 282], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L273_C4", "vector": [14, 2, 0.6498, 0.0023, 2, 0.23, 0.25, 840, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " buf = '['"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L283_C8", "label": "if", "type": "if", "loc": [283, 290], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L273_C4", "vector": [4, 2, 0.6601, 0.0184, 2, 0.23, 0.375, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _indent is not None:\n _current_indent_level += 1\n newline_indent = '\\n' + (' ' * (_indent * _current_indent_level))\n separator = _item_separator + newline_indent\n buf += newline_indent\n else:\n newline_indent = None\n separator = _item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L285_C12", "label": "newline_indent =", "type": "assigned_variable", "loc": [285, 285], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L283_C8", "vector": [14, 3, 0.6567, 0.0023, 3, 0.03, 0.0, 810, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "newline_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newline_indent = '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L286_C12", "label": "separator =", "type": "assigned_variable", "loc": [286, 286], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L283_C8", "vector": [14, 3, 0.659, 0.0023, 3, 0.03, 0.3333, 539, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " separator = _item_separator + newline_indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L289_C12", "label": "newline_indent =", "type": "assigned_variable", "loc": [289, 289], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L283_C8", "vector": [14, 3, 0.6659, 0.0023, 3, 0.03, 0.6667, 810, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "newline_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newline_indent = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L290_C12", "label": "separator =", "type": "assigned_variable", "loc": [290, 290], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L283_C8", "vector": [14, 3, 0.6682, 0.0023, 3, 0.03, 1.0, 539, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " separator = _item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L291_C8", "label": "first =", "type": "assigned_variable", "loc": [291, 291], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L273_C4", "vector": [14, 2, 0.6705, 0.0023, 2, 0.23, 0.5, 199, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L292_C8", "label": "for value", "type": "for", "loc": [292, 318], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L273_C4", "vector": [6, 2, 0.7028, 0.0622, 2, 0.23, 0.625, 441, 2, 0, 0, 0, 0, 0, 11], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for value in lst:\n if first:\n first = False\n else:\n buf = separator\n if isinstance(value, basestring):\n yield buf + _encoder(value)\n elif value is None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L293_C12", "label": "if", "type": "if", "loc": [293, 296], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L292_C8", "vector": [4, 3, 0.6786, 0.0092, 3, 0.28, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if first:\n first = False\n else:\n buf = separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L294_C16", "label": "first =", "type": "assigned_variable", "loc": [294, 294], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L293_C12", "vector": [14, 4, 0.6774, 0.0023, 4, 0.55, 0.0, 199, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L296_C16", "label": "buf =", "type": "assigned_variable", "loc": [296, 296], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L293_C12", "vector": [14, 4, 0.682, 0.0023, 4, 0.55, 1.0, 840, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " buf = separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L297_C12", "label": "if", "type": "if", "loc": [297, 318], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L292_C8", "vector": [4, 3, 0.7085, 0.0507, 3, 0.28, 1.0, 0, 3, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, basestring):\n yield buf + _encoder(value)\n elif value is None:\n yield buf + 'null'\n elif value is True:\n yield buf + 'true'\n elif value is False:\n yield buf + 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L298_C16", "label": "expression", "type": "expression", "loc": [298, 298], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L297_C12", "vector": [8, 4, 0.6866, 0.0023, 4, 0.6, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + _encoder(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L299_C12", "label": "if", "type": "if", "loc": [299, 318], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L297_C12", "vector": [4, 4, 0.7108, 0.0461, 4, 0.6, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is None:\n yield buf + 'null'\n elif value is True:\n yield buf + 'true'\n elif value is False:\n yield buf + 'false'\n elif isinstance(value, (int, long)):\n yield buf + str(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L300_C16", "label": "expression", "type": "expression", "loc": [300, 300], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L299_C12", "vector": [8, 5, 0.6912, 0.0023, 5, 0.71, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L301_C12", "label": "if", "type": "if", "loc": [301, 318], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L299_C12", "vector": [4, 5, 0.7131, 0.0415, 5, 0.71, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is True:\n yield buf + 'true'\n elif value is False:\n yield buf + 'false'\n elif isinstance(value, (int, long)):\n yield buf + str(value)\n elif isinstance(value, float):\n yield buf + _floatstr(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L302_C16", "label": "expression", "type": "expression", "loc": [302, 302], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L301_C12", "vector": [8, 6, 0.6959, 0.0023, 6, 0.06, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L303_C12", "label": "if", "type": "if", "loc": [303, 318], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L301_C12", "vector": [4, 6, 0.7154, 0.0369, 6, 0.06, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is False:\n yield buf + 'false'\n elif isinstance(value, (int, long)):\n yield buf + str(value)\n elif isinstance(value, float):\n yield buf + _floatstr(value)\n else:\n yield buf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L304_C16", "label": "expression", "type": "expression", "loc": [304, 304], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L303_C12", "vector": [8, 7, 0.7005, 0.0023, 7, 0.03, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L305_C12", "label": "if", "type": "if", "loc": [305, 318], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L303_C12", "vector": [4, 7, 0.7177, 0.0323, 7, 0.03, 1.0, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, (int, long)):\n yield buf + str(value)\n elif isinstance(value, float):\n yield buf + _floatstr(value)\n else:\n yield buf\n if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L306_C16", "label": "expression", "type": "expression", "loc": [306, 306], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L305_C12", "vector": [8, 8, 0.7051, 0.0023, 8, 0.4, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + str(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L307_C12", "label": "if", "type": "if", "loc": [307, 318], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L305_C12", "vector": [4, 8, 0.72, 0.0276, 8, 0.4, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, float):\n yield buf + _floatstr(value)\n else:\n yield buf\n if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L308_C16", "label": "expression", "type": "expression", "loc": [308, 308], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L307_C12", "vector": [8, 9, 0.7097, 0.0023, 9, 0.33, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + _floatstr(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L310_C16", "label": "expression", "type": "expression", "loc": [310, 310], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L307_C12", "vector": [8, 9, 0.7143, 0.0023, 9, 0.33, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L311_C16", "label": "if", "type": "if", "loc": [311, 316], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L307_C12", "vector": [4, 9, 0.7224, 0.0138, 9, 0.33, 0.6667, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:\n chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L312_C20", "label": "chunks = _iterencode_list()", "type": "assigned_variable", "loc": [312, 312], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L311_C16", "vector": [14, 10, 0.7189, 0.0023, 10, 0.51, 0.0, 284, 3, 2, 0, 0, 1, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode_list", "annotation": ""}, "snippet": " chunks = _iterencode_list(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L313_C16", "label": "if", "type": "if", "loc": [313, 316], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L311_C16", "vector": [4, 10, 0.7247, 0.0092, 10, 0.51, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:\n chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L314_C20", "label": "chunks = _iterencode_dict()", "type": "assigned_variable", "loc": [314, 314], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L313_C16", "vector": [14, 11, 0.7235, 0.0023, 11, 0.71, 0.0, 284, 3, 2, 0, 0, 301, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode_dict", "annotation": ""}, "snippet": " chunks = _iterencode_dict(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L316_C20", "label": "chunks = _iterencode()", "type": "assigned_variable", "loc": [316, 316], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L313_C16", "vector": [14, 11, 0.7281, 0.0023, 11, 0.71, 1.0, 284, 3, 2, 0, 0, 136, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode", "annotation": ""}, "snippet": " chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L317_C16", "label": "for chunk", "type": "for", "loc": [317, 318], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L307_C12", "vector": [6, 9, 0.7316, 0.0046, 9, 0.33, 1.0, 637, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in chunks:\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L318_C20", "label": "expression", "type": "expression", "loc": [318, 318], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L317_C16", "vector": [8, 10, 0.7327, 0.0023, 10, 0.11, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L319_C8", "label": "if", "type": "if", "loc": [319, 321], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L273_C4", "vector": [4, 2, 0.7373, 0.0069, 2, 0.23, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if newline_indent is not None:\n _current_indent_level -= 1\n yield '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L321_C12", "label": "expression", "type": "expression", "loc": [321, 321], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L319_C8", "vector": [8, 3, 0.7396, 0.0023, 3, 0.76, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L322_C8", "label": "expression", "type": "expression", "loc": [322, 322], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L273_C4", "vector": [8, 2, 0.7419, 0.0023, 2, 0.23, 0.875, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield ']'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L323_C8", "label": "if", "type": "if", "loc": [323, 324], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L273_C4", "vector": [4, 2, 0.7454, 0.0046, 2, 0.23, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n del markers[markerid]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L326_C4", "label": "_iterencode_dict", "type": "function", "loc": [326, 401], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L258_C0", "vector": [2, 1, 0.8376, 0.1751, 1, 0.82, 0.3333, 301, 0, 2, 0, 0, 0, 0, 23], "semantic": {"name": "_iterencode_dict", "arg_names": ["dct", "_current_indent_level"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _iterencode_dict(dct, _current_indent_level):\n if not dct:\n yield '{}'\n return\n if markers is not None:\n markerid = id(dct)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L327_C8", "label": "if", "type": "if", "loc": [327, 329], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L326_C4", "vector": [4, 2, 0.7558, 0.0069, 2, 0.73, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not dct:\n yield '{}'\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L328_C12", "label": "expression", "type": "expression", "loc": [328, 328], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L327_C8", "vector": [8, 3, 0.7558, 0.0023, 3, 0.71, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '{}'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L329_C12", "label": "return", "type": "return", "loc": [329, 329], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L327_C8", "vector": [13, 3, 0.7581, 0.0023, 3, 0.71, 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_1021:If_L330_C8", "label": "if", "type": "if", "loc": [330, 334], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L326_C4", "vector": [4, 2, 0.765, 0.0115, 2, 0.73, 0.1111, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n markerid = id(dct)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")\n markers[markerid] = dct"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L331_C12", "label": "markerid = id()", "type": "assigned_variable", "loc": [331, 331], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L330_C8", "vector": [14, 3, 0.7627, 0.0023, 3, 0.81, 0.0, 105, 3, 1, 0, 0, 941, 10, 1], "semantic": {"name": "markerid", "arg_names": [], "import_names": [], "rhs_call_name": "id", "annotation": ""}, "snippet": " markerid = id(dct)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L332_C12", "label": "if", "type": "if", "loc": [332, 333], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L330_C8", "vector": [4, 3, 0.7661, 0.0046, 3, 0.81, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L334_C12", "label": "assign", "type": "assigned_variable", "loc": [334, 334], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L330_C8", "vector": [14, 3, 0.7696, 0.0023, 3, 0.81, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers[markerid] = dct"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L335_C8", "label": "expression", "type": "expression", "loc": [335, 335], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L326_C4", "vector": [8, 2, 0.7719, 0.0023, 2, 0.73, 0.2222, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '{'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L336_C8", "label": "if", "type": "if", "loc": [336, 343], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L326_C4", "vector": [4, 2, 0.7823, 0.0184, 2, 0.73, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _indent is not None:\n _current_indent_level += 1\n newline_indent = '\\n' + (' ' * (_indent * _current_indent_level))\n item_separator = _item_separator + newline_indent\n yield newline_indent\n else:\n newline_indent = None\n item_separator = _item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L338_C12", "label": "newline_indent =", "type": "assigned_variable", "loc": [338, 338], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L336_C8", "vector": [14, 3, 0.7788, 0.0023, 3, 0.01, 0.0, 810, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "newline_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newline_indent = '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L339_C12", "label": "item_separator =", "type": "assigned_variable", "loc": [339, 339], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L336_C8", "vector": [14, 3, 0.7811, 0.0023, 3, 0.01, 0.25, 330, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "item_separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item_separator = _item_separator + newline_indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L340_C12", "label": "expression", "type": "expression", "loc": [340, 340], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L336_C8", "vector": [8, 3, 0.7834, 0.0023, 3, 0.01, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield newline_indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L342_C12", "label": "newline_indent =", "type": "assigned_variable", "loc": [342, 342], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L336_C8", "vector": [14, 3, 0.788, 0.0023, 3, 0.01, 0.75, 810, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "newline_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newline_indent = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L343_C12", "label": "item_separator =", "type": "assigned_variable", "loc": [343, 343], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L336_C8", "vector": [14, 3, 0.7903, 0.0023, 3, 0.01, 1.0, 330, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "item_separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item_separator = _item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L344_C8", "label": "first =", "type": "assigned_variable", "loc": [344, 344], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L326_C4", "vector": [14, 2, 0.7926, 0.0023, 2, 0.73, 0.4444, 199, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L345_C8", "label": "if", "type": "if", "loc": [345, 349], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L326_C4", "vector": [4, 2, 0.7995, 0.0115, 2, 0.73, 0.5556, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _sort_keys:\n items = dct.items()\n items.sort(key=lambda kv: kv[0])\n else:\n items = dct.iteritems()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L346_C12", "label": "items = items()", "type": "assigned_variable", "loc": [346, 346], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L345_C8", "vector": [14, 3, 0.7972, 0.0023, 3, 0.38, 0.0, 339, 3, 0, 0, 0, 339, 10, 1], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "items", "annotation": ""}, "snippet": " items = dct.items()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L347_C12", "label": "sort()", "type": "expression", "loc": [347, 347], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L345_C8", "vector": [8, 3, 0.7995, 0.0023, 3, 0.38, 0.5, 489, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " items.sort(key=lambda kv: kv[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L349_C12", "label": "items = iteritems()", "type": "assigned_variable", "loc": [349, 349], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L345_C8", "vector": [14, 3, 0.8041, 0.0023, 3, 0.38, 1.0, 339, 3, 0, 0, 0, 252, 10, 1], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "iteritems", "annotation": ""}, "snippet": " items = dct.iteritems()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L350_C8", "label": "for key, value", "type": "for", "loc": [350, 395], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L326_C4", "vector": [6, 2, 0.8583, 0.106, 2, 0.73, 0.6667, 839, 2, 0, 0, 0, 0, 0, 18], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, value in items:\n if isinstance(key, basestring):\n pass\n # JavaScript is weakly typed for these, so it makes sense to\n # also allow them. Many encoders seem to do something like this.\n elif isinstance(key, float):\n key = _floatstr(key)\n elif isinstance(key, (int, long)):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L351_C12", "label": "if", "type": "if", "loc": [351, 368], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L350_C8", "vector": [4, 3, 0.8283, 0.0415, 3, 0.41, 0.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(key, basestring):\n pass\n # JavaScript is weakly typed for these, so it makes sense to\n # also allow them. Many encoders seem to do something like this.\n elif isinstance(key, float):\n key = _floatstr(key)\n elif isinstance(key, (int, long)):\n key = str(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L355_C12", "label": "if", "type": "if", "loc": [355, 368], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L351_C12", "vector": [4, 4, 0.8329, 0.0323, 4, 0.79, 0.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(key, float):\n key = _floatstr(key)\n elif isinstance(key, (int, long)):\n key = str(key)\n elif key is True:\n key = 'true'\n elif key is False:\n key = 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L356_C16", "label": "key = _floatstr()", "type": "assigned_variable", "loc": [356, 356], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L355_C12", "vector": [14, 5, 0.8203, 0.0023, 5, 0.85, 0.0, 230, 3, 1, 0, 0, 185, 10, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "_floatstr", "annotation": ""}, "snippet": " key = _floatstr(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L357_C12", "label": "if", "type": "if", "loc": [357, 368], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L355_C12", "vector": [4, 5, 0.8353, 0.0276, 5, 0.85, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(key, (int, long)):\n key = str(key)\n elif key is True:\n key = 'true'\n elif key is False:\n key = 'false'\n elif key is None:\n key = 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L358_C16", "label": "key = str()", "type": "assigned_variable", "loc": [358, 358], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L357_C12", "vector": [14, 6, 0.8249, 0.0023, 6, 0.8, 0.0, 230, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " key = str(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L359_C12", "label": "if", "type": "if", "loc": [359, 368], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L357_C12", "vector": [4, 6, 0.8376, 0.023, 6, 0.8, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key is True:\n key = 'true'\n elif key is False:\n key = 'false'\n elif key is None:\n key = 'null'\n elif _skipkeys:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L360_C16", "label": "key =", "type": "assigned_variable", "loc": [360, 360], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L359_C12", "vector": [14, 7, 0.8295, 0.0023, 7, 0.99, 0.0, 230, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L361_C12", "label": "if", "type": "if", "loc": [361, 368], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L359_C12", "vector": [4, 7, 0.8399, 0.0184, 7, 0.99, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key is False:\n key = 'false'\n elif key is None:\n key = 'null'\n elif _skipkeys:\n continue\n else:\n raise TypeError(\"key %r is not a string\" % (key,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L362_C16", "label": "key =", "type": "assigned_variable", "loc": [362, 362], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L361_C12", "vector": [14, 8, 0.8341, 0.0023, 8, 0.31, 0.0, 230, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L363_C12", "label": "if", "type": "if", "loc": [363, 368], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L361_C12", "vector": [4, 8, 0.8422, 0.0138, 8, 0.31, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key is None:\n key = 'null'\n elif _skipkeys:\n continue\n else:\n raise TypeError(\"key %r is not a string\" % (key,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L364_C16", "label": "key =", "type": "assigned_variable", "loc": [364, 364], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L363_C12", "vector": [14, 9, 0.8387, 0.0023, 9, 0.09, 0.0, 230, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L365_C12", "label": "if", "type": "if", "loc": [365, 368], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L363_C12", "vector": [4, 9, 0.8445, 0.0092, 9, 0.09, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif _skipkeys:\n continue\n else:\n raise TypeError(\"key %r is not a string\" % (key,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L369_C12", "label": "if", "type": "if", "loc": [369, 372], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L350_C8", "vector": [4, 3, 0.8537, 0.0092, 3, 0.41, 0.25, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if first:\n first = False\n else:\n yield item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L370_C16", "label": "first =", "type": "assigned_variable", "loc": [370, 370], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L369_C12", "vector": [14, 4, 0.8525, 0.0023, 4, 0.94, 0.0, 199, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L372_C16", "label": "expression", "type": "expression", "loc": [372, 372], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L369_C12", "vector": [8, 4, 0.8571, 0.0023, 4, 0.94, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L373_C12", "label": "expression", "type": "expression", "loc": [373, 373], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L350_C8", "vector": [8, 3, 0.8594, 0.0023, 3, 0.41, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _encoder(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L374_C12", "label": "expression", "type": "expression", "loc": [374, 374], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L350_C8", "vector": [8, 3, 0.8618, 0.0023, 3, 0.41, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _key_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L375_C12", "label": "if", "type": "if", "loc": [375, 395], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L350_C8", "vector": [4, 3, 0.8871, 0.0484, 3, 0.41, 1.0, 0, 3, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, basestring):\n yield _encoder(value)\n elif value is None:\n yield 'null'\n elif value is True:\n yield 'true'\n elif value is False:\n yield 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L376_C16", "label": "expression", "type": "expression", "loc": [376, 376], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L375_C12", "vector": [8, 4, 0.8664, 0.0023, 4, 0.08, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _encoder(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L377_C12", "label": "if", "type": "if", "loc": [377, 395], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L375_C12", "vector": [4, 4, 0.8894, 0.0438, 4, 0.08, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is None:\n yield 'null'\n elif value is True:\n yield 'true'\n elif value is False:\n yield 'false'\n elif isinstance(value, (int, long)):\n yield str(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L378_C16", "label": "expression", "type": "expression", "loc": [378, 378], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L377_C12", "vector": [8, 5, 0.871, 0.0023, 5, 0.25, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L379_C12", "label": "if", "type": "if", "loc": [379, 395], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L377_C12", "vector": [4, 5, 0.8917, 0.0392, 5, 0.25, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is True:\n yield 'true'\n elif value is False:\n yield 'false'\n elif isinstance(value, (int, long)):\n yield str(value)\n elif isinstance(value, float):\n yield _floatstr(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L380_C16", "label": "expression", "type": "expression", "loc": [380, 380], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L379_C12", "vector": [8, 6, 0.8756, 0.0023, 6, 0.05, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L381_C12", "label": "if", "type": "if", "loc": [381, 395], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L379_C12", "vector": [4, 6, 0.894, 0.0346, 6, 0.05, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is False:\n yield 'false'\n elif isinstance(value, (int, long)):\n yield str(value)\n elif isinstance(value, float):\n yield _floatstr(value)\n else:\n if isinstance(value, (list, tuple)):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L382_C16", "label": "expression", "type": "expression", "loc": [382, 382], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L381_C12", "vector": [8, 7, 0.8802, 0.0023, 7, 0.81, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L383_C12", "label": "if", "type": "if", "loc": [383, 395], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L381_C12", "vector": [4, 7, 0.8963, 0.03, 7, 0.81, 1.0, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, (int, long)):\n yield str(value)\n elif isinstance(value, float):\n yield _floatstr(value)\n else:\n if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L384_C16", "label": "expression", "type": "expression", "loc": [384, 384], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L383_C12", "vector": [8, 8, 0.8848, 0.0023, 8, 0.67, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield str(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L385_C12", "label": "if", "type": "if", "loc": [385, 395], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L383_C12", "vector": [4, 8, 0.8986, 0.0253, 8, 0.67, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, float):\n yield _floatstr(value)\n else:\n if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L386_C16", "label": "expression", "type": "expression", "loc": [386, 386], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L385_C12", "vector": [8, 9, 0.8894, 0.0023, 9, 0.25, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _floatstr(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L388_C16", "label": "if", "type": "if", "loc": [388, 393], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L385_C12", "vector": [4, 9, 0.8998, 0.0138, 9, 0.25, 0.5, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:\n chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L389_C20", "label": "chunks = _iterencode_list()", "type": "assigned_variable", "loc": [389, 389], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L388_C16", "vector": [14, 10, 0.8963, 0.0023, 10, 0.28, 0.0, 284, 3, 2, 0, 0, 1, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode_list", "annotation": ""}, "snippet": " chunks = _iterencode_list(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L390_C16", "label": "if", "type": "if", "loc": [390, 393], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L388_C16", "vector": [4, 10, 0.9021, 0.0092, 10, 0.28, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:\n chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L391_C20", "label": "chunks = _iterencode_dict()", "type": "assigned_variable", "loc": [391, 391], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L390_C16", "vector": [14, 11, 0.9009, 0.0023, 11, 0.0, 0.0, 284, 3, 2, 0, 0, 301, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode_dict", "annotation": ""}, "snippet": " chunks = _iterencode_dict(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L393_C20", "label": "chunks = _iterencode()", "type": "assigned_variable", "loc": [393, 393], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L390_C16", "vector": [14, 11, 0.9055, 0.0023, 11, 0.0, 1.0, 284, 3, 2, 0, 0, 136, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode", "annotation": ""}, "snippet": " chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L394_C16", "label": "for chunk", "type": "for", "loc": [394, 395], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L385_C12", "vector": [6, 9, 0.909, 0.0046, 9, 0.25, 1.0, 637, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in chunks:\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L395_C20", "label": "expression", "type": "expression", "loc": [395, 395], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L394_C16", "vector": [8, 10, 0.9101, 0.0023, 10, 0.59, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L396_C8", "label": "if", "type": "if", "loc": [396, 398], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L326_C4", "vector": [4, 2, 0.9147, 0.0069, 2, 0.73, 0.7778, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if newline_indent is not None:\n _current_indent_level -= 1\n yield '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L398_C12", "label": "expression", "type": "expression", "loc": [398, 398], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L396_C8", "vector": [8, 3, 0.9171, 0.0023, 3, 0.24, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '\\n' + (' ' * (_indent * _current_indent_level))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L399_C8", "label": "expression", "type": "expression", "loc": [399, 399], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L326_C4", "vector": [8, 2, 0.9194, 0.0023, 2, 0.73, 0.8889, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '}'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L400_C8", "label": "if", "type": "if", "loc": [400, 401], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L326_C4", "vector": [4, 2, 0.9228, 0.0046, 2, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n del markers[markerid]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L403_C4", "label": "_iterencode", "type": "function", "loc": [403, 432], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L258_C0", "vector": [2, 1, 0.962, 0.0691, 1, 0.82, 0.6667, 136, 0, 2, 0, 0, 0, 0, 14], "semantic": {"name": "_iterencode", "arg_names": ["o", "_current_indent_level"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _iterencode(o, _current_indent_level):\n if isinstance(o, basestring):\n yield _encoder(o)\n elif o is None:\n yield 'null'\n elif o is True:\n yield 'true'\n elif o is False:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L404_C8", "label": "if", "type": "if", "loc": [404, 432], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L403_C4", "vector": [4, 2, 0.9631, 0.0668, 2, 0.12, 0.0, 0, 3, 0, 0, 0, 0, 0, 14], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(o, basestring):\n yield _encoder(o)\n elif o is None:\n yield 'null'\n elif o is True:\n yield 'true'\n elif o is False:\n yield 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L405_C12", "label": "expression", "type": "expression", "loc": [405, 405], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L404_C8", "vector": [8, 3, 0.9332, 0.0023, 3, 0.49, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _encoder(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L406_C8", "label": "if", "type": "if", "loc": [406, 432], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L404_C8", "vector": [4, 3, 0.9654, 0.0622, 3, 0.49, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o is None:\n yield 'null'\n elif o is True:\n yield 'true'\n elif o is False:\n yield 'false'\n elif isinstance(o, (int, long)):\n yield str(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L407_C12", "label": "expression", "type": "expression", "loc": [407, 407], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L406_C8", "vector": [8, 4, 0.9378, 0.0023, 4, 0.38, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L408_C8", "label": "if", "type": "if", "loc": [408, 432], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L406_C8", "vector": [4, 4, 0.9677, 0.0576, 4, 0.38, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o is True:\n yield 'true'\n elif o is False:\n yield 'false'\n elif isinstance(o, (int, long)):\n yield str(o)\n elif isinstance(o, float):\n yield _floatstr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L409_C12", "label": "expression", "type": "expression", "loc": [409, 409], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L408_C8", "vector": [8, 5, 0.9424, 0.0023, 5, 0.95, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L410_C8", "label": "if", "type": "if", "loc": [410, 432], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L408_C8", "vector": [4, 5, 0.97, 0.053, 5, 0.95, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o is False:\n yield 'false'\n elif isinstance(o, (int, long)):\n yield str(o)\n elif isinstance(o, float):\n yield _floatstr(o)\n elif isinstance(o, (list, tuple)):\n for chunk in _iterencode_list(o, _current_indent_level):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L411_C12", "label": "expression", "type": "expression", "loc": [411, 411], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L410_C8", "vector": [8, 6, 0.947, 0.0023, 6, 0.41, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L412_C8", "label": "if", "type": "if", "loc": [412, 432], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L410_C8", "vector": [4, 6, 0.9724, 0.0484, 6, 0.41, 1.0, 0, 3, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(o, (int, long)):\n yield str(o)\n elif isinstance(o, float):\n yield _floatstr(o)\n elif isinstance(o, (list, tuple)):\n for chunk in _iterencode_list(o, _current_indent_level):\n yield chunk\n elif isinstance(o, dict):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L413_C12", "label": "expression", "type": "expression", "loc": [413, 413], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L412_C8", "vector": [8, 7, 0.9516, 0.0023, 7, 0.64, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield str(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L414_C8", "label": "if", "type": "if", "loc": [414, 432], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L412_C8", "vector": [4, 7, 0.9747, 0.0438, 7, 0.64, 1.0, 0, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(o, float):\n yield _floatstr(o)\n elif isinstance(o, (list, tuple)):\n for chunk in _iterencode_list(o, _current_indent_level):\n yield chunk\n elif isinstance(o, dict):\n for chunk in _iterencode_dict(o, _current_indent_level):\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L415_C12", "label": "expression", "type": "expression", "loc": [415, 415], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L414_C8", "vector": [8, 8, 0.9562, 0.0023, 8, 0.06, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _floatstr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L416_C8", "label": "if", "type": "if", "loc": [416, 432], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L414_C8", "vector": [4, 8, 0.977, 0.0392, 8, 0.06, 1.0, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(o, (list, tuple)):\n for chunk in _iterencode_list(o, _current_indent_level):\n yield chunk\n elif isinstance(o, dict):\n for chunk in _iterencode_dict(o, _current_indent_level):\n yield chunk\n else:\n if markers is not None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L417_C12", "label": "for chunk", "type": "for", "loc": [417, 418], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L416_C8", "vector": [6, 9, 0.962, 0.0046, 9, 0.16, 0.0, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in _iterencode_list(o, _current_indent_level):\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L418_C16", "label": "expression", "type": "expression", "loc": [418, 418], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L417_C12", "vector": [8, 10, 0.9631, 0.0023, 10, 0.94, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L419_C8", "label": "if", "type": "if", "loc": [419, 432], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L416_C8", "vector": [4, 9, 0.9804, 0.0323, 9, 0.16, 1.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(o, dict):\n for chunk in _iterencode_dict(o, _current_indent_level):\n yield chunk\n else:\n if markers is not None:\n markerid = id(o)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L420_C12", "label": "for chunk", "type": "for", "loc": [420, 421], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L419_C8", "vector": [6, 10, 0.9689, 0.0046, 10, 0.44, 0.0, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in _iterencode_dict(o, _current_indent_level):\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L421_C16", "label": "expression", "type": "expression", "loc": [421, 421], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L420_C12", "vector": [8, 11, 0.97, 0.0023, 11, 0.09, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L423_C12", "label": "if", "type": "if", "loc": [423, 427], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L419_C8", "vector": [4, 10, 0.9793, 0.0115, 10, 0.44, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n markerid = id(o)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")\n markers[markerid] = o"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L424_C16", "label": "markerid = id()", "type": "assigned_variable", "loc": [424, 424], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L423_C12", "vector": [14, 11, 0.977, 0.0023, 11, 0.46, 0.0, 105, 3, 1, 0, 0, 941, 10, 1], "semantic": {"name": "markerid", "arg_names": [], "import_names": [], "rhs_call_name": "id", "annotation": ""}, "snippet": " markerid = id(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L425_C16", "label": "if", "type": "if", "loc": [425, 426], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L423_C12", "vector": [4, 11, 0.9804, 0.0046, 11, 0.46, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L427_C16", "label": "assign", "type": "assigned_variable", "loc": [427, 427], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L423_C12", "vector": [14, 11, 0.9839, 0.0023, 11, 0.46, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers[markerid] = o"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L428_C12", "label": "o = _default()", "type": "assigned_variable", "loc": [428, 428], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L419_C8", "vector": [14, 10, 0.9862, 0.0023, 10, 0.44, 0.5, 926, 3, 1, 0, 0, 99, 10, 1], "semantic": {"name": "o", "arg_names": [], "import_names": [], "rhs_call_name": "_default", "annotation": ""}, "snippet": " o = _default(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L429_C12", "label": "for chunk", "type": "for", "loc": [429, 430], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L419_C8", "vector": [6, 10, 0.9896, 0.0046, 10, 0.44, 0.75, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in _iterencode(o, _current_indent_level):\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L430_C16", "label": "expression", "type": "expression", "loc": [430, 430], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L429_C12", "vector": [8, 11, 0.9908, 0.0023, 11, 0.98, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L431_C12", "label": "if", "type": "if", "loc": [431, 432], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L419_C8", "vector": [4, 10, 0.9942, 0.0046, 10, 0.44, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n del markers[markerid]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L434_C4", "label": "return", "type": "return", "loc": [434, 434], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L258_C0", "vector": [13, 1, 1.0, 0.0023, 1, 0.82, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _iterencode"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1021:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:ImportFrom_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:ImportFrom_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:Try_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Try_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:Try_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:Try_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:Try_L50_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L54_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L55_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L54_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L59_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L54_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L60_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L54_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L61_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L150_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L151_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L152_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L184_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L185_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L185_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L186_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L185_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L187_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L187_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L189_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L184_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L190_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L190_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L191_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L190_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L193_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L199_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L203_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L212_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L213_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L212_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L215_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L216_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L216_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L217_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L216_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L219_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L220_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L220_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L221_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L221_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L222_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L222_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L223_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L221_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L224_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L226_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L226_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L230_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L230_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L231_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L230_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L232_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L232_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L233_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L232_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L234_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L234_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L235_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L234_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L237_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L226_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L239_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L226_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L243_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L246_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L246_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L247_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L246_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L252_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L256_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L273_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L274_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L274_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L275_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L274_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L276_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L277_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L278_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L277_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L279_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L277_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L281_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L282_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L283_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L283_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L285_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L283_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L286_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L283_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L289_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L283_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L290_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L291_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L292_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L292_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L293_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L293_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L294_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L293_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L296_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L292_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L297_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L297_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L298_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L297_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L299_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L299_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L300_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L299_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L301_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L301_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L302_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L301_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L303_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L303_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L304_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L303_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L305_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L305_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L306_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L305_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L307_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L307_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L308_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L307_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L310_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L307_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L311_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L311_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L312_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L311_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L313_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L313_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L314_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L313_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L316_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L307_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L317_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L317_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L318_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L319_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L319_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L321_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L322_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L323_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L326_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L327_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L327_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L328_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L327_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L329_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L330_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L330_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L331_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L330_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L332_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L330_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L334_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L335_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L336_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L338_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L339_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L340_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L342_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L343_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L344_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L345_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L345_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L346_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L345_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L347_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L345_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L349_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L350_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L351_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L351_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L355_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L355_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L356_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L355_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L357_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L357_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L358_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L357_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L359_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L359_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L360_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L359_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L361_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L361_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L362_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L361_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L363_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L363_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L364_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L363_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L365_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L369_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L369_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L370_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L369_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L372_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L373_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L374_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L375_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L375_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L376_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L375_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L377_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L377_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L378_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L377_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L379_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L379_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L380_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L379_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L381_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L381_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L382_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L381_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L383_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L383_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L384_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L383_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L385_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L385_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L386_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L385_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L388_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L388_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L389_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L388_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L390_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L390_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L391_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L390_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L393_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L385_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L394_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L394_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L395_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L396_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L396_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L398_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L399_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L400_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L403_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L403_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L404_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L404_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L405_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L404_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L406_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L406_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L407_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L406_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L408_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L408_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L409_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L408_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L410_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L410_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L411_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L410_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L412_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L412_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L413_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L412_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L414_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L414_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L415_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L414_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L416_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L416_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L417_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L417_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L418_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L416_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L419_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L420_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L420_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L421_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L423_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L423_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L424_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L423_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L425_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L423_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L427_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Assign_L428_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L429_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:For_L429_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Expr_L430_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:If_L431_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1021:FunctionDef_L258_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1021:Return_L434_C4"}]
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`simplejson` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is the externally maintained version of the :mod:`json` library contained in Python 2.6, but maintains compatibility with Python 2.4 and Python 2.5 and (currently) has significant performance advantages, even without using the optional C extension for speedups. Encoding basic Python object hierarchies:: >>> import simplejson as json >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print json.dumps("\"foo\bar") "\"foo\bar" >>> print json.dumps(u'\u1234') "\u1234" >>> print json.dumps('\\') "\\" >>> print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True) {"a": 0, "b": 0, "c": 0} >>> from StringIO import StringIO >>> io = StringIO() >>> json.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import simplejson as json >>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',',':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import simplejson as json >>> s = json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4) >>> print '\n'.join([l.rstrip() for l in s.splitlines()]) { "4": 5, "6": 7 } Decoding JSON:: >>> import simplejson as json >>> obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}] >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj True >>> json.loads('"\\"foo\\bar"') == u'"foo\x08ar' True >>> from StringIO import StringIO >>> io = StringIO('["streaming API"]') >>> json.load(io)[0] == 'streaming API' True Specializing JSON object decoding:: >>> import simplejson as json >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) >>> import decimal >>> json.loads('1.1', parse_float=decimal.Decimal) == decimal.Decimal('1.1') True Specializing JSON object encoding:: >>> import simplejson as json >>> def encode_complex(obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... raise TypeError("%r is not JSON serializable" % (o,)) ... >>> json.dumps(2 + 1j, default=encode_complex) '[2.0, 1.0]' >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j) '[2.0, 1.0]' >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j)) '[2.0, 1.0]' Using simplejson.tool from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -msimplejson.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -msimplejson.tool Expecting property name: line 1 column 2 (char 2) """ __version__ = '2.0.7' __all__ = [ 'dump', 'dumps', 'load', 'loads', 'JSONDecoder', 'JSONEncoder', ] from decoder import JSONDecoder from encoder import JSONEncoder _default_encoder = JSONEncoder( skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, indent=None, separators=None, encoding='utf-8', default=None, ) def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, encoding='utf-8', default=None, **kw): """Serialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is ``False``, then the some chunks written to ``fp`` may be ``unicode`` instances, subject to normal Python ``str`` to ``unicode`` coercion rules. Unless ``fp.write()`` explicitly understands ``unicode`` (as in ``codecs.getwriter()``) this is likely to cause an error. If ``check_circular`` is ``False``, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is ``False``, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg. """ # cached encoder if (skipkeys is False and ensure_ascii is True and check_circular is True and allow_nan is True and cls is None and indent is None and separators is None and encoding == 'utf-8' and default is None and not kw): iterable = _default_encoder.iterencode(obj) else: if cls is None: cls = JSONEncoder iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii, check_circular=check_circular, allow_nan=allow_nan, indent=indent, separators=separators, encoding=encoding, default=default, **kw).iterencode(obj) # could accelerate with writelines in some versions of Python, at # a debuggability cost for chunk in iterable: fp.write(chunk) def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, encoding='utf-8', default=None, **kw): """Serialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is ``False``, then the return value will be a ``unicode`` instance subject to normal Python ``str`` to ``unicode`` coercion rules instead of being escaped to an ASCII ``str``. If ``check_circular`` is ``False``, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is ``False``, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg. """ # cached encoder if (skipkeys is False and ensure_ascii is True and check_circular is True and allow_nan is True and cls is None and indent is None and separators is None and encoding == 'utf-8' and default is None and not kw): return _default_encoder.encode(obj) if cls is None: cls = JSONEncoder return cls( skipkeys=skipkeys, ensure_ascii=ensure_ascii, check_circular=check_circular, allow_nan=allow_nan, indent=indent, separators=separators, encoding=encoding, default=default, **kw).encode(obj) _default_decoder = JSONDecoder(encoding=None, object_hook=None) def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, **kw): """Deserialize ``fp`` (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. If the contents of ``fp`` is encoded with an ASCII based encoding other than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must be specified. Encodings that are not ASCII based (such as UCS-2) are not allowed, and should be wrapped with ``codecs.getreader(fp)(encoding)``, or simply decoded to a ``unicode`` object and passed to ``loads()`` ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg. """ return loads(fp.read(), encoding=encoding, cls=cls, object_hook=object_hook, parse_float=parse_float, parse_int=parse_int, parse_constant=parse_constant, **kw) def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, **kw): """Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON document) to a Python object. If ``s`` is a ``str`` instance and is encoded with an ASCII based encoding other than utf-8 (e.g. latin-1) then an appropriate ``encoding`` name must be specified. Encodings that are not ASCII based (such as UCS-2) are not allowed and should be decoded to ``unicode`` first. ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN, null, true, false. This can be used to raise an exception if invalid JSON numbers are encountered. To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg. """ if (cls is None and encoding is None and object_hook is None and parse_int is None and parse_float is None and parse_constant is None and not kw): return _default_decoder.decode(s) if cls is None: cls = JSONDecoder if object_hook is not None: kw['object_hook'] = object_hook if parse_float is not None: kw['parse_float'] = parse_float if parse_int is not None: kw['parse_int'] = parse_int if parse_constant is not None: kw['parse_constant'] = parse_constant return cls(encoding=encoding, **kw).decode(s)
ajibawa-2023/Python-Code-Large/train/row_1023
41
316
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 99], "level": 0, "parent": null, "vector": [8, 0, 0.1582, 0.3133, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "r\"\"\"JSON (JavaScript Object Notation) <http://json.org> is a subset of\nJavaScript syntax (ECMA-262 3rd edition) used as a lightweight data\ninterchange format.\n\n:mod:`simplejson` exposes an API familiar to users of the standard library\n:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained\nversion of the :mod:`json` library contained in Python 2.6, but maintains\ncompatibility with Python 2.4 and Python 2.5 and (currently) has"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Assign_L100_C0", "label": "__version__ =", "type": "assigned_variable", "loc": [100, 100], "level": 0, "parent": null, "vector": [14, 0, 0.3165, 0.0032, 0, 0.66, 0.1, 162, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__version__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__version__ = '2.0.7'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Assign_L101_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [101, 104], "level": 0, "parent": null, "vector": [14, 0, 0.3244, 0.0127, 0, 0.66, 0.2, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = [\n 'dump', 'dumps', 'load', 'loads',\n 'JSONDecoder', 'JSONEncoder',\n]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:ImportFrom_L106_C0", "label": "from decoder import JSONDecoder", "type": "import", "loc": [106, 106], "level": 0, "parent": null, "vector": [1, 0, 0.3354, 0.0032, 0, 0.66, 0.3, 404, 0, 1, 0, 0, 404, 0, 0], "semantic": {"name": "decoder", "arg_names": [], "import_names": ["JSONDecoder"], "rhs_call_name": "", "annotation": ""}, "snippet": "from decoder import JSONDecoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:ImportFrom_L107_C0", "label": "from encoder import JSONEncoder", "type": "import", "loc": [107, 107], "level": 0, "parent": null, "vector": [1, 0, 0.3386, 0.0032, 0, 0.66, 0.4, 672, 0, 1, 0, 0, 672, 0, 0], "semantic": {"name": "encoder", "arg_names": [], "import_names": ["JSONEncoder"], "rhs_call_name": "", "annotation": ""}, "snippet": "from encoder import JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Assign_L109_C0", "label": "_default_encoder = JSONEncoder()", "type": "assigned_variable", "loc": [109, 118], "level": 0, "parent": null, "vector": [14, 0, 0.3592, 0.0316, 0, 0.66, 0.5, 619, 3, 8, 0, 0, 228, 10, 1], "semantic": {"name": "_default_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "JSONEncoder", "annotation": ""}, "snippet": "_default_encoder = JSONEncoder(\n skipkeys=False,\n ensure_ascii=True,\n check_circular=True,\n allow_nan=True,\n indent=None,\n separators=None,\n encoding='utf-8',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L120_C0", "label": "dump", "type": "function", "loc": [120, 179], "level": 0, "parent": null, "vector": [2, 0, 0.4731, 0.1899, 0, 0.66, 0.6, 952, 0, 12, 0, 0, 0, 0, 4], "semantic": {"name": "dump", "arg_names": ["obj", "fp", "skipkeys", "ensure_ascii", "check_circular", "allow_nan", "cls", "indent", "separators", "encoding", "default", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True,\n allow_nan=True, cls=None, indent=None, separators=None,\n encoding='utf-8', default=None, **kw):\n \"\"\"Serialize ``obj`` as a JSON formatted stream to ``fp`` (a\n ``.write()``-supporting file-like object).\n\n If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types\n (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Expr_L123_C4", "label": "expression", "type": "expression", "loc": [123, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L120_C0", "vector": [8, 1, 0.4509, 0.1266, 1, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serialize ``obj`` as a JSON formatted stream to ``fp`` (a\n ``.write()``-supporting file-like object).\n\n If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types\n (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)\n will be skipped instead of raising a ``TypeError``.\n\n If ``ensure_ascii`` is ``False``, then the some chunks written to ``fp``"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L164_C4", "label": "if", "type": "if", "loc": [164, 175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L120_C0", "vector": [4, 1, 0.5364, 0.038, 1, 0.05, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (skipkeys is False and ensure_ascii is True and\n check_circular is True and allow_nan is True and\n cls is None and indent is None and separators is None and\n encoding == 'utf-8' and default is None and not kw):\n iterable = _default_encoder.iterencode(obj)\n else:\n if cls is None:\n cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Assign_L168_C8", "label": "iterable = iterencode()", "type": "assigned_variable", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L164_C4", "vector": [14, 2, 0.5316, 0.0032, 2, 0.14, 0.0, 444, 3, 1, 0, 0, 315, 10, 1], "semantic": {"name": "iterable", "arg_names": [], "import_names": [], "rhs_call_name": "iterencode", "annotation": ""}, "snippet": " iterable = _default_encoder.iterencode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L170_C8", "label": "if", "type": "if", "loc": [170, 171], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L164_C4", "vector": [4, 2, 0.5396, 0.0063, 2, 0.14, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cls is None:\n cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Assign_L171_C12", "label": "cls =", "type": "assigned_variable", "loc": [171, 171], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L170_C8", "vector": [14, 3, 0.5411, 0.0032, 3, 0.53, 0.0, 594, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Assign_L172_C8", "label": "iterable = iterencode()", "type": "assigned_variable", "loc": [172, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L164_C4", "vector": [14, 2, 0.5491, 0.0127, 2, 0.14, 1.0, 444, 3, 1, 0, 0, 315, 10, 2], "semantic": {"name": "iterable", "arg_names": [], "import_names": [], "rhs_call_name": "iterencode", "annotation": ""}, "snippet": " iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii,\n check_circular=check_circular, allow_nan=allow_nan, indent=indent,\n separators=separators, encoding=encoding,\n default=default, **kw).iterencode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:For_L178_C4", "label": "for chunk", "type": "for", "loc": [178, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L120_C0", "vector": [6, 1, 0.5649, 0.0063, 1, 0.05, 1.0, 637, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in iterable:\n fp.write(chunk)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Expr_L179_C8", "label": "write()", "type": "expression", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:For_L178_C4", "vector": [8, 2, 0.5665, 0.0032, 2, 0.39, 0.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " fp.write(chunk)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L182_C0", "label": "dumps", "type": "function", "loc": [182, 235], "level": 0, "parent": null, "vector": [2, 0, 0.6598, 0.1709, 0, 0.66, 0.7, 160, 0, 11, 1, 0, 0, 0, 3], "semantic": {"name": "dumps", "arg_names": ["obj", "skipkeys", "ensure_ascii", "check_circular", "allow_nan", "cls", "indent", "separators", "encoding", "default", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True,\n allow_nan=True, cls=None, indent=None, separators=None,\n encoding='utf-8', default=None, **kw):\n \"\"\"Serialize ``obj`` to a JSON formatted ``str``.\n\n If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types\n (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)\n will be skipped instead of raising a ``TypeError``."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Expr_L185_C4", "label": "expression", "type": "expression", "loc": [185, 222], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L182_C0", "vector": [8, 1, 0.644, 0.1203, 1, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serialize ``obj`` to a JSON formatted ``str``.\n\n If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types\n (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)\n will be skipped instead of raising a ``TypeError``.\n\n If ``ensure_ascii`` is ``False``, then the return value will be a\n ``unicode`` instance subject to normal Python ``str`` to ``unicode``"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L224_C4", "label": "if", "type": "if", "loc": [224, 228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L182_C0", "vector": [4, 1, 0.7152, 0.0158, 1, 0.19, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (skipkeys is False and ensure_ascii is True and\n check_circular is True and allow_nan is True and\n cls is None and indent is None and separators is None and\n encoding == 'utf-8' and default is None and not kw):\n return _default_encoder.encode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Return_L228_C8", "label": "return", "type": "return", "loc": [228, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L224_C4", "vector": [13, 2, 0.7215, 0.0032, 2, 0.74, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _default_encoder.encode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L229_C4", "label": "if", "type": "if", "loc": [229, 230], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L182_C0", "vector": [4, 1, 0.7263, 0.0063, 1, 0.19, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cls is None:\n cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Assign_L230_C8", "label": "cls =", "type": "assigned_variable", "loc": [230, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L229_C4", "vector": [14, 2, 0.7278, 0.0032, 2, 0.3, 0.0, 594, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Return_L231_C4", "label": "return", "type": "return", "loc": [231, 235], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L182_C0", "vector": [13, 1, 0.7373, 0.0158, 1, 0.19, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cls(\n skipkeys=skipkeys, ensure_ascii=ensure_ascii,\n check_circular=check_circular, allow_nan=allow_nan, indent=indent,\n separators=separators, encoding=encoding, default=default,\n **kw).encode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Assign_L238_C0", "label": "_default_decoder = JSONDecoder()", "type": "assigned_variable", "loc": [238, 238], "level": 0, "parent": null, "vector": [14, 0, 0.7532, 0.0032, 0, 0.66, 0.8, 340, 3, 2, 0, 0, 611, 10, 1], "semantic": {"name": "_default_decoder", "arg_names": [], "import_names": [], "rhs_call_name": "JSONDecoder", "annotation": ""}, "snippet": "_default_decoder = JSONDecoder(encoding=None, object_hook=None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L241_C0", "label": "load", "type": "function", "loc": [241, 265], "level": 0, "parent": null, "vector": [2, 0, 0.8006, 0.0791, 0, 0.66, 0.9, 37, 0, 8, 1, 0, 0, 0, 2], "semantic": {"name": "load", "arg_names": ["fp", "encoding", "cls", "object_hook", "parse_float", "parse_int", "parse_constant", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None,\n parse_int=None, parse_constant=None, **kw):\n \"\"\"Deserialize ``fp`` (a ``.read()``-supporting file-like object containing\n a JSON document) to a Python object.\n\n If the contents of ``fp`` is encoded with an ASCII based encoding other\n than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must\n be specified. Encodings that are not ASCII based (such as UCS-2) are"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Expr_L243_C4", "label": "expression", "type": "expression", "loc": [243, 261], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L241_C0", "vector": [8, 1, 0.7975, 0.0601, 1, 0.78, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Deserialize ``fp`` (a ``.read()``-supporting file-like object containing\n a JSON document) to a Python object.\n\n If the contents of ``fp`` is encoded with an ASCII based encoding other\n than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must\n be specified. Encodings that are not ASCII based (such as UCS-2) are\n not allowed, and should be wrapped with\n ``codecs.getreader(fp)(encoding)``, or simply decoded to a ``unicode``"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Return_L262_C4", "label": "return", "type": "return", "loc": [262, 265], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L241_C0", "vector": [13, 1, 0.8339, 0.0127, 1, 0.78, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return loads(fp.read(),\n encoding=encoding, cls=cls, object_hook=object_hook,\n parse_float=parse_float, parse_int=parse_int,\n parse_constant=parse_constant, **kw)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L268_C0", "label": "loads", "type": "function", "loc": [268, 316], "level": 0, "parent": null, "vector": [2, 0, 0.9241, 0.1551, 0, 0.66, 1.0, 88, 0, 8, 1, 0, 0, 0, 3], "semantic": {"name": "loads", "arg_names": ["s", "encoding", "cls", "object_hook", "parse_float", "parse_int", "parse_constant", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,\n parse_int=None, parse_constant=None, **kw):\n \"\"\"Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON\n document) to a Python object.\n\n If ``s`` is a ``str`` instance and is encoded with an ASCII based encoding\n other than utf-8 (e.g. latin-1) then an appropriate ``encoding`` name\n must be specified. Encodings that are not ASCII based (such as UCS-2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Expr_L270_C4", "label": "expression", "type": "expression", "loc": [270, 301], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L268_C0", "vector": [8, 1, 0.9035, 0.1013, 1, 0.52, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON\n document) to a Python object.\n\n If ``s`` is a ``str`` instance and is encoded with an ASCII based encoding\n other than utf-8 (e.g. latin-1) then an appropriate ``encoding`` name\n must be specified. Encodings that are not ASCII based (such as UCS-2)\n are not allowed and should be decoded to ``unicode`` first.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L302_C4", "label": "if", "type": "if", "loc": [302, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L268_C0", "vector": [4, 1, 0.9604, 0.0127, 1, 0.52, 0.1429, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (cls is None and encoding is None and object_hook is None and\n parse_int is None and parse_float is None and\n parse_constant is None and not kw):\n return _default_decoder.decode(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Return_L305_C8", "label": "return", "type": "return", "loc": [305, 305], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L302_C4", "vector": [13, 2, 0.9652, 0.0032, 2, 0.62, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _default_decoder.decode(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L306_C4", "label": "if", "type": "if", "loc": [306, 307], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L268_C0", "vector": [4, 1, 0.9699, 0.0063, 1, 0.52, 0.2857, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cls is None:\n cls = JSONDecoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Assign_L307_C8", "label": "cls =", "type": "assigned_variable", "loc": [307, 307], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L306_C4", "vector": [14, 2, 0.9715, 0.0032, 2, 0.09, 0.0, 594, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cls = JSONDecoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L308_C4", "label": "if", "type": "if", "loc": [308, 309], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L268_C0", "vector": [4, 1, 0.9763, 0.0063, 1, 0.52, 0.4286, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if object_hook is not None:\n kw['object_hook'] = object_hook"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Assign_L309_C8", "label": "assign", "type": "assigned_variable", "loc": [309, 309], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L308_C4", "vector": [14, 2, 0.9778, 0.0032, 2, 0.28, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kw['object_hook'] = object_hook"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L310_C4", "label": "if", "type": "if", "loc": [310, 311], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L268_C0", "vector": [4, 1, 0.9826, 0.0063, 1, 0.52, 0.5714, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parse_float is not None:\n kw['parse_float'] = parse_float"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Assign_L311_C8", "label": "assign", "type": "assigned_variable", "loc": [311, 311], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L310_C4", "vector": [14, 2, 0.9842, 0.0032, 2, 0.74, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kw['parse_float'] = parse_float"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L312_C4", "label": "if", "type": "if", "loc": [312, 313], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L268_C0", "vector": [4, 1, 0.9889, 0.0063, 1, 0.52, 0.7143, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parse_int is not None:\n kw['parse_int'] = parse_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Assign_L313_C8", "label": "assign", "type": "assigned_variable", "loc": [313, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L312_C4", "vector": [14, 2, 0.9905, 0.0032, 2, 0.52, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kw['parse_int'] = parse_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L314_C4", "label": "if", "type": "if", "loc": [314, 315], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L268_C0", "vector": [4, 1, 0.9953, 0.0063, 1, 0.52, 0.8571, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parse_constant is not None:\n kw['parse_constant'] = parse_constant"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Assign_L315_C8", "label": "assign", "type": "assigned_variable", "loc": [315, 315], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L314_C4", "vector": [14, 2, 0.9968, 0.0032, 2, 0.58, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kw['parse_constant'] = parse_constant"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1023:Return_L316_C4", "label": "return", "type": "return", "loc": [316, 316], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L268_C0", "vector": [13, 1, 1.0, 0.0032, 1, 0.52, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cls(encoding=encoding, **kw).decode(s)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:Expr_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:Assign_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:Assign_L171_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:Assign_L172_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:For_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:For_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:Expr_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:Expr_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L224_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L224_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:Return_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L229_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L229_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:Assign_L230_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:Return_L231_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L241_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:Expr_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L241_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:Return_L262_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:Expr_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:Return_L305_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L306_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:Assign_L307_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L308_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L308_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:Assign_L309_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L310_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L310_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:Assign_L311_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L312_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L312_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:Assign_L313_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L314_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:If_L314_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:Assign_L315_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1023:FunctionDef_L268_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1023:Return_L316_C4"}]
"""JSON token scanner """ import re try: from simplejson._speedups import make_scanner as c_make_scanner except ImportError: c_make_scanner = None __all__ = ['make_scanner'] NUMBER_RE = re.compile( r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?', (re.VERBOSE | re.MULTILINE | re.DOTALL)) def py_make_scanner(context): parse_object = context.parse_object parse_array = context.parse_array parse_string = context.parse_string match_number = NUMBER_RE.match encoding = context.encoding strict = context.strict parse_float = context.parse_float parse_int = context.parse_int parse_constant = context.parse_constant object_hook = context.object_hook def _scan_once(string, idx): try: nextchar = string[idx] except IndexError: raise StopIteration if nextchar == '"': return parse_string(string, idx + 1, encoding, strict) elif nextchar == '{': return parse_object((string, idx + 1), encoding, strict, _scan_once, object_hook) elif nextchar == '[': return parse_array((string, idx + 1), _scan_once) elif nextchar == 'n' and string[idx:idx + 4] == 'null': return None, idx + 4 elif nextchar == 't' and string[idx:idx + 4] == 'true': return True, idx + 4 elif nextchar == 'f' and string[idx:idx + 5] == 'false': return False, idx + 5 m = match_number(string, idx) if m is not None: integer, frac, exp = m.groups() if frac or exp: res = parse_float(integer + (frac or '') + (exp or '')) else: res = parse_int(integer) return res, m.end() elif nextchar == 'N' and string[idx:idx + 3] == 'NaN': return parse_constant('NaN'), idx + 3 elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity': return parse_constant('Infinity'), idx + 8 elif nextchar == '-' and string[idx:idx + 9] == '-Infinity': return parse_constant('-Infinity'), idx + 9 else: raise StopIteration return _scan_once make_scanner = c_make_scanner or py_make_scanner
ajibawa-2023/Python-Code-Large/train/row_1025
48
65
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 2], "level": 0, "parent": null, "vector": [8, 0, 0.0231, 0.0308, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"JSON token scanner\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Import_L3_C0", "label": "re import re", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0462, 0.0154, 0, 0.66, 0.1667, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Try_L4_C0", "label": "try", "type": "try", "loc": [4, 7], "level": 0, "parent": null, "vector": [7, 0, 0.0846, 0.0615, 0, 0.66, 0.3333, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from simplejson._speedups import make_scanner as c_make_scanner\nexcept ImportError:\n c_make_scanner = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:ImportFrom_L5_C4", "label": "from simplejson._speedups import c_make_scanner", "type": "import", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:Try_L4_C0", "vector": [1, 1, 0.0769, 0.0154, 1, 0.37, 0.0, 976, 0, 1, 0, 0, 976, 0, 0], "semantic": {"name": "simplejson._speedups", "arg_names": [], "import_names": ["c_make_scanner"], "rhs_call_name": "", "annotation": ""}, "snippet": " from simplejson._speedups import make_scanner as c_make_scanner"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L7_C4", "label": "c_make_scanner =", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:Try_L4_C0", "vector": [14, 1, 0.1077, 0.0154, 1, 0.37, 0.0, 400, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "c_make_scanner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_make_scanner = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L9_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.1385, 0.0154, 0, 0.66, 0.5, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = ['make_scanner']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L11_C0", "label": "NUMBER_RE = compile()", "type": "assigned_variable", "loc": [11, 13], "level": 0, "parent": null, "vector": [14, 0, 0.1846, 0.0462, 0, 0.66, 0.6667, 566, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "NUMBER_RE", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "NUMBER_RE = re.compile(\n r'(-?(?:0|[1-9]\\d*))(\\.\\d+)?([eE][-+]?\\d+)?',\n (re.VERBOSE | re.MULTILINE | re.DOTALL))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "label": "py_make_scanner", "type": "function", "loc": [15, 63], "level": 0, "parent": null, "vector": [2, 0, 0.6, 0.7538, 0, 0.66, 0.8333, 796, 0, 1, 1, 0, 0, 0, 11], "semantic": {"name": "py_make_scanner", "arg_names": ["context"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def py_make_scanner(context):\n parse_object = context.parse_object\n parse_array = context.parse_array\n parse_string = context.parse_string\n match_number = NUMBER_RE.match\n encoding = context.encoding\n strict = context.strict\n parse_float = context.parse_float"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L16_C4", "label": "parse_object =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "vector": [14, 1, 0.2462, 0.0154, 1, 0.36, 0.0, 924, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_object", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_object = context.parse_object"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L17_C4", "label": "parse_array =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "vector": [14, 1, 0.2615, 0.0154, 1, 0.36, 0.0909, 676, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_array", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_array = context.parse_array"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L18_C4", "label": "parse_string =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "vector": [14, 1, 0.2769, 0.0154, 1, 0.36, 0.1818, 867, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_string", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_string = context.parse_string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L19_C4", "label": "match_number =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "vector": [14, 1, 0.2923, 0.0154, 1, 0.36, 0.2727, 264, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "match_number", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " match_number = NUMBER_RE.match"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L20_C4", "label": "encoding =", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "vector": [14, 1, 0.3077, 0.0154, 1, 0.36, 0.3636, 325, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " encoding = context.encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L21_C4", "label": "strict =", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "vector": [14, 1, 0.3231, 0.0154, 1, 0.36, 0.4545, 697, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "strict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " strict = context.strict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L22_C4", "label": "parse_float =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "vector": [14, 1, 0.3385, 0.0154, 1, 0.36, 0.5455, 475, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_float", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_float = context.parse_float"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L23_C4", "label": "parse_int =", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "vector": [14, 1, 0.3538, 0.0154, 1, 0.36, 0.6364, 31, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_int", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_int = context.parse_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L24_C4", "label": "parse_constant =", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "vector": [14, 1, 0.3692, 0.0154, 1, 0.36, 0.7273, 808, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_constant", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_constant = context.parse_constant"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L25_C4", "label": "object_hook =", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "vector": [14, 1, 0.3846, 0.0154, 1, 0.36, 0.8182, 325, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "object_hook", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " object_hook = context.object_hook"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L27_C4", "label": "_scan_once", "type": "function", "loc": [27, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "vector": [2, 1, 0.6769, 0.5385, 1, 0.36, 0.9091, 221, 0, 2, 1, 0, 0, 0, 11], "semantic": {"name": "_scan_once", "arg_names": ["string", "idx"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _scan_once(string, idx):\n try:\n nextchar = string[idx]\n except IndexError:\n raise StopIteration\n\n if nextchar == '\"':\n return parse_string(string, idx + 1, encoding, strict)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Try_L28_C8", "label": "try", "type": "try", "loc": [28, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L27_C4", "vector": [7, 2, 0.4538, 0.0615, 2, 0.07, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n nextchar = string[idx]\n except IndexError:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L29_C12", "label": "nextchar =", "type": "assigned_variable", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:Try_L28_C8", "vector": [14, 3, 0.4462, 0.0154, 3, 0.78, 0.0, 937, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "nextchar", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nextchar = string[idx]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L33_C8", "label": "if", "type": "if", "loc": [33, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L27_C4", "vector": [4, 2, 0.5923, 0.1846, 2, 0.07, 0.3333, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if nextchar == '\"':\n return parse_string(string, idx + 1, encoding, strict)\n elif nextchar == '{':\n return parse_object((string, idx + 1), encoding, strict, _scan_once, object_hook)\n elif nextchar == '[':\n return parse_array((string, idx + 1), _scan_once)\n elif nextchar == 'n' and string[idx:idx + 4] == 'null':\n return None, idx + 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Return_L34_C12", "label": "return", "type": "return", "loc": [34, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L33_C8", "vector": [13, 3, 0.5231, 0.0154, 3, 0.3, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_string(string, idx + 1, encoding, strict)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L35_C8", "label": "if", "type": "if", "loc": [35, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L33_C8", "vector": [4, 3, 0.6077, 0.1538, 3, 0.3, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == '{':\n return parse_object((string, idx + 1), encoding, strict, _scan_once, object_hook)\n elif nextchar == '[':\n return parse_array((string, idx + 1), _scan_once)\n elif nextchar == 'n' and string[idx:idx + 4] == 'null':\n return None, idx + 4\n elif nextchar == 't' and string[idx:idx + 4] == 'true':\n return True, idx + 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Return_L36_C12", "label": "return", "type": "return", "loc": [36, 36], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L35_C8", "vector": [13, 4, 0.5538, 0.0154, 4, 0.51, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_object((string, idx + 1), encoding, strict, _scan_once, object_hook)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L37_C8", "label": "if", "type": "if", "loc": [37, 44], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L35_C8", "vector": [4, 4, 0.6231, 0.1231, 4, 0.51, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == '[':\n return parse_array((string, idx + 1), _scan_once)\n elif nextchar == 'n' and string[idx:idx + 4] == 'null':\n return None, idx + 4\n elif nextchar == 't' and string[idx:idx + 4] == 'true':\n return True, idx + 4\n elif nextchar == 'f' and string[idx:idx + 5] == 'false':\n return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Return_L38_C12", "label": "return", "type": "return", "loc": [38, 38], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L37_C8", "vector": [13, 5, 0.5846, 0.0154, 5, 0.73, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_array((string, idx + 1), _scan_once)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L39_C8", "label": "if", "type": "if", "loc": [39, 44], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L37_C8", "vector": [4, 5, 0.6385, 0.0923, 5, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 'n' and string[idx:idx + 4] == 'null':\n return None, idx + 4\n elif nextchar == 't' and string[idx:idx + 4] == 'true':\n return True, idx + 4\n elif nextchar == 'f' and string[idx:idx + 5] == 'false':\n return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Return_L40_C12", "label": "return", "type": "return", "loc": [40, 40], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L39_C8", "vector": [13, 6, 0.6154, 0.0154, 6, 0.53, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None, idx + 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L41_C8", "label": "if", "type": "if", "loc": [41, 44], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L39_C8", "vector": [4, 6, 0.6538, 0.0615, 6, 0.53, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 't' and string[idx:idx + 4] == 'true':\n return True, idx + 4\n elif nextchar == 'f' and string[idx:idx + 5] == 'false':\n return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Return_L42_C12", "label": "return", "type": "return", "loc": [42, 42], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L41_C8", "vector": [13, 7, 0.6462, 0.0154, 7, 0.03, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True, idx + 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L43_C8", "label": "if", "type": "if", "loc": [43, 44], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L41_C8", "vector": [4, 7, 0.6692, 0.0308, 7, 0.03, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 'f' and string[idx:idx + 5] == 'false':\n return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Return_L44_C12", "label": "return", "type": "return", "loc": [44, 44], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L43_C8", "vector": [13, 8, 0.6769, 0.0154, 8, 0.15, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L46_C8", "label": "m = match_number()", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L27_C4", "vector": [14, 2, 0.7077, 0.0154, 2, 0.07, 0.6667, 711, 3, 2, 0, 0, 264, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "match_number", "annotation": ""}, "snippet": " m = match_number(string, idx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L47_C8", "label": "if", "type": "if", "loc": [47, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L27_C4", "vector": [4, 2, 0.8308, 0.2308, 2, 0.07, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if m is not None:\n integer, frac, exp = m.groups()\n if frac or exp:\n res = parse_float(integer + (frac or '') + (exp or ''))\n else:\n res = parse_int(integer)\n return res, m.end()\n elif nextchar == 'N' and string[idx:idx + 3] == 'NaN':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L48_C12", "label": "integer, frac, exp = groups()", "type": "assigned_variable", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L47_C8", "vector": [14, 3, 0.7385, 0.0154, 3, 0.59, 0.0, 563, 3, 0, 0, 0, 161, 10, 1], "semantic": {"name": "integer, frac, exp", "arg_names": [], "import_names": [], "rhs_call_name": "groups", "annotation": ""}, "snippet": " integer, frac, exp = m.groups()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L49_C12", "label": "if", "type": "if", "loc": [49, 52], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L47_C8", "vector": [4, 3, 0.7769, 0.0615, 3, 0.59, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if frac or exp:\n res = parse_float(integer + (frac or '') + (exp or ''))\n else:\n res = parse_int(integer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L50_C16", "label": "res = parse_float()", "type": "assigned_variable", "loc": [50, 50], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L49_C12", "vector": [14, 4, 0.7692, 0.0154, 4, 0.89, 0.0, 413, 3, 1, 0, 0, 475, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "parse_float", "annotation": ""}, "snippet": " res = parse_float(integer + (frac or '') + (exp or ''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L52_C16", "label": "res = parse_int()", "type": "assigned_variable", "loc": [52, 52], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L49_C12", "vector": [14, 4, 0.8, 0.0154, 4, 0.89, 1.0, 413, 3, 1, 0, 0, 31, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "parse_int", "annotation": ""}, "snippet": " res = parse_int(integer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Return_L53_C12", "label": "return", "type": "return", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L47_C8", "vector": [13, 3, 0.8154, 0.0154, 3, 0.59, 0.6667, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return res, m.end()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L54_C8", "label": "if", "type": "if", "loc": [54, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L47_C8", "vector": [4, 3, 0.8846, 0.1231, 3, 0.59, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 'N' and string[idx:idx + 3] == 'NaN':\n return parse_constant('NaN'), idx + 3\n elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity':\n return parse_constant('Infinity'), idx + 8\n elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':\n return parse_constant('-Infinity'), idx + 9\n else:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Return_L55_C12", "label": "return", "type": "return", "loc": [55, 55], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L54_C8", "vector": [13, 4, 0.8462, 0.0154, 4, 0.21, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_constant('NaN'), idx + 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L56_C8", "label": "if", "type": "if", "loc": [56, 61], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L54_C8", "vector": [4, 4, 0.9, 0.0923, 4, 0.21, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity':\n return parse_constant('Infinity'), idx + 8\n elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':\n return parse_constant('-Infinity'), idx + 9\n else:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Return_L57_C12", "label": "return", "type": "return", "loc": [57, 57], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L56_C8", "vector": [13, 5, 0.8769, 0.0154, 5, 0.35, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_constant('Infinity'), idx + 8"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L58_C8", "label": "if", "type": "if", "loc": [58, 61], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L56_C8", "vector": [4, 5, 0.9154, 0.0615, 5, 0.35, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':\n return parse_constant('-Infinity'), idx + 9\n else:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Return_L59_C12", "label": "return", "type": "return", "loc": [59, 59], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L58_C8", "vector": [13, 6, 0.9077, 0.0154, 6, 0.54, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_constant('-Infinity'), idx + 9"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Return_L63_C4", "label": "return", "type": "return", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "vector": [13, 1, 0.9692, 0.0154, 1, 0.36, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _scan_once"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L65_C0", "label": "make_scanner =", "type": "assigned_variable", "loc": [65, 65], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.0154, 0, 0.66, 1.0, 683, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "make_scanner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "make_scanner = c_make_scanner or py_make_scanner"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1025:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Try_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L29_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Return_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Return_L36_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Return_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Return_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Return_L42_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L43_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Return_L44_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L49_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L50_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L49_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Assign_L52_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Return_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Return_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Return_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Return_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1025:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1025:Return_L63_C4"}]
#!/usr/bin/python2.4 '''Post a message to twitter''' __author__ = 'dewitt@google.com' import ConfigParser import getopt import os import sys import twitter USAGE = '''Usage: tweet [options] message This script posts a message to Twitter. Options: -h --help : print this help --consumer-key : the twitter consumer key --consumer-secret : the twitter consumer secret --access-key : the twitter access token key --access-secret : the twitter access token secret --encoding : the character set encoding used in input strings, e.g. "utf-8". [optional] Documentation: If either of the command line flags are not present, the environment variables TWEETUSERNAME and TWEETPASSWORD will then be checked for your consumer_key or consumer_secret, respectively. If neither the command line flags nor the enviroment variables are present, the .tweetrc file, if it exists, can be used to set the default consumer_key and consumer_secret. The file should contain the following three lines, replacing *consumer_key* with your consumer key, and *consumer_secret* with your consumer secret: A skeletal .tweetrc file: [Tweet] consumer_key: *consumer_key* consumer_secret: *consumer_password* access_key: *access_key* access_secret: *access_password* ''' def PrintUsageAndExit(): print USAGE sys.exit(2) def GetConsumerKeyEnv(): return os.environ.get("TWEETUSERNAME", None) def GetConsumerSecretEnv(): return os.environ.get("TWEETPASSWORD", None) def GetAccessKeyEnv(): return os.environ.get("TWEETACCESSKEY", None) def GetAccessSecretEnv(): return os.environ.get("TWEETACCESSSECRET", None) class TweetRc(object): def __init__(self): self._config = None def GetConsumerKey(self): return self._GetOption('consumer_key') def GetConsumerSecret(self): return self._GetOption('consumer_secret') def GetAccessKey(self): return self._GetOption('access_key') def GetAccessSecret(self): return self._GetOption('access_secret') def _GetOption(self, option): try: return self._GetConfig().get('Tweet', option) except: return None def _GetConfig(self): if not self._config: self._config = ConfigParser.ConfigParser() self._config.read(os.path.expanduser('~/.tweetrc')) return self._config def main(): try: shortflags = 'h' longflags = ['help', 'consumer-key=', 'consumer-secret=', 'access-key=', 'access-secret=', 'encoding='] opts, args = getopt.gnu_getopt(sys.argv[1:], shortflags, longflags) except getopt.GetoptError: PrintUsageAndExit() consumer_keyflag = None consumer_secretflag = None access_keyflag = None access_secretflag = None encoding = None for o, a in opts: if o in ("-h", "--help"): PrintUsageAndExit() if o in ("--consumer-key"): consumer_keyflag = a if o in ("--consumer-secret"): consumer_secretflag = a if o in ("--access-key"): access_keyflag = a if o in ("--access-secret"): access_secretflag = a if o in ("--encoding"): encoding = a message = ' '.join(args) if not message: PrintUsageAndExit() rc = TweetRc() consumer_key = consumer_keyflag or GetConsumerKeyEnv() or rc.GetConsumerKey() consumer_secret = consumer_secretflag or GetConsumerSecretEnv() or rc.GetConsumerSecret() access_key = access_keyflag or GetAccessKeyEnv() or rc.GetAccessKey() access_secret = access_secretflag or GetAccessSecretEnv() or rc.GetAccessSecret() if not consumer_key or not consumer_secret or not access_key or not access_secret: PrintUsageAndExit() api = twitter.Api(consumer_key=consumer_key, consumer_secret=consumer_secret, access_token_key=access_key, access_token_secret=access_secret, input_encoding=encoding) try: status = api.PostUpdate(message) except UnicodeDecodeError: print "Your message could not be encoded. Perhaps it contains non-ASCII characters? " print "Try explicitly specifying the encoding with the --encoding flag" sys.exit(2) print "%s just posted: %s" % (status.user.name, status.text) if __name__ == "__main__": main()
ajibawa-2023/Python-Code-Large/train/row_1027
82
141
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L3_C0", "label": "expression", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0213, 0.0071, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''Post a message to twitter'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L5_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.0355, 0.0071, 0, 0.66, 0.0667, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = 'dewitt@google.com'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Import_L7_C0", "label": "ConfigParser import ConfigParser", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0496, 0.0071, 0, 0.66, 0.1333, 272, 0, 1, 0, 0, 272, 0, 0], "semantic": {"name": "ConfigParser", "arg_names": [], "import_names": ["ConfigParser"], "rhs_call_name": "", "annotation": ""}, "snippet": "import ConfigParser"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Import_L8_C0", "label": "getopt import getopt", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0567, 0.0071, 0, 0.66, 0.2, 588, 0, 1, 0, 0, 588, 0, 0], "semantic": {"name": "getopt", "arg_names": [], "import_names": ["getopt"], "rhs_call_name": "", "annotation": ""}, "snippet": "import getopt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Import_L9_C0", "label": "os import os", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0638, 0.0071, 0, 0.66, 0.2667, 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_1027:Import_L10_C0", "label": "sys import sys", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0709, 0.0071, 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_1027:Import_L11_C0", "label": "twitter import twitter", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.078, 0.0071, 0, 0.66, 0.4, 234, 0, 1, 0, 0, 234, 0, 0], "semantic": {"name": "twitter", "arg_names": [], "import_names": ["twitter"], "rhs_call_name": "", "annotation": ""}, "snippet": "import twitter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L14_C0", "label": "USAGE =", "type": "assigned_variable", "loc": [14, 47], "level": 0, "parent": null, "vector": [14, 0, 0.2163, 0.2411, 0, 0.66, 0.4667, 952, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "USAGE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "USAGE = '''Usage: tweet [options] message\n\n This script posts a message to Twitter.\n\n Options:\n\n -h --help : print this help\n --consumer-key : the twitter consumer key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L49_C0", "label": "PrintUsageAndExit", "type": "function", "loc": [49, 51], "level": 0, "parent": null, "vector": [2, 0, 0.3546, 0.0213, 0, 0.66, 0.5333, 314, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "PrintUsageAndExit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def PrintUsageAndExit():\n print(USAGE)\n sys.exit(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L50_C2", "label": "print()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L49_C0", "vector": [8, 1, 0.3546, 0.0071, 1, 0.84, 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)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L51_C2", "label": "exit()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L49_C0", "vector": [8, 1, 0.3617, 0.0071, 1, 0.84, 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(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L53_C0", "label": "GetConsumerKeyEnv", "type": "function", "loc": [53, 54], "level": 0, "parent": null, "vector": [2, 0, 0.3794, 0.0142, 0, 0.66, 0.6, 551, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "GetConsumerKeyEnv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def GetConsumerKeyEnv():\n return os.environ.get(\"TWEETUSERNAME\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Return_L54_C2", "label": "return", "type": "return", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L53_C0", "vector": [13, 1, 0.383, 0.0071, 1, 0.21, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.environ.get(\"TWEETUSERNAME\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L56_C0", "label": "GetConsumerSecretEnv", "type": "function", "loc": [56, 57], "level": 0, "parent": null, "vector": [2, 0, 0.4007, 0.0142, 0, 0.66, 0.6667, 650, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "GetConsumerSecretEnv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def GetConsumerSecretEnv():\n return os.environ.get(\"TWEETPASSWORD\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Return_L57_C2", "label": "return", "type": "return", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L56_C0", "vector": [13, 1, 0.4043, 0.0071, 1, 0.06, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.environ.get(\"TWEETPASSWORD\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L59_C0", "label": "GetAccessKeyEnv", "type": "function", "loc": [59, 60], "level": 0, "parent": null, "vector": [2, 0, 0.422, 0.0142, 0, 0.66, 0.7333, 932, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "GetAccessKeyEnv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def GetAccessKeyEnv():\n return os.environ.get(\"TWEETACCESSKEY\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Return_L60_C2", "label": "return", "type": "return", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L59_C0", "vector": [13, 1, 0.4255, 0.0071, 1, 0.85, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.environ.get(\"TWEETACCESSKEY\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L62_C0", "label": "GetAccessSecretEnv", "type": "function", "loc": [62, 63], "level": 0, "parent": null, "vector": [2, 0, 0.4433, 0.0142, 0, 0.66, 0.8, 325, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "GetAccessSecretEnv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def GetAccessSecretEnv():\n return os.environ.get(\"TWEETACCESSSECRET\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Return_L63_C2", "label": "return", "type": "return", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L62_C0", "vector": [13, 1, 0.4468, 0.0071, 1, 0.64, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.environ.get(\"TWEETACCESSSECRET\", None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:ClassDef_L65_C0", "label": "TweetRc", "type": "class", "loc": [65, 91], "level": 0, "parent": null, "vector": [3, 0, 0.5532, 0.1915, 0, 0.66, 0.8667, 61, 0, 7, 0, 0, 186, 0, 9], "semantic": {"name": "TweetRc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TweetRc(object):\n def __init__(self):\n self._config = None\n\n def GetConsumerKey(self):\n return self._GetOption('consumer_key')\n\n def GetConsumerSecret(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L66_C2", "label": "__init__", "type": "function", "loc": [66, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:ClassDef_L65_C0", "vector": [2, 1, 0.4716, 0.0142, 1, 0.51, 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._config = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L67_C4", "label": "self._config =", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L66_C2", "vector": [14, 2, 0.4752, 0.0071, 2, 0.91, 0.0, 311, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._config", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._config = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L69_C2", "label": "GetConsumerKey", "type": "function", "loc": [69, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:ClassDef_L65_C0", "vector": [2, 1, 0.4929, 0.0142, 1, 0.51, 0.1667, 101, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "GetConsumerKey", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def GetConsumerKey(self):\n return self._GetOption('consumer_key')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Return_L70_C4", "label": "return", "type": "return", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L69_C2", "vector": [13, 2, 0.4965, 0.0071, 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._GetOption('consumer_key')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L72_C2", "label": "GetConsumerSecret", "type": "function", "loc": [72, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:ClassDef_L65_C0", "vector": [2, 1, 0.5142, 0.0142, 1, 0.51, 0.3333, 743, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "GetConsumerSecret", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def GetConsumerSecret(self):\n return self._GetOption('consumer_secret')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Return_L73_C4", "label": "return", "type": "return", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L72_C2", "vector": [13, 2, 0.5177, 0.0071, 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 self._GetOption('consumer_secret')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L75_C2", "label": "GetAccessKey", "type": "function", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:ClassDef_L65_C0", "vector": [2, 1, 0.5355, 0.0142, 1, 0.51, 0.5, 392, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "GetAccessKey", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def GetAccessKey(self):\n return self._GetOption('access_key')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Return_L76_C4", "label": "return", "type": "return", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L75_C2", "vector": [13, 2, 0.539, 0.0071, 2, 0.74, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._GetOption('access_key')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L78_C2", "label": "GetAccessSecret", "type": "function", "loc": [78, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:ClassDef_L65_C0", "vector": [2, 1, 0.5567, 0.0142, 1, 0.51, 0.6667, 686, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "GetAccessSecret", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def GetAccessSecret(self):\n return self._GetOption('access_secret')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Return_L79_C4", "label": "return", "type": "return", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L78_C2", "vector": [13, 2, 0.5603, 0.0071, 2, 0.77, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._GetOption('access_secret')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L81_C2", "label": "_GetOption", "type": "function", "loc": [81, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:ClassDef_L65_C0", "vector": [2, 1, 0.5887, 0.0355, 1, 0.51, 0.8333, 808, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "_GetOption", "arg_names": ["self", "option"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _GetOption(self, option):\n try:\n return self._GetConfig().get('Tweet', option)\n except:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L82_C4", "label": "try", "type": "try", "loc": [82, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L81_C2", "vector": [7, 2, 0.5922, 0.0284, 2, 0.64, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return self._GetConfig().get('Tweet', option)\n except:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Return_L83_C6", "label": "return", "type": "return", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L82_C4", "vector": [13, 3, 0.5887, 0.0071, 3, 0.09, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._GetConfig().get('Tweet', option)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Return_L85_C6", "label": "return", "type": "return", "loc": [85, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L82_C4", "vector": [13, 3, 0.6028, 0.0071, 3, 0.09, 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_1027:FunctionDef_L87_C2", "label": "_GetConfig", "type": "function", "loc": [87, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:ClassDef_L65_C0", "vector": [2, 1, 0.6312, 0.0355, 1, 0.51, 1.0, 33, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "_GetConfig", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _GetConfig(self):\n if not self._config:\n self._config = ConfigParser.ConfigParser()\n self._config.read(os.path.expanduser('~/.tweetrc'))\n return self._config"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L88_C4", "label": "if", "type": "if", "loc": [88, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L87_C2", "vector": [4, 2, 0.6312, 0.0213, 2, 0.15, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self._config:\n self._config = ConfigParser.ConfigParser()\n self._config.read(os.path.expanduser('~/.tweetrc'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L89_C6", "label": "self._config = ConfigParser()", "type": "assigned_variable", "loc": [89, 89], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L88_C4", "vector": [14, 3, 0.6312, 0.0071, 3, 0.58, 0.0, 311, 3, 0, 0, 0, 272, 10, 1], "semantic": {"name": "self._config", "arg_names": [], "import_names": [], "rhs_call_name": "ConfigParser", "annotation": ""}, "snippet": " self._config = ConfigParser.ConfigParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L90_C6", "label": "read()", "type": "expression", "loc": [90, 90], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L88_C4", "vector": [8, 3, 0.6383, 0.0071, 3, 0.58, 1.0, 453, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "read", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " self._config.read(os.path.expanduser('~/.tweetrc'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Return_L91_C4", "label": "return", "type": "return", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L87_C2", "vector": [13, 2, 0.6454, 0.0071, 2, 0.15, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._config"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "label": "main", "type": "function", "loc": [93, 138], "level": 0, "parent": null, "vector": [2, 0, 0.8191, 0.3262, 0, 0.66, 0.9333, 624, 0, 0, 0, 0, 0, 0, 21], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n try:\n shortflags = 'h'\n longflags = ['help', 'consumer-key=', 'consumer-secret=', \n 'access-key=', 'access-secret=', 'encoding=']\n opts, args = getopt.gnu_getopt(sys.argv[1:], shortflags, longflags)\n except getopt.GetoptError:\n PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L94_C2", "label": "try", "type": "try", "loc": [94, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "vector": [7, 1, 0.6879, 0.0496, 1, 0.58, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n shortflags = 'h'\n longflags = ['help', 'consumer-key=', 'consumer-secret=', \n 'access-key=', 'access-secret=', 'encoding=']\n opts, args = getopt.gnu_getopt(sys.argv[1:], shortflags, longflags)\n except getopt.GetoptError:\n PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L95_C4", "label": "shortflags =", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L94_C2", "vector": [14, 2, 0.6738, 0.0071, 2, 0.93, 0.0, 245, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "shortflags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " shortflags = 'h'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L96_C4", "label": "longflags =", "type": "assigned_variable", "loc": [96, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L94_C2", "vector": [14, 2, 0.6844, 0.0142, 2, 0.93, 0.5, 745, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "longflags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " longflags = ['help', 'consumer-key=', 'consumer-secret=', \n 'access-key=', 'access-secret=', 'encoding=']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L98_C4", "label": "opts, args = gnu_getopt()", "type": "assigned_variable", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L94_C2", "vector": [14, 2, 0.695, 0.0071, 2, 0.93, 1.0, 616, 3, 3, 0, 0, 712, 10, 1], "semantic": {"name": "opts, args", "arg_names": [], "import_names": [], "rhs_call_name": "gnu_getopt", "annotation": ""}, "snippet": " opts, args = getopt.gnu_getopt(sys.argv[1:], shortflags, longflags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L100_C4", "label": "PrintUsageAndExit()", "type": "expression", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L94_C2", "vector": [8, 2, 0.7092, 0.0071, 2, 0.93, 0.0, 314, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "PrintUsageAndExit", "arg_names": [], "import_names": [], "rhs_call_name": "PrintUsageAndExit", "annotation": ""}, "snippet": " PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L101_C2", "label": "consumer_keyflag =", "type": "assigned_variable", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "vector": [14, 1, 0.7163, 0.0071, 1, 0.58, 0.0588, 74, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "consumer_keyflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " consumer_keyflag = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L102_C2", "label": "consumer_secretflag =", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "vector": [14, 1, 0.7234, 0.0071, 1, 0.58, 0.1176, 178, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "consumer_secretflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " consumer_secretflag = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L103_C2", "label": "access_keyflag =", "type": "assigned_variable", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "vector": [14, 1, 0.7305, 0.0071, 1, 0.58, 0.1765, 450, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "access_keyflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " access_keyflag = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L104_C2", "label": "access_secretflag =", "type": "assigned_variable", "loc": [104, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "vector": [14, 1, 0.7376, 0.0071, 1, 0.58, 0.2353, 83, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "access_secretflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " access_secretflag = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L105_C2", "label": "encoding =", "type": "assigned_variable", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "vector": [14, 1, 0.7447, 0.0071, 1, 0.58, 0.2941, 325, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " encoding = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:For_L106_C2", "label": "for o, a", "type": "for", "loc": [106, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "vector": [6, 1, 0.7943, 0.0922, 1, 0.58, 0.3529, 736, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "o, a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for o, a in opts:\n if o in (\"-h\", \"--help\"):\n PrintUsageAndExit()\n if o in (\"--consumer-key\"):\n consumer_keyflag = a\n if o in (\"--consumer-secret\"):\n consumer_secretflag = a\n if o in (\"--access-key\"):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L107_C4", "label": "if", "type": "if", "loc": [107, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:For_L106_C2", "vector": [4, 2, 0.7624, 0.0142, 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 o in (\"-h\", \"--help\"):\n PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L108_C6", "label": "PrintUsageAndExit()", "type": "expression", "loc": [108, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L107_C4", "vector": [8, 3, 0.766, 0.0071, 3, 0.72, 0.0, 314, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "PrintUsageAndExit", "arg_names": [], "import_names": [], "rhs_call_name": "PrintUsageAndExit", "annotation": ""}, "snippet": " PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L109_C4", "label": "if", "type": "if", "loc": [109, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:For_L106_C2", "vector": [4, 2, 0.7766, 0.0142, 2, 0.93, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o in (\"--consumer-key\"):\n consumer_keyflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L110_C6", "label": "consumer_keyflag =", "type": "assigned_variable", "loc": [110, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L109_C4", "vector": [14, 3, 0.7801, 0.0071, 3, 0.47, 0.0, 74, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "consumer_keyflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " consumer_keyflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L111_C4", "label": "if", "type": "if", "loc": [111, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:For_L106_C2", "vector": [4, 2, 0.7908, 0.0142, 2, 0.93, 0.4, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o in (\"--consumer-secret\"):\n consumer_secretflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L112_C6", "label": "consumer_secretflag =", "type": "assigned_variable", "loc": [112, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L111_C4", "vector": [14, 3, 0.7943, 0.0071, 3, 0.2, 0.0, 178, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "consumer_secretflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " consumer_secretflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L113_C4", "label": "if", "type": "if", "loc": [113, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:For_L106_C2", "vector": [4, 2, 0.805, 0.0142, 2, 0.93, 0.6, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o in (\"--access-key\"):\n access_keyflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L114_C6", "label": "access_keyflag =", "type": "assigned_variable", "loc": [114, 114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L113_C4", "vector": [14, 3, 0.8085, 0.0071, 3, 0.72, 0.0, 450, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "access_keyflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " access_keyflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L115_C4", "label": "if", "type": "if", "loc": [115, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:For_L106_C2", "vector": [4, 2, 0.8191, 0.0142, 2, 0.93, 0.8, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o in (\"--access-secret\"):\n access_secretflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L116_C6", "label": "access_secretflag =", "type": "assigned_variable", "loc": [116, 116], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L115_C4", "vector": [14, 3, 0.8227, 0.0071, 3, 0.36, 0.0, 83, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "access_secretflag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " access_secretflag = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L117_C4", "label": "if", "type": "if", "loc": [117, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:For_L106_C2", "vector": [4, 2, 0.8333, 0.0142, 2, 0.93, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o in (\"--encoding\"):\n encoding = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L118_C6", "label": "encoding =", "type": "assigned_variable", "loc": [118, 118], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L117_C4", "vector": [14, 3, 0.8369, 0.0071, 3, 0.48, 0.0, 325, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " encoding = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L119_C2", "label": "message = join()", "type": "assigned_variable", "loc": [119, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "vector": [14, 1, 0.844, 0.0071, 1, 0.58, 0.4118, 635, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "message", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " message = ' '.join(args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L120_C2", "label": "if", "type": "if", "loc": [120, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "vector": [4, 1, 0.8546, 0.0142, 1, 0.58, 0.4706, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not message:\n PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L121_C4", "label": "PrintUsageAndExit()", "type": "expression", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L120_C2", "vector": [8, 2, 0.8582, 0.0071, 2, 0.34, 0.0, 314, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "PrintUsageAndExit", "arg_names": [], "import_names": [], "rhs_call_name": "PrintUsageAndExit", "annotation": ""}, "snippet": " PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L122_C2", "label": "rc = TweetRc()", "type": "assigned_variable", "loc": [122, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "vector": [14, 1, 0.8652, 0.0071, 1, 0.58, 0.5294, 401, 3, 0, 0, 0, 61, 10, 1], "semantic": {"name": "rc", "arg_names": [], "import_names": [], "rhs_call_name": "TweetRc", "annotation": ""}, "snippet": " rc = TweetRc()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L123_C2", "label": "consumer_key =", "type": "assigned_variable", "loc": [123, 123], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "vector": [14, 1, 0.8723, 0.0071, 1, 0.58, 0.5882, 353, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "consumer_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " consumer_key = consumer_keyflag or GetConsumerKeyEnv() or rc.GetConsumerKey()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L124_C2", "label": "consumer_secret =", "type": "assigned_variable", "loc": [124, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "vector": [14, 1, 0.8794, 0.0071, 1, 0.58, 0.6471, 734, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "consumer_secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " consumer_secret = consumer_secretflag or GetConsumerSecretEnv() or rc.GetConsumerSecret()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L125_C2", "label": "access_key =", "type": "assigned_variable", "loc": [125, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "vector": [14, 1, 0.8865, 0.0071, 1, 0.58, 0.7059, 200, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "access_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " access_key = access_keyflag or GetAccessKeyEnv() or rc.GetAccessKey()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L126_C2", "label": "access_secret =", "type": "assigned_variable", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "vector": [14, 1, 0.8936, 0.0071, 1, 0.58, 0.7647, 171, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "access_secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " access_secret = access_secretflag or GetAccessSecretEnv() or rc.GetAccessSecret()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L127_C2", "label": "if", "type": "if", "loc": [127, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "vector": [4, 1, 0.9043, 0.0142, 1, 0.58, 0.8235, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not consumer_key or not consumer_secret or not access_key or not access_secret:\n PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L128_C4", "label": "PrintUsageAndExit()", "type": "expression", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L127_C2", "vector": [8, 2, 0.9078, 0.0071, 2, 0.65, 0.0, 314, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "PrintUsageAndExit", "arg_names": [], "import_names": [], "rhs_call_name": "PrintUsageAndExit", "annotation": ""}, "snippet": " PrintUsageAndExit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L129_C2", "label": "api = Api()", "type": "assigned_variable", "loc": [129, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "vector": [14, 1, 0.922, 0.0213, 1, 0.58, 0.8824, 976, 3, 5, 0, 0, 192, 10, 1], "semantic": {"name": "api", "arg_names": [], "import_names": [], "rhs_call_name": "Api", "annotation": ""}, "snippet": " api = twitter.Api(consumer_key=consumer_key, consumer_secret=consumer_secret,\n access_token_key=access_key, access_token_secret=access_secret,\n input_encoding=encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L132_C2", "label": "try", "type": "try", "loc": [132, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "vector": [7, 1, 0.9539, 0.0426, 1, 0.58, 0.9412, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n status = api.PostUpdate(message)\n except UnicodeDecodeError:\n print(\"Your message could not be encoded. Perhaps it contains non-ASCII characters? \")\n print(\"Try explicitly specifying the encoding with the --encoding flag\")\n sys.exit(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L133_C4", "label": "status = PostUpdate()", "type": "assigned_variable", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L132_C2", "vector": [14, 2, 0.9433, 0.0071, 2, 0.27, 0.0, 699, 3, 1, 0, 0, 880, 10, 1], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "PostUpdate", "annotation": ""}, "snippet": " status = api.PostUpdate(message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L135_C4", "label": "print()", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L132_C2", "vector": [8, 2, 0.9574, 0.0071, 2, 0.27, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Your message could not be encoded. Perhaps it contains non-ASCII characters? \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L136_C4", "label": "print()", "type": "expression", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L132_C2", "vector": [8, 2, 0.9645, 0.0071, 2, 0.27, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Try explicitly specifying the encoding with the --encoding flag\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L137_C4", "label": "exit()", "type": "expression", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L132_C2", "vector": [8, 2, 0.9716, 0.0071, 2, 0.27, 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(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L138_C2", "label": "print()", "type": "expression", "loc": [138, 138], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "vector": [8, 1, 0.9787, 0.0071, 1, 0.58, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"%s just posted: %s\" % (status.user.name, status.text))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L140_C0", "label": "if", "type": "if", "loc": [140, 141], "level": 0, "parent": null, "vector": [4, 0, 0.9965, 0.0142, 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_1027:Expr_L141_C2", "label": "main()", "type": "expression", "loc": [141, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L140_C0", "vector": [8, 1, 1.0, 0.0071, 1, 0.74, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Return_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Return_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Return_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Return_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L69_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Return_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L72_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Return_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L75_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Return_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L78_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Return_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L81_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L81_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Return_L83_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Return_L85_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L89_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L90_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Return_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L94_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L94_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L94_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L94_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L94_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L101_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L102_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L103_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L104_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L105_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:For_L106_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:For_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L107_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L108_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:For_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L110_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:For_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L112_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:For_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L114_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:For_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L116_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:For_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L118_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L119_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L120_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L122_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L123_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L124_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L125_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L126_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L127_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L127_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L129_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L132_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Assign_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:Try_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L138_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1027:If_L140_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1027:Expr_L141_C2"}]
#!/usr/bin/python2.4 # # Copyright 2007 The Python-Twitter Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. '''A class that defines the default URL Shortener. TinyURL is provided as the default and as an example. ''' import urllib # Change History # # 2010-05-16 # TinyURL example and the idea for this comes from a bug filed by # acolorado with patch provided by ghills. Class implementation # was done by bear. # # Issue 19 http://code.google.com/p/python-twitter/issues/detail?id=19 # class ShortenURL(object): '''Helper class to make URL Shortener calls if/when required''' def __init__(self, userid=None, password=None): '''Instantiate a new ShortenURL object Args: userid: userid for any required authorization call [optional] password: password for any required authorization call [optional] ''' self.userid = userid self.password = password def Shorten(self, longURL): '''Call TinyURL API and returned shortened URL result Args: longURL: URL string to shorten Returns: The shortened URL as a string Note: longURL is required and no checks are made to ensure completeness ''' result = None f = urllib.urlopen("http://tinyurl.com/api-create.php?url=%s" % longURL) try: result = f.read() finally: f.close() return result
ajibawa-2023/Python-Code-Large/train/row_1028
16
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_1028:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 20], "level": 0, "parent": null, "vector": [8, 0, 0.2606, 0.0563, 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 class that defines the default URL Shortener.\n\nTinyURL is provided as the default and as an example.\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1028:Import_L22_C0", "label": "urllib import urllib", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.3099, 0.0141, 0, 0.66, 0.5, 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_1028:ClassDef_L36_C0", "label": "ShortenURL", "type": "class", "loc": [36, 71], "level": 0, "parent": null, "vector": [3, 0, 0.7535, 0.507, 0, 0.66, 1.0, 365, 0, 2, 0, 0, 186, 0, 3], "semantic": {"name": "ShortenURL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ShortenURL(object):\n '''Helper class to make URL Shortener calls if/when required'''\n def __init__(self,\n userid=None,\n password=None):\n '''Instantiate a new ShortenURL object\n \n Args:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1028:Expr_L37_C4", "label": "expression", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1028:ClassDef_L36_C0", "vector": [8, 1, 0.5211, 0.0141, 1, 0.27, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Helper class to make URL Shortener calls if/when required'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1028:FunctionDef_L38_C4", "label": "__init__", "type": "function", "loc": [38, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1028:ClassDef_L36_C0", "vector": [2, 1, 0.6056, 0.1549, 1, 0.27, 0.5, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "userid", "password"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self,\n userid=None,\n password=None):\n '''Instantiate a new ShortenURL object\n \n Args:\n userid: userid for any required authorization call [optional]\n password: password for any required authorization call [optional]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1028:Expr_L41_C8", "label": "expression", "type": "expression", "loc": [41, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1028:FunctionDef_L38_C4", "vector": [8, 2, 0.6127, 0.0845, 2, 0.21, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Instantiate a new ShortenURL object\n \n Args:\n userid: userid for any required authorization call [optional]\n password: password for any required authorization call [optional]\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1028:Assign_L47_C8", "label": "self.userid =", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1028:FunctionDef_L38_C4", "vector": [14, 2, 0.662, 0.0141, 2, 0.21, 0.5, 677, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.userid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.userid = userid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1028:Assign_L48_C8", "label": "self.password =", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1028:FunctionDef_L38_C4", "vector": [14, 2, 0.6761, 0.0141, 2, 0.21, 1.0, 902, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.password", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.password = password"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1028:FunctionDef_L50_C4", "label": "Shorten", "type": "function", "loc": [50, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1028:ClassDef_L36_C0", "vector": [2, 1, 0.8521, 0.3099, 1, 0.27, 1.0, 862, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "Shorten", "arg_names": ["self", "longURL"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def Shorten(self,\n longURL):\n '''Call TinyURL API and returned shortened URL result\n \n Args:\n longURL: URL string to shorten\n \n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1028:Expr_L52_C8", "label": "expression", "type": "expression", "loc": [52, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1028:FunctionDef_L50_C4", "vector": [8, 2, 0.8028, 0.1549, 2, 0.36, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Call TinyURL API and returned shortened URL result\n \n Args:\n longURL: URL string to shorten\n \n Returns:\n The shortened URL as a string\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1028:Assign_L64_C8", "label": "result =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1028:FunctionDef_L50_C4", "vector": [14, 2, 0.9014, 0.0141, 2, 0.36, 0.25, 51, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1028:Assign_L65_C8", "label": "f = urlopen()", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1028:FunctionDef_L50_C4", "vector": [14, 2, 0.9155, 0.0141, 2, 0.36, 0.5, 899, 3, 1, 0, 0, 687, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "urlopen", "annotation": ""}, "snippet": " f = urllib.urlopen(\"http://tinyurl.com/api-create.php?url=%s\" % longURL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1028:Try_L66_C8", "label": "try", "type": "try", "loc": [66, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1028:FunctionDef_L50_C4", "vector": [7, 2, 0.9507, 0.0563, 2, 0.36, 0.75, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n result = f.read()\n finally:\n f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1028:Assign_L67_C12", "label": "result = read()", "type": "assigned_variable", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1028:Try_L66_C8", "vector": [14, 3, 0.9437, 0.0141, 3, 0.1, 0.0, 51, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " result = f.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1028:Expr_L69_C12", "label": "close()", "type": "expression", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1028:Try_L66_C8", "vector": [8, 3, 0.9718, 0.0141, 3, 0.1, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1028:Return_L71_C8", "label": "return", "type": "return", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1028:FunctionDef_L50_C4", "vector": [13, 2, 1.0, 0.0141, 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 result"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1028:ClassDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1028:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1028:ClassDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1028:FunctionDef_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1028:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1028:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1028:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1028:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1028:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1028:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1028:ClassDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1028:FunctionDef_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1028:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1028:Expr_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1028:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1028:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1028:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1028:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1028:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1028:Try_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1028:Try_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1028:Assign_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1028:Try_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1028:Expr_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1028:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1028:Return_L71_C8"}]
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # from astm.version import __version__ try: from setuptools import setup, find_packages except ImportError: from distutils.core import setup # http://wiki.python.org/moin/Distutils/Cookbook/AutoPackageDiscovery import os def is_package(path): return ( os.path.isdir(path) and os.path.isfile(os.path.join(path, '__init__.py')) ) def find_packages(path='.', base=""): """ Find all packages in path """ packages = {} for item in os.listdir(path): dir = os.path.join(path, item) if is_package(dir): if base: module_name = "%(base)s.%(item)s" % vars() else: module_name = item packages[module_name] = dir packages.update(find_packages(dir, module_name)) return packages setup( name = 'astm', version = __version__, description = 'Python implementation of ASTM E1381/1394 protocol.', long_description = open('README').read(), author = 'Alexander Shorin', author_email = 'kxepal@gmail.com', license = 'BSD', url = 'http://code.google.com/p/python-astm', install_requires = [], test_suite = 'astm.tests', zip_safe = True, classifiers = [ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Scientific/Engineering :: Medical Science Apps.' ], packages = find_packages(), )
ajibawa-2023/Python-Code-Large/train/row_1031
20
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_1031:ImportFrom_L11_C0", "label": "from astm.version import __version__", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1618, 0.0147, 0, 0.66, 0.0, 390, 0, 1, 0, 0, 390, 0, 0], "semantic": {"name": "astm.version", "arg_names": [], "import_names": ["__version__"], "rhs_call_name": "", "annotation": ""}, "snippet": "from astm.version import __version__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1031:Try_L12_C0", "label": "try", "type": "try", "loc": [12, 37], "level": 0, "parent": null, "vector": [7, 0, 0.3603, 0.3824, 0, 0.66, 0.5, 0, 0, 1, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from setuptools import setup, find_packages\nexcept ImportError:\n from distutils.core import setup\n # http://wiki.python.org/moin/Distutils/Cookbook/AutoPackageDiscovery\n import os\n\n def is_package(path):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1031:ImportFrom_L13_C4", "label": "from setuptools import setup, find_packages", "type": "import", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1031:Try_L12_C0", "vector": [1, 1, 0.1912, 0.0147, 1, 0.62, 0.0, 182, 0, 2, 0, 0, 182, 0, 0], "semantic": {"name": "setuptools", "arg_names": [], "import_names": ["setup", "find_packages"], "rhs_call_name": "", "annotation": ""}, "snippet": " from setuptools import setup, find_packages"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1031:ImportFrom_L15_C4", "label": "from distutils.core import setup", "type": "import", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1031:Try_L12_C0", "vector": [1, 1, 0.2206, 0.0147, 1, 0.62, 0.0, 152, 0, 1, 0, 0, 152, 0, 0], "semantic": {"name": "distutils.core", "arg_names": [], "import_names": ["setup"], "rhs_call_name": "", "annotation": ""}, "snippet": " from distutils.core import setup"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1031:Import_L17_C4", "label": "os import os", "type": "import", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1031:Try_L12_C0", "vector": [1, 1, 0.25, 0.0147, 1, 0.62, 0.3333, 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_1031:FunctionDef_L19_C4", "label": "is_package", "type": "function", "loc": [19, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1031:Try_L12_C0", "vector": [2, 1, 0.3088, 0.0735, 1, 0.62, 0.6667, 121, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "is_package", "arg_names": ["path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_package(path):\n return (\n os.path.isdir(path) and\n os.path.isfile(os.path.join(path, '__init__.py'))\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1031:Return_L20_C8", "label": "return", "type": "return", "loc": [20, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1031:FunctionDef_L19_C4", "vector": [13, 2, 0.3162, 0.0588, 2, 0.86, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (\n os.path.isdir(path) and\n os.path.isfile(os.path.join(path, '__init__.py'))\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1031:FunctionDef_L25_C4", "label": "find_packages", "type": "function", "loc": [25, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1031:Try_L12_C0", "vector": [2, 1, 0.4559, 0.1912, 1, 0.62, 1.0, 395, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "find_packages", "arg_names": ["path", "base"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def find_packages(path='.', base=\"\"):\n \"\"\" Find all packages in path \"\"\"\n packages = {}\n for item in os.listdir(path):\n dir = os.path.join(path, item)\n if is_package(dir):\n if base:\n module_name = \"%(base)s.%(item)s\" % vars()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1031:Expr_L26_C8", "label": "expression", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1031:FunctionDef_L25_C4", "vector": [8, 2, 0.3824, 0.0147, 2, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Find all packages in path \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1031:Assign_L27_C8", "label": "packages =", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1031:FunctionDef_L25_C4", "vector": [14, 2, 0.3971, 0.0147, 2, 0.91, 0.3333, 301, 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_1031:For_L28_C8", "label": "for item", "type": "for", "loc": [28, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1031:FunctionDef_L25_C4", "vector": [6, 2, 0.4706, 0.1324, 2, 0.91, 0.6667, 434, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in os.listdir(path):\n dir = os.path.join(path, item)\n if is_package(dir):\n if base:\n module_name = \"%(base)s.%(item)s\" % vars()\n else:\n module_name = item\n packages[module_name] = dir"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1031:Assign_L29_C12", "label": "dir = join()", "type": "assigned_variable", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1031:For_L28_C8", "vector": [14, 3, 0.4265, 0.0147, 3, 0.04, 0.0, 152, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "dir", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " dir = os.path.join(path, item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1031:If_L30_C12", "label": "if", "type": "if", "loc": [30, 36], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1031:For_L28_C8", "vector": [4, 3, 0.4853, 0.1029, 3, 0.04, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if is_package(dir):\n if base:\n module_name = \"%(base)s.%(item)s\" % vars()\n else:\n module_name = item\n packages[module_name] = dir\n packages.update(find_packages(dir, module_name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1031:If_L31_C16", "label": "if", "type": "if", "loc": [31, 34], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1031:If_L30_C12", "vector": [4, 4, 0.4779, 0.0588, 4, 0.06, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if base:\n module_name = \"%(base)s.%(item)s\" % vars()\n else:\n module_name = item"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1031:Assign_L32_C20", "label": "module_name =", "type": "assigned_variable", "loc": [32, 32], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1031:If_L31_C16", "vector": [14, 5, 0.4706, 0.0147, 5, 0.2, 0.0, 672, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "module_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " module_name = \"%(base)s.%(item)s\" % vars()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1031:Assign_L34_C20", "label": "module_name =", "type": "assigned_variable", "loc": [34, 34], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1031:If_L31_C16", "vector": [14, 5, 0.5, 0.0147, 5, 0.2, 1.0, 672, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "module_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " module_name = item"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1031:Assign_L35_C16", "label": "assign", "type": "assigned_variable", "loc": [35, 35], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1031:If_L30_C12", "vector": [14, 4, 0.5147, 0.0147, 4, 0.06, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " packages[module_name] = dir"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1031:Expr_L36_C16", "label": "update()", "type": "expression", "loc": [36, 36], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1031:If_L30_C12", "vector": [8, 4, 0.5294, 0.0147, 4, 0.06, 1.0, 637, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " packages.update(find_packages(dir, module_name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1031:Return_L37_C8", "label": "return", "type": "return", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1031:FunctionDef_L25_C4", "vector": [13, 2, 0.5441, 0.0147, 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 packages"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1031:Expr_L39_C0", "label": "setup()", "type": "expression", "loc": [39, 68], "level": 0, "parent": null, "vector": [8, 0, 0.7868, 0.4412, 0, 0.66, 1.0, 234, 3, 13, 0, 0, 0, 0, 4], "semantic": {"name": "setup", "arg_names": [], "import_names": [], "rhs_call_name": "setup", "annotation": ""}, "snippet": "setup(\n name = 'astm',\n version = __version__,\n description = 'Python implementation of ASTM E1381/1394 protocol.',\n long_description = open('README').read(),\n\n author = 'Alexander Shorin',\n author_email = 'kxepal@gmail.com',"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1031:Try_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1031:ImportFrom_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1031:Try_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1031:ImportFrom_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1031:Try_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1031:Import_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1031:Try_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1031:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1031:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1031:Return_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1031:Try_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1031:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1031:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1031:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1031:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1031:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1031:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1031:For_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1031:For_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1031:Assign_L29_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1031:For_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1031:If_L30_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1031:If_L30_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1031:If_L31_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1031:If_L31_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1031:Assign_L32_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1031:If_L31_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1031:Assign_L34_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1031:If_L30_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1031:Assign_L35_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1031:If_L30_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1031:Expr_L36_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1031:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1031:Return_L37_C8"}]
# -*- coding: utf-8 -*- # # Author: Sam Rushing <rushing@nightmare.com> # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # """ .. module:: astm.asynclib :synopsis: Forked version of asyncore mixed with asynchat. .. moduleauthor:: Sam Rushing <rushing@nightmare.com> .. sectionauthor:: Christopher Petrilli <petrilli@amber.org> .. sectionauthor:: Steve Holden <sholden@holdenweb.com> .. heavily adapted from original documentation by Sam Rushing """ import heapq import logging import os import select import socket import sys import time from collections import deque from errno import ( EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, EINVAL, ENOTCONN, ESHUTDOWN, EINTR, EISCONN, EBADF, ECONNABORTED, EPIPE, EAGAIN, errorcode ) from .compat import long, b, bytes, buffer class ExitNow(Exception): pass _DISCONNECTED = frozenset((ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED, EPIPE, EBADF)) _RERAISEABLE_EXC = (ExitNow, KeyboardInterrupt, SystemExit) _SOCKET_MAP = {} _SCHEDULED_TASKS = [] log = logging.getLogger(__name__) def _strerror(err): try: return os.strerror(err) except (ValueError, OverflowError, NameError): if err in errorcode: return errorcode[err] return "Unknown error %s" % err def read(obj): """Triggers ``handle_read_event`` for specified object.""" try: obj.handle_read_event() except _RERAISEABLE_EXC: raise except Exception: obj.handle_error() def write(obj): """Triggers ``handle_write_event`` for specified object.""" try: obj.handle_write_event() except _RERAISEABLE_EXC: raise except Exception: obj.handle_error() def exception(obj): """Triggers ``handle_exception_event`` for specified object.""" try: obj.handle_exception_event() except _RERAISEABLE_EXC: raise except Exception: obj.handle_error() def readwrite(obj, flags): try: if flags & select.POLLIN: obj.handle_read_event() if flags & select.POLLOUT: obj.handle_write_event() if flags & select.POLLPRI: obj.handle_exception_event() if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL): obj.handle_close() except socket.error as e: if e.args[0] not in _DISCONNECTED: obj.handle_error() else: obj.handle_close() except _RERAISEABLE_EXC: raise except Exception: obj.handle_error() def poll(timeout=0.0, map=None): if map is None: map = map or _SOCKET_MAP if map: r = []; w = []; e = [] for fd, obj in map.items(): is_r = obj.readable() is_w = obj.writable() if is_r: r.append(fd) # accepting sockets should not be writable if is_w and not obj.accepting: w.append(fd) if is_r or is_w: e.append(fd) if [] == r == w == e: time.sleep(timeout) return try: r, w, e = select.select(r, w, e, timeout) except select.error as err: if err.args[0] != EINTR: raise else: return for fd in r: obj = map.get(fd) if obj is None: continue read(obj) for fd in w: obj = map.get(fd) if obj is None: continue write(obj) for fd in e: obj = map.get(fd) if obj is None: continue exception(obj) def scheduler(tasks=None): if tasks is None: tasks = _SCHEDULED_TASKS now = time.time() while tasks and now >= tasks[0].timeout: call = heapq.heappop(tasks) if call.repush: heapq.heappush(tasks, call) call.repush = False continue try: call.call() finally: if not call.cancelled: call.cancel() def loop(timeout=30.0, map=None, tasks=None, count=None): """ Enter a polling loop that terminates after count passes or all open channels have been closed. All arguments are optional. The *count* parameter defaults to None, resulting in the loop terminating only when all channels have been closed. The *timeout* argument sets the timeout parameter for the appropriate :func:`select` or :func:`poll` call, measured in seconds; the default is 30 seconds. The *use_poll* parameter, if true, indicates that :func:`poll` should be used in preference to :func:`select` (the default is ``False``). The *map* parameter is a dictionary whose items are the channels to watch. As channels are closed they are deleted from their map. If *map* is omitted, a global map is used. Channels (instances of :class:`asyncore.dispatcher`, :class:`asynchat.async_chat` and subclasses thereof) can freely be mixed in the map. """ if map is None: map = _SOCKET_MAP if tasks is None: tasks = _SCHEDULED_TASKS if count is None: while map or tasks: if map: poll(timeout, map) if tasks: scheduler() else: while (map or tasks) and count > 0: if map: poll(timeout, map) if tasks: scheduler() count -= 1 class call_later: """Calls a function at a later time. It can be used to asynchronously schedule a call within the polling loop without blocking it. The instance returned is an object that can be used to cancel or reschedule the call. """ def __init__(self, seconds, target, *args, **kwargs): """ - seconds: the number of seconds to wait - target: the callable object to call later - args: the arguments to call it with - kwargs: the keyword arguments to call it with - _tasks: a reserved keyword to specify a different list to store the delayed call instances. """ assert callable(target), "%s is not callable" % target assert seconds >= 0, \ "%s is not greater than or equal to 0 seconds" % (seconds) self.__delay = seconds self.__target = target self.__args = args self.__kwargs = kwargs self.__tasks = kwargs.pop('_tasks', _SCHEDULED_TASKS) # seconds from the epoch at which to call the function self.timeout = time.time() + self.__delay self.repush = False self.cancelled = False heapq.heappush(self.__tasks, self) def __lt__(self, other): return self.timeout <= other.timeout def call(self): """Call this scheduled function.""" assert not self.cancelled, "Already cancelled" self.__target(*self.__args, **self.__kwargs) def reset(self): """Reschedule this call resetting the current countdown.""" assert not self.cancelled, "Already cancelled" self.timeout = time.time() + self.__delay self.repush = True def delay(self, seconds): """Reschedule this call for a later time.""" assert not self.cancelled, "Already cancelled." assert seconds >= 0, \ "%s is not greater than or equal to 0 seconds" % (seconds) self.__delay = seconds newtime = time.time() + self.__delay if newtime > self.timeout: self.timeout = newtime self.repush = True else: # XXX - slow, can be improved self.timeout = newtime heapq.heapify(self.__tasks) def cancel(self): """Unschedule this call.""" assert not self.cancelled, "Already cancelled" self.cancelled = True del self.__target, self.__args, self.__kwargs if self in self.__tasks: pos = self.__tasks.index(self) if pos == 0: heapq.heappop(self.__tasks) elif pos == len(self.__tasks) - 1: self.__tasks.pop(pos) else: self.__tasks[pos] = self.__tasks.pop() heapq._siftup(self.__tasks, pos) class Dispatcher(object): """ The :class:`Dispatcher` class is a thin wrapper around a low-level socket object. To make it more useful, it has a few methods for event-handling which are called from the asynchronous loop. Otherwise, it can be treated as a normal non-blocking socket object. The firing of low-level events at certain times or in certain connection states tells the asynchronous loop that certain higher-level events have taken place. For example, if we have asked for a socket to connect to another host, we know that the connection has been made when the socket becomes writable for the first time (at this point you know that you may write to it with the expectation of success). The implied higher-level events are: +----------------------+----------------------------------------+ | Event | Description | +======================+========================================+ | ``handle_connect()`` | Implied by the first read or write | | | event | +----------------------+----------------------------------------+ | ``handle_close()`` | Implied by a read event with no data | | | available | +----------------------+----------------------------------------+ | ``handle_accept()`` | Implied by a read event on a listening | | | socket | +----------------------+----------------------------------------+ During asynchronous processing, each mapped channel's :meth:`readable` and :meth:`writable` methods are used to determine whether the channel's socket should be added to the list of channels :c:func:`select`\ ed or :c:func:`poll`\ ed for read and write events. """ connected = False accepting = False addr = None def __init__(self, sock=None, map=None): if map is None: self._map = _SOCKET_MAP else: self._map = map self._fileno = None if sock: # Set to nonblocking just to make sure for cases where we # get a socket from a blocking source. sock.setblocking(0) self.set_socket(sock, map) self.connected = True # The constructor no longer requires that the socket # passed be connected. try: self.addr = sock.getpeername() except socket.error as err: if err.args[0] == ENOTCONN: # To handle the case where we got an unconnected # socket. self.connected = False else: # The socket is broken in some unknown way, alert # the user and remove it from the map (to prevent # polling of broken sockets). self._del_channel(map) raise else: self.socket = None def __repr__(self): status = [self.__class__.__module__ + '.' + self.__class__.__name__] if self.accepting and self.addr: status.append('listening') elif self.connected: status.append('connected') if self.addr is not None: try: status.append('%s:%d' % self.addr) except TypeError: status.append(repr(self.addr)) return '<%s at %#x>' % (' '.join(status), id(self)) __str__ = __repr__ def _add_channel(self, map=None): log.debug('Adding channel %s' % self) if map is None: map = self._map map[self._fileno] = self def _del_channel(self, map=None): fd = self._fileno if map is None: map = self._map if fd in map: log.debug('Closing channel %d:%s' % (fd, self)) del map[fd] self._fileno = None def create_socket(self, family, type): """ This is identical to the creation of a normal socket, and will use the same options for creation. Refer to the :mod:`socket` documentation for information on creating sockets. """ self.family_and_type = family, type sock = socket.socket(family, type) sock.setblocking(0) self.set_socket(sock) def set_socket(self, sock, map=None): self.socket = sock self._fileno = sock.fileno() self._add_channel(map) def set_reuse_addr(self): try: self.socket.setsockopt( socket.SOL_SOCKET, socket.SO_REUSEADDR, self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR) | 1 ) except socket.error: pass def readable(self): """ Called each time around the asynchronous loop to determine whether a channel's socket should be added to the list on which read events can occur. The default method simply returns ``True``, indicating that by default, all channels will be interested in read events.""" return True def writable(self): """ Called each time around the asynchronous loop to determine whether a channel's socket should be added to the list on which write events can occur. The default method simply returns ``True``, indicating that by default, all channels will be interested in write events. """ return True def listen(self, num): """Listen for connections made to the socket. The `num` argument specifies the maximum number of queued connections and should be at least 1; the maximum value is system-dependent (usually 5).""" self.accepting = True if os.name == 'nt' and num > 5: num = 5 return self.socket.listen(num) def bind(self, address): """Bind the socket to `address`. The socket must not already be bound. The format of `address` depends on the address family --- refer to the :mod:`socket` documentation for more information. To mark the socket as re-usable (setting the :const:`SO_REUSEADDR` option), call the :class:`Dispatcher` object's :meth:`set_reuse_addr` method. """ self.addr = address return self.socket.bind(address) def connect(self, address): """ As with the normal socket object, `address` is a tuple with the first element the host to connect to, and the second the port number. """ self.connected = False self.addr = address err = self.socket.connect_ex(address) if err in (EINPROGRESS, EALREADY, EWOULDBLOCK)\ or err == EINVAL and os.name in ('nt', 'ce'): return if err in (0, EISCONN): self.handle_connect_event() else: raise socket.error(err, errorcode[err]) def accept(self): """Accept a connection. The socket must be bound to an address and listening for connections. The return value can be either ``None`` or a pair ``(conn, address)`` where `conn` is a *new* socket object usable to send and receive data on the connection, and *address* is the address bound to the socket on the other end of the connection. When ``None`` is returned it means the connection didn't take place, in which case the server should just ignore this event and keep listening for further incoming connections. """ try: conn, addr = self.socket.accept() except TypeError: return None except socket.error as err: if err.args[0] in (EWOULDBLOCK, ECONNABORTED, EAGAIN): return None else: raise else: return conn, addr def send(self, data): """Send `data` to the remote end-point of the socket.""" try: log.debug('[%s:%d] <<< %r', self.addr[0], self.addr[1], data) result = self.socket.send(data) return result except socket.error as err: if err.args[0] == EWOULDBLOCK: return 0 elif err.args[0] in _DISCONNECTED: self.handle_close() return 0 else: raise def recv(self, buffer_size): """Read at most `buffer_size` bytes from the socket's remote end-point. An empty string implies that the channel has been closed from the other end. """ try: data = self.socket.recv(buffer_size) log.debug('[%s:%d] >>> %r', self.addr[0], self.addr[1], data) if not data: # a closed connection is indicated by signaling # a read condition, and having recv() return 0. self.handle_close() return b'' else: return data except socket.error as err: # winsock sometimes throws ENOTCONN if err.args[0] in _DISCONNECTED: self.handle_close() return b'' else: raise def close(self): """Close the socket. All future operations on the socket object will fail. The remote end-point will receive no more data (after queued data is flushed). Sockets are automatically closed when they are garbage-collected. """ self.connected = False self.accepting = False self._del_channel() try: self.socket.close() except socket.error as err: if err.args[0] not in (ENOTCONN, EBADF): raise def handle_read_event(self): if self.accepting: # accepting sockets are never connected, they "spawn" new # sockets that are connected self.handle_accept() elif not self.connected: self.handle_connect_event() self.handle_read() else: self.handle_read() def handle_connect_event(self): err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR) if err != 0: raise socket.error(err, _strerror(err)) self.handle_connect() self.connected = True def handle_write_event(self): if self.accepting: # Accepting sockets shouldn't get a write event. # We will pretend it didn't happen. return if not self.connected: #check for errors err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR) if err != 0: raise socket.error(err, _strerror(err)) self.handle_connect_event() self.handle_write() def handle_exception_event(self): # handle_exception_event() is called if there might be an error on the # socket, or if there is OOB data # check for the error condition first err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR) if err != 0: # we can get here when select.select() says that there is an # exceptional condition on the socket # since there is an error, we'll go ahead and close the socket # like we would in a subclassed handle_read() that received no # data self.handle_close() else: self.handle_exception() def handle_error(self): """ Called when an exception is raised and not otherwise handled. The default version prints a condensed traceback. """ try: self_repr = repr(self) except Exception: self_repr = '<__repr__(self) failed for object at %0x>' % id(self) log.exception('Uncatched python exception, closing channel %s', self_repr) self.handle_close() def handle_exception(self): log.exception('Unknown error') def handle_read(self): log.debug('Unhandled read event') def handle_write(self): """ Called when the asynchronous loop detects that a writable socket can be written. Often this method will implement the necessary buffering for performance. For example:: def handle_write(self): sent = self.send(self.buffer) self.buffer = self.buffer[sent:] """ log.debug('Unhandled write event') def handle_connect(self): """ Called when the active opener's socket actually makes a connection. Might send a "welcome" banner, or initiate a protocol negotiation with the remote endpoint, for example. """ log.info('[%s:%d] Connection established', self.addr[0], self.addr[1]) def handle_accept(self): """ Called on listening channels (passive openers) when a connection can be established with a new remote endpoint that has issued a :meth:`connect` call for the local endpoint. """ log.info('[%s:%d] Connection accepted', self.addr[0], self.addr[1]) def handle_close(self): """Called when the socket is closed.""" log.info('[%s:%d] Connection closed', self.addr[0], self.addr[1]) self.close() def close_all(map=None, tasks=None, ignore_all=False): if map is None: map = _SOCKET_MAP if tasks is None: tasks = _SCHEDULED_TASKS for x in list(map.values()): try: x.close() except OSError as err: if err.args[0] == EBADF: pass elif not ignore_all: raise except _RERAISEABLE_EXC: raise except Exception: if not ignore_all: raise map.clear() for x in tasks: try: x.cancel() except _RERAISEABLE_EXC: raise except Exception: if not ignore_all: raise del tasks[:] class AsyncChat(Dispatcher): """ This class is an abstract subclass of :class:`Dispatcher`. To make practical use of the code you must subclass :class:`AsyncChat`, providing meaningful meth:`found_terminator` method. The :class:`Dispatcher` methods can be used, although not all make sense in a message/response context. Like :class:`Dispatcher`, :class:`AsyncChat` defines a set of events that are generated by an analysis of socket conditions after a :c:func:`select` call. Once the polling loop has been started the :class:`AsyncChat` object's methods are called by the event-processing framework with no action on the part of the programmer. """ # these are overridable defaults #: The asynchronous input buffer size. recv_buffer_size = 4096 #: The asynchronous output buffer size. send_buffer_size = 4096 #: Encoding usage is not enabled by default, because that is a #: sign of an application bug that we don't want to pass silently. use_encoding = False #: Default encoding. encoding = 'latin-1' #: Remove terminator from the result data. strip_terminator = True _terminator = None def __init__(self, sock=None, map=None): # for string terminator matching self._input_buffer = b'' self.inbox = deque() self.outbox = deque() super(AsyncChat, self).__init__(sock, map) self.collect_incoming_data = self.pull self.initiate_send = self.flush def pull(self, data): """Puts `data` into incoming queue. Also available by alias `collect_incoming_data`. """ self.inbox.append(data) def found_terminator(self): """ Called when the incoming data stream matches the :attr:`termination` condition. The default method, which must be overridden, raises a :exc:`NotImplementedError` exception. The buffered input data should be available via an instance attribute. """ raise NotImplementedError("must be implemented in subclass") def _set_terminator(self, term): self._terminator = term def _get_terminator(self): return self._terminator #: The input delimiter and the terminating condition to be recognized on the #: channel. May be any of three types of value, corresponding to three #: different ways to handle incoming protocol data. #: #: +-----------+---------------------------------------------+ #: | term | Description | #: +===========+=============================================+ #: | *string* | Will call :meth:`found_terminator` when the | #: | | string is found in the input stream | #: +-----------+---------------------------------------------+ #: | *integer* | Will call :meth:`found_terminator` when the | #: | | indicated number of characters have been | #: | | received | #: +-----------+---------------------------------------------+ #: | ``None`` | The channel continues to collect data | #: | | forever | #: +-----------+---------------------------------------------+ #: #: Note that any data following the terminator will be available for reading #: by the channel after :meth:`found_terminator` is called. terminator = property(_get_terminator, _set_terminator) def handle_read(self): try: data = self.recv(self.recv_buffer_size) except socket.error as err: self.handle_error() return if self.use_encoding and not isinstance(): data = data.decode(self.encoding) self._input_buffer += data while self._input_buffer: terminator = self.terminator if not terminator: handler = self._lookup_none_terminator elif isinstance(terminator, (int, long)): handler = self._lookup_int_terminator elif isinstance(terminator, str): handler = self._lookup_str_terminator else: handler = self._lookup_list_terminator res = handler(self.terminator) if res is None: break def _lookup_none_terminator(self, terminator): self.pull(self._input_buffer) self._input_buffer = '' return False def _lookup_int_terminator(self, terminator): if len(self._input_buffer) < terminator: self.pull(self._input_buffer) self._input_buffer = '' return False else: self.pull(self._input_buffer[:terminator]) self._input_buffer = self._input_buffer[terminator:] self.found_terminator() return True def _lookup_list_terminator(self, terminator): for item in terminator: if self._input_buffer.find(item) != -1: return self._lookup_str_terminator(item) return self._lookup_none_terminator(terminator) def _lookup_str_terminator(self, terminator): # 3 cases: # 1) end of buffer matches terminator exactly: # collect data, transition # 2) end of buffer matches some prefix: # collect data to the prefix # 3) end of buffer does not match any prefix: # collect data terminator_len = len(terminator) index = self._input_buffer.find(terminator) if index != -1: # we found the terminator if self.strip_terminator and index > 0: self.pull(self._input_buffer[:index]) elif not self.strip_terminator: self.pull(self._input_buffer[:index+terminator_len]) self._input_buffer = self._input_buffer[index+terminator_len:] # This does the Right Thing if the terminator is changed here. self.found_terminator() return True else: # check for a prefix of the terminator index = find_prefix_at_end(self._input_buffer, terminator) if index: if index != len(self._input_buffer): # we found a prefix, collect up to the prefix self.pull(self._input_buffer[:-index]) self._input_buffer = self._input_buffer[-index:] return None else: # no prefix, collect it all self.pull(self._input_buffer) self._input_buffer = '' return False def handle_write(self): self.flush() def push(self, data): """ Pushes data on to the channel's fifo to ensure its transmission. This is all you need to do to have the channel write the data out to the network. """ sabs = self.send_buffer_size if len(data) > sabs: for i in range(0, len(data), sabs): self.outbox.append(data[i:i+sabs]) else: self.outbox.append(data) return self.flush() def push_with_producer(self, producer): self.outbox.append(producer) return self.flush() def readable(self): """Predicate for inclusion in the readable for select()""" return True def writable(self): """Predicate for inclusion in the writable for select()""" # For nonblocking sockets connect() will not set self.connected flag, # due to EINPROGRESS socket error which is actually promise for # successful connection. return bool(self.outbox or not self.connected) def close_when_done(self): """Automatically close this channel once the outgoing queue is empty.""" self.outbox.append(None) def flush(self): """Sends all data from outgoing queue.""" while self.outbox and self.connected: self._send_chunky(self.outbox.popleft()) def _send_chunky(self, data): """Sends data as chunks sized by ``send_buffer_size`` value. Returns ``True`` on success, ``False`` on error and ``None`` on closing event. """ if self.use_encoding and not isinstance(data, bytes): data = data.encode(self.encoding) while True: if data is None: self.handle_close() return obs = self.send_buffer_size bdata = buffer(data, 0, obs) try: num_sent = self.send(bdata) except socket.error: self.handle_error() return False if num_sent and num_sent < len(bdata) or obs < len(data): data = data[num_sent:] else: return True def discard_buffers(self): """In emergencies this method will discard any data held in the input and output buffers.""" self.discard_input_buffers() self.discard_output_buffers() def discard_input_buffers(self): self._input_buffer = b('') self.inbox.clear() def discard_output_buffers(self): self.outbox.clear() def find_prefix_at_end(haystack, needle): l = len(needle) - 1 while l and not haystack.endswith(needle[:l]): l -= 1 return l
ajibawa-2023/Python-Code-Large/train/row_1032
482
941
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L12_C0", "label": "expression", "type": "expression", "loc": [12, 19], "level": 0, "parent": null, "vector": [8, 0, 0.0165, 0.0085, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n.. module:: astm.asynclib\n :synopsis: Forked version of asyncore mixed with asynchat.\n.. moduleauthor:: Sam Rushing <rushing@nightmare.com>\n.. sectionauthor:: Christopher Petrilli <petrilli@amber.org>\n.. sectionauthor:: Steve Holden <sholden@holdenweb.com>\n.. heavily adapted from original documentation by Sam Rushing\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Import_L21_C0", "label": "heapq import heapq", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.0223, 0.0011, 0, 0.66, 0.0345, 251, 0, 1, 0, 0, 251, 0, 0], "semantic": {"name": "heapq", "arg_names": [], "import_names": ["heapq"], "rhs_call_name": "", "annotation": ""}, "snippet": "import heapq"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Import_L22_C0", "label": "logging import logging", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.0234, 0.0011, 0, 0.66, 0.069, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Import_L23_C0", "label": "os import os", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.0244, 0.0011, 0, 0.66, 0.1034, 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_1032:Import_L24_C0", "label": "select import select", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.0255, 0.0011, 0, 0.66, 0.1379, 438, 0, 1, 0, 0, 438, 0, 0], "semantic": {"name": "select", "arg_names": [], "import_names": ["select"], "rhs_call_name": "", "annotation": ""}, "snippet": "import select"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Import_L25_C0", "label": "socket import socket", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.0266, 0.0011, 0, 0.66, 0.1724, 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_1032:Import_L26_C0", "label": "sys import sys", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.0276, 0.0011, 0, 0.66, 0.2069, 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_1032:Import_L27_C0", "label": "time import time", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.0287, 0.0011, 0, 0.66, 0.2414, 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_1032:ImportFrom_L28_C0", "label": "from collections import deque", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.0298, 0.0011, 0, 0.66, 0.2759, 193, 0, 1, 0, 0, 193, 0, 0], "semantic": {"name": "collections", "arg_names": [], "import_names": ["deque"], "rhs_call_name": "", "annotation": ""}, "snippet": "from collections import deque"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:ImportFrom_L29_C0", "label": "from errno import EALREADY, EINPROGRESS, EWOULDBLOCK\u2026", "type": "import", "loc": [29, 33], "level": 0, "parent": null, "vector": [1, 0, 0.0329, 0.0053, 0, 0.66, 0.3103, 546, 0, 14, 0, 0, 546, 0, 0], "semantic": {"name": "errno", "arg_names": [], "import_names": ["EALREADY", "EINPROGRESS", "EWOULDBLOCK", "ECONNRESET", "EINVAL", "ENOTCONN", "ESHUTDOWN", "EINTR", "EISCONN", "EBADF", "ECONNABORTED", "EPIPE", "EAGAIN", "errorcode"], "rhs_call_name": "", "annotation": ""}, "snippet": "from errno import (\n EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, EINVAL,\n ENOTCONN, ESHUTDOWN, EINTR, EISCONN, EBADF, ECONNABORTED, EPIPE, EAGAIN,\n errorcode\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:ImportFrom_L34_C0", "label": "from compat import long, b, bytes\u2026", "type": "import", "loc": [34, 34], "level": 0, "parent": null, "vector": [1, 0, 0.0361, 0.0011, 0, 0.66, 0.3448, 238, 0, 4, 0, 0, 238, 0, 0], "semantic": {"name": "compat", "arg_names": [], "import_names": ["long", "b", "bytes", "buffer"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .compat import long, b, bytes, buffer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L36_C0", "label": "ExitNow", "type": "class", "loc": [36, 37], "level": 0, "parent": null, "vector": [3, 0, 0.0388, 0.0021, 0, 0.66, 0.3793, 67, 0, 0, 0, 0, 645, 0, 0], "semantic": {"name": "ExitNow", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ExitNow(Exception):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L40_C0", "label": "_DISCONNECTED = frozenset()", "type": "assigned_variable", "loc": [40, 41], "level": 0, "parent": null, "vector": [14, 0, 0.043, 0.0021, 0, 0.66, 0.4138, 284, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "_DISCONNECTED", "arg_names": [], "import_names": [], "rhs_call_name": "frozenset", "annotation": ""}, "snippet": "_DISCONNECTED = frozenset((ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED, EPIPE,\n EBADF))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L43_C0", "label": "_RERAISEABLE_EXC =", "type": "assigned_variable", "loc": [43, 43], "level": 0, "parent": null, "vector": [14, 0, 0.0457, 0.0011, 0, 0.66, 0.4483, 136, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "_RERAISEABLE_EXC", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_RERAISEABLE_EXC = (ExitNow, KeyboardInterrupt, SystemExit)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L45_C0", "label": "_SOCKET_MAP =", "type": "assigned_variable", "loc": [45, 45], "level": 0, "parent": null, "vector": [14, 0, 0.0478, 0.0011, 0, 0.66, 0.4828, 232, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "_SOCKET_MAP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_SOCKET_MAP = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L47_C0", "label": "_SCHEDULED_TASKS =", "type": "assigned_variable", "loc": [47, 47], "level": 0, "parent": null, "vector": [14, 0, 0.0499, 0.0011, 0, 0.66, 0.5172, 550, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "_SCHEDULED_TASKS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_SCHEDULED_TASKS = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L49_C0", "label": "log = getLogger()", "type": "assigned_variable", "loc": [49, 49], "level": 0, "parent": null, "vector": [14, 0, 0.0521, 0.0011, 0, 0.66, 0.5517, 432, 3, 1, 0, 0, 71, 10, 1], "semantic": {"name": "log", "arg_names": [], "import_names": [], "rhs_call_name": "getLogger", "annotation": ""}, "snippet": "log = logging.getLogger(__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L52_C0", "label": "_strerror", "type": "function", "loc": [52, 58], "level": 0, "parent": null, "vector": [2, 0, 0.0584, 0.0074, 0, 0.66, 0.5862, 332, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "_strerror", "arg_names": ["err"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _strerror(err):\n try:\n return os.strerror(err)\n except (ValueError, OverflowError, NameError):\n if err in errorcode:\n return errorcode[err]\n return \"Unknown error %s\" % err"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L53_C4", "label": "try", "type": "try", "loc": [53, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L52_C0", "vector": [7, 1, 0.059, 0.0064, 1, 0.1, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return os.strerror(err)\n except (ValueError, OverflowError, NameError):\n if err in errorcode:\n return errorcode[err]\n return \"Unknown error %s\" % err"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L54_C8", "label": "return", "type": "return", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L53_C4", "vector": [13, 2, 0.0574, 0.0011, 2, 0.66, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.strerror(err)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L56_C8", "label": "if", "type": "if", "loc": [56, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L53_C4", "vector": [4, 2, 0.06, 0.0021, 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 err in errorcode:\n return errorcode[err]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L57_C12", "label": "return", "type": "return", "loc": [57, 57], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L56_C8", "vector": [13, 3, 0.0606, 0.0011, 3, 0.71, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return errorcode[err]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L58_C8", "label": "return", "type": "return", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L53_C4", "vector": [13, 2, 0.0616, 0.0011, 2, 0.66, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"Unknown error %s\" % err"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L61_C0", "label": "read", "type": "function", "loc": [61, 68], "level": 0, "parent": null, "vector": [2, 0, 0.0685, 0.0085, 0, 0.66, 0.6207, 453, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "read", "arg_names": ["obj"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def read(obj):\n \"\"\"Triggers ``handle_read_event`` for specified object.\"\"\"\n try:\n obj.handle_read_event()\n except _RERAISEABLE_EXC:\n raise\n except Exception:\n obj.handle_error()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L62_C4", "label": "expression", "type": "expression", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L61_C0", "vector": [8, 1, 0.0659, 0.0011, 1, 0.08, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Triggers ``handle_read_event`` for specified object.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L63_C4", "label": "try", "type": "try", "loc": [63, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L61_C0", "vector": [7, 1, 0.0696, 0.0064, 1, 0.08, 1.0, 0, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n obj.handle_read_event()\n except _RERAISEABLE_EXC:\n raise\n except Exception:\n obj.handle_error()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L64_C8", "label": "handle_read_event()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L63_C4", "vector": [8, 2, 0.068, 0.0011, 2, 0.83, 0.0, 102, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_read_event", "arg_names": [], "import_names": [], "rhs_call_name": "handle_read_event", "annotation": ""}, "snippet": " obj.handle_read_event()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L68_C8", "label": "handle_error()", "type": "expression", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L63_C4", "vector": [8, 2, 0.0723, 0.0011, 2, 0.83, 0.0, 899, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_error", "arg_names": [], "import_names": [], "rhs_call_name": "handle_error", "annotation": ""}, "snippet": " obj.handle_error()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L71_C0", "label": "write", "type": "function", "loc": [71, 78], "level": 0, "parent": null, "vector": [2, 0, 0.0792, 0.0085, 0, 0.66, 0.6552, 837, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": ["obj"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def write(obj):\n \"\"\"Triggers ``handle_write_event`` for specified object.\"\"\"\n try:\n obj.handle_write_event()\n except _RERAISEABLE_EXC:\n raise\n except Exception:\n obj.handle_error()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L72_C4", "label": "expression", "type": "expression", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L71_C0", "vector": [8, 1, 0.0765, 0.0011, 1, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Triggers ``handle_write_event`` for specified object.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L73_C4", "label": "try", "type": "try", "loc": [73, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L71_C0", "vector": [7, 1, 0.0802, 0.0064, 1, 0.57, 1.0, 0, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n obj.handle_write_event()\n except _RERAISEABLE_EXC:\n raise\n except Exception:\n obj.handle_error()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L74_C8", "label": "handle_write_event()", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L73_C4", "vector": [8, 2, 0.0786, 0.0011, 2, 0.28, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_write_event", "arg_names": [], "import_names": [], "rhs_call_name": "handle_write_event", "annotation": ""}, "snippet": " obj.handle_write_event()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L78_C8", "label": "handle_error()", "type": "expression", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L73_C4", "vector": [8, 2, 0.0829, 0.0011, 2, 0.28, 0.0, 899, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_error", "arg_names": [], "import_names": [], "rhs_call_name": "handle_error", "annotation": ""}, "snippet": " obj.handle_error()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L81_C0", "label": "exception", "type": "function", "loc": [81, 88], "level": 0, "parent": null, "vector": [2, 0, 0.0898, 0.0085, 0, 0.66, 0.6897, 69, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "exception", "arg_names": ["obj"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def exception(obj):\n \"\"\"Triggers ``handle_exception_event`` for specified object.\"\"\"\n try:\n obj.handle_exception_event()\n except _RERAISEABLE_EXC:\n raise\n except Exception:\n obj.handle_error()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L82_C4", "label": "expression", "type": "expression", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L81_C0", "vector": [8, 1, 0.0871, 0.0011, 1, 0.99, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Triggers ``handle_exception_event`` for specified object.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L83_C4", "label": "try", "type": "try", "loc": [83, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L81_C0", "vector": [7, 1, 0.0909, 0.0064, 1, 0.99, 1.0, 0, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n obj.handle_exception_event()\n except _RERAISEABLE_EXC:\n raise\n except Exception:\n obj.handle_error()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L84_C8", "label": "handle_exception_event()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L83_C4", "vector": [8, 2, 0.0893, 0.0011, 2, 0.73, 0.0, 275, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_exception_event", "arg_names": [], "import_names": [], "rhs_call_name": "handle_exception_event", "annotation": ""}, "snippet": " obj.handle_exception_event()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L88_C8", "label": "handle_error()", "type": "expression", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L83_C4", "vector": [8, 2, 0.0935, 0.0011, 2, 0.73, 0.0, 899, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_error", "arg_names": [], "import_names": [], "rhs_call_name": "handle_error", "annotation": ""}, "snippet": " obj.handle_error()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L91_C0", "label": "readwrite", "type": "function", "loc": [91, 109], "level": 0, "parent": null, "vector": [2, 0, 0.1063, 0.0202, 0, 0.66, 0.7241, 638, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "readwrite", "arg_names": ["obj", "flags"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def readwrite(obj, flags):\n try:\n if flags & select.POLLIN:\n obj.handle_read_event()\n if flags & select.POLLOUT:\n obj.handle_write_event()\n if flags & select.POLLPRI:\n obj.handle_exception_event()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L92_C4", "label": "try", "type": "try", "loc": [92, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L91_C0", "vector": [7, 1, 0.1068, 0.0191, 1, 0.08, 0.0, 0, 0, 3, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if flags & select.POLLIN:\n obj.handle_read_event()\n if flags & select.POLLOUT:\n obj.handle_write_event()\n if flags & select.POLLPRI:\n obj.handle_exception_event()\n if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L93_C8", "label": "if", "type": "if", "loc": [93, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L92_C4", "vector": [4, 2, 0.0994, 0.0021, 2, 0.43, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if flags & select.POLLIN:\n obj.handle_read_event()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L94_C12", "label": "handle_read_event()", "type": "expression", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L93_C8", "vector": [8, 3, 0.0999, 0.0011, 3, 0.53, 0.0, 102, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_read_event", "arg_names": [], "import_names": [], "rhs_call_name": "handle_read_event", "annotation": ""}, "snippet": " obj.handle_read_event()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L95_C8", "label": "if", "type": "if", "loc": [95, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L92_C4", "vector": [4, 2, 0.1015, 0.0021, 2, 0.43, 0.3333, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if flags & select.POLLOUT:\n obj.handle_write_event()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L96_C12", "label": "handle_write_event()", "type": "expression", "loc": [96, 96], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L95_C8", "vector": [8, 3, 0.102, 0.0011, 3, 0.48, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_write_event", "arg_names": [], "import_names": [], "rhs_call_name": "handle_write_event", "annotation": ""}, "snippet": " obj.handle_write_event()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L97_C8", "label": "if", "type": "if", "loc": [97, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L92_C4", "vector": [4, 2, 0.1036, 0.0021, 2, 0.43, 0.6667, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if flags & select.POLLPRI:\n obj.handle_exception_event()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L98_C12", "label": "handle_exception_event()", "type": "expression", "loc": [98, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L97_C8", "vector": [8, 3, 0.1041, 0.0011, 3, 0.18, 0.0, 275, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_exception_event", "arg_names": [], "import_names": [], "rhs_call_name": "handle_exception_event", "annotation": ""}, "snippet": " obj.handle_exception_event()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L99_C8", "label": "if", "type": "if", "loc": [99, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L92_C4", "vector": [4, 2, 0.1057, 0.0021, 2, 0.43, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):\n obj.handle_close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L100_C12", "label": "handle_close()", "type": "expression", "loc": [100, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L99_C8", "vector": [8, 3, 0.1063, 0.0011, 3, 0.66, 0.0, 320, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_close", "arg_names": [], "import_names": [], "rhs_call_name": "handle_close", "annotation": ""}, "snippet": " obj.handle_close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L102_C8", "label": "if", "type": "if", "loc": [102, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L92_C4", "vector": [4, 2, 0.11, 0.0043, 2, 0.43, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if e.args[0] not in _DISCONNECTED:\n obj.handle_error()\n else:\n obj.handle_close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L103_C12", "label": "handle_error()", "type": "expression", "loc": [103, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L102_C8", "vector": [8, 3, 0.1095, 0.0011, 3, 0.1, 0.0, 899, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_error", "arg_names": [], "import_names": [], "rhs_call_name": "handle_error", "annotation": ""}, "snippet": " obj.handle_error()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L105_C12", "label": "handle_close()", "type": "expression", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L102_C8", "vector": [8, 3, 0.1116, 0.0011, 3, 0.1, 1.0, 320, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_close", "arg_names": [], "import_names": [], "rhs_call_name": "handle_close", "annotation": ""}, "snippet": " obj.handle_close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L109_C8", "label": "handle_error()", "type": "expression", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L92_C4", "vector": [8, 2, 0.1158, 0.0011, 2, 0.43, 0.0, 899, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_error", "arg_names": [], "import_names": [], "rhs_call_name": "handle_error", "annotation": ""}, "snippet": " obj.handle_error()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L112_C0", "label": "poll", "type": "function", "loc": [112, 155], "level": 0, "parent": null, "vector": [2, 0, 0.1419, 0.0468, 0, 0.66, 0.7586, 182, 0, 2, 0, 0, 0, 0, 14], "semantic": {"name": "poll", "arg_names": ["timeout", "map"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def poll(timeout=0.0, map=None):\n if map is None:\n map = map or _SOCKET_MAP\n if map:\n r = []; w = []; e = []\n for fd, obj in map.items():\n is_r = obj.readable()\n is_w = obj.writable()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L113_C4", "label": "if", "type": "if", "loc": [113, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L112_C0", "vector": [4, 1, 0.1206, 0.0021, 1, 0.25, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if map is None:\n map = map or _SOCKET_MAP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L114_C8", "label": "map =", "type": "assigned_variable", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L113_C4", "vector": [14, 2, 0.1211, 0.0011, 2, 0.0, 0.0, 53, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " map = map or _SOCKET_MAP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L115_C4", "label": "if", "type": "if", "loc": [115, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L112_C0", "vector": [4, 1, 0.1435, 0.0436, 1, 0.25, 1.0, 0, 2, 0, 0, 0, 0, 0, 14], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if map:\n r = []; w = []; e = []\n for fd, obj in map.items():\n is_r = obj.readable()\n is_w = obj.writable()\n if is_r:\n r.append(fd)\n # accepting sockets should not be writable"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L116_C8", "label": "r =", "type": "assigned_variable", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L115_C4", "vector": [14, 2, 0.1233, 0.0011, 2, 0.2, 0.0, 436, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r = []; w = []; e = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L116_C16", "label": "w =", "type": "assigned_variable", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L115_C4", "vector": [14, 2, 0.1233, 0.0011, 2, 0.2, 0.125, 549, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r = []; w = []; e = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L116_C24", "label": "e =", "type": "assigned_variable", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L115_C4", "vector": [14, 2, 0.1233, 0.0011, 2, 0.2, 0.25, 175, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "e", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r = []; w = []; e = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L117_C8", "label": "for fd, obj", "type": "for", "loc": [117, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L115_C4", "vector": [6, 2, 0.1291, 0.0106, 2, 0.2, 0.375, 654, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "fd, obj", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for fd, obj in map.items():\n is_r = obj.readable()\n is_w = obj.writable()\n if is_r:\n r.append(fd)\n # accepting sockets should not be writable\n if is_w and not obj.accepting:\n w.append(fd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L118_C12", "label": "is_r = readable()", "type": "assigned_variable", "loc": [118, 118], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L117_C8", "vector": [14, 3, 0.1254, 0.0011, 3, 0.21, 0.0, 707, 3, 0, 0, 0, 808, 10, 1], "semantic": {"name": "is_r", "arg_names": [], "import_names": [], "rhs_call_name": "readable", "annotation": ""}, "snippet": " is_r = obj.readable()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L119_C12", "label": "is_w = writable()", "type": "assigned_variable", "loc": [119, 119], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L117_C8", "vector": [14, 3, 0.1265, 0.0011, 3, 0.21, 0.25, 258, 3, 0, 0, 0, 58, 10, 1], "semantic": {"name": "is_w", "arg_names": [], "import_names": [], "rhs_call_name": "writable", "annotation": ""}, "snippet": " is_w = obj.writable()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L120_C12", "label": "if", "type": "if", "loc": [120, 121], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L117_C8", "vector": [4, 3, 0.1281, 0.0021, 3, 0.21, 0.5, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if is_r:\n r.append(fd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L121_C16", "label": "append()", "type": "expression", "loc": [121, 121], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L120_C12", "vector": [8, 4, 0.1286, 0.0011, 4, 0.44, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " r.append(fd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L123_C12", "label": "if", "type": "if", "loc": [123, 124], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L117_C8", "vector": [4, 3, 0.1312, 0.0021, 3, 0.21, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if is_w and not obj.accepting:\n w.append(fd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L124_C16", "label": "append()", "type": "expression", "loc": [124, 124], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L123_C12", "vector": [8, 4, 0.1318, 0.0011, 4, 0.25, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " w.append(fd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L125_C12", "label": "if", "type": "if", "loc": [125, 126], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L117_C8", "vector": [4, 3, 0.1334, 0.0021, 3, 0.21, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if is_r or is_w:\n e.append(fd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L126_C16", "label": "append()", "type": "expression", "loc": [126, 126], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L125_C12", "vector": [8, 4, 0.1339, 0.0011, 4, 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": " e.append(fd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L127_C8", "label": "if", "type": "if", "loc": [127, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L115_C4", "vector": [4, 2, 0.136, 0.0032, 2, 0.2, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if [] == r == w == e:\n time.sleep(timeout)\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L128_C12", "label": "sleep()", "type": "expression", "loc": [128, 128], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L127_C8", "vector": [8, 3, 0.136, 0.0011, 3, 0.46, 0.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep(timeout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L129_C12", "label": "return", "type": "return", "loc": [129, 129], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L127_C8", "vector": [13, 3, 0.1371, 0.0011, 3, 0.46, 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_1032:Try_L131_C8", "label": "try", "type": "try", "loc": [131, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L115_C4", "vector": [7, 2, 0.1424, 0.0074, 2, 0.2, 0.625, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n r, w, e = select.select(r, w, e, timeout)\n except select.error as err:\n if err.args[0] != EINTR:\n raise\n else:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L132_C12", "label": "r, w, e = select()", "type": "assigned_variable", "loc": [132, 132], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L131_C8", "vector": [14, 3, 0.1403, 0.0011, 3, 0.39, 0.0, 733, 3, 4, 0, 0, 438, 10, 1], "semantic": {"name": "r, w, e", "arg_names": [], "import_names": [], "rhs_call_name": "select", "annotation": ""}, "snippet": " r, w, e = select.select(r, w, e, timeout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L134_C12", "label": "if", "type": "if", "loc": [134, 137], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L131_C8", "vector": [4, 3, 0.144, 0.0043, 3, 0.39, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if err.args[0] != EINTR:\n raise\n else:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L137_C16", "label": "return", "type": "return", "loc": [137, 137], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L134_C12", "vector": [13, 4, 0.1456, 0.0011, 4, 0.59, 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_1032:For_L139_C8", "label": "for fd", "type": "for", "loc": [139, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L115_C4", "vector": [6, 2, 0.1498, 0.0053, 2, 0.2, 0.75, 863, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "fd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for fd in r:\n obj = map.get(fd)\n if obj is None:\n continue\n read(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L140_C12", "label": "obj = get()", "type": "assigned_variable", "loc": [140, 140], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L139_C8", "vector": [14, 3, 0.1488, 0.0011, 3, 0.4, 0.0, 505, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " obj = map.get(fd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L141_C12", "label": "if", "type": "if", "loc": [141, 142], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L139_C8", "vector": [4, 3, 0.1504, 0.0021, 3, 0.4, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if obj is None:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L143_C12", "label": "read()", "type": "expression", "loc": [143, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L139_C8", "vector": [8, 3, 0.152, 0.0011, 3, 0.4, 1.0, 453, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "read", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " read(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L145_C8", "label": "for fd", "type": "for", "loc": [145, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L115_C4", "vector": [6, 2, 0.1562, 0.0053, 2, 0.2, 0.875, 863, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "fd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for fd in w:\n obj = map.get(fd)\n if obj is None:\n continue\n write(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L146_C12", "label": "obj = get()", "type": "assigned_variable", "loc": [146, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L145_C8", "vector": [14, 3, 0.1552, 0.0011, 3, 0.44, 0.0, 505, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " obj = map.get(fd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L147_C12", "label": "if", "type": "if", "loc": [147, 148], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L145_C8", "vector": [4, 3, 0.1567, 0.0021, 3, 0.44, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if obj is None:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L149_C12", "label": "write()", "type": "expression", "loc": [149, 149], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L145_C8", "vector": [8, 3, 0.1583, 0.0011, 3, 0.44, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " write(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L151_C8", "label": "for fd", "type": "for", "loc": [151, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L115_C4", "vector": [6, 2, 0.1626, 0.0053, 2, 0.2, 1.0, 863, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "fd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for fd in e:\n obj = map.get(fd)\n if obj is None:\n continue\n exception(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L152_C12", "label": "obj = get()", "type": "assigned_variable", "loc": [152, 152], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L151_C8", "vector": [14, 3, 0.1615, 0.0011, 3, 0.2, 0.0, 505, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " obj = map.get(fd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L153_C12", "label": "if", "type": "if", "loc": [153, 154], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L151_C8", "vector": [4, 3, 0.1631, 0.0021, 3, 0.2, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if obj is None:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L155_C12", "label": "exception()", "type": "expression", "loc": [155, 155], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L151_C8", "vector": [8, 3, 0.1647, 0.0011, 3, 0.2, 1.0, 69, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exception", "arg_names": [], "import_names": [], "rhs_call_name": "exception", "annotation": ""}, "snippet": " exception(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L158_C0", "label": "scheduler", "type": "function", "loc": [158, 172], "level": 0, "parent": null, "vector": [2, 0, 0.1753, 0.0159, 0, 0.66, 0.7931, 553, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "scheduler", "arg_names": ["tasks"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def scheduler(tasks=None):\n if tasks is None:\n tasks = _SCHEDULED_TASKS\n now = time.time()\n while tasks and now >= tasks[0].timeout:\n call = heapq.heappop(tasks)\n if call.repush:\n heapq.heappush(tasks, call)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L159_C4", "label": "if", "type": "if", "loc": [159, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L158_C0", "vector": [4, 1, 0.1695, 0.0021, 1, 0.26, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tasks is None:\n tasks = _SCHEDULED_TASKS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L160_C8", "label": "tasks =", "type": "assigned_variable", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L159_C4", "vector": [14, 2, 0.17, 0.0011, 2, 0.11, 0.0, 116, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tasks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tasks = _SCHEDULED_TASKS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L161_C4", "label": "now = time()", "type": "assigned_variable", "loc": [161, 161], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L158_C0", "vector": [14, 1, 0.1711, 0.0011, 1, 0.26, 0.5, 894, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "now", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " now = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L162_C4", "label": "while", "type": "while", "loc": [162, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L158_C0", "vector": [5, 1, 0.1775, 0.0117, 1, 0.26, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while tasks and now >= tasks[0].timeout:\n call = heapq.heappop(tasks)\n if call.repush:\n heapq.heappush(tasks, call)\n call.repush = False\n continue\n try:\n call.call()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L163_C8", "label": "call = heappop()", "type": "assigned_variable", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L162_C4", "vector": [14, 2, 0.1732, 0.0011, 2, 0.4, 0.0, 832, 3, 1, 0, 0, 889, 10, 1], "semantic": {"name": "call", "arg_names": [], "import_names": [], "rhs_call_name": "heappop", "annotation": ""}, "snippet": " call = heapq.heappop(tasks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L164_C8", "label": "if", "type": "if", "loc": [164, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L162_C4", "vector": [4, 2, 0.1759, 0.0043, 2, 0.4, 0.5, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if call.repush:\n heapq.heappush(tasks, call)\n call.repush = False\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L165_C12", "label": "heappush()", "type": "expression", "loc": [165, 165], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L164_C8", "vector": [8, 3, 0.1753, 0.0011, 3, 0.99, 0.0, 563, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "heappush", "arg_names": [], "import_names": [], "rhs_call_name": "heappush", "annotation": ""}, "snippet": " heapq.heappush(tasks, call)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L166_C12", "label": "call.repush =", "type": "assigned_variable", "loc": [166, 166], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L164_C8", "vector": [14, 3, 0.1764, 0.0011, 3, 0.99, 1.0, 36, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "call.repush", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " call.repush = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L168_C8", "label": "try", "type": "try", "loc": [168, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L162_C4", "vector": [7, 2, 0.1807, 0.0053, 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 call.call()\n finally:\n if not call.cancelled:\n call.cancel()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L169_C12", "label": "call()", "type": "expression", "loc": [169, 169], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L168_C8", "vector": [8, 3, 0.1796, 0.0011, 3, 0.04, 0.0, 832, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "call", "arg_names": [], "import_names": [], "rhs_call_name": "call", "annotation": ""}, "snippet": " call.call()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L171_C12", "label": "if", "type": "if", "loc": [171, 172], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L168_C8", "vector": [4, 3, 0.1823, 0.0021, 3, 0.04, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not call.cancelled:\n call.cancel()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L172_C16", "label": "cancel()", "type": "expression", "loc": [172, 172], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L171_C12", "vector": [8, 4, 0.1828, 0.0011, 4, 0.33, 0.0, 732, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "cancel", "arg_names": [], "import_names": [], "rhs_call_name": "cancel", "annotation": ""}, "snippet": " call.cancel()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L175_C0", "label": "loop", "type": "function", "loc": [175, 211], "level": 0, "parent": null, "vector": [2, 0, 0.2051, 0.0393, 0, 0.66, 0.8276, 848, 0, 4, 0, 0, 0, 0, 4], "semantic": {"name": "loop", "arg_names": ["timeout", "map", "tasks", "count"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def loop(timeout=30.0, map=None, tasks=None, count=None):\n \"\"\"\n Enter a polling loop that terminates after count passes or all open\n channels have been closed. All arguments are optional. The *count*\n parameter defaults to None, resulting in the loop terminating only when all\n channels have been closed. The *timeout* argument sets the timeout\n parameter for the appropriate :func:`select` or :func:`poll` call, measured\n in seconds; the default is 30 seconds. The *use_poll* parameter, if true,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L176_C4", "label": "expression", "type": "expression", "loc": [176, 192], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L175_C0", "vector": [8, 1, 0.1955, 0.0181, 1, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Enter a polling loop that terminates after count passes or all open\n channels have been closed. All arguments are optional. The *count*\n parameter defaults to None, resulting in the loop terminating only when all\n channels have been closed. The *timeout* argument sets the timeout\n parameter for the appropriate :func:`select` or :func:`poll` call, measured\n in seconds; the default is 30 seconds. The *use_poll* parameter, if true,\n indicates that :func:`poll` should be used in preference to :func:`select`"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L193_C4", "label": "if", "type": "if", "loc": [193, 194], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L175_C0", "vector": [4, 1, 0.2056, 0.0021, 1, 0.88, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if map is None:\n map = _SOCKET_MAP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L194_C8", "label": "map =", "type": "assigned_variable", "loc": [194, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L193_C4", "vector": [14, 2, 0.2062, 0.0011, 2, 0.43, 0.0, 53, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " map = _SOCKET_MAP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L195_C4", "label": "if", "type": "if", "loc": [195, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L175_C0", "vector": [4, 1, 0.2078, 0.0021, 1, 0.88, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tasks is None:\n tasks = _SCHEDULED_TASKS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L196_C8", "label": "tasks =", "type": "assigned_variable", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L195_C4", "vector": [14, 2, 0.2083, 0.0011, 2, 0.82, 0.0, 116, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tasks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tasks = _SCHEDULED_TASKS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L198_C4", "label": "if", "type": "if", "loc": [198, 211], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L175_C0", "vector": [4, 1, 0.2173, 0.0149, 1, 0.88, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if count is None:\n while map or tasks:\n if map:\n poll(timeout, map)\n if tasks:\n scheduler()\n\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L199_C8", "label": "while", "type": "while", "loc": [199, 203], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L198_C4", "vector": [5, 2, 0.2136, 0.0053, 2, 0.37, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while map or tasks:\n if map:\n poll(timeout, map)\n if tasks:\n scheduler()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L200_C12", "label": "if", "type": "if", "loc": [200, 201], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L199_C8", "vector": [4, 3, 0.2131, 0.0021, 3, 0.66, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if map:\n poll(timeout, map)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L201_C16", "label": "poll()", "type": "expression", "loc": [201, 201], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L200_C12", "vector": [8, 4, 0.2136, 0.0011, 4, 0.5, 0.0, 182, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "poll", "arg_names": [], "import_names": [], "rhs_call_name": "poll", "annotation": ""}, "snippet": " poll(timeout, map)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L202_C12", "label": "if", "type": "if", "loc": [202, 203], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L199_C8", "vector": [4, 3, 0.2152, 0.0021, 3, 0.66, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tasks:\n scheduler()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L203_C16", "label": "scheduler()", "type": "expression", "loc": [203, 203], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L202_C12", "vector": [8, 4, 0.2157, 0.0011, 4, 0.39, 0.0, 553, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "scheduler", "arg_names": [], "import_names": [], "rhs_call_name": "scheduler", "annotation": ""}, "snippet": " scheduler()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L206_C8", "label": "while", "type": "while", "loc": [206, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L198_C4", "vector": [5, 2, 0.2216, 0.0064, 2, 0.37, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while (map or tasks) and count > 0:\n if map:\n poll(timeout, map)\n if tasks:\n scheduler()\n count -= 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L207_C12", "label": "if", "type": "if", "loc": [207, 208], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L206_C8", "vector": [4, 3, 0.2205, 0.0021, 3, 0.63, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if map:\n poll(timeout, map)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L208_C16", "label": "poll()", "type": "expression", "loc": [208, 208], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L207_C12", "vector": [8, 4, 0.221, 0.0011, 4, 0.84, 0.0, 182, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "poll", "arg_names": [], "import_names": [], "rhs_call_name": "poll", "annotation": ""}, "snippet": " poll(timeout, map)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L209_C12", "label": "if", "type": "if", "loc": [209, 210], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L206_C8", "vector": [4, 3, 0.2226, 0.0021, 3, 0.63, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tasks:\n scheduler()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L210_C16", "label": "scheduler()", "type": "expression", "loc": [210, 210], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L209_C12", "vector": [8, 4, 0.2232, 0.0011, 4, 0.25, 0.0, 553, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "scheduler", "arg_names": [], "import_names": [], "rhs_call_name": "scheduler", "annotation": ""}, "snippet": " scheduler()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L214_C0", "label": "call_later", "type": "class", "loc": [214, 287], "level": 0, "parent": null, "vector": [3, 0, 0.2662, 0.0786, 0, 0.66, 0.8621, 824, 0, 6, 0, 0, 0, 0, 14], "semantic": {"name": "call_later", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class call_later:\n \"\"\"Calls a function at a later time.\n\n It can be used to asynchronously schedule a call within the polling\n loop without blocking it. The instance returned is an object that\n can be used to cancel or reschedule the call.\n \"\"\"\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L215_C4", "label": "expression", "type": "expression", "loc": [215, 220], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L214_C0", "vector": [8, 1, 0.2311, 0.0064, 1, 0.22, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Calls a function at a later time.\n\n It can be used to asynchronously schedule a call within the polling\n loop without blocking it. The instance returned is an object that\n can be used to cancel or reschedule the call.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L222_C4", "label": "__init__", "type": "function", "loc": [222, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L214_C0", "vector": [2, 1, 0.2471, 0.0234, 1, 0.22, 0.1667, 555, 0, 5, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "seconds", "target", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, seconds, target, *args, **kwargs):\n \"\"\"\n - seconds: the number of seconds to wait\n - target: the callable object to call later\n - args: the arguments to call it with\n - kwargs: the keyword arguments to call it with\n - _tasks: a reserved keyword to specify a different list to\n store the delayed call instances."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L223_C8", "label": "expression", "type": "expression", "loc": [223, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L222_C4", "vector": [8, 2, 0.2407, 0.0085, 2, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n - seconds: the number of seconds to wait\n - target: the callable object to call later\n - args: the arguments to call it with\n - kwargs: the keyword arguments to call it with\n - _tasks: a reserved keyword to specify a different list to\n store the delayed call instances.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L234_C8", "label": "self.__delay =", "type": "assigned_variable", "loc": [234, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L222_C4", "vector": [14, 2, 0.2487, 0.0011, 2, 0.91, 0.1111, 636, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.__delay", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__delay = seconds"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L235_C8", "label": "self.__target =", "type": "assigned_variable", "loc": [235, 235], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L222_C4", "vector": [14, 2, 0.2497, 0.0011, 2, 0.91, 0.2222, 882, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.__target", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__target = target"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L236_C8", "label": "self.__args =", "type": "assigned_variable", "loc": [236, 236], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L222_C4", "vector": [14, 2, 0.2508, 0.0011, 2, 0.91, 0.3333, 116, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.__args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__args = args"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L237_C8", "label": "self.__kwargs =", "type": "assigned_variable", "loc": [237, 237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L222_C4", "vector": [14, 2, 0.2519, 0.0011, 2, 0.91, 0.4444, 9, 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_1032:Assign_L238_C8", "label": "self.__tasks = pop()", "type": "assigned_variable", "loc": [238, 238], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L222_C4", "vector": [14, 2, 0.2529, 0.0011, 2, 0.91, 0.5556, 84, 3, 2, 0, 0, 969, 10, 1], "semantic": {"name": "self.__tasks", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " self.__tasks = kwargs.pop('_tasks', _SCHEDULED_TASKS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L240_C8", "label": "self.timeout =", "type": "assigned_variable", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L222_C4", "vector": [14, 2, 0.255, 0.0011, 2, 0.91, 0.6667, 621, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.timeout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.timeout = time.time() + self.__delay"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L241_C8", "label": "self.repush =", "type": "assigned_variable", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L222_C4", "vector": [14, 2, 0.2561, 0.0011, 2, 0.91, 0.7778, 188, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.repush", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.repush = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L242_C8", "label": "self.cancelled =", "type": "assigned_variable", "loc": [242, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L222_C4", "vector": [14, 2, 0.2572, 0.0011, 2, 0.91, 0.8889, 116, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.cancelled", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cancelled = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L243_C8", "label": "heappush()", "type": "expression", "loc": [243, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L222_C4", "vector": [8, 2, 0.2582, 0.0011, 2, 0.91, 1.0, 563, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "heappush", "arg_names": [], "import_names": [], "rhs_call_name": "heappush", "annotation": ""}, "snippet": " heapq.heappush(self.__tasks, self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L245_C4", "label": "__lt__", "type": "function", "loc": [245, 246], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L214_C0", "vector": [2, 1, 0.2609, 0.0021, 1, 0.22, 0.3333, 217, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__lt__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __lt__(self, other):\n return self.timeout <= other.timeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L246_C8", "label": "return", "type": "return", "loc": [246, 246], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L245_C4", "vector": [13, 2, 0.2614, 0.0011, 2, 0.46, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.timeout <= other.timeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L248_C4", "label": "call", "type": "function", "loc": [248, 251], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L214_C0", "vector": [2, 1, 0.2651, 0.0043, 1, 0.22, 0.5, 832, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "call", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def call(self):\n \"\"\"Call this scheduled function.\"\"\"\n assert not self.cancelled, \"Already cancelled\"\n self.__target(*self.__args, **self.__kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L249_C8", "label": "expression", "type": "expression", "loc": [249, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L248_C4", "vector": [8, 2, 0.2646, 0.0011, 2, 0.78, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Call this scheduled function.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L251_C8", "label": "__target()", "type": "expression", "loc": [251, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L248_C4", "vector": [8, 2, 0.2667, 0.0011, 2, 0.78, 1.0, 875, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__target", "arg_names": [], "import_names": [], "rhs_call_name": "__target", "annotation": ""}, "snippet": " self.__target(*self.__args, **self.__kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L253_C4", "label": "reset", "type": "function", "loc": [253, 257], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L214_C0", "vector": [2, 1, 0.271, 0.0053, 1, 0.22, 0.6667, 944, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "reset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def reset(self):\n \"\"\"Reschedule this call resetting the current countdown.\"\"\"\n assert not self.cancelled, \"Already cancelled\"\n self.timeout = time.time() + self.__delay\n self.repush = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L254_C8", "label": "expression", "type": "expression", "loc": [254, 254], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L253_C4", "vector": [8, 2, 0.2699, 0.0011, 2, 0.55, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Reschedule this call resetting the current countdown.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L256_C8", "label": "self.timeout =", "type": "assigned_variable", "loc": [256, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L253_C4", "vector": [14, 2, 0.2721, 0.0011, 2, 0.55, 0.5, 621, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.timeout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.timeout = time.time() + self.__delay"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L257_C8", "label": "self.repush =", "type": "assigned_variable", "loc": [257, 257], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L253_C4", "vector": [14, 2, 0.2731, 0.0011, 2, 0.55, 1.0, 188, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.repush", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.repush = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L259_C4", "label": "delay", "type": "function", "loc": [259, 272], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L214_C0", "vector": [2, 1, 0.2821, 0.0149, 1, 0.22, 0.8333, 140, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "delay", "arg_names": ["self", "seconds"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def delay(self, seconds):\n \"\"\"Reschedule this call for a later time.\"\"\"\n assert not self.cancelled, \"Already cancelled.\"\n assert seconds >= 0, \\\n \"%s is not greater than or equal to 0 seconds\" % (seconds)\n self.__delay = seconds\n newtime = time.time() + self.__delay\n if newtime > self.timeout:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L260_C8", "label": "expression", "type": "expression", "loc": [260, 260], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L259_C4", "vector": [8, 2, 0.2763, 0.0011, 2, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Reschedule this call for a later time.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L264_C8", "label": "self.__delay =", "type": "assigned_variable", "loc": [264, 264], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L259_C4", "vector": [14, 2, 0.2806, 0.0011, 2, 0.07, 0.3333, 636, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.__delay", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__delay = seconds"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L265_C8", "label": "newtime =", "type": "assigned_variable", "loc": [265, 265], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L259_C4", "vector": [14, 2, 0.2816, 0.0011, 2, 0.07, 0.6667, 852, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "newtime", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newtime = time.time() + self.__delay"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L266_C8", "label": "if", "type": "if", "loc": [266, 272], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L259_C4", "vector": [4, 2, 0.2859, 0.0074, 2, 0.07, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if newtime > self.timeout:\n self.timeout = newtime\n self.repush = True\n else:\n # XXX - slow, can be improved\n self.timeout = newtime\n heapq.heapify(self.__tasks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L267_C12", "label": "self.timeout =", "type": "assigned_variable", "loc": [267, 267], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L266_C8", "vector": [14, 3, 0.2837, 0.0011, 3, 0.61, 0.0, 621, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.timeout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.timeout = newtime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L268_C12", "label": "self.repush =", "type": "assigned_variable", "loc": [268, 268], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L266_C8", "vector": [14, 3, 0.2848, 0.0011, 3, 0.61, 0.3333, 188, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.repush", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.repush = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L271_C12", "label": "self.timeout =", "type": "assigned_variable", "loc": [271, 271], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L266_C8", "vector": [14, 3, 0.288, 0.0011, 3, 0.61, 0.6667, 621, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.timeout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.timeout = newtime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L272_C12", "label": "heapify()", "type": "expression", "loc": [272, 272], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L266_C8", "vector": [8, 3, 0.2891, 0.0011, 3, 0.61, 1.0, 257, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "heapify", "arg_names": [], "import_names": [], "rhs_call_name": "heapify", "annotation": ""}, "snippet": " heapq.heapify(self.__tasks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L274_C4", "label": "cancel", "type": "function", "loc": [274, 287], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L214_C0", "vector": [2, 1, 0.2981, 0.0149, 1, 0.22, 1.0, 732, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "cancel", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def cancel(self):\n \"\"\"Unschedule this call.\"\"\"\n assert not self.cancelled, \"Already cancelled\"\n self.cancelled = True\n del self.__target, self.__args, self.__kwargs\n if self in self.__tasks:\n pos = self.__tasks.index(self)\n if pos == 0:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L275_C8", "label": "expression", "type": "expression", "loc": [275, 275], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L274_C4", "vector": [8, 2, 0.2922, 0.0011, 2, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Unschedule this call.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L277_C8", "label": "self.cancelled =", "type": "assigned_variable", "loc": [277, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L274_C4", "vector": [14, 2, 0.2944, 0.0011, 2, 0.84, 0.5, 116, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.cancelled", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cancelled = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L279_C8", "label": "if", "type": "if", "loc": [279, 287], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L274_C4", "vector": [4, 2, 0.3007, 0.0096, 2, 0.84, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self in self.__tasks:\n pos = self.__tasks.index(self)\n if pos == 0:\n heapq.heappop(self.__tasks)\n elif pos == len(self.__tasks) - 1:\n self.__tasks.pop(pos)\n else:\n self.__tasks[pos] = self.__tasks.pop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L280_C12", "label": "pos = index()", "type": "assigned_variable", "loc": [280, 280], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L279_C8", "vector": [14, 3, 0.2976, 0.0011, 3, 0.07, 0.0, 627, 3, 1, 0, 0, 780, 10, 1], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "index", "annotation": ""}, "snippet": " pos = self.__tasks.index(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L281_C12", "label": "if", "type": "if", "loc": [281, 287], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L279_C8", "vector": [4, 3, 0.3018, 0.0074, 3, 0.07, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if pos == 0:\n heapq.heappop(self.__tasks)\n elif pos == len(self.__tasks) - 1:\n self.__tasks.pop(pos)\n else:\n self.__tasks[pos] = self.__tasks.pop()\n heapq._siftup(self.__tasks, pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L282_C16", "label": "heappop()", "type": "expression", "loc": [282, 282], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L281_C12", "vector": [8, 4, 0.2997, 0.0011, 4, 0.88, 0.0, 889, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "heappop", "arg_names": [], "import_names": [], "rhs_call_name": "heappop", "annotation": ""}, "snippet": " heapq.heappop(self.__tasks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L283_C12", "label": "if", "type": "if", "loc": [283, 287], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L281_C12", "vector": [4, 4, 0.3029, 0.0053, 4, 0.88, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif pos == len(self.__tasks) - 1:\n self.__tasks.pop(pos)\n else:\n self.__tasks[pos] = self.__tasks.pop()\n heapq._siftup(self.__tasks, pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L284_C16", "label": "pop()", "type": "expression", "loc": [284, 284], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L283_C12", "vector": [8, 5, 0.3018, 0.0011, 5, 0.75, 0.0, 969, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pop", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " self.__tasks.pop(pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L286_C16", "label": " = pop()", "type": "assigned_variable", "loc": [286, 286], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L283_C12", "vector": [14, 5, 0.3039, 0.0011, 5, 0.75, 0.5, 0, 3, 0, 0, 0, 969, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " self.__tasks[pos] = self.__tasks.pop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L287_C16", "label": "_siftup()", "type": "expression", "loc": [287, 287], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L283_C12", "vector": [8, 5, 0.305, 0.0011, 5, 0.75, 1.0, 523, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_siftup", "arg_names": [], "import_names": [], "rhs_call_name": "_siftup", "annotation": ""}, "snippet": " heapq._siftup(self.__tasks, pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "label": "Dispatcher", "type": "class", "loc": [290, 653], "level": 0, "parent": null, "vector": [3, 0, 0.5011, 0.3868, 0, 0.66, 0.8966, 958, 0, 27, 0, 0, 186, 0, 62], "semantic": {"name": "Dispatcher", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Dispatcher(object):\n \"\"\"\n The :class:`Dispatcher` class is a thin wrapper around a low-level socket\n object. To make it more useful, it has a few methods for event-handling\n which are called from the asynchronous loop. Otherwise, it can be treated\n as a normal non-blocking socket object.\n\n The firing of low-level events at certain times or in certain connection"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L291_C4", "label": "expression", "type": "expression", "loc": [291, 323], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [8, 1, 0.3262, 0.0351, 1, 0.68, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n The :class:`Dispatcher` class is a thin wrapper around a low-level socket\n object. To make it more useful, it has a few methods for event-handling\n which are called from the asynchronous loop. Otherwise, it can be treated\n as a normal non-blocking socket object.\n\n The firing of low-level events at certain times or in certain connection\n states tells the asynchronous loop that certain higher-level events have"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L325_C4", "label": "connected =", "type": "assigned_variable", "loc": [325, 325], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [14, 1, 0.3454, 0.0011, 1, 0.68, 0.0323, 720, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "connected", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " connected = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L326_C4", "label": "accepting =", "type": "assigned_variable", "loc": [326, 326], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [14, 1, 0.3464, 0.0011, 1, 0.68, 0.0645, 326, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "accepting", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " accepting = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L327_C4", "label": "addr =", "type": "assigned_variable", "loc": [327, 327], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [14, 1, 0.3475, 0.0011, 1, 0.68, 0.0968, 526, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "addr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " addr = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L329_C4", "label": "__init__", "type": "function", "loc": [329, 358], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.365, 0.0319, 1, 0.68, 0.129, 555, 0, 3, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "sock", "map"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, sock=None, map=None):\n if map is None:\n self._map = _SOCKET_MAP\n else:\n self._map = map\n\n self._fileno = None\n if sock:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L330_C8", "label": "if", "type": "if", "loc": [330, 333], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L329_C4", "vector": [4, 2, 0.3523, 0.0043, 2, 0.03, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if map is None:\n self._map = _SOCKET_MAP\n else:\n self._map = map"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L331_C12", "label": "self._map =", "type": "assigned_variable", "loc": [331, 331], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L330_C8", "vector": [14, 3, 0.3518, 0.0011, 3, 0.1, 0.0, 16, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._map = _SOCKET_MAP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L333_C12", "label": "self._map =", "type": "assigned_variable", "loc": [333, 333], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L330_C8", "vector": [14, 3, 0.3539, 0.0011, 3, 0.1, 1.0, 16, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._map = map"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L335_C8", "label": "self._fileno =", "type": "assigned_variable", "loc": [335, 335], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L329_C4", "vector": [14, 2, 0.356, 0.0011, 2, 0.03, 0.5, 521, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._fileno", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._fileno = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L336_C8", "label": "if", "type": "if", "loc": [336, 358], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L329_C4", "vector": [4, 2, 0.3688, 0.0244, 2, 0.03, 1.0, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if sock:\n # Set to nonblocking just to make sure for cases where we\n # get a socket from a blocking source.\n sock.setblocking(0)\n self.set_socket(sock, map)\n self.connected = True\n # The constructor no longer requires that the socket\n # passed be connected."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L339_C12", "label": "setblocking()", "type": "expression", "loc": [339, 339], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L336_C8", "vector": [8, 3, 0.3603, 0.0011, 3, 0.29, 0.0, 473, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setblocking", "arg_names": [], "import_names": [], "rhs_call_name": "setblocking", "annotation": ""}, "snippet": " sock.setblocking(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L340_C12", "label": "set_socket()", "type": "expression", "loc": [340, 340], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L336_C8", "vector": [8, 3, 0.3613, 0.0011, 3, 0.29, 0.25, 554, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_socket", "arg_names": [], "import_names": [], "rhs_call_name": "set_socket", "annotation": ""}, "snippet": " self.set_socket(sock, map)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L341_C12", "label": "self.connected =", "type": "assigned_variable", "loc": [341, 341], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L336_C8", "vector": [14, 3, 0.3624, 0.0011, 3, 0.29, 0.5, 99, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.connected", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.connected = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L344_C12", "label": "try", "type": "try", "loc": [344, 356], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L336_C8", "vector": [7, 3, 0.3719, 0.0138, 3, 0.29, 0.75, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.addr = sock.getpeername()\n except socket.error as err:\n if err.args[0] == ENOTCONN:\n # To handle the case where we got an unconnected\n # socket.\n self.connected = False\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L345_C16", "label": "self.addr = getpeername()", "type": "assigned_variable", "loc": [345, 345], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L344_C12", "vector": [14, 4, 0.3666, 0.0011, 4, 0.06, 0.0, 895, 3, 0, 0, 0, 468, 10, 1], "semantic": {"name": "self.addr", "arg_names": [], "import_names": [], "rhs_call_name": "getpeername", "annotation": ""}, "snippet": " self.addr = sock.getpeername()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L347_C16", "label": "if", "type": "if", "loc": [347, 356], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L344_C12", "vector": [4, 4, 0.3735, 0.0106, 4, 0.06, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if err.args[0] == ENOTCONN:\n # To handle the case where we got an unconnected\n # socket.\n self.connected = False\n else:\n # The socket is broken in some unknown way, alert\n # the user and remove it from the map (to prevent\n # polling of broken sockets)."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L350_C20", "label": "self.connected =", "type": "assigned_variable", "loc": [350, 350], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L347_C16", "vector": [14, 5, 0.3719, 0.0011, 5, 0.62, 0.0, 99, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.connected", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.connected = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L355_C20", "label": "_del_channel()", "type": "expression", "loc": [355, 355], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L347_C16", "vector": [8, 5, 0.3773, 0.0011, 5, 0.62, 1.0, 2, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_del_channel", "arg_names": [], "import_names": [], "rhs_call_name": "_del_channel", "annotation": ""}, "snippet": " self._del_channel(map)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L358_C12", "label": "self.socket =", "type": "assigned_variable", "loc": [358, 358], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L336_C8", "vector": [14, 3, 0.3804, 0.0011, 3, 0.29, 1.0, 172, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.socket", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.socket = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L360_C4", "label": "__repr__", "type": "function", "loc": [360, 371], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.3884, 0.0128, 1, 0.68, 0.1613, 204, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "__repr__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __repr__(self):\n status = [self.__class__.__module__ + '.' + self.__class__.__name__]\n if self.accepting and self.addr:\n status.append('listening')\n elif self.connected:\n status.append('connected')\n if self.addr is not None:\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L361_C8", "label": "status =", "type": "assigned_variable", "loc": [361, 361], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L360_C4", "vector": [14, 2, 0.3836, 0.0011, 2, 0.35, 0.0, 699, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " status = [self.__class__.__module__ + '.' + self.__class__.__name__]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L362_C8", "label": "if", "type": "if", "loc": [362, 365], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L360_C4", "vector": [4, 2, 0.3863, 0.0043, 2, 0.35, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.accepting and self.addr:\n status.append('listening')\n elif self.connected:\n status.append('connected')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L363_C12", "label": "append()", "type": "expression", "loc": [363, 363], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L362_C8", "vector": [8, 3, 0.3858, 0.0011, 3, 0.62, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " status.append('listening')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L364_C8", "label": "if", "type": "if", "loc": [364, 365], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L362_C8", "vector": [4, 3, 0.3874, 0.0021, 3, 0.62, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.connected:\n status.append('connected')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L365_C12", "label": "append()", "type": "expression", "loc": [365, 365], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L364_C8", "vector": [8, 4, 0.3879, 0.0011, 4, 0.93, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " status.append('connected')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L366_C8", "label": "if", "type": "if", "loc": [366, 370], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L360_C4", "vector": [4, 2, 0.3911, 0.0053, 2, 0.35, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.addr is not None:\n try:\n status.append('%s:%d' % self.addr)\n except TypeError:\n status.append(repr(self.addr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L367_C12", "label": "try", "type": "try", "loc": [367, 370], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L366_C8", "vector": [7, 3, 0.3916, 0.0043, 3, 0.58, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n status.append('%s:%d' % self.addr)\n except TypeError:\n status.append(repr(self.addr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L368_C16", "label": "append()", "type": "expression", "loc": [368, 368], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L367_C12", "vector": [8, 4, 0.3911, 0.0011, 4, 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": " status.append('%s:%d' % self.addr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L370_C16", "label": "append()", "type": "expression", "loc": [370, 370], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L367_C12", "vector": [8, 4, 0.3932, 0.0011, 4, 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": " status.append(repr(self.addr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L371_C8", "label": "return", "type": "return", "loc": [371, 371], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L360_C4", "vector": [13, 2, 0.3943, 0.0011, 2, 0.35, 1.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '<%s at %#x>' % (' '.join(status), id(self))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L373_C4", "label": "__str__ =", "type": "assigned_variable", "loc": [373, 373], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [14, 1, 0.3964, 0.0011, 1, 0.68, 0.1935, 527, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "__str__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " __str__ = __repr__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L375_C4", "label": "_add_channel", "type": "function", "loc": [375, 379], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.4006, 0.0053, 1, 0.68, 0.2258, 419, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_add_channel", "arg_names": ["self", "map"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _add_channel(self, map=None):\n log.debug('Adding channel %s' % self)\n if map is None:\n map = self._map\n map[self._fileno] = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L376_C8", "label": "debug()", "type": "expression", "loc": [376, 376], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L375_C4", "vector": [8, 2, 0.3996, 0.0011, 2, 0.84, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " log.debug('Adding channel %s' % self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L377_C8", "label": "if", "type": "if", "loc": [377, 378], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L375_C4", "vector": [4, 2, 0.4012, 0.0021, 2, 0.84, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if map is None:\n map = self._map"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L378_C12", "label": "map =", "type": "assigned_variable", "loc": [378, 378], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L377_C8", "vector": [14, 3, 0.4017, 0.0011, 3, 0.44, 0.0, 53, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " map = self._map"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L379_C8", "label": "assign", "type": "assigned_variable", "loc": [379, 379], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L375_C4", "vector": [14, 2, 0.4028, 0.0011, 2, 0.84, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " map[self._fileno] = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L381_C4", "label": "_del_channel", "type": "function", "loc": [381, 388], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.4086, 0.0085, 1, 0.68, 0.2581, 2, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_del_channel", "arg_names": ["self", "map"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _del_channel(self, map=None):\n fd = self._fileno\n if map is None:\n map = self._map\n if fd in map:\n log.debug('Closing channel %d:%s' % (fd, self))\n del map[fd]\n self._fileno = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L382_C8", "label": "fd =", "type": "assigned_variable", "loc": [382, 382], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L381_C4", "vector": [14, 2, 0.406, 0.0011, 2, 0.75, 0.0, 863, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fd = self._fileno"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L383_C8", "label": "if", "type": "if", "loc": [383, 384], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L381_C4", "vector": [4, 2, 0.4075, 0.0021, 2, 0.75, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if map is None:\n map = self._map"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L384_C12", "label": "map =", "type": "assigned_variable", "loc": [384, 384], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L383_C8", "vector": [14, 3, 0.4081, 0.0011, 3, 0.88, 0.0, 53, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " map = self._map"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L385_C8", "label": "if", "type": "if", "loc": [385, 387], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L381_C4", "vector": [4, 2, 0.4102, 0.0032, 2, 0.75, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if fd in map:\n log.debug('Closing channel %d:%s' % (fd, self))\n del map[fd]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L386_C12", "label": "debug()", "type": "expression", "loc": [386, 386], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L385_C8", "vector": [8, 3, 0.4102, 0.0011, 3, 0.19, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " log.debug('Closing channel %d:%s' % (fd, self))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L388_C8", "label": "self._fileno =", "type": "assigned_variable", "loc": [388, 388], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L381_C4", "vector": [14, 2, 0.4123, 0.0011, 2, 0.75, 1.0, 521, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._fileno", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._fileno = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L390_C4", "label": "create_socket", "type": "function", "loc": [390, 399], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.4192, 0.0106, 1, 0.68, 0.2903, 444, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "create_socket", "arg_names": ["self", "family", "type"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def create_socket(self, family, type):\n \"\"\"\n This is identical to the creation of a normal socket, and will use\n the same options for creation. Refer to the :mod:`socket` documentation\n for information on creating sockets.\n \"\"\"\n self.family_and_type = family, type\n sock = socket.socket(family, type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L391_C8", "label": "expression", "type": "expression", "loc": [391, 395], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L390_C4", "vector": [8, 2, 0.4176, 0.0053, 2, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n This is identical to the creation of a normal socket, and will use\n the same options for creation. Refer to the :mod:`socket` documentation\n for information on creating sockets.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L396_C8", "label": "self.family_and_type =", "type": "assigned_variable", "loc": [396, 396], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L390_C4", "vector": [14, 2, 0.4208, 0.0011, 2, 0.05, 0.25, 765, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "self.family_and_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.family_and_type = family, type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L397_C8", "label": "sock = socket()", "type": "assigned_variable", "loc": [397, 397], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L390_C4", "vector": [14, 2, 0.4219, 0.0011, 2, 0.05, 0.5, 263, 3, 2, 0, 0, 687, 10, 1], "semantic": {"name": "sock", "arg_names": [], "import_names": [], "rhs_call_name": "socket", "annotation": ""}, "snippet": " sock = socket.socket(family, type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L398_C8", "label": "setblocking()", "type": "expression", "loc": [398, 398], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L390_C4", "vector": [8, 2, 0.423, 0.0011, 2, 0.05, 0.75, 473, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setblocking", "arg_names": [], "import_names": [], "rhs_call_name": "setblocking", "annotation": ""}, "snippet": " sock.setblocking(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L399_C8", "label": "set_socket()", "type": "expression", "loc": [399, 399], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L390_C4", "vector": [8, 2, 0.424, 0.0011, 2, 0.05, 1.0, 554, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_socket", "arg_names": [], "import_names": [], "rhs_call_name": "set_socket", "annotation": ""}, "snippet": " self.set_socket(sock)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L401_C4", "label": "set_socket", "type": "function", "loc": [401, 404], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.4277, 0.0043, 1, 0.68, 0.3226, 554, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "set_socket", "arg_names": ["self", "sock", "map"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_socket(self, sock, map=None):\n self.socket = sock\n self._fileno = sock.fileno()\n self._add_channel(map)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L402_C8", "label": "self.socket =", "type": "assigned_variable", "loc": [402, 402], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L401_C4", "vector": [14, 2, 0.4272, 0.0011, 2, 0.9, 0.0, 172, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.socket", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.socket = sock"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L403_C8", "label": "self._fileno = fileno()", "type": "assigned_variable", "loc": [403, 403], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L401_C4", "vector": [14, 2, 0.4283, 0.0011, 2, 0.9, 0.5, 521, 3, 0, 0, 0, 15, 10, 1], "semantic": {"name": "self._fileno", "arg_names": [], "import_names": [], "rhs_call_name": "fileno", "annotation": ""}, "snippet": " self._fileno = sock.fileno()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L404_C8", "label": "_add_channel()", "type": "expression", "loc": [404, 404], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L401_C4", "vector": [8, 2, 0.4293, 0.0011, 2, 0.9, 1.0, 419, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_add_channel", "arg_names": [], "import_names": [], "rhs_call_name": "_add_channel", "annotation": ""}, "snippet": " self._add_channel(map)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L406_C4", "label": "set_reuse_addr", "type": "function", "loc": [406, 414], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.4357, 0.0096, 1, 0.68, 0.3548, 935, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "set_reuse_addr", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_reuse_addr(self):\n try:\n self.socket.setsockopt(\n socket.SOL_SOCKET, socket.SO_REUSEADDR,\n self.socket.getsockopt(socket.SOL_SOCKET,\n socket.SO_REUSEADDR) | 1\n )\n except socket.error:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L407_C8", "label": "try", "type": "try", "loc": [407, 414], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L406_C4", "vector": [7, 2, 0.4362, 0.0085, 2, 0.11, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.socket.setsockopt(\n socket.SOL_SOCKET, socket.SO_REUSEADDR,\n self.socket.getsockopt(socket.SOL_SOCKET,\n socket.SO_REUSEADDR) | 1\n )\n except socket.error:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L408_C12", "label": "setsockopt()", "type": "expression", "loc": [408, 412], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L407_C8", "vector": [8, 3, 0.4357, 0.0053, 3, 0.1, 0.0, 461, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setsockopt", "arg_names": [], "import_names": [], "rhs_call_name": "setsockopt", "annotation": ""}, "snippet": " self.socket.setsockopt(\n socket.SOL_SOCKET, socket.SO_REUSEADDR,\n self.socket.getsockopt(socket.SOL_SOCKET,\n socket.SO_REUSEADDR) | 1\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L416_C4", "label": "readable", "type": "function", "loc": [416, 422], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.4453, 0.0074, 1, 0.68, 0.3871, 808, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "readable", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def readable(self):\n \"\"\"\n Called each time around the asynchronous loop to determine whether a\n channel's socket should be added to the list on which read events can\n occur. The default method simply returns ``True``, indicating that by\n default, all channels will be interested in read events.\"\"\"\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L417_C8", "label": "expression", "type": "expression", "loc": [417, 421], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L416_C4", "vector": [8, 2, 0.4453, 0.0053, 2, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Called each time around the asynchronous loop to determine whether a\n channel's socket should be added to the list on which read events can\n occur. The default method simply returns ``True``, indicating that by\n default, all channels will be interested in read events.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L422_C8", "label": "return", "type": "return", "loc": [422, 422], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L416_C4", "vector": [13, 2, 0.4485, 0.0011, 2, 0.45, 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_1032:FunctionDef_L424_C4", "label": "writable", "type": "function", "loc": [424, 431], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.4543, 0.0085, 1, 0.68, 0.4194, 58, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "writable", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def writable(self):\n \"\"\"\n Called each time around the asynchronous loop to determine whether a\n channel's socket should be added to the list on which write events can\n occur. The default method simply returns ``True``, indicating that by\n default, all channels will be interested in write events.\n \"\"\"\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L425_C8", "label": "expression", "type": "expression", "loc": [425, 430], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L424_C4", "vector": [8, 2, 0.4543, 0.0064, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Called each time around the asynchronous loop to determine whether a\n channel's socket should be added to the list on which write events can\n occur. The default method simply returns ``True``, indicating that by\n default, all channels will be interested in write events.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L431_C8", "label": "return", "type": "return", "loc": [431, 431], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L424_C4", "vector": [13, 2, 0.458, 0.0011, 2, 0.83, 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_1032:FunctionDef_L433_C4", "label": "listen", "type": "function", "loc": [433, 442], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.4649, 0.0106, 1, 0.68, 0.4516, 265, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "listen", "arg_names": ["self", "num"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def listen(self, num):\n \"\"\"Listen for connections made to the socket.\n\n The `num` argument specifies the maximum number of queued connections\n and should be at least 1; the maximum value is system-dependent\n (usually 5).\"\"\"\n self.accepting = True\n if os.name == 'nt' and num > 5:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L434_C8", "label": "expression", "type": "expression", "loc": [434, 438], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L433_C4", "vector": [8, 2, 0.4633, 0.0053, 2, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Listen for connections made to the socket.\n\n The `num` argument specifies the maximum number of queued connections\n and should be at least 1; the maximum value is system-dependent\n (usually 5).\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L439_C8", "label": "self.accepting =", "type": "assigned_variable", "loc": [439, 439], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L433_C4", "vector": [14, 2, 0.4665, 0.0011, 2, 0.72, 0.3333, 931, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.accepting", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.accepting = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L440_C8", "label": "if", "type": "if", "loc": [440, 441], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L433_C4", "vector": [4, 2, 0.4681, 0.0021, 2, 0.72, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.name == 'nt' and num > 5:\n num = 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L441_C12", "label": "num =", "type": "assigned_variable", "loc": [441, 441], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L440_C8", "vector": [14, 3, 0.4687, 0.0011, 3, 0.0, 0.0, 328, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "num", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " num = 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L442_C8", "label": "return", "type": "return", "loc": [442, 442], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L433_C4", "vector": [13, 2, 0.4697, 0.0011, 2, 0.72, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.socket.listen(num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L444_C4", "label": "bind", "type": "function", "loc": [444, 454], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.4772, 0.0117, 1, 0.68, 0.4839, 640, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "bind", "arg_names": ["self", "address"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def bind(self, address):\n \"\"\"Bind the socket to `address`.\n\n The socket must not already be bound. The format of `address` depends\n on the address family --- refer to the :mod:`socket` documentation for\n more information. To mark the socket as re-usable (setting the\n :const:`SO_REUSEADDR` option), call the :class:`Dispatcher` object's\n :meth:`set_reuse_addr` method."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L445_C8", "label": "expression", "type": "expression", "loc": [445, 452], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L444_C4", "vector": [8, 2, 0.4766, 0.0085, 2, 0.36, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Bind the socket to `address`.\n\n The socket must not already be bound. The format of `address` depends\n on the address family --- refer to the :mod:`socket` documentation for\n more information. To mark the socket as re-usable (setting the\n :const:`SO_REUSEADDR` option), call the :class:`Dispatcher` object's\n :meth:`set_reuse_addr` method.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L453_C8", "label": "self.addr =", "type": "assigned_variable", "loc": [453, 453], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L444_C4", "vector": [14, 2, 0.4814, 0.0011, 2, 0.36, 0.5, 895, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.addr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.addr = address"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L454_C8", "label": "return", "type": "return", "loc": [454, 454], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L444_C4", "vector": [13, 2, 0.4825, 0.0011, 2, 0.36, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.socket.bind(address)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L456_C4", "label": "connect", "type": "function", "loc": [456, 470], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.492, 0.0159, 1, 0.68, 0.5161, 242, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "connect", "arg_names": ["self", "address"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def connect(self, address):\n \"\"\"\n As with the normal socket object, `address` is a tuple with the first\n element the host to connect to, and the second the port number.\n \"\"\"\n self.connected = False\n self.addr = address\n err = self.socket.connect_ex(address)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L457_C8", "label": "expression", "type": "expression", "loc": [457, 460], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L456_C4", "vector": [8, 2, 0.4872, 0.0043, 2, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n As with the normal socket object, `address` is a tuple with the first\n element the host to connect to, and the second the port number.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L461_C8", "label": "self.connected =", "type": "assigned_variable", "loc": [461, 461], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L456_C4", "vector": [14, 2, 0.4899, 0.0011, 2, 0.73, 0.2, 99, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.connected", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.connected = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L462_C8", "label": "self.addr =", "type": "assigned_variable", "loc": [462, 462], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L456_C4", "vector": [14, 2, 0.491, 0.0011, 2, 0.73, 0.4, 895, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.addr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.addr = address"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L463_C8", "label": "err = connect_ex()", "type": "assigned_variable", "loc": [463, 463], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L456_C4", "vector": [14, 2, 0.492, 0.0011, 2, 0.73, 0.6, 541, 3, 1, 0, 0, 9, 10, 1], "semantic": {"name": "err", "arg_names": [], "import_names": [], "rhs_call_name": "connect_ex", "annotation": ""}, "snippet": " err = self.socket.connect_ex(address)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L464_C8", "label": "if", "type": "if", "loc": [464, 466], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L456_C4", "vector": [4, 2, 0.4942, 0.0032, 2, 0.73, 0.8, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if err in (EINPROGRESS, EALREADY, EWOULDBLOCK)\\\n or err == EINVAL and os.name in ('nt', 'ce'):\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L466_C12", "label": "return", "type": "return", "loc": [466, 466], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L464_C8", "vector": [13, 3, 0.4952, 0.0011, 3, 0.15, 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_1032:If_L467_C8", "label": "if", "type": "if", "loc": [467, 470], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L456_C4", "vector": [4, 2, 0.4979, 0.0043, 2, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if err in (0, EISCONN):\n self.handle_connect_event()\n else:\n raise socket.error(err, errorcode[err])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L468_C12", "label": "handle_connect_event()", "type": "expression", "loc": [468, 468], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L467_C8", "vector": [8, 3, 0.4973, 0.0011, 3, 0.52, 0.0, 67, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_connect_event", "arg_names": [], "import_names": [], "rhs_call_name": "handle_connect_event", "annotation": ""}, "snippet": " self.handle_connect_event()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L472_C4", "label": "accept", "type": "function", "loc": [472, 495], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.5138, 0.0255, 1, 0.68, 0.5484, 829, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "accept", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def accept(self):\n \"\"\"Accept a connection.\n\n The socket must be bound to an address and listening for connections.\n The return value can be either ``None`` or a pair ``(conn, address)``\n where `conn` is a *new* socket object usable to send and receive data on\n the connection, and *address* is the address bound to the socket on the\n other end of the connection."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L473_C8", "label": "expression", "type": "expression", "loc": [473, 484], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L472_C4", "vector": [8, 2, 0.5085, 0.0128, 2, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Accept a connection.\n\n The socket must be bound to an address and listening for connections.\n The return value can be either ``None`` or a pair ``(conn, address)``\n where `conn` is a *new* socket object usable to send and receive data on\n the connection, and *address* is the address bound to the socket on the\n other end of the connection.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L485_C8", "label": "try", "type": "try", "loc": [485, 495], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L472_C4", "vector": [7, 2, 0.5207, 0.0117, 2, 0.46, 1.0, 0, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n conn, addr = self.socket.accept()\n except TypeError:\n return None\n except socket.error as err:\n if err.args[0] in (EWOULDBLOCK, ECONNABORTED, EAGAIN):\n return None\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L486_C12", "label": "conn, addr = accept()", "type": "assigned_variable", "loc": [486, 486], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L485_C8", "vector": [14, 3, 0.5165, 0.0011, 3, 0.67, 0.0, 427, 3, 0, 0, 0, 829, 10, 1], "semantic": {"name": "conn, addr", "arg_names": [], "import_names": [], "rhs_call_name": "accept", "annotation": ""}, "snippet": " conn, addr = self.socket.accept()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L488_C12", "label": "return", "type": "return", "loc": [488, 488], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L485_C8", "vector": [13, 3, 0.5186, 0.0011, 3, 0.67, 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_1032:If_L490_C12", "label": "if", "type": "if", "loc": [490, 493], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L485_C8", "vector": [4, 3, 0.5223, 0.0043, 3, 0.67, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if err.args[0] in (EWOULDBLOCK, ECONNABORTED, EAGAIN):\n return None\n else:\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L491_C16", "label": "return", "type": "return", "loc": [491, 491], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L490_C12", "vector": [13, 4, 0.5218, 0.0011, 4, 0.04, 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_1032:Return_L495_C12", "label": "return", "type": "return", "loc": [495, 495], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L485_C8", "vector": [13, 3, 0.526, 0.0011, 3, 0.67, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return conn, addr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L497_C4", "label": "send", "type": "function", "loc": [497, 510], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.5351, 0.0149, 1, 0.68, 0.5806, 826, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "send", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def send(self, data):\n \"\"\"Send `data` to the remote end-point of the socket.\"\"\"\n try:\n log.debug('[%s:%d] <<< %r', self.addr[0], self.addr[1], data)\n result = self.socket.send(data)\n return result\n except socket.error as err:\n if err.args[0] == EWOULDBLOCK:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L498_C8", "label": "expression", "type": "expression", "loc": [498, 498], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L497_C4", "vector": [8, 2, 0.5292, 0.0011, 2, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Send `data` to the remote end-point of the socket.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L499_C8", "label": "try", "type": "try", "loc": [499, 510], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L497_C4", "vector": [7, 2, 0.5361, 0.0128, 2, 0.56, 1.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n log.debug('[%s:%d] <<< %r', self.addr[0], self.addr[1], data)\n result = self.socket.send(data)\n return result\n except socket.error as err:\n if err.args[0] == EWOULDBLOCK:\n return 0\n elif err.args[0] in _DISCONNECTED:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L500_C12", "label": "debug()", "type": "expression", "loc": [500, 500], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L499_C8", "vector": [8, 3, 0.5313, 0.0011, 3, 0.86, 0.0, 924, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " log.debug('[%s:%d] <<< %r', self.addr[0], self.addr[1], data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L501_C12", "label": "result = send()", "type": "assigned_variable", "loc": [501, 501], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L499_C8", "vector": [14, 3, 0.5324, 0.0011, 3, 0.86, 0.5, 51, 3, 1, 0, 0, 826, 10, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "send", "annotation": ""}, "snippet": " result = self.socket.send(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L502_C12", "label": "return", "type": "return", "loc": [502, 502], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L499_C8", "vector": [13, 3, 0.5335, 0.0011, 3, 0.86, 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_1032:If_L504_C12", "label": "if", "type": "if", "loc": [504, 510], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L499_C8", "vector": [4, 3, 0.5388, 0.0074, 3, 0.86, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if err.args[0] == EWOULDBLOCK:\n return 0\n elif err.args[0] in _DISCONNECTED:\n self.handle_close()\n return 0\n else:\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L505_C16", "label": "return", "type": "return", "loc": [505, 505], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L504_C12", "vector": [13, 4, 0.5367, 0.0011, 4, 0.34, 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_1032:If_L506_C12", "label": "if", "type": "if", "loc": [506, 510], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L504_C12", "vector": [4, 4, 0.5399, 0.0053, 4, 0.34, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif err.args[0] in _DISCONNECTED:\n self.handle_close()\n return 0\n else:\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L507_C16", "label": "handle_close()", "type": "expression", "loc": [507, 507], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L506_C12", "vector": [8, 5, 0.5388, 0.0011, 5, 0.72, 0.0, 320, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_close", "arg_names": [], "import_names": [], "rhs_call_name": "handle_close", "annotation": ""}, "snippet": " self.handle_close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L508_C16", "label": "return", "type": "return", "loc": [508, 508], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L506_C12", "vector": [13, 5, 0.5399, 0.0011, 5, 0.72, 1.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L512_C4", "label": "recv", "type": "function", "loc": [512, 534], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.5558, 0.0244, 1, 0.68, 0.6129, 178, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "recv", "arg_names": ["self", "buffer_size"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def recv(self, buffer_size):\n \"\"\"Read at most `buffer_size` bytes from the socket's remote end-point.\n\n An empty string implies that the channel has been closed from the other\n end.\n \"\"\"\n try:\n data = self.socket.recv(buffer_size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L513_C8", "label": "expression", "type": "expression", "loc": [513, 517], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L512_C4", "vector": [8, 2, 0.5473, 0.0053, 2, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Read at most `buffer_size` bytes from the socket's remote end-point.\n\n An empty string implies that the channel has been closed from the other\n end.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L518_C8", "label": "try", "type": "try", "loc": [518, 534], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L512_C4", "vector": [7, 2, 0.559, 0.0181, 2, 0.81, 1.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n data = self.socket.recv(buffer_size)\n log.debug('[%s:%d] >>> %r', self.addr[0], self.addr[1], data)\n if not data:\n # a closed connection is indicated by signaling\n # a read condition, and having recv() return 0.\n self.handle_close()\n return b''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L519_C12", "label": "data = recv()", "type": "assigned_variable", "loc": [519, 519], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L518_C8", "vector": [14, 3, 0.5515, 0.0011, 3, 0.68, 0.0, 929, 3, 1, 0, 0, 178, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "recv", "annotation": ""}, "snippet": " data = self.socket.recv(buffer_size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L520_C12", "label": "debug()", "type": "expression", "loc": [520, 520], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L518_C8", "vector": [8, 3, 0.5526, 0.0011, 3, 0.68, 0.5, 924, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " log.debug('[%s:%d] >>> %r', self.addr[0], self.addr[1], data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L521_C12", "label": "if", "type": "if", "loc": [521, 527], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L518_C8", "vector": [4, 3, 0.5569, 0.0074, 3, 0.68, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not data:\n # a closed connection is indicated by signaling\n # a read condition, and having recv() return 0.\n self.handle_close()\n return b''\n else:\n return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L524_C16", "label": "handle_close()", "type": "expression", "loc": [524, 524], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L521_C12", "vector": [8, 4, 0.5569, 0.0011, 4, 0.46, 0.0, 320, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_close", "arg_names": [], "import_names": [], "rhs_call_name": "handle_close", "annotation": ""}, "snippet": " self.handle_close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L525_C16", "label": "return", "type": "return", "loc": [525, 525], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L521_C12", "vector": [13, 4, 0.5579, 0.0011, 4, 0.46, 0.5, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return b''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L527_C16", "label": "return", "type": "return", "loc": [527, 527], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L521_C12", "vector": [13, 4, 0.56, 0.0011, 4, 0.46, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L530_C12", "label": "if", "type": "if", "loc": [530, 534], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L518_C8", "vector": [4, 3, 0.5654, 0.0053, 3, 0.68, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if err.args[0] in _DISCONNECTED:\n self.handle_close()\n return b''\n else:\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L531_C16", "label": "handle_close()", "type": "expression", "loc": [531, 531], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L530_C12", "vector": [8, 4, 0.5643, 0.0011, 4, 0.5, 0.0, 320, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_close", "arg_names": [], "import_names": [], "rhs_call_name": "handle_close", "annotation": ""}, "snippet": " self.handle_close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L532_C16", "label": "return", "type": "return", "loc": [532, 532], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L530_C12", "vector": [13, 4, 0.5654, 0.0011, 4, 0.5, 1.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return b''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L536_C4", "label": "close", "type": "function", "loc": [536, 551], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.5776, 0.017, 1, 0.68, 0.6452, 77, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "close", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def close(self):\n \"\"\"Close the socket.\n \n All future operations on the socket object will fail.\n The remote end-point will receive no more data (after queued data is\n flushed). Sockets are automatically closed when they are\n garbage-collected.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L537_C8", "label": "expression", "type": "expression", "loc": [537, 543], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L536_C4", "vector": [8, 2, 0.5739, 0.0074, 2, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Close the socket.\n \n All future operations on the socket object will fail.\n The remote end-point will receive no more data (after queued data is\n flushed). Sockets are automatically closed when they are\n garbage-collected.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L544_C8", "label": "self.connected =", "type": "assigned_variable", "loc": [544, 544], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L536_C4", "vector": [14, 2, 0.5781, 0.0011, 2, 0.82, 0.25, 99, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.connected", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.connected = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L545_C8", "label": "self.accepting =", "type": "assigned_variable", "loc": [545, 545], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L536_C4", "vector": [14, 2, 0.5792, 0.0011, 2, 0.82, 0.5, 931, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.accepting", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.accepting = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L546_C8", "label": "_del_channel()", "type": "expression", "loc": [546, 546], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L536_C4", "vector": [8, 2, 0.5802, 0.0011, 2, 0.82, 0.75, 2, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_del_channel", "arg_names": [], "import_names": [], "rhs_call_name": "_del_channel", "annotation": ""}, "snippet": " self._del_channel()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L547_C8", "label": "try", "type": "try", "loc": [547, 551], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L536_C4", "vector": [7, 2, 0.5834, 0.0053, 2, 0.82, 1.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.socket.close()\n except socket.error as err:\n if err.args[0] not in (ENOTCONN, EBADF):\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L548_C12", "label": "close()", "type": "expression", "loc": [548, 548], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L547_C8", "vector": [8, 3, 0.5824, 0.0011, 3, 0.87, 0.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " self.socket.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L550_C12", "label": "if", "type": "if", "loc": [550, 551], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L547_C8", "vector": [4, 3, 0.585, 0.0021, 3, 0.87, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if err.args[0] not in (ENOTCONN, EBADF):\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L553_C4", "label": "handle_read_event", "type": "function", "loc": [553, 562], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.5925, 0.0106, 1, 0.68, 0.6774, 102, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "handle_read_event", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_read_event(self):\n if self.accepting:\n # accepting sockets are never connected, they \"spawn\" new\n # sockets that are connected\n self.handle_accept()\n elif not self.connected:\n self.handle_connect_event()\n self.handle_read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L554_C8", "label": "if", "type": "if", "loc": [554, 562], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L553_C4", "vector": [4, 2, 0.593, 0.0096, 2, 0.48, 0.0, 0, 7, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.accepting:\n # accepting sockets are never connected, they \"spawn\" new\n # sockets that are connected\n self.handle_accept()\n elif not self.connected:\n self.handle_connect_event()\n self.handle_read()\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L557_C12", "label": "handle_accept()", "type": "expression", "loc": [557, 557], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L554_C8", "vector": [8, 3, 0.5919, 0.0011, 3, 0.17, 0.0, 137, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_accept", "arg_names": [], "import_names": [], "rhs_call_name": "handle_accept", "annotation": ""}, "snippet": " self.handle_accept()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L558_C8", "label": "if", "type": "if", "loc": [558, 562], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L554_C8", "vector": [4, 3, 0.5951, 0.0053, 3, 0.17, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not self.connected:\n self.handle_connect_event()\n self.handle_read()\n else:\n self.handle_read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L559_C12", "label": "handle_connect_event()", "type": "expression", "loc": [559, 559], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L558_C8", "vector": [8, 4, 0.594, 0.0011, 4, 0.51, 0.0, 67, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_connect_event", "arg_names": [], "import_names": [], "rhs_call_name": "handle_connect_event", "annotation": ""}, "snippet": " self.handle_connect_event()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L560_C12", "label": "handle_read()", "type": "expression", "loc": [560, 560], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L558_C8", "vector": [8, 4, 0.5951, 0.0011, 4, 0.51, 0.5, 325, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_read", "arg_names": [], "import_names": [], "rhs_call_name": "handle_read", "annotation": ""}, "snippet": " self.handle_read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L562_C12", "label": "handle_read()", "type": "expression", "loc": [562, 562], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L558_C8", "vector": [8, 4, 0.5972, 0.0011, 4, 0.51, 1.0, 325, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_read", "arg_names": [], "import_names": [], "rhs_call_name": "handle_read", "annotation": ""}, "snippet": " self.handle_read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L564_C4", "label": "handle_connect_event", "type": "function", "loc": [564, 569], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.602, 0.0064, 1, 0.68, 0.7097, 67, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "handle_connect_event", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_connect_event(self):\n err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)\n if err != 0:\n raise socket.error(err, _strerror(err))\n self.handle_connect()\n self.connected = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L565_C8", "label": "err = getsockopt()", "type": "assigned_variable", "loc": [565, 565], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L564_C4", "vector": [14, 2, 0.6004, 0.0011, 2, 0.7, 0.0, 541, 3, 2, 0, 0, 758, 10, 1], "semantic": {"name": "err", "arg_names": [], "import_names": [], "rhs_call_name": "getsockopt", "annotation": ""}, "snippet": " err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L566_C8", "label": "if", "type": "if", "loc": [566, 567], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L564_C4", "vector": [4, 2, 0.602, 0.0021, 2, 0.7, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if err != 0:\n raise socket.error(err, _strerror(err))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L568_C8", "label": "handle_connect()", "type": "expression", "loc": [568, 568], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L564_C4", "vector": [8, 2, 0.6036, 0.0011, 2, 0.7, 0.6667, 411, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_connect", "arg_names": [], "import_names": [], "rhs_call_name": "handle_connect", "annotation": ""}, "snippet": " self.handle_connect()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L569_C8", "label": "self.connected =", "type": "assigned_variable", "loc": [569, 569], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L564_C4", "vector": [14, 2, 0.6047, 0.0011, 2, 0.7, 1.0, 99, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.connected", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.connected = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L571_C4", "label": "handle_write_event", "type": "function", "loc": [571, 584], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.6137, 0.0149, 1, 0.68, 0.7419, 0, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "handle_write_event", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_write_event(self):\n if self.accepting:\n # Accepting sockets shouldn't get a write event.\n # We will pretend it didn't happen.\n return\n\n if not self.connected:\n #check for errors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L572_C8", "label": "if", "type": "if", "loc": [572, 575], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L571_C4", "vector": [4, 2, 0.6095, 0.0043, 2, 0.06, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.accepting:\n # Accepting sockets shouldn't get a write event.\n # We will pretend it didn't happen.\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L575_C12", "label": "return", "type": "return", "loc": [575, 575], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L572_C8", "vector": [13, 3, 0.6111, 0.0011, 3, 0.92, 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_1032:If_L577_C8", "label": "if", "type": "if", "loc": [577, 583], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L571_C4", "vector": [4, 2, 0.6164, 0.0074, 2, 0.06, 0.5, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.connected:\n #check for errors\n err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)\n if err != 0:\n raise socket.error(err, _strerror(err))\n\n self.handle_connect_event()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L579_C12", "label": "err = getsockopt()", "type": "assigned_variable", "loc": [579, 579], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L577_C8", "vector": [14, 3, 0.6153, 0.0011, 3, 0.82, 0.0, 541, 3, 2, 0, 0, 758, 10, 1], "semantic": {"name": "err", "arg_names": [], "import_names": [], "rhs_call_name": "getsockopt", "annotation": ""}, "snippet": " err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L580_C12", "label": "if", "type": "if", "loc": [580, 581], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L577_C8", "vector": [4, 3, 0.6169, 0.0021, 3, 0.82, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if err != 0:\n raise socket.error(err, _strerror(err))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L583_C12", "label": "handle_connect_event()", "type": "expression", "loc": [583, 583], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L577_C8", "vector": [8, 3, 0.6196, 0.0011, 3, 0.82, 1.0, 67, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_connect_event", "arg_names": [], "import_names": [], "rhs_call_name": "handle_connect_event", "annotation": ""}, "snippet": " self.handle_connect_event()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L584_C8", "label": "handle_write()", "type": "expression", "loc": [584, 584], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L571_C4", "vector": [8, 2, 0.6206, 0.0011, 2, 0.06, 1.0, 707, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_write", "arg_names": [], "import_names": [], "rhs_call_name": "handle_write", "annotation": ""}, "snippet": " self.handle_write()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L586_C4", "label": "handle_exception_event", "type": "function", "loc": [586, 599], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.6296, 0.0149, 1, 0.68, 0.7742, 275, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "handle_exception_event", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_exception_event(self):\n # handle_exception_event() is called if there might be an error on the\n # socket, or if there is OOB data\n # check for the error condition first\n err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)\n if err != 0:\n # we can get here when select.select() says that there is an\n # exceptional condition on the socket"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L590_C8", "label": "err = getsockopt()", "type": "assigned_variable", "loc": [590, 590], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L586_C4", "vector": [14, 2, 0.627, 0.0011, 2, 0.14, 0.0, 541, 3, 2, 0, 0, 758, 10, 1], "semantic": {"name": "err", "arg_names": [], "import_names": [], "rhs_call_name": "getsockopt", "annotation": ""}, "snippet": " err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L591_C8", "label": "if", "type": "if", "loc": [591, 599], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L586_C4", "vector": [4, 2, 0.6323, 0.0096, 2, 0.14, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if err != 0:\n # we can get here when select.select() says that there is an\n # exceptional condition on the socket\n # since there is an error, we'll go ahead and close the socket\n # like we would in a subclassed handle_read() that received no\n # data\n self.handle_close()\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L597_C12", "label": "handle_close()", "type": "expression", "loc": [597, 597], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L591_C8", "vector": [8, 3, 0.6344, 0.0011, 3, 0.31, 0.0, 320, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_close", "arg_names": [], "import_names": [], "rhs_call_name": "handle_close", "annotation": ""}, "snippet": " self.handle_close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L599_C12", "label": "handle_exception()", "type": "expression", "loc": [599, 599], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L591_C8", "vector": [8, 3, 0.6366, 0.0011, 3, 0.31, 1.0, 625, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_exception", "arg_names": [], "import_names": [], "rhs_call_name": "handle_exception", "annotation": ""}, "snippet": " self.handle_exception()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L601_C4", "label": "handle_error", "type": "function", "loc": [601, 614], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.6456, 0.0149, 1, 0.68, 0.8065, 899, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "handle_error", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_error(self):\n \"\"\"\n Called when an exception is raised and not otherwise handled.\n The default version prints a condensed traceback.\n \"\"\"\n try:\n self_repr = repr(self)\n except Exception:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L602_C8", "label": "expression", "type": "expression", "loc": [602, 605], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L601_C4", "vector": [8, 2, 0.6413, 0.0043, 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 Called when an exception is raised and not otherwise handled.\n The default version prints a condensed traceback.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L606_C8", "label": "try", "type": "try", "loc": [606, 609], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L601_C4", "vector": [7, 2, 0.6456, 0.0043, 2, 0.33, 0.3333, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self_repr = repr(self)\n except Exception:\n self_repr = '<__repr__(self) failed for object at %0x>' % id(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L607_C12", "label": "self_repr = repr()", "type": "assigned_variable", "loc": [607, 607], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L606_C8", "vector": [14, 3, 0.6451, 0.0011, 3, 0.57, 0.0, 283, 3, 1, 0, 0, 881, 10, 1], "semantic": {"name": "self_repr", "arg_names": [], "import_names": [], "rhs_call_name": "repr", "annotation": ""}, "snippet": " self_repr = repr(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L609_C12", "label": "self_repr =", "type": "assigned_variable", "loc": [609, 609], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L606_C8", "vector": [14, 3, 0.6472, 0.0011, 3, 0.57, 0.0, 283, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self_repr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self_repr = '<__repr__(self) failed for object at %0x>' % id(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L611_C8", "label": "exception()", "type": "expression", "loc": [611, 612], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L601_C4", "vector": [8, 2, 0.6498, 0.0021, 2, 0.33, 0.6667, 69, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "exception", "arg_names": [], "import_names": [], "rhs_call_name": "exception", "annotation": ""}, "snippet": " log.exception('Uncatched python exception, closing channel %s',\n self_repr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L614_C8", "label": "handle_close()", "type": "expression", "loc": [614, 614], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L601_C4", "vector": [8, 2, 0.6525, 0.0011, 2, 0.33, 1.0, 320, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_close", "arg_names": [], "import_names": [], "rhs_call_name": "handle_close", "annotation": ""}, "snippet": " self.handle_close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L616_C4", "label": "handle_exception", "type": "function", "loc": [616, 617], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.6552, 0.0021, 1, 0.68, 0.8387, 625, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "handle_exception", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_exception(self):\n log.exception('Unknown error')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L617_C8", "label": "exception()", "type": "expression", "loc": [617, 617], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L616_C4", "vector": [8, 2, 0.6557, 0.0011, 2, 0.32, 0.0, 69, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exception", "arg_names": [], "import_names": [], "rhs_call_name": "exception", "annotation": ""}, "snippet": " log.exception('Unknown error')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L619_C4", "label": "handle_read", "type": "function", "loc": [619, 620], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.6583, 0.0021, 1, 0.68, 0.871, 325, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "handle_read", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_read(self):\n log.debug('Unhandled read event')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L620_C8", "label": "debug()", "type": "expression", "loc": [620, 620], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L619_C4", "vector": [8, 2, 0.6589, 0.0011, 2, 0.75, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " log.debug('Unhandled read event')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L622_C4", "label": "handle_write", "type": "function", "loc": [622, 632], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.6663, 0.0117, 1, 0.68, 0.9032, 707, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "handle_write", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_write(self):\n \"\"\"\n Called when the asynchronous loop detects that a writable socket can be\n written. Often this method will implement the necessary buffering for\n performance. For example::\n\n def handle_write(self):\n sent = self.send(self.buffer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L623_C8", "label": "expression", "type": "expression", "loc": [623, 631], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L622_C4", "vector": [8, 2, 0.6663, 0.0096, 2, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Called when the asynchronous loop detects that a writable socket can be\n written. Often this method will implement the necessary buffering for\n performance. For example::\n\n def handle_write(self):\n sent = self.send(self.buffer)\n self.buffer = self.buffer[sent:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L632_C8", "label": "debug()", "type": "expression", "loc": [632, 632], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L622_C4", "vector": [8, 2, 0.6716, 0.0011, 2, 0.37, 1.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " log.debug('Unhandled write event')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L634_C4", "label": "handle_connect", "type": "function", "loc": [634, 640], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.6769, 0.0074, 1, 0.68, 0.9355, 411, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "handle_connect", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_connect(self):\n \"\"\"\n Called when the active opener's socket actually makes a connection.\n Might send a \"welcome\" banner, or initiate a protocol negotiation with\n the remote endpoint, for example.\n \"\"\"\n log.info('[%s:%d] Connection established', self.addr[0], self.addr[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L635_C8", "label": "expression", "type": "expression", "loc": [635, 639], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L634_C4", "vector": [8, 2, 0.6769, 0.0053, 2, 0.93, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Called when the active opener's socket actually makes a connection.\n Might send a \"welcome\" banner, or initiate a protocol negotiation with\n the remote endpoint, for example.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L640_C8", "label": "info()", "type": "expression", "loc": [640, 640], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L634_C4", "vector": [8, 2, 0.6801, 0.0011, 2, 0.93, 1.0, 730, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " log.info('[%s:%d] Connection established', self.addr[0], self.addr[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L642_C4", "label": "handle_accept", "type": "function", "loc": [642, 648], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.6854, 0.0074, 1, 0.68, 0.9677, 137, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "handle_accept", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_accept(self):\n \"\"\"\n Called on listening channels (passive openers) when a connection can be\n established with a new remote endpoint that has issued a :meth:`connect`\n call for the local endpoint.\n \"\"\"\n log.info('[%s:%d] Connection accepted', self.addr[0], self.addr[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L643_C8", "label": "expression", "type": "expression", "loc": [643, 647], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L642_C4", "vector": [8, 2, 0.6854, 0.0053, 2, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Called on listening channels (passive openers) when a connection can be\n established with a new remote endpoint that has issued a :meth:`connect`\n call for the local endpoint.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L648_C8", "label": "info()", "type": "expression", "loc": [648, 648], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L642_C4", "vector": [8, 2, 0.6886, 0.0011, 2, 0.91, 1.0, 730, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " log.info('[%s:%d] Connection accepted', self.addr[0], self.addr[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L650_C4", "label": "handle_close", "type": "function", "loc": [650, 653], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "vector": [2, 1, 0.6923, 0.0043, 1, 0.68, 1.0, 320, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "handle_close", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_close(self):\n \"\"\"Called when the socket is closed.\"\"\"\n log.info('[%s:%d] Connection closed', self.addr[0], self.addr[1])\n self.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L651_C8", "label": "expression", "type": "expression", "loc": [651, 651], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L650_C4", "vector": [8, 2, 0.6918, 0.0011, 2, 0.22, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Called when the socket is closed.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L652_C8", "label": "info()", "type": "expression", "loc": [652, 652], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L650_C4", "vector": [8, 2, 0.6929, 0.0011, 2, 0.22, 0.5, 730, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " log.info('[%s:%d] Connection closed', self.addr[0], self.addr[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L653_C8", "label": "close()", "type": "expression", "loc": [653, 653], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L650_C4", "vector": [8, 2, 0.6939, 0.0011, 2, 0.22, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " self.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L656_C0", "label": "close_all", "type": "function", "loc": [656, 684], "level": 0, "parent": null, "vector": [2, 0, 0.712, 0.0308, 0, 0.66, 0.931, 720, 0, 3, 0, 0, 0, 0, 5], "semantic": {"name": "close_all", "arg_names": ["map", "tasks", "ignore_all"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def close_all(map=None, tasks=None, ignore_all=False):\n if map is None:\n map = _SOCKET_MAP\n if tasks is None:\n tasks = _SCHEDULED_TASKS\n for x in list(map.values()):\n try:\n x.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L657_C4", "label": "if", "type": "if", "loc": [657, 658], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L656_C0", "vector": [4, 1, 0.6987, 0.0021, 1, 0.88, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if map is None:\n map = _SOCKET_MAP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L658_C8", "label": "map =", "type": "assigned_variable", "loc": [658, 658], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L657_C4", "vector": [14, 2, 0.6993, 0.0011, 2, 0.48, 0.0, 53, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " map = _SOCKET_MAP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L659_C4", "label": "if", "type": "if", "loc": [659, 660], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L656_C0", "vector": [4, 1, 0.7009, 0.0021, 1, 0.88, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tasks is None:\n tasks = _SCHEDULED_TASKS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L660_C8", "label": "tasks =", "type": "assigned_variable", "loc": [660, 660], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L659_C4", "vector": [14, 2, 0.7014, 0.0011, 2, 0.46, 0.0, 116, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tasks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tasks = _SCHEDULED_TASKS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L661_C4", "label": "for x", "type": "for", "loc": [661, 673], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L656_C0", "vector": [6, 1, 0.7088, 0.0138, 1, 0.88, 0.5, 190, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for x in list(map.values()):\n try:\n x.close()\n except OSError as err:\n if err.args[0] == EBADF:\n pass\n elif not ignore_all:\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L662_C8", "label": "try", "type": "try", "loc": [662, 673], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L661_C4", "vector": [7, 2, 0.7094, 0.0128, 2, 0.5, 0.0, 0, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n x.close()\n except OSError as err:\n if err.args[0] == EBADF:\n pass\n elif not ignore_all:\n raise\n except _RERAISEABLE_EXC:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L663_C12", "label": "close()", "type": "expression", "loc": [663, 663], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L662_C8", "vector": [8, 3, 0.7046, 0.0011, 3, 0.73, 0.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " x.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L665_C12", "label": "if", "type": "if", "loc": [665, 668], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L662_C8", "vector": [4, 3, 0.7083, 0.0043, 3, 0.73, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if err.args[0] == EBADF:\n pass\n elif not ignore_all:\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L667_C12", "label": "if", "type": "if", "loc": [667, 668], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L665_C12", "vector": [4, 4, 0.7094, 0.0021, 4, 0.33, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not ignore_all:\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L672_C12", "label": "if", "type": "if", "loc": [672, 673], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L662_C8", "vector": [4, 3, 0.7147, 0.0021, 3, 0.73, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not ignore_all:\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L674_C4", "label": "clear()", "type": "expression", "loc": [674, 674], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L656_C0", "vector": [8, 1, 0.7163, 0.0011, 1, 0.88, 0.75, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " map.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L676_C4", "label": "for x", "type": "for", "loc": [676, 683], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L656_C0", "vector": [6, 1, 0.7221, 0.0085, 1, 0.88, 1.0, 190, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for x in tasks:\n try:\n x.cancel()\n except _RERAISEABLE_EXC:\n raise\n except Exception:\n if not ignore_all:\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L677_C8", "label": "try", "type": "try", "loc": [677, 683], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L676_C4", "vector": [7, 2, 0.7226, 0.0074, 2, 0.78, 0.0, 0, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n x.cancel()\n except _RERAISEABLE_EXC:\n raise\n except Exception:\n if not ignore_all:\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L678_C12", "label": "cancel()", "type": "expression", "loc": [678, 678], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L677_C8", "vector": [8, 3, 0.7205, 0.0011, 3, 0.47, 0.0, 732, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "cancel", "arg_names": [], "import_names": [], "rhs_call_name": "cancel", "annotation": ""}, "snippet": " x.cancel()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L682_C12", "label": "if", "type": "if", "loc": [682, 683], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L677_C8", "vector": [4, 3, 0.7253, 0.0021, 3, 0.47, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not ignore_all:\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "label": "AsyncChat", "type": "class", "loc": [687, 934], "level": 0, "parent": null, "vector": [3, 0, 0.8613, 0.2635, 0, 0.66, 0.9655, 658, 0, 21, 0, 0, 958, 0, 57], "semantic": {"name": "AsyncChat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class AsyncChat(Dispatcher):\n \"\"\"\n This class is an abstract subclass of :class:`Dispatcher`. To make\n practical use of the code you must subclass :class:`AsyncChat`, providing\n meaningful meth:`found_terminator` method.\n The :class:`Dispatcher` methods can be used, although not all make\n sense in a message/response context.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L688_C4", "label": "expression", "type": "expression", "loc": [688, 700], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [8, 1, 0.7375, 0.0138, 1, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n This class is an abstract subclass of :class:`Dispatcher`. To make\n practical use of the code you must subclass :class:`AsyncChat`, providing\n meaningful meth:`found_terminator` method.\n The :class:`Dispatcher` methods can be used, although not all make\n sense in a message/response context.\n\n Like :class:`Dispatcher`, :class:`AsyncChat` defines a set of"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L705_C4", "label": "recv_buffer_size =", "type": "assigned_variable", "loc": [705, 705], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [14, 1, 0.7492, 0.0011, 1, 0.19, 0.0357, 527, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "recv_buffer_size", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " recv_buffer_size = 4096"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L707_C4", "label": "send_buffer_size =", "type": "assigned_variable", "loc": [707, 707], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [14, 1, 0.7513, 0.0011, 1, 0.19, 0.0714, 445, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "send_buffer_size", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " send_buffer_size = 4096"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L711_C4", "label": "use_encoding =", "type": "assigned_variable", "loc": [711, 711], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [14, 1, 0.7556, 0.0011, 1, 0.19, 0.1071, 280, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "use_encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " use_encoding = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L713_C4", "label": "encoding =", "type": "assigned_variable", "loc": [713, 713], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [14, 1, 0.7577, 0.0011, 1, 0.19, 0.1429, 325, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " encoding = 'latin-1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L716_C4", "label": "strip_terminator =", "type": "assigned_variable", "loc": [716, 716], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [14, 1, 0.7609, 0.0011, 1, 0.19, 0.1786, 211, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "strip_terminator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " strip_terminator = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L718_C4", "label": "_terminator =", "type": "assigned_variable", "loc": [718, 718], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [14, 1, 0.763, 0.0011, 1, 0.19, 0.2143, 401, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "_terminator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _terminator = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L720_C4", "label": "__init__", "type": "function", "loc": [720, 727], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [2, 1, 0.7689, 0.0085, 1, 0.19, 0.25, 555, 0, 3, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "sock", "map"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, sock=None, map=None):\n # for string terminator matching\n self._input_buffer = b''\n self.inbox = deque()\n self.outbox = deque()\n super(AsyncChat, self).__init__(sock, map)\n self.collect_incoming_data = self.pull\n self.initiate_send = self.flush"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L722_C8", "label": "self._input_buffer =", "type": "assigned_variable", "loc": [722, 722], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L720_C4", "vector": [14, 2, 0.7673, 0.0011, 2, 0.67, 0.0, 416, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._input_buffer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._input_buffer = b''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L723_C8", "label": "self.inbox = deque()", "type": "assigned_variable", "loc": [723, 723], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L720_C4", "vector": [14, 2, 0.7683, 0.0011, 2, 0.67, 0.2, 238, 3, 0, 0, 0, 650, 10, 1], "semantic": {"name": "self.inbox", "arg_names": [], "import_names": [], "rhs_call_name": "deque", "annotation": ""}, "snippet": " self.inbox = deque()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L724_C8", "label": "self.outbox = deque()", "type": "assigned_variable", "loc": [724, 724], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L720_C4", "vector": [14, 2, 0.7694, 0.0011, 2, 0.67, 0.4, 810, 3, 0, 0, 0, 650, 10, 1], "semantic": {"name": "self.outbox", "arg_names": [], "import_names": [], "rhs_call_name": "deque", "annotation": ""}, "snippet": " self.outbox = deque()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L725_C8", "label": "__init__()", "type": "expression", "loc": [725, 725], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L720_C4", "vector": [8, 2, 0.7705, 0.0011, 2, 0.67, 0.6, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(AsyncChat, self).__init__(sock, map)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L726_C8", "label": "self.collect_incoming_data =", "type": "assigned_variable", "loc": [726, 726], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L720_C4", "vector": [14, 2, 0.7715, 0.0011, 2, 0.67, 0.8, 808, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.collect_incoming_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.collect_incoming_data = self.pull"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L727_C8", "label": "self.initiate_send =", "type": "assigned_variable", "loc": [727, 727], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L720_C4", "vector": [14, 2, 0.7726, 0.0011, 2, 0.67, 1.0, 705, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.initiate_send", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.initiate_send = self.flush"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L729_C4", "label": "pull", "type": "function", "loc": [729, 733], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [2, 1, 0.7768, 0.0053, 1, 0.19, 0.2857, 964, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "pull", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pull(self, data):\n \"\"\"Puts `data` into incoming queue. Also available by alias\n `collect_incoming_data`.\n \"\"\"\n self.inbox.append(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L730_C8", "label": "expression", "type": "expression", "loc": [730, 732], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L729_C4", "vector": [8, 2, 0.7768, 0.0032, 2, 0.12, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Puts `data` into incoming queue. Also available by alias\n `collect_incoming_data`.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L733_C8", "label": "append()", "type": "expression", "loc": [733, 733], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L729_C4", "vector": [8, 2, 0.779, 0.0011, 2, 0.12, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.inbox.append(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L735_C4", "label": "found_terminator", "type": "function", "loc": [735, 742], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [2, 1, 0.7848, 0.0085, 1, 0.19, 0.3214, 372, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "found_terminator", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def found_terminator(self):\n \"\"\"\n Called when the incoming data stream matches the :attr:`termination`\n condition. The default method, which must be overridden, raises a\n :exc:`NotImplementedError` exception. The buffered input data should be\n available via an instance attribute.\n \"\"\"\n raise NotImplementedError(\"must be implemented in subclass\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L736_C8", "label": "expression", "type": "expression", "loc": [736, 741], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L735_C4", "vector": [8, 2, 0.7848, 0.0064, 2, 0.96, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Called when the incoming data stream matches the :attr:`termination`\n condition. The default method, which must be overridden, raises a\n :exc:`NotImplementedError` exception. The buffered input data should be\n available via an instance attribute.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L744_C4", "label": "_set_terminator", "type": "function", "loc": [744, 745], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [2, 1, 0.7912, 0.0021, 1, 0.19, 0.3571, 804, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "_set_terminator", "arg_names": ["self", "term"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_terminator(self, term):\n self._terminator = term"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L745_C8", "label": "self._terminator =", "type": "assigned_variable", "loc": [745, 745], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L744_C4", "vector": [14, 2, 0.7917, 0.0011, 2, 0.27, 0.0, 321, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._terminator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._terminator = term"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L747_C4", "label": "_get_terminator", "type": "function", "loc": [747, 748], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [2, 1, 0.7944, 0.0021, 1, 0.19, 0.3929, 325, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "_get_terminator", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_terminator(self):\n return self._terminator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L748_C8", "label": "return", "type": "return", "loc": [748, 748], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L747_C4", "vector": [13, 2, 0.7949, 0.0011, 2, 0.7, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._terminator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L770_C4", "label": "terminator = property()", "type": "assigned_variable", "loc": [770, 770], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [14, 1, 0.8183, 0.0011, 1, 0.19, 0.4286, 920, 3, 2, 0, 0, 244, 10, 1], "semantic": {"name": "terminator", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " terminator = property(_get_terminator, _set_terminator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L772_C4", "label": "handle_read", "type": "function", "loc": [772, 796], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [2, 1, 0.8332, 0.0266, 1, 0.19, 0.4643, 325, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "handle_read", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_read(self):\n try:\n data = self.recv(self.recv_buffer_size)\n except socket.error as err:\n self.handle_error()\n return\n\n if self.use_encoding and not isinstance():"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L773_C8", "label": "try", "type": "try", "loc": [773, 777], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L772_C4", "vector": [7, 2, 0.8236, 0.0053, 2, 0.49, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n data = self.recv(self.recv_buffer_size)\n except socket.error as err:\n self.handle_error()\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L774_C12", "label": "data = recv()", "type": "assigned_variable", "loc": [774, 774], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L773_C8", "vector": [14, 3, 0.8225, 0.0011, 3, 0.13, 0.0, 929, 3, 1, 0, 0, 178, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "recv", "annotation": ""}, "snippet": " data = self.recv(self.recv_buffer_size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L776_C12", "label": "handle_error()", "type": "expression", "loc": [776, 776], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L773_C8", "vector": [8, 3, 0.8247, 0.0011, 3, 0.13, 0.0, 899, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_error", "arg_names": [], "import_names": [], "rhs_call_name": "handle_error", "annotation": ""}, "snippet": " self.handle_error()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L777_C12", "label": "return", "type": "return", "loc": [777, 777], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L773_C8", "vector": [13, 3, 0.8257, 0.0011, 3, 0.13, 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_1032:If_L779_C8", "label": "if", "type": "if", "loc": [779, 780], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L772_C4", "vector": [4, 2, 0.8284, 0.0021, 2, 0.49, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.use_encoding and not isinstance():\n data = data.decode(self.encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L780_C12", "label": "data = decode()", "type": "assigned_variable", "loc": [780, 780], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L779_C8", "vector": [14, 3, 0.8289, 0.0011, 3, 0.25, 0.0, 929, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " data = data.decode(self.encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L784_C8", "label": "while", "type": "while", "loc": [784, 796], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L772_C4", "vector": [5, 2, 0.8395, 0.0138, 2, 0.49, 1.0, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while self._input_buffer:\n terminator = self.terminator\n if not terminator:\n handler = self._lookup_none_terminator\n elif isinstance(terminator, (int, long)):\n handler = self._lookup_int_terminator\n elif isinstance(terminator, str):\n handler = self._lookup_str_terminator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L785_C12", "label": "terminator =", "type": "assigned_variable", "loc": [785, 785], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L784_C8", "vector": [14, 3, 0.8342, 0.0011, 3, 0.43, 0.0, 920, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "terminator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " terminator = self.terminator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L786_C12", "label": "if", "type": "if", "loc": [786, 793], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L784_C8", "vector": [4, 3, 0.839, 0.0085, 3, 0.43, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not terminator:\n handler = self._lookup_none_terminator\n elif isinstance(terminator, (int, long)):\n handler = self._lookup_int_terminator\n elif isinstance(terminator, str):\n handler = self._lookup_str_terminator\n else:\n handler = self._lookup_list_terminator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L787_C16", "label": "handler =", "type": "assigned_variable", "loc": [787, 787], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L786_C12", "vector": [14, 4, 0.8363, 0.0011, 4, 0.56, 0.0, 388, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "handler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " handler = self._lookup_none_terminator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L788_C12", "label": "if", "type": "if", "loc": [788, 793], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L786_C12", "vector": [4, 4, 0.8401, 0.0064, 4, 0.56, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(terminator, (int, long)):\n handler = self._lookup_int_terminator\n elif isinstance(terminator, str):\n handler = self._lookup_str_terminator\n else:\n handler = self._lookup_list_terminator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L789_C16", "label": "handler =", "type": "assigned_variable", "loc": [789, 789], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L788_C12", "vector": [14, 5, 0.8385, 0.0011, 5, 0.96, 0.0, 388, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "handler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " handler = self._lookup_int_terminator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L790_C12", "label": "if", "type": "if", "loc": [790, 793], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L788_C12", "vector": [4, 5, 0.8411, 0.0043, 5, 0.96, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(terminator, str):\n handler = self._lookup_str_terminator\n else:\n handler = self._lookup_list_terminator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L791_C16", "label": "handler =", "type": "assigned_variable", "loc": [791, 791], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L790_C12", "vector": [14, 6, 0.8406, 0.0011, 6, 0.68, 0.0, 388, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "handler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " handler = self._lookup_str_terminator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L793_C16", "label": "handler =", "type": "assigned_variable", "loc": [793, 793], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L790_C12", "vector": [14, 6, 0.8427, 0.0011, 6, 0.68, 1.0, 388, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "handler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " handler = self._lookup_list_terminator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L794_C12", "label": "res = handler()", "type": "assigned_variable", "loc": [794, 794], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L784_C8", "vector": [14, 3, 0.8438, 0.0011, 3, 0.43, 0.6667, 413, 3, 1, 0, 0, 388, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "handler", "annotation": ""}, "snippet": " res = handler(self.terminator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L795_C12", "label": "if", "type": "if", "loc": [795, 796], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L784_C8", "vector": [4, 3, 0.8454, 0.0021, 3, 0.43, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if res is None:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L798_C4", "label": "_lookup_none_terminator", "type": "function", "loc": [798, 801], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [2, 1, 0.8496, 0.0043, 1, 0.19, 0.5, 650, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "_lookup_none_terminator", "arg_names": ["self", "terminator"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _lookup_none_terminator(self, terminator):\n self.pull(self._input_buffer)\n self._input_buffer = ''\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L799_C8", "label": "pull()", "type": "expression", "loc": [799, 799], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L798_C4", "vector": [8, 2, 0.8491, 0.0011, 2, 0.11, 0.0, 964, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pull", "arg_names": [], "import_names": [], "rhs_call_name": "pull", "annotation": ""}, "snippet": " self.pull(self._input_buffer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L800_C8", "label": "self._input_buffer =", "type": "assigned_variable", "loc": [800, 800], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L798_C4", "vector": [14, 2, 0.8502, 0.0011, 2, 0.11, 0.5, 416, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self._input_buffer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._input_buffer = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L801_C8", "label": "return", "type": "return", "loc": [801, 801], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L798_C4", "vector": [13, 2, 0.8512, 0.0011, 2, 0.11, 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_1032:FunctionDef_L803_C4", "label": "_lookup_int_terminator", "type": "function", "loc": [803, 812], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [2, 1, 0.8581, 0.0106, 1, 0.19, 0.5357, 898, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "_lookup_int_terminator", "arg_names": ["self", "terminator"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _lookup_int_terminator(self, terminator):\n if len(self._input_buffer) < terminator:\n self.pull(self._input_buffer)\n self._input_buffer = ''\n return False\n else:\n self.pull(self._input_buffer[:terminator])\n self._input_buffer = self._input_buffer[terminator:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L804_C8", "label": "if", "type": "if", "loc": [804, 812], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L803_C4", "vector": [4, 2, 0.8587, 0.0096, 2, 0.51, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(self._input_buffer) < terminator:\n self.pull(self._input_buffer)\n self._input_buffer = ''\n return False\n else:\n self.pull(self._input_buffer[:terminator])\n self._input_buffer = self._input_buffer[terminator:]\n self.found_terminator()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L805_C12", "label": "pull()", "type": "expression", "loc": [805, 805], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L804_C8", "vector": [8, 3, 0.8555, 0.0011, 3, 0.77, 0.0, 964, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pull", "arg_names": [], "import_names": [], "rhs_call_name": "pull", "annotation": ""}, "snippet": " self.pull(self._input_buffer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L806_C12", "label": "self._input_buffer =", "type": "assigned_variable", "loc": [806, 806], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L804_C8", "vector": [14, 3, 0.8565, 0.0011, 3, 0.77, 0.1667, 416, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self._input_buffer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._input_buffer = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L807_C12", "label": "return", "type": "return", "loc": [807, 807], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L804_C8", "vector": [13, 3, 0.8576, 0.0011, 3, 0.77, 0.3333, 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_1032:Expr_L809_C12", "label": "pull()", "type": "expression", "loc": [809, 809], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L804_C8", "vector": [8, 3, 0.8597, 0.0011, 3, 0.77, 0.5, 964, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pull", "arg_names": [], "import_names": [], "rhs_call_name": "pull", "annotation": ""}, "snippet": " self.pull(self._input_buffer[:terminator])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L810_C12", "label": "self._input_buffer =", "type": "assigned_variable", "loc": [810, 810], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L804_C8", "vector": [14, 3, 0.8608, 0.0011, 3, 0.77, 0.6667, 416, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._input_buffer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._input_buffer = self._input_buffer[terminator:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L811_C12", "label": "found_terminator()", "type": "expression", "loc": [811, 811], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L804_C8", "vector": [8, 3, 0.8618, 0.0011, 3, 0.77, 0.8333, 372, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "found_terminator", "arg_names": [], "import_names": [], "rhs_call_name": "found_terminator", "annotation": ""}, "snippet": " self.found_terminator()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L812_C12", "label": "return", "type": "return", "loc": [812, 812], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L804_C8", "vector": [13, 3, 0.8629, 0.0011, 3, 0.77, 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_1032:FunctionDef_L814_C4", "label": "_lookup_list_terminator", "type": "function", "loc": [814, 818], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [2, 1, 0.8672, 0.0053, 1, 0.19, 0.5714, 831, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "_lookup_list_terminator", "arg_names": ["self", "terminator"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _lookup_list_terminator(self, terminator):\n for item in terminator:\n if self._input_buffer.find(item) != -1:\n return self._lookup_str_terminator(item)\n return self._lookup_none_terminator(terminator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L815_C8", "label": "for item", "type": "for", "loc": [815, 817], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L814_C4", "vector": [6, 2, 0.8672, 0.0032, 2, 0.42, 0.0, 434, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in terminator:\n if self._input_buffer.find(item) != -1:\n return self._lookup_str_terminator(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L816_C12", "label": "if", "type": "if", "loc": [816, 817], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L815_C8", "vector": [4, 3, 0.8677, 0.0021, 3, 0.03, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._input_buffer.find(item) != -1:\n return self._lookup_str_terminator(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L817_C16", "label": "return", "type": "return", "loc": [817, 817], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L816_C12", "vector": [13, 4, 0.8682, 0.0011, 4, 0.85, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._lookup_str_terminator(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L818_C8", "label": "return", "type": "return", "loc": [818, 818], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L814_C4", "vector": [13, 2, 0.8693, 0.0011, 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._lookup_none_terminator(terminator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L820_C4", "label": "_lookup_str_terminator", "type": "function", "loc": [820, 853], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [2, 1, 0.8889, 0.0361, 1, 0.19, 0.6071, 782, 0, 2, 1, 0, 0, 0, 9], "semantic": {"name": "_lookup_str_terminator", "arg_names": ["self", "terminator"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _lookup_str_terminator(self, terminator):\n # 3 cases:\n # 1) end of buffer matches terminator exactly:\n # collect data, transition\n # 2) end of buffer matches some prefix:\n # collect data to the prefix\n # 3) end of buffer does not match any prefix:\n # collect data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L828_C8", "label": "terminator_len = len()", "type": "assigned_variable", "loc": [828, 828], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L820_C4", "vector": [14, 2, 0.8799, 0.0011, 2, 0.93, 0.0, 385, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "terminator_len", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " terminator_len = len(terminator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L829_C8", "label": "index = find()", "type": "assigned_variable", "loc": [829, 829], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L820_C4", "vector": [14, 2, 0.881, 0.0011, 2, 0.93, 0.5, 780, 3, 1, 0, 0, 340, 10, 1], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "find", "annotation": ""}, "snippet": " index = self._input_buffer.find(terminator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L830_C8", "label": "if", "type": "if", "loc": [830, 853], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L820_C4", "vector": [4, 2, 0.8943, 0.0255, 2, 0.93, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if index != -1:\n # we found the terminator\n if self.strip_terminator and index > 0:\n self.pull(self._input_buffer[:index])\n elif not self.strip_terminator:\n self.pull(self._input_buffer[:index+terminator_len])\n self._input_buffer = self._input_buffer[index+terminator_len:]\n # This does the Right Thing if the terminator is changed here."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L832_C12", "label": "if", "type": "if", "loc": [832, 835], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L830_C8", "vector": [4, 3, 0.8858, 0.0043, 3, 0.98, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.strip_terminator and index > 0:\n self.pull(self._input_buffer[:index])\n elif not self.strip_terminator:\n self.pull(self._input_buffer[:index+terminator_len])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L833_C16", "label": "pull()", "type": "expression", "loc": [833, 833], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L832_C12", "vector": [8, 4, 0.8852, 0.0011, 4, 0.12, 0.0, 964, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pull", "arg_names": [], "import_names": [], "rhs_call_name": "pull", "annotation": ""}, "snippet": " self.pull(self._input_buffer[:index])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L834_C12", "label": "if", "type": "if", "loc": [834, 835], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L832_C12", "vector": [4, 4, 0.8868, 0.0021, 4, 0.12, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not self.strip_terminator:\n self.pull(self._input_buffer[:index+terminator_len])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L835_C16", "label": "pull()", "type": "expression", "loc": [835, 835], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L834_C12", "vector": [8, 5, 0.8874, 0.0011, 5, 0.4, 0.0, 964, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pull", "arg_names": [], "import_names": [], "rhs_call_name": "pull", "annotation": ""}, "snippet": " self.pull(self._input_buffer[:index+terminator_len])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L836_C12", "label": "self._input_buffer =", "type": "assigned_variable", "loc": [836, 836], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L830_C8", "vector": [14, 3, 0.8884, 0.0011, 3, 0.98, 0.2, 416, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._input_buffer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._input_buffer = self._input_buffer[index+terminator_len:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L838_C12", "label": "found_terminator()", "type": "expression", "loc": [838, 838], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L830_C8", "vector": [8, 3, 0.8905, 0.0011, 3, 0.98, 0.4, 372, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "found_terminator", "arg_names": [], "import_names": [], "rhs_call_name": "found_terminator", "annotation": ""}, "snippet": " self.found_terminator()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L839_C12", "label": "return", "type": "return", "loc": [839, 839], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L830_C8", "vector": [13, 3, 0.8916, 0.0011, 3, 0.98, 0.6, 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_1032:Assign_L842_C12", "label": "index = find_prefix_at_end()", "type": "assigned_variable", "loc": [842, 842], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L830_C8", "vector": [14, 3, 0.8948, 0.0011, 3, 0.98, 0.8, 780, 3, 2, 0, 0, 898, 10, 1], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "find_prefix_at_end", "annotation": ""}, "snippet": " index = find_prefix_at_end(self._input_buffer, terminator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L843_C12", "label": "if", "type": "if", "loc": [843, 853], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L830_C8", "vector": [4, 3, 0.9012, 0.0117, 3, 0.98, 1.0, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if index:\n if index != len(self._input_buffer):\n # we found a prefix, collect up to the prefix\n self.pull(self._input_buffer[:-index])\n self._input_buffer = self._input_buffer[-index:]\n return None\n else:\n # no prefix, collect it all"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L844_C16", "label": "if", "type": "if", "loc": [844, 847], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L843_C12", "vector": [4, 4, 0.8985, 0.0043, 4, 0.2, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if index != len(self._input_buffer):\n # we found a prefix, collect up to the prefix\n self.pull(self._input_buffer[:-index])\n self._input_buffer = self._input_buffer[-index:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L846_C20", "label": "pull()", "type": "expression", "loc": [846, 846], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L844_C16", "vector": [8, 5, 0.899, 0.0011, 5, 0.13, 0.0, 964, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pull", "arg_names": [], "import_names": [], "rhs_call_name": "pull", "annotation": ""}, "snippet": " self.pull(self._input_buffer[:-index])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L847_C20", "label": "self._input_buffer =", "type": "assigned_variable", "loc": [847, 847], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L844_C16", "vector": [14, 5, 0.9001, 0.0011, 5, 0.13, 1.0, 416, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._input_buffer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._input_buffer = self._input_buffer[-index:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L848_C16", "label": "return", "type": "return", "loc": [848, 848], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L843_C12", "vector": [13, 4, 0.9012, 0.0011, 4, 0.2, 0.25, 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_1032:Expr_L851_C16", "label": "pull()", "type": "expression", "loc": [851, 851], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L843_C12", "vector": [8, 4, 0.9044, 0.0011, 4, 0.2, 0.5, 964, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pull", "arg_names": [], "import_names": [], "rhs_call_name": "pull", "annotation": ""}, "snippet": " self.pull(self._input_buffer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L852_C16", "label": "self._input_buffer =", "type": "assigned_variable", "loc": [852, 852], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L843_C12", "vector": [14, 4, 0.9054, 0.0011, 4, 0.2, 0.75, 416, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self._input_buffer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._input_buffer = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L853_C16", "label": "return", "type": "return", "loc": [853, 853], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L843_C12", "vector": [13, 4, 0.9065, 0.0011, 4, 0.2, 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_1032:FunctionDef_L855_C4", "label": "handle_write", "type": "function", "loc": [855, 856], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [2, 1, 0.9091, 0.0021, 1, 0.19, 0.6429, 707, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "handle_write", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_write(self):\n self.flush()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L856_C8", "label": "flush()", "type": "expression", "loc": [856, 856], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L855_C4", "vector": [8, 2, 0.9097, 0.0011, 2, 0.65, 0.0, 439, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "flush", "arg_names": [], "import_names": [], "rhs_call_name": "flush", "annotation": ""}, "snippet": " self.flush()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L858_C4", "label": "push", "type": "function", "loc": [858, 870], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [2, 1, 0.9182, 0.0138, 1, 0.19, 0.6786, 176, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "push", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def push(self, data):\n \"\"\"\n Pushes data on to the channel's fifo to ensure its transmission.\n This is all you need to do to have the channel write the data out to\n the network.\n \"\"\"\n sabs = self.send_buffer_size\n if len(data) > sabs:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L859_C8", "label": "expression", "type": "expression", "loc": [859, 863], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L858_C4", "vector": [8, 2, 0.915, 0.0053, 2, 0.11, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Pushes data on to the channel's fifo to ensure its transmission.\n This is all you need to do to have the channel write the data out to\n the network.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L864_C8", "label": "sabs =", "type": "assigned_variable", "loc": [864, 864], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L858_C4", "vector": [14, 2, 0.9182, 0.0011, 2, 0.11, 0.3333, 687, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sabs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sabs = self.send_buffer_size"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L865_C8", "label": "if", "type": "if", "loc": [865, 869], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L858_C4", "vector": [4, 2, 0.9214, 0.0053, 2, 0.11, 0.6667, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(data) > sabs:\n for i in range(0, len(data), sabs):\n self.outbox.append(data[i:i+sabs])\n else:\n self.outbox.append(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L866_C12", "label": "for i", "type": "for", "loc": [866, 867], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L865_C8", "vector": [6, 3, 0.9208, 0.0021, 3, 0.81, 0.0, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(0, len(data), sabs):\n self.outbox.append(data[i:i+sabs])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L867_C16", "label": "append()", "type": "expression", "loc": [867, 867], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L866_C12", "vector": [8, 4, 0.9214, 0.0011, 4, 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": " self.outbox.append(data[i:i+sabs])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L869_C12", "label": "append()", "type": "expression", "loc": [869, 869], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L865_C8", "vector": [8, 3, 0.9235, 0.0011, 3, 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": " self.outbox.append(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L870_C8", "label": "return", "type": "return", "loc": [870, 870], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L858_C4", "vector": [13, 2, 0.9245, 0.0011, 2, 0.11, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.flush()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L872_C4", "label": "push_with_producer", "type": "function", "loc": [872, 874], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [2, 1, 0.9277, 0.0032, 1, 0.19, 0.7143, 961, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "push_with_producer", "arg_names": ["self", "producer"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def push_with_producer(self, producer):\n self.outbox.append(producer)\n return self.flush()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L873_C8", "label": "append()", "type": "expression", "loc": [873, 873], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L872_C4", "vector": [8, 2, 0.9277, 0.0011, 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": " self.outbox.append(producer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L874_C8", "label": "return", "type": "return", "loc": [874, 874], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L872_C4", "vector": [13, 2, 0.9288, 0.0011, 2, 0.51, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.flush()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L876_C4", "label": "readable", "type": "function", "loc": [876, 878], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [2, 1, 0.932, 0.0032, 1, 0.19, 0.75, 808, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "readable", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def readable(self):\n \"\"\"Predicate for inclusion in the readable for select()\"\"\"\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L877_C8", "label": "expression", "type": "expression", "loc": [877, 877], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L876_C4", "vector": [8, 2, 0.932, 0.0011, 2, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Predicate for inclusion in the readable for select()\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L878_C8", "label": "return", "type": "return", "loc": [878, 878], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L876_C4", "vector": [13, 2, 0.933, 0.0011, 2, 0.86, 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_1032:FunctionDef_L880_C4", "label": "writable", "type": "function", "loc": [880, 885], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [2, 1, 0.9378, 0.0064, 1, 0.19, 0.7857, 58, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "writable", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def writable(self):\n \"\"\"Predicate for inclusion in the writable for select()\"\"\"\n # For nonblocking sockets connect() will not set self.connected flag,\n # due to EINPROGRESS socket error which is actually promise for\n # successful connection.\n return bool(self.outbox or not self.connected)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L881_C8", "label": "expression", "type": "expression", "loc": [881, 881], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L880_C4", "vector": [8, 2, 0.9362, 0.0011, 2, 0.6, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Predicate for inclusion in the writable for select()\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L885_C8", "label": "return", "type": "return", "loc": [885, 885], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L880_C4", "vector": [13, 2, 0.9405, 0.0011, 2, 0.6, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bool(self.outbox or not self.connected)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L887_C4", "label": "close_when_done", "type": "function", "loc": [887, 889], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [2, 1, 0.9437, 0.0032, 1, 0.19, 0.8214, 565, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "close_when_done", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def close_when_done(self):\n \"\"\"Automatically close this channel once the outgoing queue is empty.\"\"\"\n self.outbox.append(None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L888_C8", "label": "expression", "type": "expression", "loc": [888, 888], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L887_C4", "vector": [8, 2, 0.9437, 0.0011, 2, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Automatically close this channel once the outgoing queue is empty.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L889_C8", "label": "append()", "type": "expression", "loc": [889, 889], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L887_C4", "vector": [8, 2, 0.9447, 0.0011, 2, 0.95, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.outbox.append(None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L891_C4", "label": "flush", "type": "function", "loc": [891, 894], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [2, 1, 0.9485, 0.0043, 1, 0.19, 0.8571, 439, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "flush", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def flush(self):\n \"\"\"Sends all data from outgoing queue.\"\"\"\n while self.outbox and self.connected:\n self._send_chunky(self.outbox.popleft())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L892_C8", "label": "expression", "type": "expression", "loc": [892, 892], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L891_C4", "vector": [8, 2, 0.9479, 0.0011, 2, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Sends all data from outgoing queue.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L893_C8", "label": "while", "type": "while", "loc": [893, 894], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L891_C4", "vector": [5, 2, 0.9495, 0.0021, 2, 0.31, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while self.outbox and self.connected:\n self._send_chunky(self.outbox.popleft())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L894_C12", "label": "_send_chunky()", "type": "expression", "loc": [894, 894], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L893_C8", "vector": [8, 3, 0.9501, 0.0011, 3, 0.07, 0.0, 308, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "_send_chunky", "arg_names": [], "import_names": [], "rhs_call_name": "_send_chunky", "annotation": ""}, "snippet": " self._send_chunky(self.outbox.popleft())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L896_C4", "label": "_send_chunky", "type": "function", "loc": [896, 921], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [2, 1, 0.9655, 0.0276, 1, 0.19, 0.8929, 308, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "_send_chunky", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _send_chunky(self, data):\n \"\"\"Sends data as chunks sized by ``send_buffer_size`` value.\n\n Returns ``True`` on success, ``False`` on error and ``None`` on closing\n event.\n \"\"\"\n if self.use_encoding and not isinstance(data, bytes):\n data = data.encode(self.encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L897_C8", "label": "expression", "type": "expression", "loc": [897, 901], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L896_C4", "vector": [8, 2, 0.9554, 0.0053, 2, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Sends data as chunks sized by ``send_buffer_size`` value.\n\n Returns ``True`` on success, ``False`` on error and ``None`` on closing\n event.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L902_C8", "label": "if", "type": "if", "loc": [902, 903], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L896_C4", "vector": [4, 2, 0.9591, 0.0021, 2, 0.81, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.use_encoding and not isinstance(data, bytes):\n data = data.encode(self.encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L903_C12", "label": "data = encode()", "type": "assigned_variable", "loc": [903, 903], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L902_C8", "vector": [14, 3, 0.9596, 0.0011, 3, 0.65, 0.0, 929, 3, 1, 0, 0, 623, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": " data = data.encode(self.encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L904_C8", "label": "while", "type": "while", "loc": [904, 921], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L896_C4", "vector": [5, 2, 0.9697, 0.0191, 2, 0.81, 1.0, 0, 1, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n if data is None:\n self.handle_close()\n return\n\n obs = self.send_buffer_size\n bdata = buffer(data, 0, obs)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L905_C12", "label": "if", "type": "if", "loc": [905, 907], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L904_C8", "vector": [4, 3, 0.9628, 0.0032, 3, 0.22, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if data is None:\n self.handle_close()\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L906_C16", "label": "handle_close()", "type": "expression", "loc": [906, 906], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L905_C12", "vector": [8, 4, 0.9628, 0.0011, 4, 0.58, 0.0, 320, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_close", "arg_names": [], "import_names": [], "rhs_call_name": "handle_close", "annotation": ""}, "snippet": " self.handle_close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L907_C16", "label": "return", "type": "return", "loc": [907, 907], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L905_C12", "vector": [13, 4, 0.9639, 0.0011, 4, 0.58, 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_1032:Assign_L909_C12", "label": "obs =", "type": "assigned_variable", "loc": [909, 909], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L904_C8", "vector": [14, 3, 0.966, 0.0011, 3, 0.22, 0.25, 347, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obs = self.send_buffer_size"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L910_C12", "label": "bdata = buffer()", "type": "assigned_variable", "loc": [910, 910], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L904_C8", "vector": [14, 3, 0.9671, 0.0011, 3, 0.22, 0.5, 703, 3, 3, 0, 0, 640, 10, 1], "semantic": {"name": "bdata", "arg_names": [], "import_names": [], "rhs_call_name": "buffer", "annotation": ""}, "snippet": " bdata = buffer(data, 0, obs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L912_C12", "label": "try", "type": "try", "loc": [912, 916], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L904_C8", "vector": [7, 3, 0.9713, 0.0053, 3, 0.22, 0.75, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n num_sent = self.send(bdata)\n except socket.error:\n self.handle_error()\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L913_C16", "label": "num_sent = send()", "type": "assigned_variable", "loc": [913, 913], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L912_C12", "vector": [14, 4, 0.9702, 0.0011, 4, 0.46, 0.0, 923, 3, 1, 0, 0, 826, 10, 1], "semantic": {"name": "num_sent", "arg_names": [], "import_names": [], "rhs_call_name": "send", "annotation": ""}, "snippet": " num_sent = self.send(bdata)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L915_C16", "label": "handle_error()", "type": "expression", "loc": [915, 915], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L912_C12", "vector": [8, 4, 0.9724, 0.0011, 4, 0.46, 0.0, 899, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handle_error", "arg_names": [], "import_names": [], "rhs_call_name": "handle_error", "annotation": ""}, "snippet": " self.handle_error()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L916_C16", "label": "return", "type": "return", "loc": [916, 916], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L912_C12", "vector": [13, 4, 0.9734, 0.0011, 4, 0.46, 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_1032:If_L918_C12", "label": "if", "type": "if", "loc": [918, 921], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L904_C8", "vector": [4, 3, 0.9772, 0.0043, 3, 0.22, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if num_sent and num_sent < len(bdata) or obs < len(data):\n data = data[num_sent:]\n else:\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L919_C16", "label": "data =", "type": "assigned_variable", "loc": [919, 919], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L918_C12", "vector": [14, 4, 0.9766, 0.0011, 4, 0.31, 0.0, 929, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = data[num_sent:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L921_C16", "label": "return", "type": "return", "loc": [921, 921], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L918_C12", "vector": [13, 4, 0.9787, 0.0011, 4, 0.31, 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_1032:FunctionDef_L923_C4", "label": "discard_buffers", "type": "function", "loc": [923, 927], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [2, 1, 0.983, 0.0053, 1, 0.19, 0.9286, 626, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "discard_buffers", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def discard_buffers(self):\n \"\"\"In emergencies this method will discard any data held in the input\n and output buffers.\"\"\"\n self.discard_input_buffers()\n self.discard_output_buffers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L924_C8", "label": "expression", "type": "expression", "loc": [924, 925], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L923_C4", "vector": [8, 2, 0.9825, 0.0021, 2, 0.69, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"In emergencies this method will discard any data held in the input\n and output buffers.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L926_C8", "label": "discard_input_buffers()", "type": "expression", "loc": [926, 926], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L923_C4", "vector": [8, 2, 0.9841, 0.0011, 2, 0.69, 0.5, 629, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "discard_input_buffers", "arg_names": [], "import_names": [], "rhs_call_name": "discard_input_buffers", "annotation": ""}, "snippet": " self.discard_input_buffers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L927_C8", "label": "discard_output_buffers()", "type": "expression", "loc": [927, 927], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L923_C4", "vector": [8, 2, 0.9851, 0.0011, 2, 0.69, 1.0, 156, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "discard_output_buffers", "arg_names": [], "import_names": [], "rhs_call_name": "discard_output_buffers", "annotation": ""}, "snippet": " self.discard_output_buffers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L929_C4", "label": "discard_input_buffers", "type": "function", "loc": [929, 931], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [2, 1, 0.9883, 0.0032, 1, 0.19, 0.9643, 629, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "discard_input_buffers", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def discard_input_buffers(self):\n self._input_buffer = b('')\n self.inbox.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L930_C8", "label": "self._input_buffer = b()", "type": "assigned_variable", "loc": [930, 930], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L929_C4", "vector": [14, 2, 0.9883, 0.0011, 2, 0.34, 0.0, 416, 3, 1, 0, 0, 756, 10, 1], "semantic": {"name": "self._input_buffer", "arg_names": [], "import_names": [], "rhs_call_name": "b", "annotation": ""}, "snippet": " self._input_buffer = b('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L931_C8", "label": "clear()", "type": "expression", "loc": [931, 931], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L929_C4", "vector": [8, 2, 0.9894, 0.0011, 2, 0.34, 1.0, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " self.inbox.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L933_C4", "label": "discard_output_buffers", "type": "function", "loc": [933, 934], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "vector": [2, 1, 0.992, 0.0021, 1, 0.19, 1.0, 156, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "discard_output_buffers", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def discard_output_buffers(self):\n self.outbox.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L934_C8", "label": "clear()", "type": "expression", "loc": [934, 934], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L933_C4", "vector": [8, 2, 0.9926, 0.0011, 2, 0.98, 0.0, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " self.outbox.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L937_C0", "label": "find_prefix_at_end", "type": "function", "loc": [937, 941], "level": 0, "parent": null, "vector": [2, 0, 0.9979, 0.0053, 0, 0.66, 1.0, 898, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "find_prefix_at_end", "arg_names": ["haystack", "needle"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def find_prefix_at_end(haystack, needle):\n l = len(needle) - 1\n while l and not haystack.endswith(needle[:l]):\n l -= 1\n return l"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L938_C4", "label": "l =", "type": "assigned_variable", "loc": [938, 938], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L937_C0", "vector": [14, 1, 0.9968, 0.0011, 1, 0.19, 0.0, 810, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "l", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " l = len(needle) - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L939_C4", "label": "while", "type": "while", "loc": [939, 940], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L937_C0", "vector": [5, 1, 0.9984, 0.0021, 1, 0.19, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while l and not haystack.endswith(needle[:l]):\n l -= 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L941_C4", "label": "return", "type": "return", "loc": [941, 941], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L937_C0", "vector": [13, 1, 1.0, 0.0011, 1, 0.19, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return l"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L93_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L94_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L95_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L96_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L97_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L98_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L99_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L100_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L102_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L103_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L102_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L105_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L112_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L112_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L116_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L116_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L117_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L118_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L117_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L119_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L117_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L120_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L120_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L121_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L117_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L123_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L123_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L124_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L117_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L125_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L125_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L126_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L127_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L128_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L127_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L129_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L131_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L132_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L131_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L134_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L134_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L137_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L139_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L140_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L139_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L141_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L139_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L143_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L145_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L146_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L145_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L147_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L145_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L149_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L151_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L152_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L151_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L151_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L155_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L158_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L159_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L158_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L158_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L164_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L165_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L164_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L166_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L168_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L169_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L168_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L171_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L171_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L172_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L193_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L193_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L196_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L175_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L199_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L199_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L200_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L200_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L201_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L199_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L202_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L202_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L203_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L206_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L206_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L207_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L207_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L208_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L206_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L209_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L209_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L210_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L214_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L215_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L214_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L222_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L223_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L234_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L235_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L236_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L237_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L238_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L241_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L242_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L243_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L214_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L245_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L246_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L214_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L248_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L248_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L248_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L214_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L253_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L254_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L256_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L257_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L214_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L259_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L259_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L260_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L259_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L264_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L259_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L265_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L259_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L266_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L267_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L268_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L271_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L272_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L214_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L274_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L274_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L275_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L274_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L274_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L279_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L279_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L280_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L279_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L281_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L281_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L282_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L281_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L283_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L283_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L284_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L283_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L286_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L283_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L287_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L291_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L325_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L326_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L327_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L329_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L329_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L330_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L330_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L331_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L330_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L333_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L329_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L335_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L329_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L336_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L339_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L340_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L341_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L344_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L344_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L345_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L344_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L347_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L347_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L350_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L347_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L355_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L358_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L360_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L360_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L361_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L360_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L362_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L362_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L363_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L362_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L364_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L364_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L365_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L360_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L366_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L366_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L367_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L367_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L368_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L367_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L370_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L360_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L371_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L373_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L375_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L375_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L376_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L375_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L377_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L377_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L378_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L375_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L379_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L381_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L381_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L382_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L381_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L383_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L383_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L384_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L381_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L385_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L385_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L386_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L381_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L388_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L390_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L390_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L391_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L390_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L396_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L390_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L397_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L390_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L398_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L390_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L399_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L401_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L401_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L402_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L401_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L403_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L401_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L404_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L406_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L406_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L407_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L407_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L408_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L416_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L416_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L417_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L416_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L422_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L424_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L424_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L425_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L424_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L431_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L433_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L433_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L434_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L433_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L439_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L433_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L440_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L440_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L441_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L433_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L442_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L444_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L444_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L445_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L444_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L453_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L444_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L454_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L456_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L456_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L457_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L456_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L461_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L456_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L462_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L456_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L463_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L456_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L464_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L464_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L466_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L456_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L467_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L467_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L468_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L472_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L472_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L473_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L472_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L485_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L485_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L486_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L485_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L488_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L485_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L490_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L490_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L491_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L485_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L495_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L497_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L497_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L498_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L497_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L499_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L499_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L500_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L499_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L501_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L499_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L502_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L499_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L504_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L504_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L505_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L504_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L506_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L506_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L507_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L506_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L508_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L512_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L512_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L513_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L512_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L518_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L518_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L519_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L518_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L520_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L518_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L521_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L521_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L524_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L521_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L525_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L521_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L527_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L518_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L530_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L530_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L531_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L530_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L532_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L536_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L536_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L537_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L536_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L544_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L536_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L545_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L536_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L546_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L536_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L547_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L547_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L548_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L547_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L550_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L553_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L553_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L554_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L554_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L557_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L554_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L558_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L558_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L559_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L558_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L560_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L558_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L562_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L564_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L564_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L565_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L564_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L566_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L564_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L568_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L564_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L569_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L571_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L572_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L572_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L575_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L577_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L577_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L579_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L577_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L580_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L577_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L583_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L584_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L586_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L586_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L590_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L586_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L591_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L591_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L597_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L591_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L599_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L601_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L601_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L602_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L601_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L606_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L606_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L607_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L606_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L609_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L601_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L611_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L601_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L614_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L616_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L616_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L617_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L619_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L619_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L620_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L622_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L622_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L623_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L622_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L632_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L634_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L634_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L635_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L634_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L640_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L642_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L642_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L643_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L642_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L648_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L290_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L650_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L650_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L651_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L650_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L652_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L650_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L653_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L656_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L657_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L657_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L658_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L656_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L659_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L659_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L660_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L656_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L661_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L661_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L662_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L662_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L663_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L662_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L665_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L665_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L667_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L662_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L672_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L656_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L674_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L656_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L676_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L676_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L677_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L677_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L678_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L677_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L682_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L688_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L705_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L707_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L711_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L713_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L716_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L718_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L720_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L720_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L722_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L720_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L723_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L720_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L724_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L720_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L725_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L720_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L726_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L720_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L727_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L729_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L729_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L730_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L729_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L733_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L735_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L735_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L736_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L744_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L744_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L745_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L747_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L747_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L748_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L770_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L772_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L772_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L773_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L773_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L774_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L773_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L776_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L773_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L777_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L772_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L779_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L779_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L780_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L772_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L784_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L784_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L785_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L784_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L786_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L786_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L787_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L786_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L788_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L788_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L789_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L788_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L790_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L790_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L791_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L790_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L793_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L784_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L794_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L784_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L795_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L798_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L798_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L799_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L798_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L800_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L798_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L801_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L803_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L803_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L804_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L804_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L805_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L804_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L806_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L804_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L807_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L804_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L809_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L804_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L810_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L804_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L811_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L804_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L812_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L814_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L814_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L815_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L815_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L816_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L816_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L817_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L814_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L818_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L820_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L820_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L828_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L820_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L829_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L820_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L830_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L830_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L832_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L832_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L833_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L832_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L834_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L834_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L835_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L830_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L836_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L830_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L838_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L830_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L839_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L830_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L842_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L830_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L843_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L843_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L844_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L844_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L846_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L844_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L847_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L843_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L848_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L843_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L851_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L843_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L852_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L843_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L853_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L855_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L855_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L856_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L858_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L858_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L859_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L858_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L864_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L858_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L865_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L865_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L866_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:For_L866_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L867_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L865_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L869_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L858_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L870_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L872_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L872_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L873_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L872_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L874_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L876_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L876_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L877_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L876_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L878_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L880_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L880_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L881_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L880_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L885_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L887_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L887_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L888_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L887_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L889_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L891_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L891_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L892_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L891_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L893_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L893_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L894_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L896_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L896_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L897_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L896_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L902_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L902_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L903_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L896_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L904_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L904_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L905_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L905_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L906_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L905_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L907_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L904_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L909_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L904_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L910_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L904_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L912_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L912_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L913_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L912_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L915_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:Try_L912_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L916_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L904_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L918_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L918_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L919_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:If_L918_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L921_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L923_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L923_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L924_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L923_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L926_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L923_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L927_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L929_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L929_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L930_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L929_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L931_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:ClassDef_L687_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L933_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L933_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Expr_L934_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L937_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Assign_L938_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L937_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:While_L939_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1032:FunctionDef_L937_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1032:Return_L941_C4"}]
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # from collections import Iterable from .compat import unicode from .constants import ( STX, ETX, ETB, CR, LF, CRLF, FIELD_SEP, COMPONENT_SEP, RECORD_SEP, REPEAT_SEP, ENCODING ) try: from itertools import izip_longest except ImportError: # Python 3 from itertools import zip_longest as izip_longest def decode(data, encoding=ENCODING): """Common ASTM decoding function that tries to guess which kind of data it handles. If `data` starts with STX character (``0x02``) than probably it is full ASTM message with checksum and other system characters. If `data` starts with digit character (``0-9``) than probably it is frame of records leading by his sequence number. No checksum is expected in this case. Otherwise it counts `data` as regular record structure. Note, that `data` should be bytes, not unicode string even if you know his `encoding`. :param data: ASTM data object. :type data: bytes :param encoding: Data encoding. :type encoding: str :return: List of ASTM records with unicode data. :rtype: list """ if not isinstance(data, bytes): raise TypeError('bytes expected, got %r' % data) if data.startswith(STX): # may be decode message \x02...\x03CS\r\n seq, records, cs = decode_message(data, encoding) return records byte = data[:1].decode() if byte.isdigit(): seq, records = decode_frame(data, encoding) return records return [decode_record(data, encoding)] def decode_message(message, encoding): """Decodes complete ASTM message that is sent or received due communication routines. It should contains checksum that would be additionally verified. :param message: ASTM message. :type message: bytes :param encoding: Data encoding. :type encoding: str :returns: Tuple of three elements: * :class:`int` frame sequence number. * :class:`list` of records with unicode data. * :class:`bytes` checksum. :raises: * :exc:`ValueError` if ASTM message is malformed. * :exc:`AssertionError` if checksum verification fails. """ if not isinstance(message, bytes): raise TypeError('bytes expected, got %r' % message) if not (message.startswith(STX) and message.endswith(CRLF)): raise ValueError('Malformed ASTM message. Expected that it will started' ' with %x and followed by %x%x characters. Got: %r' ' ' % (ord(STX), ord(CR), ord(LF), message)) stx, frame_cs = message[0], message[1:-2] frame, cs = frame_cs[:-2], frame_cs[-2:] ccs = make_checksum(frame) assert cs == ccs, 'Checksum failure: expected %r, calculated %r' % (cs, ccs) seq, records = decode_frame(frame, encoding) return seq, records, cs.decode() def decode_frame(frame, encoding): """Decodes ASTM frame: list of records followed by sequence number.""" if not isinstance(frame, bytes): raise TypeError('bytes expected, got %r' % frame) if frame.endswith(CR + ETX): frame = frame[:-2] elif frame.endswith(ETB): frame = frame[:-1] else: raise ValueError('Incomplete frame data %r.' ' Expected trailing <CR><ETX> or <ETB> chars' % frame) seq = frame[:1].decode() if not seq.isdigit(): raise ValueError('Malformed ASTM frame. Expected leading seq number %r' '' % frame) seq, records = int(seq), frame[1:] return seq, [decode_record(record, encoding) for record in records.split(RECORD_SEP)] def decode_record(record, encoding): """Decodes ASTM record message.""" fields = [] for item in record.split(FIELD_SEP): if REPEAT_SEP in item: item = decode_repeated_component(item, encoding) elif COMPONENT_SEP in item: item = decode_component(item, encoding) else: item = item.decode(encoding) fields.append([None, item][bool(item)]) return fields def decode_component(field, encoding): """Decodes ASTM field component.""" return [[None, item.decode(encoding)][bool(item)] for item in field.split(COMPONENT_SEP)] def decode_repeated_component(component, encoding): """Decodes ASTM field repeated component.""" return [decode_component(item, encoding) for item in component.split(REPEAT_SEP)] def encode(records, encoding=ENCODING, size=None, seq=1): """Encodes list of records into single ASTM message, also called as "packed" message. If you need to get each record as standalone message use :func:`iter_encode` instead. If the result message is too large (greater than specified `size` if it's not :const:`None`), than it will be split by chunks. :param records: List of ASTM records. :type records: list :param encoding: Data encoding. :type encoding: str :param size: Chunk size in bytes. :type size: int :param seq: Frame start sequence number. :type seq: int :return: List of ASTM message chunks. :rtype: list """ msg = encode_message(seq, records, encoding) if size is not None and len(msg) > size: return list(split(msg, size)) return [msg] def iter_encode(records, encoding=ENCODING, size=None, seq=1): """Encodes and emits each record as separate message. If the result message is too large (greater than specified `size` if it's not :const:`None`), than it will be split by chunks. :yields: ASTM message chunks. :rtype: str """ for record in records: msg = encode_message(seq, [record], encoding) if size is not None and len(msg) > size: for chunk in split(msg, size): seq += 1 yield chunk else: seq += 1 yield msg def encode_message(seq, records, encoding): """Encodes ASTM message. :param seq: Frame sequence number. :type seq: int :param records: List of ASTM records. :type records: list :param encoding: Data encoding. :type encoding: str :return: ASTM complete message with checksum and other control characters. :rtype: str """ data = RECORD_SEP.join(encode_record(record, encoding) for record in records) data = b''.join((str(seq % 8).encode(), data, CR, ETX)) return b''.join([STX, data, make_checksum(data), CR, LF]) def encode_record(record, encoding): """Encodes single ASTM record. :param record: ASTM record. Each :class:`str`-typed item counted as field value, one level nested :class:`list` counted as components and second leveled - as repeated components. :type record: list :param encoding: Data encoding. :type encoding: str :returns: Encoded ASTM record. :rtype: str """ fields = [] _append = fields.append for field in record: if isinstance(field, bytes): _append(field) elif isinstance(field, unicode): _append(field.encode(encoding)) elif isinstance(field, Iterable): _append(encode_component(field, encoding)) elif field is None: _append(b'') else: _append(unicode(field).encode(encoding)) return FIELD_SEP.join(fields) def encode_component(component, encoding): """Encodes ASTM record field components.""" items = [] _append = items.append for item in component: if isinstance(item, bytes): _append(item) elif isinstance(item, unicode): _append(item.encode(encoding)) elif isinstance(item, Iterable): return encode_repeated_component(component, encoding) elif item is None: _append(b'') else: _append(unicode(item).encode(encoding)) return COMPONENT_SEP.join(items).rstrip(COMPONENT_SEP) def encode_repeated_component(components, encoding): """Encodes repeated components.""" return REPEAT_SEP.join(encode_component(item, encoding) for item in components) def make_checksum(message): """Calculates checksum for specified message. :param message: ASTM message. :type message: bytes :returns: Checksum value that is actually byte sized integer in hex base :rtype: bytes """ if not isinstance(message[0], int): message = map(ord, message) return hex(sum(message) & 0xFF)[2:].upper().zfill(2).encode() def make_chunks(s, n): iter_bytes = (s[i:i + 1] for i in range(len(s))) return [b''.join(item) for item in izip_longest(*[iter_bytes] * n, fillvalue=b'')] def split(msg, size): """Split `msg` into chunks with specified `size`. Chunk `size` value couldn't be less then 7 since each chunk goes with at least 7 special characters: STX, frame number, ETX or ETB, checksum and message terminator. :param msg: ASTM message. :type msg: bytes :param size: Chunk size in bytes. :type size: int :yield: `bytes` """ stx, frame, msg, tail = msg[:1], msg[1:2], msg[2:-6], msg[-6:] assert stx == STX assert frame.isdigit() assert tail.endswith(CRLF) assert size is not None and size >= 7 frame = int(frame) chunks = make_chunks(msg, size - 7) chunks, last = chunks[:-1], chunks[-1] idx = 0 for idx, chunk in enumerate(chunks): item = b''.join([str((idx + frame) % 8).encode(), chunk, ETB]) yield b''.join([STX, item, make_checksum(item), CRLF]) item = b''.join([str((idx + frame + 1) % 8).encode(), last, CR, ETX]) yield b''.join([STX, item, make_checksum(item), CRLF]) def join(chunks): """Merges ASTM message `chunks` into single message. :param chunks: List of chunks as `bytes`. :type chunks: iterable """ msg = b'1' + b''.join(c[2:-5] for c in chunks) + ETX return b''.join([STX, msg, make_checksum(msg), CRLF]) def is_chunked_message(message): """Checks plain message for chunked byte.""" length = len(message) if len(message) < 5: return False if ETB not in message: return False return message.index(ETB) == length - 5
ajibawa-2023/Python-Code-Large/train/row_1033
138
335
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1033:ImportFrom_L10_C0", "label": "from collections import Iterable", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0299, 0.003, 0, 0.66, 0.0, 193, 0, 1, 0, 0, 193, 0, 0], "semantic": {"name": "collections", "arg_names": [], "import_names": ["Iterable"], "rhs_call_name": "", "annotation": ""}, "snippet": "from collections import Iterable"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:ImportFrom_L11_C0", "label": "from compat import unicode", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0328, 0.003, 0, 0.66, 0.05, 238, 0, 1, 0, 0, 238, 0, 0], "semantic": {"name": "compat", "arg_names": [], "import_names": ["unicode"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .compat import unicode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:ImportFrom_L12_C0", "label": "from constants import STX, ETX, ETB\u2026", "type": "import", "loc": [12, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0403, 0.0119, 0, 0.66, 0.1, 208, 0, 11, 0, 0, 208, 0, 0], "semantic": {"name": "constants", "arg_names": [], "import_names": ["STX", "ETX", "ETB", "CR", "LF", "CRLF", "FIELD_SEP", "COMPONENT_SEP", "RECORD_SEP", "REPEAT_SEP", "ENCODING"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .constants import (\n STX, ETX, ETB, CR, LF, CRLF,\n FIELD_SEP, COMPONENT_SEP, RECORD_SEP, REPEAT_SEP, ENCODING\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Try_L16_C0", "label": "try", "type": "try", "loc": [16, 19], "level": 0, "parent": null, "vector": [7, 0, 0.0522, 0.0119, 0, 0.66, 0.15, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from itertools import izip_longest\nexcept ImportError: # Python 3\n from itertools import zip_longest as izip_longest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:ImportFrom_L17_C4", "label": "from itertools import izip_longest", "type": "import", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:Try_L16_C0", "vector": [1, 1, 0.0507, 0.003, 1, 0.64, 0.0, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "itertools", "arg_names": [], "import_names": ["izip_longest"], "rhs_call_name": "", "annotation": ""}, "snippet": " from itertools import izip_longest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:ImportFrom_L19_C4", "label": "from itertools import izip_longest", "type": "import", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:Try_L16_C0", "vector": [1, 1, 0.0567, 0.003, 1, 0.64, 0.0, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "itertools", "arg_names": [], "import_names": ["izip_longest"], "rhs_call_name": "", "annotation": ""}, "snippet": " from itertools import zip_longest as izip_longest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L22_C0", "label": "decode", "type": "function", "loc": [22, 56], "level": 0, "parent": null, "vector": [2, 0, 0.1164, 0.1045, 0, 0.66, 0.2, 528, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "decode", "arg_names": ["data", "encoding"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def decode(data, encoding=ENCODING):\n \"\"\"Common ASTM decoding function that tries to guess which kind of data it\n handles.\n\n If `data` starts with STX character (``0x02``) than probably it is\n full ASTM message with checksum and other system characters.\n\n If `data` starts with digit character (``0-9``) than probably it is"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L23_C4", "label": "expression", "type": "expression", "loc": [23, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L22_C0", "vector": [8, 1, 0.103, 0.0716, 1, 0.48, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Common ASTM decoding function that tries to guess which kind of data it\n handles.\n\n If `data` starts with STX character (``0x02``) than probably it is\n full ASTM message with checksum and other system characters.\n\n If `data` starts with digit character (``0-9``) than probably it is\n frame of records leading by his sequence number. No checksum is expected"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L47_C4", "label": "if", "type": "if", "loc": [47, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L22_C0", "vector": [4, 1, 0.1418, 0.006, 1, 0.48, 0.2, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(data, bytes):\n raise TypeError('bytes expected, got %r' % data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L49_C4", "label": "if", "type": "if", "loc": [49, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L22_C0", "vector": [4, 1, 0.1493, 0.009, 1, 0.48, 0.4, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if data.startswith(STX): # may be decode message \\x02...\\x03CS\\r\\n\n seq, records, cs = decode_message(data, encoding)\n return records"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L50_C8", "label": "seq, records, cs = decode_message()", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L49_C4", "vector": [14, 2, 0.1493, 0.003, 2, 0.29, 0.0, 433, 3, 2, 0, 0, 880, 10, 1], "semantic": {"name": "seq, records, cs", "arg_names": [], "import_names": [], "rhs_call_name": "decode_message", "annotation": ""}, "snippet": " seq, records, cs = decode_message(data, encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L51_C8", "label": "return", "type": "return", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L49_C4", "vector": [13, 2, 0.1522, 0.003, 2, 0.29, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return records"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L52_C4", "label": "byte = decode()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L22_C0", "vector": [14, 1, 0.1552, 0.003, 1, 0.48, 0.6, 314, 3, 0, 0, 0, 528, 10, 1], "semantic": {"name": "byte", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " byte = data[:1].decode()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L53_C4", "label": "if", "type": "if", "loc": [53, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L22_C0", "vector": [4, 1, 0.1612, 0.009, 1, 0.48, 0.8, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if byte.isdigit():\n seq, records = decode_frame(data, encoding)\n return records"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L54_C8", "label": "seq, records = decode_frame()", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L53_C4", "vector": [14, 2, 0.1612, 0.003, 2, 0.69, 0.0, 795, 3, 2, 0, 0, 690, 10, 1], "semantic": {"name": "seq, records", "arg_names": [], "import_names": [], "rhs_call_name": "decode_frame", "annotation": ""}, "snippet": " seq, records = decode_frame(data, encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L55_C8", "label": "return", "type": "return", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L53_C4", "vector": [13, 2, 0.1642, 0.003, 2, 0.69, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return records"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L56_C4", "label": "return", "type": "return", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L22_C0", "vector": [13, 1, 0.1672, 0.003, 1, 0.48, 1.0, 0, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [decode_record(data, encoding)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L59_C0", "label": "decode_message", "type": "function", "loc": [59, 91], "level": 0, "parent": null, "vector": [2, 0, 0.2239, 0.0985, 0, 0.66, 0.25, 880, 0, 2, 1, 0, 0, 0, 11], "semantic": {"name": "decode_message", "arg_names": ["message", "encoding"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def decode_message(message, encoding):\n \"\"\"Decodes complete ASTM message that is sent or received due\n communication routines. It should contains checksum that would be\n additionally verified.\n\n :param message: ASTM message.\n :type message: bytes\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L60_C4", "label": "expression", "type": "expression", "loc": [60, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L59_C0", "vector": [8, 1, 0.2075, 0.0597, 1, 0.21, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Decodes complete ASTM message that is sent or received due\n communication routines. It should contains checksum that would be\n additionally verified.\n\n :param message: ASTM message.\n :type message: bytes\n\n :param encoding: Data encoding."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L80_C4", "label": "if", "type": "if", "loc": [80, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L59_C0", "vector": [4, 1, 0.2403, 0.006, 1, 0.21, 0.1429, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(message, bytes):\n raise TypeError('bytes expected, got %r' % message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L82_C4", "label": "if", "type": "if", "loc": [82, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L59_C0", "vector": [4, 1, 0.2493, 0.0119, 1, 0.21, 0.2857, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not (message.startswith(STX) and message.endswith(CRLF)):\n raise ValueError('Malformed ASTM message. Expected that it will started'\n ' with %x and followed by %x%x characters. Got: %r'\n ' ' % (ord(STX), ord(CR), ord(LF), message))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L86_C4", "label": "stx, frame_cs =", "type": "assigned_variable", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L59_C0", "vector": [14, 1, 0.2567, 0.003, 1, 0.21, 0.4286, 752, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "stx, frame_cs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " stx, frame_cs = message[0], message[1:-2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L87_C4", "label": "frame, cs =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L59_C0", "vector": [14, 1, 0.2597, 0.003, 1, 0.21, 0.5714, 710, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "frame, cs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " frame, cs = frame_cs[:-2], frame_cs[-2:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L88_C4", "label": "ccs = make_checksum()", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L59_C0", "vector": [14, 1, 0.2627, 0.003, 1, 0.21, 0.7143, 799, 3, 1, 0, 0, 10, 10, 1], "semantic": {"name": "ccs", "arg_names": [], "import_names": [], "rhs_call_name": "make_checksum", "annotation": ""}, "snippet": " ccs = make_checksum(frame)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L90_C4", "label": "seq, records = decode_frame()", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L59_C0", "vector": [14, 1, 0.2687, 0.003, 1, 0.21, 0.8571, 795, 3, 2, 0, 0, 690, 10, 1], "semantic": {"name": "seq, records", "arg_names": [], "import_names": [], "rhs_call_name": "decode_frame", "annotation": ""}, "snippet": " seq, records = decode_frame(frame, encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L91_C4", "label": "return", "type": "return", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L59_C0", "vector": [13, 1, 0.2716, 0.003, 1, 0.21, 1.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return seq, records, cs.decode()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L94_C0", "label": "decode_frame", "type": "function", "loc": [94, 111], "level": 0, "parent": null, "vector": [2, 0, 0.306, 0.0537, 0, 0.66, 0.3, 690, 0, 2, 1, 0, 0, 0, 11], "semantic": {"name": "decode_frame", "arg_names": ["frame", "encoding"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def decode_frame(frame, encoding):\n \"\"\"Decodes ASTM frame: list of records followed by sequence number.\"\"\"\n if not isinstance(frame, bytes):\n raise TypeError('bytes expected, got %r' % frame)\n if frame.endswith(CR + ETX):\n frame = frame[:-2]\n elif frame.endswith(ETB):\n frame = frame[:-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L95_C4", "label": "expression", "type": "expression", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L94_C0", "vector": [8, 1, 0.2836, 0.003, 1, 0.36, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Decodes ASTM frame: list of records followed by sequence number.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L96_C4", "label": "if", "type": "if", "loc": [96, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L94_C0", "vector": [4, 1, 0.2881, 0.006, 1, 0.36, 0.1667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(frame, bytes):\n raise TypeError('bytes expected, got %r' % frame)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L98_C4", "label": "if", "type": "if", "loc": [98, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L94_C0", "vector": [4, 1, 0.3015, 0.0209, 1, 0.36, 0.3333, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if frame.endswith(CR + ETX):\n frame = frame[:-2]\n elif frame.endswith(ETB):\n frame = frame[:-1]\n else:\n raise ValueError('Incomplete frame data %r.'\n ' Expected trailing <CR><ETX> or <ETB> chars' % frame)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L99_C8", "label": "frame =", "type": "assigned_variable", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L98_C4", "vector": [14, 2, 0.2955, 0.003, 2, 0.55, 0.0, 313, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "frame", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " frame = frame[:-2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L100_C4", "label": "if", "type": "if", "loc": [100, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L98_C4", "vector": [4, 2, 0.3045, 0.0149, 2, 0.55, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif frame.endswith(ETB):\n frame = frame[:-1]\n else:\n raise ValueError('Incomplete frame data %r.'\n ' Expected trailing <CR><ETX> or <ETB> chars' % frame)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L101_C8", "label": "frame =", "type": "assigned_variable", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L100_C4", "vector": [14, 3, 0.3015, 0.003, 3, 0.7, 0.0, 313, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "frame", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " frame = frame[:-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L105_C4", "label": "seq = decode()", "type": "assigned_variable", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L94_C0", "vector": [14, 1, 0.3134, 0.003, 1, 0.36, 0.5, 609, 3, 0, 0, 0, 528, 10, 1], "semantic": {"name": "seq", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " seq = frame[:1].decode()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L106_C4", "label": "if", "type": "if", "loc": [106, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L94_C0", "vector": [4, 1, 0.3194, 0.009, 1, 0.36, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not seq.isdigit():\n raise ValueError('Malformed ASTM frame. Expected leading seq number %r'\n '' % frame)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L109_C4", "label": "seq, records =", "type": "assigned_variable", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L94_C0", "vector": [14, 1, 0.3254, 0.003, 1, 0.36, 0.8333, 795, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "seq, records", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " seq, records = int(seq), frame[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L110_C4", "label": "return", "type": "return", "loc": [110, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L94_C0", "vector": [13, 1, 0.3299, 0.006, 1, 0.36, 1.0, 0, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return seq, [decode_record(record, encoding)\n for record in records.split(RECORD_SEP)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L114_C0", "label": "decode_record", "type": "function", "loc": [114, 125], "level": 0, "parent": null, "vector": [2, 0, 0.3567, 0.0358, 0, 0.66, 0.35, 326, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "decode_record", "arg_names": ["record", "encoding"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def decode_record(record, encoding):\n \"\"\"Decodes ASTM record message.\"\"\"\n fields = []\n for item in record.split(FIELD_SEP):\n if REPEAT_SEP in item:\n item = decode_repeated_component(item, encoding)\n elif COMPONENT_SEP in item:\n item = decode_component(item, encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L115_C4", "label": "expression", "type": "expression", "loc": [115, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L114_C0", "vector": [8, 1, 0.3433, 0.003, 1, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Decodes ASTM record message.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L116_C4", "label": "fields =", "type": "assigned_variable", "loc": [116, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L114_C0", "vector": [14, 1, 0.3463, 0.003, 1, 0.38, 0.3333, 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_1033:For_L117_C4", "label": "for item", "type": "for", "loc": [117, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L114_C0", "vector": [6, 1, 0.3597, 0.0239, 1, 0.38, 0.6667, 434, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in record.split(FIELD_SEP):\n if REPEAT_SEP in item:\n item = decode_repeated_component(item, encoding)\n elif COMPONENT_SEP in item:\n item = decode_component(item, encoding)\n else:\n item = item.decode(encoding)\n fields.append([None, item][bool(item)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L118_C8", "label": "if", "type": "if", "loc": [118, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L117_C4", "vector": [4, 2, 0.3597, 0.0179, 2, 0.59, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if REPEAT_SEP in item:\n item = decode_repeated_component(item, encoding)\n elif COMPONENT_SEP in item:\n item = decode_component(item, encoding)\n else:\n item = item.decode(encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L119_C12", "label": "item = decode_repeated_component()", "type": "assigned_variable", "loc": [119, 119], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L118_C8", "vector": [14, 3, 0.3552, 0.003, 3, 0.57, 0.0, 434, 3, 2, 0, 0, 612, 10, 1], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "decode_repeated_component", "annotation": ""}, "snippet": " item = decode_repeated_component(item, encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L120_C8", "label": "if", "type": "if", "loc": [120, 123], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L118_C8", "vector": [4, 3, 0.3627, 0.0119, 3, 0.57, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif COMPONENT_SEP in item:\n item = decode_component(item, encoding)\n else:\n item = item.decode(encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L121_C12", "label": "item = decode_component()", "type": "assigned_variable", "loc": [121, 121], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L120_C8", "vector": [14, 4, 0.3612, 0.003, 4, 0.85, 0.0, 434, 3, 2, 0, 0, 871, 10, 1], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "decode_component", "annotation": ""}, "snippet": " item = decode_component(item, encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L123_C12", "label": "item = decode()", "type": "assigned_variable", "loc": [123, 123], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L120_C8", "vector": [14, 4, 0.3672, 0.003, 4, 0.85, 1.0, 434, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " item = item.decode(encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L124_C8", "label": "append()", "type": "expression", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L117_C4", "vector": [8, 2, 0.3701, 0.003, 2, 0.59, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " fields.append([None, item][bool(item)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L125_C4", "label": "return", "type": "return", "loc": [125, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L114_C0", "vector": [13, 1, 0.3731, 0.003, 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 fields"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L128_C0", "label": "decode_component", "type": "function", "loc": [128, 131], "level": 0, "parent": null, "vector": [2, 0, 0.3866, 0.0119, 0, 0.66, 0.4, 871, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "decode_component", "arg_names": ["field", "encoding"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def decode_component(field, encoding):\n \"\"\"Decodes ASTM field component.\"\"\"\n return [[None, item.decode(encoding)][bool(item)]\n for item in field.split(COMPONENT_SEP)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L129_C4", "label": "expression", "type": "expression", "loc": [129, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L128_C0", "vector": [8, 1, 0.3851, 0.003, 1, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Decodes ASTM field component.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L130_C4", "label": "return", "type": "return", "loc": [130, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L128_C0", "vector": [13, 1, 0.3896, 0.006, 1, 0.71, 1.0, 0, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [[None, item.decode(encoding)][bool(item)]\n for item in field.split(COMPONENT_SEP)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L134_C0", "label": "decode_repeated_component", "type": "function", "loc": [134, 137], "level": 0, "parent": null, "vector": [2, 0, 0.4045, 0.0119, 0, 0.66, 0.45, 612, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "decode_repeated_component", "arg_names": ["component", "encoding"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def decode_repeated_component(component, encoding):\n \"\"\"Decodes ASTM field repeated component.\"\"\"\n return [decode_component(item, encoding)\n for item in component.split(REPEAT_SEP)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L135_C4", "label": "expression", "type": "expression", "loc": [135, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L134_C0", "vector": [8, 1, 0.403, 0.003, 1, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Decodes ASTM field repeated component.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L136_C4", "label": "return", "type": "return", "loc": [136, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L134_C0", "vector": [13, 1, 0.4075, 0.006, 1, 0.26, 1.0, 0, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [decode_component(item, encoding)\n for item in component.split(REPEAT_SEP)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L140_C0", "label": "encode", "type": "function", "loc": [140, 168], "level": 0, "parent": null, "vector": [2, 0, 0.4597, 0.0866, 0, 0.66, 0.5, 623, 0, 4, 1, 0, 0, 0, 4], "semantic": {"name": "encode", "arg_names": ["records", "encoding", "size", "seq"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def encode(records, encoding=ENCODING, size=None, seq=1):\n \"\"\"Encodes list of records into single ASTM message, also called as \"packed\"\n message.\n\n If you need to get each record as standalone message use :func:`iter_encode`\n instead.\n\n If the result message is too large (greater than specified `size` if it's"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L141_C4", "label": "expression", "type": "expression", "loc": [141, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L140_C0", "vector": [8, 1, 0.4552, 0.0716, 1, 0.61, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Encodes list of records into single ASTM message, also called as \"packed\"\n message.\n\n If you need to get each record as standalone message use :func:`iter_encode`\n instead.\n\n If the result message is too large (greater than specified `size` if it's\n not :const:`None`), than it will be split by chunks."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L165_C4", "label": "msg = encode_message()", "type": "assigned_variable", "loc": [165, 165], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L140_C0", "vector": [14, 1, 0.4925, 0.003, 1, 0.61, 0.3333, 712, 3, 3, 0, 0, 621, 10, 1], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "encode_message", "annotation": ""}, "snippet": " msg = encode_message(seq, records, encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L166_C4", "label": "if", "type": "if", "loc": [166, 167], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L140_C0", "vector": [4, 1, 0.497, 0.006, 1, 0.61, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if size is not None and len(msg) > size:\n return list(split(msg, size))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L167_C8", "label": "return", "type": "return", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L166_C4", "vector": [13, 2, 0.4985, 0.003, 2, 0.02, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return list(split(msg, size))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L168_C4", "label": "return", "type": "return", "loc": [168, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L140_C0", "vector": [13, 1, 0.5015, 0.003, 1, 0.61, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [msg]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L171_C0", "label": "iter_encode", "type": "function", "loc": [171, 188], "level": 0, "parent": null, "vector": [2, 0, 0.5358, 0.0537, 0, 0.66, 0.55, 869, 0, 4, 0, 0, 0, 0, 3], "semantic": {"name": "iter_encode", "arg_names": ["records", "encoding", "size", "seq"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def iter_encode(records, encoding=ENCODING, size=None, seq=1):\n \"\"\"Encodes and emits each record as separate message.\n\n If the result message is too large (greater than specified `size` if it's\n not :const:`None`), than it will be split by chunks.\n\n :yields: ASTM message chunks.\n :rtype: str"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L172_C4", "label": "expression", "type": "expression", "loc": [172, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L171_C0", "vector": [8, 1, 0.5239, 0.0239, 1, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Encodes and emits each record as separate message.\n\n If the result message is too large (greater than specified `size` if it's\n not :const:`None`), than it will be split by chunks.\n\n :yields: ASTM message chunks.\n :rtype: str\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L180_C4", "label": "for record", "type": "for", "loc": [180, 188], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L171_C0", "vector": [6, 1, 0.5493, 0.0269, 1, 0.41, 1.0, 667, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "record", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for record in records:\n msg = encode_message(seq, [record], encoding)\n if size is not None and len(msg) > size:\n for chunk in split(msg, size):\n seq += 1\n yield chunk\n else:\n seq += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L181_C8", "label": "msg = encode_message()", "type": "assigned_variable", "loc": [181, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L180_C4", "vector": [14, 2, 0.5403, 0.003, 2, 0.33, 0.0, 712, 3, 3, 0, 0, 621, 10, 1], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "encode_message", "annotation": ""}, "snippet": " msg = encode_message(seq, [record], encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L182_C8", "label": "if", "type": "if", "loc": [182, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L180_C4", "vector": [4, 2, 0.5522, 0.0209, 2, 0.33, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if size is not None and len(msg) > size:\n for chunk in split(msg, size):\n seq += 1\n yield chunk\n else:\n seq += 1\n yield msg"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L183_C12", "label": "for chunk", "type": "for", "loc": [183, 185], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L182_C8", "vector": [6, 3, 0.5493, 0.009, 3, 0.46, 0.0, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in split(msg, size):\n seq += 1\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L185_C16", "label": "expression", "type": "expression", "loc": [185, 185], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L183_C12", "vector": [8, 4, 0.5522, 0.003, 4, 0.55, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L188_C12", "label": "expression", "type": "expression", "loc": [188, 188], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L182_C8", "vector": [8, 3, 0.5612, 0.003, 3, 0.46, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield msg"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L191_C0", "label": "encode_message", "type": "function", "loc": [191, 209], "level": 0, "parent": null, "vector": [2, 0, 0.597, 0.0567, 0, 0.66, 0.6, 621, 0, 3, 1, 0, 0, 0, 7], "semantic": {"name": "encode_message", "arg_names": ["seq", "records", "encoding"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def encode_message(seq, records, encoding):\n \"\"\"Encodes ASTM message.\n\n :param seq: Frame sequence number.\n :type seq: int\n\n :param records: List of ASTM records.\n :type records: list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L192_C4", "label": "expression", "type": "expression", "loc": [192, 205], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L191_C0", "vector": [8, 1, 0.5925, 0.0418, 1, 0.48, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Encodes ASTM message.\n\n :param seq: Frame sequence number.\n :type seq: int\n\n :param records: List of ASTM records.\n :type records: list\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L206_C4", "label": "data = join()", "type": "assigned_variable", "loc": [206, 207], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L191_C0", "vector": [14, 1, 0.6164, 0.006, 1, 0.48, 0.3333, 929, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " data = RECORD_SEP.join(encode_record(record, encoding)\n for record in records)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L208_C4", "label": "data = join()", "type": "assigned_variable", "loc": [208, 208], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L191_C0", "vector": [14, 1, 0.6209, 0.003, 1, 0.48, 0.6667, 929, 3, 1, 0, 0, 933, 10, 3], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " data = b''.join((str(seq % 8).encode(), data, CR, ETX))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L209_C4", "label": "return", "type": "return", "loc": [209, 209], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L191_C0", "vector": [13, 1, 0.6239, 0.003, 1, 0.48, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return b''.join([STX, data, make_checksum(data), CR, LF])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L212_C0", "label": "encode_record", "type": "function", "loc": [212, 239], "level": 0, "parent": null, "vector": [2, 0, 0.6731, 0.0836, 0, 0.66, 0.65, 309, 0, 2, 1, 0, 0, 0, 13], "semantic": {"name": "encode_record", "arg_names": ["record", "encoding"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def encode_record(record, encoding):\n \"\"\"Encodes single ASTM record.\n\n :param record: ASTM record. Each :class:`str`-typed item counted as field\n value, one level nested :class:`list` counted as components\n and second leveled - as repeated components.\n :type record: list\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L213_C4", "label": "expression", "type": "expression", "loc": [213, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L212_C0", "vector": [8, 1, 0.6537, 0.0388, 1, 0.89, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Encodes single ASTM record.\n\n :param record: ASTM record. Each :class:`str`-typed item counted as field\n value, one level nested :class:`list` counted as components\n and second leveled - as repeated components.\n :type record: list\n\n :param encoding: Data encoding."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L226_C4", "label": "fields =", "type": "assigned_variable", "loc": [226, 226], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L212_C0", "vector": [14, 1, 0.6746, 0.003, 1, 0.89, 0.25, 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_1033:Assign_L227_C4", "label": "_append =", "type": "assigned_variable", "loc": [227, 227], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L212_C0", "vector": [14, 1, 0.6776, 0.003, 1, 0.89, 0.5, 6, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_append", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _append = fields.append"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L228_C4", "label": "for field", "type": "for", "loc": [228, 238], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L212_C0", "vector": [6, 1, 0.6955, 0.0328, 1, 0.89, 0.75, 480, 2, 0, 0, 0, 0, 0, 12], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for field in record:\n if isinstance(field, bytes):\n _append(field)\n elif isinstance(field, unicode):\n _append(field.encode(encoding))\n elif isinstance(field, Iterable):\n _append(encode_component(field, encoding))\n elif field is None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L229_C8", "label": "if", "type": "if", "loc": [229, 238], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L228_C4", "vector": [4, 2, 0.697, 0.0299, 2, 0.95, 0.0, 0, 3, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(field, bytes):\n _append(field)\n elif isinstance(field, unicode):\n _append(field.encode(encoding))\n elif isinstance(field, Iterable):\n _append(encode_component(field, encoding))\n elif field is None:\n _append(b'')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L230_C12", "label": "_append()", "type": "expression", "loc": [230, 230], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L229_C8", "vector": [8, 3, 0.6866, 0.003, 3, 0.94, 0.0, 6, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_append", "arg_names": [], "import_names": [], "rhs_call_name": "_append", "annotation": ""}, "snippet": " _append(field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L231_C8", "label": "if", "type": "if", "loc": [231, 238], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L229_C8", "vector": [4, 3, 0.7, 0.0239, 3, 0.94, 1.0, 0, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(field, unicode):\n _append(field.encode(encoding))\n elif isinstance(field, Iterable):\n _append(encode_component(field, encoding))\n elif field is None:\n _append(b'')\n else:\n _append(unicode(field).encode(encoding))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L232_C12", "label": "_append()", "type": "expression", "loc": [232, 232], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L231_C8", "vector": [8, 4, 0.6925, 0.003, 4, 0.47, 0.0, 6, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "_append", "arg_names": [], "import_names": [], "rhs_call_name": "_append", "annotation": ""}, "snippet": " _append(field.encode(encoding))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L233_C8", "label": "if", "type": "if", "loc": [233, 238], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L231_C8", "vector": [4, 4, 0.703, 0.0179, 4, 0.47, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(field, Iterable):\n _append(encode_component(field, encoding))\n elif field is None:\n _append(b'')\n else:\n _append(unicode(field).encode(encoding))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L234_C12", "label": "_append()", "type": "expression", "loc": [234, 234], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L233_C8", "vector": [8, 5, 0.6985, 0.003, 5, 0.14, 0.0, 6, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "_append", "arg_names": [], "import_names": [], "rhs_call_name": "_append", "annotation": ""}, "snippet": " _append(encode_component(field, encoding))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L235_C8", "label": "if", "type": "if", "loc": [235, 238], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L233_C8", "vector": [4, 5, 0.706, 0.0119, 5, 0.14, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif field is None:\n _append(b'')\n else:\n _append(unicode(field).encode(encoding))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L236_C12", "label": "_append()", "type": "expression", "loc": [236, 236], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L235_C8", "vector": [8, 6, 0.7045, 0.003, 6, 0.14, 0.0, 6, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_append", "arg_names": [], "import_names": [], "rhs_call_name": "_append", "annotation": ""}, "snippet": " _append(b'')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L238_C12", "label": "_append()", "type": "expression", "loc": [238, 238], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L235_C8", "vector": [8, 6, 0.7104, 0.003, 6, 0.14, 1.0, 6, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "_append", "arg_names": [], "import_names": [], "rhs_call_name": "_append", "annotation": ""}, "snippet": " _append(unicode(field).encode(encoding))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L239_C4", "label": "return", "type": "return", "loc": [239, 239], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L212_C0", "vector": [13, 1, 0.7134, 0.003, 1, 0.89, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return FIELD_SEP.join(fields)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L242_C0", "label": "encode_component", "type": "function", "loc": [242, 258], "level": 0, "parent": null, "vector": [2, 0, 0.7463, 0.0507, 0, 0.66, 0.7, 40, 0, 2, 1, 0, 0, 0, 13], "semantic": {"name": "encode_component", "arg_names": ["component", "encoding"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def encode_component(component, encoding):\n \"\"\"Encodes ASTM record field components.\"\"\"\n items = []\n _append = items.append\n for item in component:\n if isinstance(item, bytes):\n _append(item)\n elif isinstance(item, unicode):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L243_C4", "label": "expression", "type": "expression", "loc": [243, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L242_C0", "vector": [8, 1, 0.7254, 0.003, 1, 0.61, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Encodes ASTM record field components.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L244_C4", "label": "items =", "type": "assigned_variable", "loc": [244, 244], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L242_C0", "vector": [14, 1, 0.7284, 0.003, 1, 0.61, 0.25, 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_1033:Assign_L245_C4", "label": "_append =", "type": "assigned_variable", "loc": [245, 245], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L242_C0", "vector": [14, 1, 0.7313, 0.003, 1, 0.61, 0.5, 6, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_append", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _append = items.append"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L246_C4", "label": "for item", "type": "for", "loc": [246, 256], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L242_C0", "vector": [6, 1, 0.7493, 0.0328, 1, 0.61, 0.75, 434, 2, 0, 0, 0, 0, 0, 11], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in component:\n if isinstance(item, bytes):\n _append(item)\n elif isinstance(item, unicode):\n _append(item.encode(encoding))\n elif isinstance(item, Iterable):\n return encode_repeated_component(component, encoding)\n elif item is None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L247_C8", "label": "if", "type": "if", "loc": [247, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L246_C4", "vector": [4, 2, 0.7507, 0.0299, 2, 0.01, 0.0, 0, 3, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(item, bytes):\n _append(item)\n elif isinstance(item, unicode):\n _append(item.encode(encoding))\n elif isinstance(item, Iterable):\n return encode_repeated_component(component, encoding)\n elif item is None:\n _append(b'')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L248_C12", "label": "_append()", "type": "expression", "loc": [248, 248], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L247_C8", "vector": [8, 3, 0.7403, 0.003, 3, 0.75, 0.0, 6, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_append", "arg_names": [], "import_names": [], "rhs_call_name": "_append", "annotation": ""}, "snippet": " _append(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L249_C8", "label": "if", "type": "if", "loc": [249, 256], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L247_C8", "vector": [4, 3, 0.7537, 0.0239, 3, 0.75, 1.0, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(item, unicode):\n _append(item.encode(encoding))\n elif isinstance(item, Iterable):\n return encode_repeated_component(component, encoding)\n elif item is None:\n _append(b'')\n else:\n _append(unicode(item).encode(encoding))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L250_C12", "label": "_append()", "type": "expression", "loc": [250, 250], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L249_C8", "vector": [8, 4, 0.7463, 0.003, 4, 0.09, 0.0, 6, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "_append", "arg_names": [], "import_names": [], "rhs_call_name": "_append", "annotation": ""}, "snippet": " _append(item.encode(encoding))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L251_C8", "label": "if", "type": "if", "loc": [251, 256], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L249_C8", "vector": [4, 4, 0.7567, 0.0179, 4, 0.09, 1.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(item, Iterable):\n return encode_repeated_component(component, encoding)\n elif item is None:\n _append(b'')\n else:\n _append(unicode(item).encode(encoding))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L252_C12", "label": "return", "type": "return", "loc": [252, 252], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L251_C8", "vector": [13, 5, 0.7522, 0.003, 5, 0.4, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return encode_repeated_component(component, encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L253_C8", "label": "if", "type": "if", "loc": [253, 256], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L251_C8", "vector": [4, 5, 0.7597, 0.0119, 5, 0.4, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif item is None:\n _append(b'')\n else:\n _append(unicode(item).encode(encoding))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L254_C12", "label": "_append()", "type": "expression", "loc": [254, 254], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L253_C8", "vector": [8, 6, 0.7582, 0.003, 6, 0.55, 0.0, 6, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_append", "arg_names": [], "import_names": [], "rhs_call_name": "_append", "annotation": ""}, "snippet": " _append(b'')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L256_C12", "label": "_append()", "type": "expression", "loc": [256, 256], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L253_C8", "vector": [8, 6, 0.7642, 0.003, 6, 0.55, 1.0, 6, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "_append", "arg_names": [], "import_names": [], "rhs_call_name": "_append", "annotation": ""}, "snippet": " _append(unicode(item).encode(encoding))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L258_C4", "label": "return", "type": "return", "loc": [258, 258], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L242_C0", "vector": [13, 1, 0.7701, 0.003, 1, 0.61, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return COMPONENT_SEP.join(items).rstrip(COMPONENT_SEP)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L261_C0", "label": "encode_repeated_component", "type": "function", "loc": [261, 264], "level": 0, "parent": null, "vector": [2, 0, 0.7836, 0.0119, 0, 0.66, 0.75, 947, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "encode_repeated_component", "arg_names": ["components", "encoding"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def encode_repeated_component(components, encoding):\n \"\"\"Encodes repeated components.\"\"\"\n return REPEAT_SEP.join(encode_component(item, encoding)\n for item in components)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L262_C4", "label": "expression", "type": "expression", "loc": [262, 262], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L261_C0", "vector": [8, 1, 0.7821, 0.003, 1, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Encodes repeated components.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L263_C4", "label": "return", "type": "return", "loc": [263, 264], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L261_C0", "vector": [13, 1, 0.7866, 0.006, 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 REPEAT_SEP.join(encode_component(item, encoding)\n for item in components)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L267_C0", "label": "make_checksum", "type": "function", "loc": [267, 278], "level": 0, "parent": null, "vector": [2, 0, 0.8134, 0.0358, 0, 0.66, 0.8, 10, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "make_checksum", "arg_names": ["message"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def make_checksum(message):\n \"\"\"Calculates checksum for specified message.\n\n :param message: ASTM message.\n :type message: bytes\n\n :returns: Checksum value that is actually byte sized integer in hex base\n :rtype: bytes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L268_C4", "label": "expression", "type": "expression", "loc": [268, 275], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L267_C0", "vector": [8, 1, 0.8104, 0.0239, 1, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Calculates checksum for specified message.\n\n :param message: ASTM message.\n :type message: bytes\n\n :returns: Checksum value that is actually byte sized integer in hex base\n :rtype: bytes\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L276_C4", "label": "if", "type": "if", "loc": [276, 277], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L267_C0", "vector": [4, 1, 0.8254, 0.006, 1, 0.66, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(message[0], int):\n message = map(ord, message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L277_C8", "label": "message = map()", "type": "assigned_variable", "loc": [277, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L276_C4", "vector": [14, 2, 0.8269, 0.003, 2, 0.03, 0.0, 635, 3, 2, 0, 0, 53, 10, 1], "semantic": {"name": "message", "arg_names": [], "import_names": [], "rhs_call_name": "map", "annotation": ""}, "snippet": " message = map(ord, message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L278_C4", "label": "return", "type": "return", "loc": [278, 278], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L267_C0", "vector": [13, 1, 0.8299, 0.003, 1, 0.66, 1.0, 0, 3, 0, 0, 0, 0, 10, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return hex(sum(message) & 0xFF)[2:].upper().zfill(2).encode()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L281_C0", "label": "make_chunks", "type": "function", "loc": [281, 284], "level": 0, "parent": null, "vector": [2, 0, 0.8433, 0.0119, 0, 0.66, 0.85, 785, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "make_chunks", "arg_names": ["s", "n"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def make_chunks(s, n):\n iter_bytes = (s[i:i + 1] for i in range(len(s)))\n return [b''.join(item)\n for item in izip_longest(*[iter_bytes] * n, fillvalue=b'')]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L282_C4", "label": "iter_bytes =", "type": "assigned_variable", "loc": [282, 282], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L281_C0", "vector": [14, 1, 0.8418, 0.003, 1, 0.97, 0.0, 665, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "iter_bytes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " iter_bytes = (s[i:i + 1] for i in range(len(s)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L283_C4", "label": "return", "type": "return", "loc": [283, 284], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L281_C0", "vector": [13, 1, 0.8463, 0.006, 1, 0.97, 1.0, 0, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [b''.join(item)\n for item in izip_longest(*[iter_bytes] * n, fillvalue=b'')]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L287_C0", "label": "split", "type": "function", "loc": [287, 315], "level": 0, "parent": null, "vector": [2, 0, 0.8985, 0.0866, 0, 0.66, 0.9, 908, 0, 2, 0, 0, 0, 0, 15], "semantic": {"name": "split", "arg_names": ["msg", "size"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def split(msg, size):\n \"\"\"Split `msg` into chunks with specified `size`.\n\n Chunk `size` value couldn't be less then 7 since each chunk goes with at\n least 7 special characters: STX, frame number, ETX or ETB, checksum and\n message terminator.\n\n :param msg: ASTM message."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L288_C4", "label": "expression", "type": "expression", "loc": [288, 301], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L287_C0", "vector": [8, 1, 0.8791, 0.0418, 1, 0.04, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Split `msg` into chunks with specified `size`.\n\n Chunk `size` value couldn't be less then 7 since each chunk goes with at\n least 7 special characters: STX, frame number, ETX or ETB, checksum and\n message terminator.\n\n :param msg: ASTM message.\n :type msg: bytes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L302_C4", "label": "stx, frame, msg, tail =", "type": "assigned_variable", "loc": [302, 302], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L287_C0", "vector": [14, 1, 0.9015, 0.003, 1, 0.04, 0.125, 163, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "stx, frame, msg, tail", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " stx, frame, msg, tail = msg[:1], msg[1:2], msg[2:-6], msg[-6:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L307_C4", "label": "frame = int()", "type": "assigned_variable", "loc": [307, 307], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L287_C0", "vector": [14, 1, 0.9164, 0.003, 1, 0.04, 0.25, 313, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "frame", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " frame = int(frame)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L308_C4", "label": "chunks = make_chunks()", "type": "assigned_variable", "loc": [308, 308], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L287_C0", "vector": [14, 1, 0.9194, 0.003, 1, 0.04, 0.375, 284, 3, 2, 0, 0, 785, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "make_chunks", "annotation": ""}, "snippet": " chunks = make_chunks(msg, size - 7)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L309_C4", "label": "chunks, last =", "type": "assigned_variable", "loc": [309, 309], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L287_C0", "vector": [14, 1, 0.9224, 0.003, 1, 0.04, 0.5, 50, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "chunks, last", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " chunks, last = chunks[:-1], chunks[-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L310_C4", "label": "idx =", "type": "assigned_variable", "loc": [310, 310], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L287_C0", "vector": [14, 1, 0.9254, 0.003, 1, 0.04, 0.625, 187, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "idx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " idx = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L311_C4", "label": "for idx, chunk", "type": "for", "loc": [311, 313], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L287_C0", "vector": [6, 1, 0.9313, 0.009, 1, 0.04, 0.75, 767, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "idx, chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for idx, chunk in enumerate(chunks):\n item = b''.join([str((idx + frame) % 8).encode(), chunk, ETB])\n yield b''.join([STX, item, make_checksum(item), CRLF])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L312_C8", "label": "item = join()", "type": "assigned_variable", "loc": [312, 312], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L311_C4", "vector": [14, 2, 0.9313, 0.003, 2, 0.18, 0.0, 434, 3, 1, 0, 0, 933, 10, 3], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " item = b''.join([str((idx + frame) % 8).encode(), chunk, ETB])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L313_C8", "label": "expression", "type": "expression", "loc": [313, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L311_C4", "vector": [8, 2, 0.9343, 0.003, 2, 0.18, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield b''.join([STX, item, make_checksum(item), CRLF])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L314_C4", "label": "item = join()", "type": "assigned_variable", "loc": [314, 314], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L287_C0", "vector": [14, 1, 0.9373, 0.003, 1, 0.04, 0.875, 434, 3, 1, 0, 0, 933, 10, 3], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " item = b''.join([str((idx + frame + 1) % 8).encode(), last, CR, ETX])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L315_C4", "label": "expression", "type": "expression", "loc": [315, 315], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L287_C0", "vector": [8, 1, 0.9403, 0.003, 1, 0.04, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield b''.join([STX, item, make_checksum(item), CRLF])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L318_C0", "label": "join", "type": "function", "loc": [318, 325], "level": 0, "parent": null, "vector": [2, 0, 0.9597, 0.0239, 0, 0.66, 0.95, 933, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "join", "arg_names": ["chunks"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def join(chunks):\n \"\"\"Merges ASTM message `chunks` into single message.\n\n :param chunks: List of chunks as `bytes`.\n :type chunks: iterable\n \"\"\"\n msg = b'1' + b''.join(c[2:-5] for c in chunks) + ETX\n return b''.join([STX, msg, make_checksum(msg), CRLF])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L319_C4", "label": "expression", "type": "expression", "loc": [319, 323], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L318_C0", "vector": [8, 1, 0.9582, 0.0149, 1, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Merges ASTM message `chunks` into single message.\n\n :param chunks: List of chunks as `bytes`.\n :type chunks: iterable\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L324_C4", "label": "msg =", "type": "assigned_variable", "loc": [324, 324], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L318_C0", "vector": [14, 1, 0.9672, 0.003, 1, 0.75, 0.5, 712, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg = b'1' + b''.join(c[2:-5] for c in chunks) + ETX"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L325_C4", "label": "return", "type": "return", "loc": [325, 325], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L318_C0", "vector": [13, 1, 0.9701, 0.003, 1, 0.75, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return b''.join([STX, msg, make_checksum(msg), CRLF])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L328_C0", "label": "is_chunked_message", "type": "function", "loc": [328, 335], "level": 0, "parent": null, "vector": [2, 0, 0.9896, 0.0239, 0, 0.66, 1.0, 668, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "is_chunked_message", "arg_names": ["message"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def is_chunked_message(message):\n \"\"\"Checks plain message for chunked byte.\"\"\"\n length = len(message)\n if len(message) < 5:\n return False\n if ETB not in message:\n return False\n return message.index(ETB) == length - 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L329_C4", "label": "expression", "type": "expression", "loc": [329, 329], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L328_C0", "vector": [8, 1, 0.9821, 0.003, 1, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Checks plain message for chunked byte.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L330_C4", "label": "length = len()", "type": "assigned_variable", "loc": [330, 330], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L328_C0", "vector": [14, 1, 0.9851, 0.003, 1, 0.84, 0.25, 221, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "length", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " length = len(message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L331_C4", "label": "if", "type": "if", "loc": [331, 332], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L328_C0", "vector": [4, 1, 0.9896, 0.006, 1, 0.84, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(message) < 5:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L332_C8", "label": "return", "type": "return", "loc": [332, 332], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L331_C4", "vector": [13, 2, 0.991, 0.003, 2, 0.78, 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_1033:If_L333_C4", "label": "if", "type": "if", "loc": [333, 334], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L328_C0", "vector": [4, 1, 0.9955, 0.006, 1, 0.84, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ETB not in message:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L334_C8", "label": "return", "type": "return", "loc": [334, 334], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L333_C4", "vector": [13, 2, 0.997, 0.003, 2, 0.83, 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_1033:Return_L335_C4", "label": "return", "type": "return", "loc": [335, 335], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L328_C0", "vector": [13, 1, 1.0, 0.003, 1, 0.84, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return message.index(ETB) == length - 5"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1033:Try_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:ImportFrom_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:Try_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:ImportFrom_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L114_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L114_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L114_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L118_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L119_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L118_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L120_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L121_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L120_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L123_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L114_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L134_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L134_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L140_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L140_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L165_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L140_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L140_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L180_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L181_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L182_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L182_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L183_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L183_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L185_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L182_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L188_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L191_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L191_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L191_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L208_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L191_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L209_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L212_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L213_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L212_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L226_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L212_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L212_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L228_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L228_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L229_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L229_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L230_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L229_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L231_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L231_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L232_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L231_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L233_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L233_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L234_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L233_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L235_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L235_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L236_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L235_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L238_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L212_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L239_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L242_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L242_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L244_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L242_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L245_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L242_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L246_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L247_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L247_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L248_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L247_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L249_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L250_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L249_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L251_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L252_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L251_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L253_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L253_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L254_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L253_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L256_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L242_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L258_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L262_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L261_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L263_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L267_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L268_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L267_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L276_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L276_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L267_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L278_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L281_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L282_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L281_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L283_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L287_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L288_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L287_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L287_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L307_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L287_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L308_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L287_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L309_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L287_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L310_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L287_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L311_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L311_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L312_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:For_L311_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L313_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L287_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L314_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L287_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L315_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L318_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L319_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L318_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L324_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L318_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L325_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L328_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Expr_L329_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L328_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Assign_L330_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L328_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L331_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L331_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L332_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L328_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L333_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:If_L333_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L334_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1033:FunctionDef_L328_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1033:Return_L335_C4"}]
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # import logging import socket from .asynclib import Dispatcher, loop from .codec import decode_message, is_chunked_message, join from .constants import ACK, CRLF, EOT, NAK, ENCODING from .exceptions import InvalidState, NotAccepted from .protocol import ASTMProtocol log = logging.getLogger(__name__) __all__ = ['BaseRecordsDispatcher', 'RequestHandler', 'Server'] class BaseRecordsDispatcher(object): """Abstract dispatcher of received ASTM records by :class:`RequestHandler`. You need to override his handlers or extend dispatcher for your needs. For instance:: class Dispatcher(BaseRecordsDispatcher): def __init__(self, encoding=None): super(Dispatcher, self).__init__(encoding) # extend it for your needs self.dispatch['M'] = self.my_handler # map custom wrappers for ASTM records to their type if you # don't like to work with raw data. self.wrapper['M'] = MyWrapper def on_header(self, record): # initialize state for this session ... def on_patient(self, record): # handle patient info ... # etc handlers def my_handler(self, record): # handle custom record that wasn't implemented yet by # python-astm due to some reasons ... After defining our dispatcher, we left only to let :class:`Server` use it:: server = Server(dispatcher=Dispatcher) """ #: Encoding of received messages. encoding = ENCODING def __init__(self, encoding=None): self.encoding = encoding or self.encoding self.dispatch = { 'H': self.on_header, 'C': self.on_comment, 'P': self.on_patient, 'O': self.on_order, 'R': self.on_result, 'S': self.on_scientific, 'M': self.on_manufacturer_info, 'L': self.on_terminator } self.wrappers = {} def __call__(self, message): seq, records, cs = decode_message(message, self.encoding) for record in records: self.dispatch.get(record[0], self.on_unknown)(self.wrap(record)) def wrap(self, record): rtype = record[0] if rtype in self.wrappers: return self.wrappers[rtype](*record) return record def _default_handler(self, record): log.warn('Record remains unprocessed: %s', record) def on_header(self, record): """Header record handler.""" self._default_handler(record) def on_comment(self, record): """Comment record handler.""" self._default_handler(record) def on_patient(self, record): """Patient record handler.""" self._default_handler(record) def on_order(self, record): """Order record handler.""" self._default_handler(record) def on_result(self, record): """Result record handler.""" self._default_handler(record) def on_scientific(self, record): """Scientific record handler.""" self._default_handler(record) def on_manufacturer_info(self, record): """Manufacturer information record handler.""" self._default_handler(record) def on_terminator(self, record): """Terminator record handler.""" self._default_handler(record) def on_unknown(self, record): """Fallback handler for dispatcher.""" self._default_handler(record) class RequestHandler(ASTMProtocol): """ASTM protocol request handler. :param sock: Socket object. :param dispatcher: Request handler records dispatcher instance. :type dispatcher: :class:`BaseRecordsDispatcher` :param timeout: Number of seconds to wait for incoming data before connection closing. :type timeout: int """ def __init__(self, sock, dispatcher, timeout=None): super(RequestHandler, self).__init__(sock, timeout=timeout) self._chunks = [] host, port = sock.getpeername() if sock is not None else (None, None) self.client_info = {'host': host, 'port': port} self.dispatcher = dispatcher self._is_transfer_state = False self.terminator = 1 def on_enq(self): if not self._is_transfer_state: self._is_transfer_state = True self.terminator = [CRLF, EOT] return ACK else: log.error('ENQ is not expected') return NAK def on_ack(self): raise NotAccepted('Server should not be ACKed.') def on_nak(self): raise NotAccepted('Server should not be NAKed.') def on_eot(self): if self._is_transfer_state: self._is_transfer_state = False self.terminator = 1 else: raise InvalidState('Server is not ready to accept EOT message.') def on_message(self): if not self._is_transfer_state: self.discard_input_buffers() return NAK else: try: self.handle_message(self._last_recv_data) return ACK except Exception: log.exception('Error occurred on message handling.') return NAK def handle_message(self, message): self.is_chunked_transfer = is_chunked_message(message) if self.is_chunked_transfer: self._chunks.append(message) elif self._chunks: self._chunks.append(message) self.dispatcher(join(self._chunks)) self._chunks = [] else: self.dispatcher(message) def discard_input_buffers(self): self._chunks = [] return super(RequestHandler, self).discard_input_buffers() def on_timeout(self): """Closes connection on timeout.""" super(RequestHandler, self).on_timeout() self.close() class Server(Dispatcher): """Asyncore driven ASTM server. :param host: Server IP address or hostname. :type host: str :param port: Server port number. :type port: int :param request: Custom server request handler. If omitted the :class:`RequestHandler` will be used by default. :param dispatcher: Custom request handler records dispatcher. If omitted the :class:`BaseRecordsDispatcher` will be used by default. :param timeout: :class:`RequestHandler` connection timeout. If :const:`None` request handler will wait for data before connection closing. :type timeout: int :param encoding: :class:`Dispatcher <BaseRecordsDispatcher>`\'s encoding. :type encoding: str """ request = RequestHandler dispatcher = BaseRecordsDispatcher def __init__(self, host='localhost', port=15200, request=None, dispatcher=None, timeout=None, encoding=None): super(Server, self).__init__() self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.set_reuse_addr() self.bind((host, port)) self.listen(5) self.pool = [] self.timeout = timeout self.encoding = encoding if request is not None: self.request = request if dispatcher is not None: self.dispatcher = dispatcher def handle_accept(self): pair = self.accept() if pair is None: return sock, addr = pair self.request(sock, self.dispatcher(self.encoding), timeout=self.timeout) super(Server, self).handle_accept() def serve_forever(self, *args, **kwargs): """Enters into the :func:`polling loop <asynclib.loop>` to let server handle incoming requests.""" loop(*args, **kwargs)
ajibawa-2023/Python-Code-Large/train/row_1034
129
256
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Import_L10_C0", "label": "logging import logging", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0391, 0.0039, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Import_L11_C0", "label": "socket import socket", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.043, 0.0039, 0, 0.66, 0.0909, 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_1034:ImportFrom_L12_C0", "label": "from asynclib import Dispatcher, loop", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0469, 0.0039, 0, 0.66, 0.1818, 591, 0, 2, 0, 0, 591, 0, 0], "semantic": {"name": "asynclib", "arg_names": [], "import_names": ["Dispatcher", "loop"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .asynclib import Dispatcher, loop"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:ImportFrom_L13_C0", "label": "from codec import decode_message, is_chunked_message, join", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0508, 0.0039, 0, 0.66, 0.2727, 563, 0, 3, 0, 0, 563, 0, 0], "semantic": {"name": "codec", "arg_names": [], "import_names": ["decode_message", "is_chunked_message", "join"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .codec import decode_message, is_chunked_message, join"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:ImportFrom_L14_C0", "label": "from constants import ACK, CRLF, EOT\u2026", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0547, 0.0039, 0, 0.66, 0.3636, 208, 0, 5, 0, 0, 208, 0, 0], "semantic": {"name": "constants", "arg_names": [], "import_names": ["ACK", "CRLF", "EOT", "NAK", "ENCODING"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .constants import ACK, CRLF, EOT, NAK, ENCODING"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:ImportFrom_L15_C0", "label": "from exceptions import InvalidState, NotAccepted", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0586, 0.0039, 0, 0.66, 0.4545, 63, 0, 2, 0, 0, 63, 0, 0], "semantic": {"name": "exceptions", "arg_names": [], "import_names": ["InvalidState", "NotAccepted"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .exceptions import InvalidState, NotAccepted"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:ImportFrom_L16_C0", "label": "from protocol import ASTMProtocol", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0039, 0, 0.66, 0.5455, 393, 0, 1, 0, 0, 393, 0, 0], "semantic": {"name": "protocol", "arg_names": [], "import_names": ["ASTMProtocol"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .protocol import ASTMProtocol"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L18_C0", "label": "log = getLogger()", "type": "assigned_variable", "loc": [18, 18], "level": 0, "parent": null, "vector": [14, 0, 0.0703, 0.0039, 0, 0.66, 0.6364, 432, 3, 1, 0, 0, 71, 10, 1], "semantic": {"name": "log", "arg_names": [], "import_names": [], "rhs_call_name": "getLogger", "annotation": ""}, "snippet": "log = logging.getLogger(__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L20_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.0781, 0.0039, 0, 0.66, 0.7273, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = ['BaseRecordsDispatcher', 'RequestHandler', 'Server']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "label": "BaseRecordsDispatcher", "type": "class", "loc": [23, 123], "level": 0, "parent": null, "vector": [3, 0, 0.2852, 0.3945, 0, 0.66, 0.8182, 339, 0, 13, 0, 0, 186, 0, 15], "semantic": {"name": "BaseRecordsDispatcher", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BaseRecordsDispatcher(object):\n \"\"\"Abstract dispatcher of received ASTM records by :class:`RequestHandler`.\n You need to override his handlers or extend dispatcher for your needs.\n For instance::\n\n class Dispatcher(BaseRecordsDispatcher):\n\n def __init__(self, encoding=None):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L24_C4", "label": "expression", "type": "expression", "loc": [24, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "vector": [8, 1, 0.1562, 0.1289, 1, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Abstract dispatcher of received ASTM records by :class:`RequestHandler`.\n You need to override his handlers or extend dispatcher for your needs.\n For instance::\n\n class Dispatcher(BaseRecordsDispatcher):\n\n def __init__(self, encoding=None):\n super(Dispatcher, self).__init__(encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L59_C4", "label": "encoding =", "type": "assigned_variable", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "vector": [14, 1, 0.2305, 0.0039, 1, 0.37, 0.0714, 325, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " encoding = ENCODING"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L61_C4", "label": "__init__", "type": "function", "loc": [61, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "vector": [2, 1, 0.2617, 0.0508, 1, 0.37, 0.1429, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "encoding"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, encoding=None):\n self.encoding = encoding or self.encoding\n self.dispatch = {\n 'H': self.on_header,\n 'C': self.on_comment,\n 'P': self.on_patient,\n 'O': self.on_order,\n 'R': self.on_result,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L62_C8", "label": "self.encoding =", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L61_C4", "vector": [14, 2, 0.2422, 0.0039, 2, 0.27, 0.0, 564, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.encoding = encoding or self.encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L63_C8", "label": "self.dispatch =", "type": "assigned_variable", "loc": [63, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L61_C4", "vector": [14, 2, 0.2637, 0.0391, 2, 0.27, 0.5, 743, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dispatch = {\n 'H': self.on_header,\n 'C': self.on_comment,\n 'P': self.on_patient,\n 'O': self.on_order,\n 'R': self.on_result,\n 'S': self.on_scientific,\n 'M': self.on_manufacturer_info,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L73_C8", "label": "self.wrappers =", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L61_C4", "vector": [14, 2, 0.2852, 0.0039, 2, 0.27, 1.0, 520, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.wrappers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.wrappers = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L75_C4", "label": "__call__", "type": "function", "loc": [75, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "vector": [2, 1, 0.2988, 0.0156, 1, 0.37, 0.2143, 319, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "__call__", "arg_names": ["self", "message"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __call__(self, message):\n seq, records, cs = decode_message(message, self.encoding)\n for record in records:\n self.dispatch.get(record[0], self.on_unknown)(self.wrap(record))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L76_C8", "label": "seq, records, cs = decode_message()", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L75_C4", "vector": [14, 2, 0.2969, 0.0039, 2, 0.39, 0.0, 433, 3, 2, 0, 0, 880, 10, 1], "semantic": {"name": "seq, records, cs", "arg_names": [], "import_names": [], "rhs_call_name": "decode_message", "annotation": ""}, "snippet": " seq, records, cs = decode_message(message, self.encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:For_L77_C8", "label": "for record", "type": "for", "loc": [77, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L75_C4", "vector": [6, 2, 0.3027, 0.0078, 2, 0.39, 1.0, 667, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "record", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for record in records:\n self.dispatch.get(record[0], self.on_unknown)(self.wrap(record))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L78_C12", "label": "expression", "type": "expression", "loc": [78, 78], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:For_L77_C8", "vector": [8, 3, 0.3047, 0.0039, 3, 0.28, 0.0, 0, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dispatch.get(record[0], self.on_unknown)(self.wrap(record))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L80_C4", "label": "wrap", "type": "function", "loc": [80, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "vector": [2, 1, 0.3203, 0.0195, 1, 0.37, 0.2857, 9, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "wrap", "arg_names": ["self", "record"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wrap(self, record):\n rtype = record[0]\n if rtype in self.wrappers:\n return self.wrappers[rtype](*record)\n return record"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L81_C8", "label": "rtype =", "type": "assigned_variable", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L80_C4", "vector": [14, 2, 0.3164, 0.0039, 2, 0.12, 0.0, 814, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rtype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rtype = record[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L82_C8", "label": "if", "type": "if", "loc": [82, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L80_C4", "vector": [4, 2, 0.3223, 0.0078, 2, 0.12, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if rtype in self.wrappers:\n return self.wrappers[rtype](*record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Return_L83_C12", "label": "return", "type": "return", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L82_C8", "vector": [13, 3, 0.3242, 0.0039, 3, 0.01, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.wrappers[rtype](*record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Return_L84_C8", "label": "return", "type": "return", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L80_C4", "vector": [13, 2, 0.3281, 0.0039, 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 record"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L86_C4", "label": "_default_handler", "type": "function", "loc": [86, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "vector": [2, 1, 0.3379, 0.0078, 1, 0.37, 0.3571, 523, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_default_handler", "arg_names": ["self", "record"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _default_handler(self, record):\n log.warn('Record remains unprocessed: %s', record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L87_C8", "label": "warn()", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L86_C4", "vector": [8, 2, 0.3398, 0.0039, 2, 0.79, 0.0, 960, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " log.warn('Record remains unprocessed: %s', record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L89_C4", "label": "on_header", "type": "function", "loc": [89, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "vector": [2, 1, 0.3516, 0.0117, 1, 0.37, 0.4286, 543, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "on_header", "arg_names": ["self", "record"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_header(self, record):\n \"\"\"Header record handler.\"\"\"\n self._default_handler(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L90_C8", "label": "expression", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L89_C4", "vector": [8, 2, 0.3516, 0.0039, 2, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Header record handler.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L91_C8", "label": "_default_handler()", "type": "expression", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L89_C4", "vector": [8, 2, 0.3555, 0.0039, 2, 0.94, 1.0, 523, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_default_handler", "arg_names": [], "import_names": [], "rhs_call_name": "_default_handler", "annotation": ""}, "snippet": " self._default_handler(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L93_C4", "label": "on_comment", "type": "function", "loc": [93, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "vector": [2, 1, 0.3672, 0.0117, 1, 0.37, 0.5, 809, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "on_comment", "arg_names": ["self", "record"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_comment(self, record):\n \"\"\"Comment record handler.\"\"\"\n self._default_handler(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L94_C8", "label": "expression", "type": "expression", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L93_C4", "vector": [8, 2, 0.3672, 0.0039, 2, 0.29, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Comment record handler.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L95_C8", "label": "_default_handler()", "type": "expression", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L93_C4", "vector": [8, 2, 0.3711, 0.0039, 2, 0.29, 1.0, 523, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_default_handler", "arg_names": [], "import_names": [], "rhs_call_name": "_default_handler", "annotation": ""}, "snippet": " self._default_handler(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L97_C4", "label": "on_patient", "type": "function", "loc": [97, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "vector": [2, 1, 0.3828, 0.0117, 1, 0.37, 0.5714, 551, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "on_patient", "arg_names": ["self", "record"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_patient(self, record):\n \"\"\"Patient record handler.\"\"\"\n self._default_handler(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L98_C8", "label": "expression", "type": "expression", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L97_C4", "vector": [8, 2, 0.3828, 0.0039, 2, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Patient record handler.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L99_C8", "label": "_default_handler()", "type": "expression", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L97_C4", "vector": [8, 2, 0.3867, 0.0039, 2, 0.28, 1.0, 523, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_default_handler", "arg_names": [], "import_names": [], "rhs_call_name": "_default_handler", "annotation": ""}, "snippet": " self._default_handler(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L101_C4", "label": "on_order", "type": "function", "loc": [101, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "vector": [2, 1, 0.3984, 0.0117, 1, 0.37, 0.6429, 499, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "on_order", "arg_names": ["self", "record"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_order(self, record):\n \"\"\"Order record handler.\"\"\"\n self._default_handler(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L102_C8", "label": "expression", "type": "expression", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L101_C4", "vector": [8, 2, 0.3984, 0.0039, 2, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Order record handler.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L103_C8", "label": "_default_handler()", "type": "expression", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L101_C4", "vector": [8, 2, 0.4023, 0.0039, 2, 0.84, 1.0, 523, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_default_handler", "arg_names": [], "import_names": [], "rhs_call_name": "_default_handler", "annotation": ""}, "snippet": " self._default_handler(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L105_C4", "label": "on_result", "type": "function", "loc": [105, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "vector": [2, 1, 0.4141, 0.0117, 1, 0.37, 0.7143, 167, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "on_result", "arg_names": ["self", "record"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_result(self, record):\n \"\"\"Result record handler.\"\"\"\n self._default_handler(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L106_C8", "label": "expression", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L105_C4", "vector": [8, 2, 0.4141, 0.0039, 2, 0.92, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Result record handler.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L107_C8", "label": "_default_handler()", "type": "expression", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L105_C4", "vector": [8, 2, 0.418, 0.0039, 2, 0.92, 1.0, 523, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_default_handler", "arg_names": [], "import_names": [], "rhs_call_name": "_default_handler", "annotation": ""}, "snippet": " self._default_handler(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L109_C4", "label": "on_scientific", "type": "function", "loc": [109, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "vector": [2, 1, 0.4297, 0.0117, 1, 0.37, 0.7857, 155, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "on_scientific", "arg_names": ["self", "record"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_scientific(self, record):\n \"\"\"Scientific record handler.\"\"\"\n self._default_handler(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L110_C8", "label": "expression", "type": "expression", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L109_C4", "vector": [8, 2, 0.4297, 0.0039, 2, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Scientific record handler.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L111_C8", "label": "_default_handler()", "type": "expression", "loc": [111, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L109_C4", "vector": [8, 2, 0.4336, 0.0039, 2, 0.67, 1.0, 523, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_default_handler", "arg_names": [], "import_names": [], "rhs_call_name": "_default_handler", "annotation": ""}, "snippet": " self._default_handler(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L113_C4", "label": "on_manufacturer_info", "type": "function", "loc": [113, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "vector": [2, 1, 0.4453, 0.0117, 1, 0.37, 0.8571, 801, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "on_manufacturer_info", "arg_names": ["self", "record"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_manufacturer_info(self, record):\n \"\"\"Manufacturer information record handler.\"\"\"\n self._default_handler(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L114_C8", "label": "expression", "type": "expression", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L113_C4", "vector": [8, 2, 0.4453, 0.0039, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Manufacturer information record handler.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L115_C8", "label": "_default_handler()", "type": "expression", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L113_C4", "vector": [8, 2, 0.4492, 0.0039, 2, 0.88, 1.0, 523, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_default_handler", "arg_names": [], "import_names": [], "rhs_call_name": "_default_handler", "annotation": ""}, "snippet": " self._default_handler(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L117_C4", "label": "on_terminator", "type": "function", "loc": [117, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "vector": [2, 1, 0.4609, 0.0117, 1, 0.37, 0.9286, 62, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "on_terminator", "arg_names": ["self", "record"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_terminator(self, record):\n \"\"\"Terminator record handler.\"\"\"\n self._default_handler(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L118_C8", "label": "expression", "type": "expression", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L117_C4", "vector": [8, 2, 0.4609, 0.0039, 2, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Terminator record handler.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L119_C8", "label": "_default_handler()", "type": "expression", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L117_C4", "vector": [8, 2, 0.4648, 0.0039, 2, 0.71, 1.0, 523, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_default_handler", "arg_names": [], "import_names": [], "rhs_call_name": "_default_handler", "annotation": ""}, "snippet": " self._default_handler(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L121_C4", "label": "on_unknown", "type": "function", "loc": [121, 123], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "vector": [2, 1, 0.4766, 0.0117, 1, 0.37, 1.0, 440, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "on_unknown", "arg_names": ["self", "record"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_unknown(self, record):\n \"\"\"Fallback handler for dispatcher.\"\"\"\n self._default_handler(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L122_C8", "label": "expression", "type": "expression", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L121_C4", "vector": [8, 2, 0.4766, 0.0039, 2, 0.93, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Fallback handler for dispatcher.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L123_C8", "label": "_default_handler()", "type": "expression", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L121_C4", "vector": [8, 2, 0.4805, 0.0039, 2, 0.93, 1.0, 523, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_default_handler", "arg_names": [], "import_names": [], "rhs_call_name": "_default_handler", "annotation": ""}, "snippet": " self._default_handler(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L126_C0", "label": "RequestHandler", "type": "class", "loc": [126, 199], "level": 0, "parent": null, "vector": [3, 0, 0.6348, 0.2891, 0, 0.66, 0.9091, 200, 0, 9, 0, 0, 400, 0, 21], "semantic": {"name": "RequestHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RequestHandler(ASTMProtocol):\n \"\"\"ASTM protocol request handler.\n\n :param sock: Socket object.\n\n :param dispatcher: Request handler records dispatcher instance.\n :type dispatcher: :class:`BaseRecordsDispatcher`\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L127_C4", "label": "expression", "type": "expression", "loc": [127, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L126_C0", "vector": [8, 1, 0.5156, 0.043, 1, 0.06, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"ASTM protocol request handler.\n\n :param sock: Socket object.\n\n :param dispatcher: Request handler records dispatcher instance.\n :type dispatcher: :class:`BaseRecordsDispatcher`\n\n :param timeout: Number of seconds to wait for incoming data before"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L138_C4", "label": "__init__", "type": "function", "loc": [138, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L126_C0", "vector": [2, 1, 0.5527, 0.0312, 1, 0.06, 0.1111, 555, 0, 4, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "sock", "dispatcher", "timeout"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, sock, dispatcher, timeout=None):\n super(RequestHandler, self).__init__(sock, timeout=timeout)\n self._chunks = []\n host, port = sock.getpeername() if sock is not None else (None, None)\n self.client_info = {'host': host, 'port': port}\n self.dispatcher = dispatcher\n self._is_transfer_state = False\n self.terminator = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L139_C8", "label": "__init__()", "type": "expression", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L138_C4", "vector": [8, 2, 0.543, 0.0039, 2, 0.84, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(RequestHandler, self).__init__(sock, timeout=timeout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L140_C8", "label": "self._chunks =", "type": "assigned_variable", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L138_C4", "vector": [14, 2, 0.5469, 0.0039, 2, 0.84, 0.1667, 232, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self._chunks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._chunks = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L141_C8", "label": "host, port =", "type": "assigned_variable", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L138_C4", "vector": [14, 2, 0.5508, 0.0039, 2, 0.84, 0.3333, 364, 8, 0, 0, 0, 0, 0, 1], "semantic": {"name": "host, port", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " host, port = sock.getpeername() if sock is not None else (None, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L142_C8", "label": "self.client_info =", "type": "assigned_variable", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L138_C4", "vector": [14, 2, 0.5547, 0.0039, 2, 0.84, 0.5, 849, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.client_info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.client_info = {'host': host, 'port': port}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L143_C8", "label": "self.dispatcher =", "type": "assigned_variable", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L138_C4", "vector": [14, 2, 0.5586, 0.0039, 2, 0.84, 0.6667, 352, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.dispatcher", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dispatcher = dispatcher"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L144_C8", "label": "self._is_transfer_state =", "type": "assigned_variable", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L138_C4", "vector": [14, 2, 0.5625, 0.0039, 2, 0.84, 0.8333, 720, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self._is_transfer_state", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._is_transfer_state = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L145_C8", "label": "self.terminator =", "type": "assigned_variable", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L138_C4", "vector": [14, 2, 0.5664, 0.0039, 2, 0.84, 1.0, 568, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.terminator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.terminator = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L147_C4", "label": "on_enq", "type": "function", "loc": [147, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L126_C0", "vector": [2, 1, 0.5879, 0.0312, 1, 0.06, 0.2222, 197, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "on_enq", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_enq(self):\n if not self._is_transfer_state:\n self._is_transfer_state = True\n self.terminator = [CRLF, EOT]\n return ACK\n else:\n log.error('ENQ is not expected')\n return NAK"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L148_C8", "label": "if", "type": "if", "loc": [148, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L147_C4", "vector": [4, 2, 0.5898, 0.0273, 2, 0.11, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self._is_transfer_state:\n self._is_transfer_state = True\n self.terminator = [CRLF, EOT]\n return ACK\n else:\n log.error('ENQ is not expected')\n return NAK"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L149_C12", "label": "self._is_transfer_state =", "type": "assigned_variable", "loc": [149, 149], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L148_C8", "vector": [14, 3, 0.582, 0.0039, 3, 0.35, 0.0, 720, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self._is_transfer_state", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._is_transfer_state = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L150_C12", "label": "self.terminator =", "type": "assigned_variable", "loc": [150, 150], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L148_C8", "vector": [14, 3, 0.5859, 0.0039, 3, 0.35, 0.25, 568, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.terminator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.terminator = [CRLF, EOT]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Return_L151_C12", "label": "return", "type": "return", "loc": [151, 151], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L148_C8", "vector": [13, 3, 0.5898, 0.0039, 3, 0.35, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ACK"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L153_C12", "label": "error()", "type": "expression", "loc": [153, 153], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L148_C8", "vector": [8, 3, 0.5977, 0.0039, 3, 0.35, 0.75, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " log.error('ENQ is not expected')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Return_L154_C12", "label": "return", "type": "return", "loc": [154, 154], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L148_C8", "vector": [13, 3, 0.6016, 0.0039, 3, 0.35, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return NAK"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L156_C4", "label": "on_ack", "type": "function", "loc": [156, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L126_C0", "vector": [2, 1, 0.6113, 0.0078, 1, 0.06, 0.3333, 6, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "on_ack", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_ack(self):\n raise NotAccepted('Server should not be ACKed.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L159_C4", "label": "on_nak", "type": "function", "loc": [159, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L126_C0", "vector": [2, 1, 0.623, 0.0078, 1, 0.06, 0.4444, 54, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "on_nak", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_nak(self):\n raise NotAccepted('Server should not be NAKed.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L162_C4", "label": "on_eot", "type": "function", "loc": [162, 167], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L126_C0", "vector": [2, 1, 0.6426, 0.0234, 1, 0.06, 0.5556, 163, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "on_eot", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_eot(self):\n if self._is_transfer_state:\n self._is_transfer_state = False\n self.terminator = 1\n else:\n raise InvalidState('Server is not ready to accept EOT message.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L163_C8", "label": "if", "type": "if", "loc": [163, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L162_C4", "vector": [4, 2, 0.6445, 0.0195, 2, 0.05, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._is_transfer_state:\n self._is_transfer_state = False\n self.terminator = 1\n else:\n raise InvalidState('Server is not ready to accept EOT message.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L164_C12", "label": "self._is_transfer_state =", "type": "assigned_variable", "loc": [164, 164], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L163_C8", "vector": [14, 3, 0.6406, 0.0039, 3, 0.52, 0.0, 720, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self._is_transfer_state", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._is_transfer_state = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L165_C12", "label": "self.terminator =", "type": "assigned_variable", "loc": [165, 165], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L163_C8", "vector": [14, 3, 0.6445, 0.0039, 3, 0.52, 1.0, 568, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.terminator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.terminator = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L169_C4", "label": "on_message", "type": "function", "loc": [169, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L126_C0", "vector": [2, 1, 0.6797, 0.043, 1, 0.06, 0.6667, 365, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "on_message", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_message(self):\n if not self._is_transfer_state:\n self.discard_input_buffers()\n return NAK\n else:\n try:\n self.handle_message(self._last_recv_data)\n return ACK"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L170_C8", "label": "if", "type": "if", "loc": [170, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L169_C4", "vector": [4, 2, 0.6816, 0.0391, 2, 0.2, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self._is_transfer_state:\n self.discard_input_buffers()\n return NAK\n else:\n try:\n self.handle_message(self._last_recv_data)\n return ACK\n except Exception:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L171_C12", "label": "discard_input_buffers()", "type": "expression", "loc": [171, 171], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L170_C8", "vector": [8, 3, 0.668, 0.0039, 3, 0.05, 0.0, 629, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "discard_input_buffers", "arg_names": [], "import_names": [], "rhs_call_name": "discard_input_buffers", "annotation": ""}, "snippet": " self.discard_input_buffers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Return_L172_C12", "label": "return", "type": "return", "loc": [172, 172], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L170_C8", "vector": [13, 3, 0.6719, 0.0039, 3, 0.05, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return NAK"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Try_L174_C12", "label": "try", "type": "try", "loc": [174, 179], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L170_C8", "vector": [7, 3, 0.6895, 0.0234, 3, 0.05, 1.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.handle_message(self._last_recv_data)\n return ACK\n except Exception:\n log.exception('Error occurred on message handling.')\n return NAK"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L175_C16", "label": "handle_message()", "type": "expression", "loc": [175, 175], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:Try_L174_C12", "vector": [8, 4, 0.6836, 0.0039, 4, 0.83, 0.0, 207, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "handle_message", "arg_names": [], "import_names": [], "rhs_call_name": "handle_message", "annotation": ""}, "snippet": " self.handle_message(self._last_recv_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Return_L176_C16", "label": "return", "type": "return", "loc": [176, 176], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:Try_L174_C12", "vector": [13, 4, 0.6875, 0.0039, 4, 0.83, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ACK"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L178_C16", "label": "exception()", "type": "expression", "loc": [178, 178], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:Try_L174_C12", "vector": [8, 4, 0.6953, 0.0039, 4, 0.83, 0.0, 69, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exception", "arg_names": [], "import_names": [], "rhs_call_name": "exception", "annotation": ""}, "snippet": " log.exception('Error occurred on message handling.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Return_L179_C16", "label": "return", "type": "return", "loc": [179, 179], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:Try_L174_C12", "vector": [13, 4, 0.6992, 0.0039, 4, 0.83, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return NAK"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L181_C4", "label": "handle_message", "type": "function", "loc": [181, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L126_C0", "vector": [2, 1, 0.7246, 0.0391, 1, 0.06, 0.7778, 207, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "handle_message", "arg_names": ["self", "message"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_message(self, message):\n self.is_chunked_transfer = is_chunked_message(message)\n if self.is_chunked_transfer:\n self._chunks.append(message)\n elif self._chunks:\n self._chunks.append(message)\n self.dispatcher(join(self._chunks))\n self._chunks = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L182_C8", "label": "self.is_chunked_transfer = is_chunked_message()", "type": "assigned_variable", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L181_C4", "vector": [14, 2, 0.7109, 0.0039, 2, 0.52, 0.0, 520, 3, 1, 0, 0, 668, 10, 1], "semantic": {"name": "self.is_chunked_transfer", "arg_names": [], "import_names": [], "rhs_call_name": "is_chunked_message", "annotation": ""}, "snippet": " self.is_chunked_transfer = is_chunked_message(message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L183_C8", "label": "if", "type": "if", "loc": [183, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L181_C4", "vector": [4, 2, 0.7285, 0.0312, 2, 0.52, 1.0, 0, 7, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.is_chunked_transfer:\n self._chunks.append(message)\n elif self._chunks:\n self._chunks.append(message)\n self.dispatcher(join(self._chunks))\n self._chunks = []\n else:\n self.dispatcher(message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L184_C12", "label": "append()", "type": "expression", "loc": [184, 184], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L183_C8", "vector": [8, 3, 0.7188, 0.0039, 3, 0.07, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self._chunks.append(message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L185_C8", "label": "if", "type": "if", "loc": [185, 190], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L183_C8", "vector": [4, 3, 0.7324, 0.0234, 3, 0.07, 1.0, 0, 7, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self._chunks:\n self._chunks.append(message)\n self.dispatcher(join(self._chunks))\n self._chunks = []\n else:\n self.dispatcher(message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L186_C12", "label": "append()", "type": "expression", "loc": [186, 186], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L185_C8", "vector": [8, 4, 0.7266, 0.0039, 4, 0.77, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self._chunks.append(message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L187_C12", "label": "dispatcher()", "type": "expression", "loc": [187, 187], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L185_C8", "vector": [8, 4, 0.7305, 0.0039, 4, 0.77, 0.3333, 350, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "dispatcher", "arg_names": [], "import_names": [], "rhs_call_name": "dispatcher", "annotation": ""}, "snippet": " self.dispatcher(join(self._chunks))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L188_C12", "label": "self._chunks =", "type": "assigned_variable", "loc": [188, 188], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L185_C8", "vector": [14, 4, 0.7344, 0.0039, 4, 0.77, 0.6667, 232, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self._chunks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._chunks = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L190_C12", "label": "dispatcher()", "type": "expression", "loc": [190, 190], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L185_C8", "vector": [8, 4, 0.7422, 0.0039, 4, 0.77, 1.0, 350, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "dispatcher", "arg_names": [], "import_names": [], "rhs_call_name": "dispatcher", "annotation": ""}, "snippet": " self.dispatcher(message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L192_C4", "label": "discard_input_buffers", "type": "function", "loc": [192, 194], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L126_C0", "vector": [2, 1, 0.7539, 0.0117, 1, 0.06, 0.8889, 629, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "discard_input_buffers", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def discard_input_buffers(self):\n self._chunks = []\n return super(RequestHandler, self).discard_input_buffers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L193_C8", "label": "self._chunks =", "type": "assigned_variable", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L192_C4", "vector": [14, 2, 0.7539, 0.0039, 2, 0.86, 0.0, 232, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self._chunks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._chunks = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Return_L194_C8", "label": "return", "type": "return", "loc": [194, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L192_C4", "vector": [13, 2, 0.7578, 0.0039, 2, 0.86, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return super(RequestHandler, self).discard_input_buffers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L196_C4", "label": "on_timeout", "type": "function", "loc": [196, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L126_C0", "vector": [2, 1, 0.7715, 0.0156, 1, 0.06, 1.0, 68, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "on_timeout", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_timeout(self):\n \"\"\"Closes connection on timeout.\"\"\"\n super(RequestHandler, self).on_timeout()\n self.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L197_C8", "label": "expression", "type": "expression", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L196_C4", "vector": [8, 2, 0.7695, 0.0039, 2, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Closes connection on timeout.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L198_C8", "label": "on_timeout()", "type": "expression", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L196_C4", "vector": [8, 2, 0.7734, 0.0039, 2, 0.84, 0.5, 68, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "on_timeout", "arg_names": [], "import_names": [], "rhs_call_name": "on_timeout", "annotation": ""}, "snippet": " super(RequestHandler, self).on_timeout()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L199_C8", "label": "close()", "type": "expression", "loc": [199, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L196_C4", "vector": [8, 2, 0.7773, 0.0039, 2, 0.84, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " self.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L202_C0", "label": "Server", "type": "class", "loc": [202, 256], "level": 0, "parent": null, "vector": [3, 0, 0.8945, 0.2148, 0, 0.66, 1.0, 630, 0, 3, 0, 0, 958, 0, 12], "semantic": {"name": "Server", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Server(Dispatcher):\n \"\"\"Asyncore driven ASTM server.\n\n :param host: Server IP address or hostname.\n :type host: str\n\n :param port: Server port number.\n :type port: int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L203_C4", "label": "expression", "type": "expression", "loc": [203, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L202_C0", "vector": [8, 1, 0.834, 0.0859, 1, 0.51, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Asyncore driven ASTM server.\n\n :param host: Server IP address or hostname.\n :type host: str\n\n :param port: Server port number.\n :type port: int\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L226_C4", "label": "request =", "type": "assigned_variable", "loc": [226, 226], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L202_C0", "vector": [14, 1, 0.8828, 0.0039, 1, 0.51, 0.2, 50, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request = RequestHandler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L227_C4", "label": "dispatcher =", "type": "assigned_variable", "loc": [227, 227], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L202_C0", "vector": [14, 1, 0.8867, 0.0039, 1, 0.51, 0.4, 350, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dispatcher", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dispatcher = BaseRecordsDispatcher"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L229_C4", "label": "__init__", "type": "function", "loc": [229, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L202_C0", "vector": [2, 1, 0.9219, 0.0586, 1, 0.51, 0.6, 555, 0, 7, 0, 0, 0, 0, 6], "semantic": {"name": "__init__", "arg_names": ["self", "host", "port", "request", "dispatcher", "timeout", "encoding"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, host='localhost', port=15200,\n request=None, dispatcher=None,\n timeout=None, encoding=None):\n super(Server, self).__init__()\n self.create_socket(socket.AF_INET, socket.SOCK_STREAM)\n self.set_reuse_addr()\n self.bind((host, port))\n self.listen(5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L232_C8", "label": "__init__()", "type": "expression", "loc": [232, 232], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L229_C4", "vector": [8, 2, 0.9062, 0.0039, 2, 0.62, 0.0, 555, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Server, self).__init__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L233_C8", "label": "create_socket()", "type": "expression", "loc": [233, 233], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L229_C4", "vector": [8, 2, 0.9102, 0.0039, 2, 0.62, 0.1111, 444, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "create_socket", "arg_names": [], "import_names": [], "rhs_call_name": "create_socket", "annotation": ""}, "snippet": " self.create_socket(socket.AF_INET, socket.SOCK_STREAM)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L234_C8", "label": "set_reuse_addr()", "type": "expression", "loc": [234, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L229_C4", "vector": [8, 2, 0.9141, 0.0039, 2, 0.62, 0.2222, 935, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "set_reuse_addr", "arg_names": [], "import_names": [], "rhs_call_name": "set_reuse_addr", "annotation": ""}, "snippet": " self.set_reuse_addr()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L235_C8", "label": "bind()", "type": "expression", "loc": [235, 235], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L229_C4", "vector": [8, 2, 0.918, 0.0039, 2, 0.62, 0.3333, 640, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "bind", "arg_names": [], "import_names": [], "rhs_call_name": "bind", "annotation": ""}, "snippet": " self.bind((host, port))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L236_C8", "label": "listen()", "type": "expression", "loc": [236, 236], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L229_C4", "vector": [8, 2, 0.9219, 0.0039, 2, 0.62, 0.4444, 265, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "listen", "arg_names": [], "import_names": [], "rhs_call_name": "listen", "annotation": ""}, "snippet": " self.listen(5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L237_C8", "label": "self.pool =", "type": "assigned_variable", "loc": [237, 237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L229_C4", "vector": [14, 2, 0.9258, 0.0039, 2, 0.62, 0.5556, 65, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.pool", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pool = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L238_C8", "label": "self.timeout =", "type": "assigned_variable", "loc": [238, 238], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L229_C4", "vector": [14, 2, 0.9297, 0.0039, 2, 0.62, 0.6667, 621, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.timeout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.timeout = timeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L239_C8", "label": "self.encoding =", "type": "assigned_variable", "loc": [239, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L229_C4", "vector": [14, 2, 0.9336, 0.0039, 2, 0.62, 0.7778, 564, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.encoding = encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L240_C8", "label": "if", "type": "if", "loc": [240, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L229_C4", "vector": [4, 2, 0.9395, 0.0078, 2, 0.62, 0.8889, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request is not None:\n self.request = request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L241_C12", "label": "self.request =", "type": "assigned_variable", "loc": [241, 241], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L240_C8", "vector": [14, 3, 0.9414, 0.0039, 3, 0.79, 0.0, 952, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.request = request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L242_C8", "label": "if", "type": "if", "loc": [242, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L229_C4", "vector": [4, 2, 0.9473, 0.0078, 2, 0.62, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if dispatcher is not None:\n self.dispatcher = dispatcher"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L243_C12", "label": "self.dispatcher =", "type": "assigned_variable", "loc": [243, 243], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L242_C8", "vector": [14, 3, 0.9492, 0.0039, 3, 0.26, 0.0, 352, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.dispatcher", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dispatcher = dispatcher"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L245_C4", "label": "handle_accept", "type": "function", "loc": [245, 251], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L202_C0", "vector": [2, 1, 0.9688, 0.0273, 1, 0.51, 0.8, 137, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "handle_accept", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_accept(self):\n pair = self.accept()\n if pair is None:\n return\n sock, addr = pair\n self.request(sock, self.dispatcher(self.encoding), timeout=self.timeout)\n super(Server, self).handle_accept()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L246_C8", "label": "pair = accept()", "type": "assigned_variable", "loc": [246, 246], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L245_C4", "vector": [14, 2, 0.9609, 0.0039, 2, 0.44, 0.0, 825, 3, 0, 0, 0, 829, 10, 1], "semantic": {"name": "pair", "arg_names": [], "import_names": [], "rhs_call_name": "accept", "annotation": ""}, "snippet": " pair = self.accept()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L247_C8", "label": "if", "type": "if", "loc": [247, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L245_C4", "vector": [4, 2, 0.9668, 0.0078, 2, 0.44, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if pair is None:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Return_L248_C12", "label": "return", "type": "return", "loc": [248, 248], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L247_C8", "vector": [13, 3, 0.9688, 0.0039, 3, 0.53, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L249_C8", "label": "sock, addr =", "type": "assigned_variable", "loc": [249, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L245_C4", "vector": [14, 2, 0.9727, 0.0039, 2, 0.44, 0.5, 775, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sock, addr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sock, addr = pair"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L250_C8", "label": "request()", "type": "expression", "loc": [250, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L245_C4", "vector": [8, 2, 0.9766, 0.0039, 2, 0.44, 0.75, 50, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "request", "annotation": ""}, "snippet": " self.request(sock, self.dispatcher(self.encoding), timeout=self.timeout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L251_C8", "label": "handle_accept()", "type": "expression", "loc": [251, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L245_C4", "vector": [8, 2, 0.9805, 0.0039, 2, 0.44, 1.0, 137, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "handle_accept", "arg_names": [], "import_names": [], "rhs_call_name": "handle_accept", "annotation": ""}, "snippet": " super(Server, self).handle_accept()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L253_C4", "label": "serve_forever", "type": "function", "loc": [253, 256], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L202_C0", "vector": [2, 1, 0.9941, 0.0156, 1, 0.51, 1.0, 993, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "serve_forever", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serve_forever(self, *args, **kwargs):\n \"\"\"Enters into the :func:`polling loop <asynclib.loop>` to let server\n handle incoming requests.\"\"\"\n loop(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L254_C8", "label": "expression", "type": "expression", "loc": [254, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L253_C4", "vector": [8, 2, 0.9941, 0.0078, 2, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Enters into the :func:`polling loop <asynclib.loop>` to let server\n handle incoming requests.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L256_C8", "label": "loop()", "type": "expression", "loc": [256, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L253_C4", "vector": [8, 2, 1.0, 0.0039, 2, 0.57, 1.0, 848, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "loop", "arg_names": [], "import_names": [], "rhs_call_name": "loop", "annotation": ""}, "snippet": " loop(*args, **kwargs)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:For_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:For_L77_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Return_L83_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Return_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L126_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L126_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L126_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L147_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L148_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L149_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L148_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L150_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L148_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Return_L151_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L148_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L148_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Return_L154_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L126_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L126_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L126_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L163_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L164_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L163_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L165_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L126_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L169_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L171_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Return_L172_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Try_L174_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:Try_L174_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L175_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:Try_L174_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Return_L176_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:Try_L174_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L178_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:Try_L174_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Return_L179_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L126_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L181_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L182_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L181_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L183_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L184_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L183_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L185_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L185_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L186_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L185_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L187_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L185_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L188_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L185_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L190_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L126_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Return_L194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L126_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L196_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L196_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L196_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L196_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L199_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L203_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L226_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L229_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L229_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L232_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L229_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L233_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L229_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L234_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L229_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L235_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L229_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L236_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L229_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L237_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L229_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L238_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L229_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L239_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L229_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L240_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L241_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L229_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L242_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L242_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L243_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L245_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L246_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L247_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:If_L247_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Return_L248_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Assign_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L250_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:ClassDef_L202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L253_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L254_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1034:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1034:Expr_L256_C8"}]
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # import logging from .asynclib import AsyncChat, call_later from .records import HeaderRecord, TerminatorRecord from .constants import STX, ENQ, ACK, NAK, EOT, ENCODING log = logging.getLogger(__name__) __all__ = ['ASTMProtocol'] class ASTMProtocol(AsyncChat): """Common ASTM protocol routines.""" #: ASTM header record class. astm_header = HeaderRecord #: ASTM terminator record class. astm_terminator = TerminatorRecord #: Flag about chunked transfer. is_chunked_transfer = None #: IO timer timer = None encoding = ENCODING strip_terminator = False _last_recv_data = None _last_sent_data = None def __init__(self, sock=None, map=None, timeout=None): super(ASTMProtocol, self).__init__(sock, map) if timeout is not None: self.timer = call_later(timeout, self.on_timeout) def found_terminator(self): while self.inbox: data = self.inbox.popleft() if not data: continue self.dispatch(data) def dispatch(self, data): """Dispatcher of received data.""" self._last_recv_data = data if data == ENQ: handler = self.on_enq elif data == ACK: handler = self.on_ack elif data == NAK: handler = self.on_nak elif data == EOT: handler = self.on_eot elif data.startswith(STX): # this looks like a message handler = self.on_message else: handler = lambda: self.default_handler(data) resp = handler() if resp is not None: self.push(resp) def default_handler(self, data): raise ValueError('Unable to dispatch data: %r', data) def push(self, data): self._last_sent_data = data if self.timer is not None and not self.timer.cancelled: self.timer.reset() return super(ASTMProtocol, self).push(data) def on_enq(self): """Calls on <ENQ> message receiving.""" def on_ack(self): """Calls on <ACK> message receiving.""" def on_nak(self): """Calls on <NAK> message receiving.""" def on_eot(self): """Calls on <EOT> message receiving.""" def on_message(self): """Calls on ASTM message receiving.""" def on_timeout(self): """Calls when timeout event occurs. Used to limit waiting time for response data.""" log.warning('Communication timeout') def handle_read(self): if self.timer is not None and not self.timer.cancelled: self.timer.reset() super(ASTMProtocol, self).handle_read() def handle_close(self): if self.timer is not None and not self.timer.cancelled: self.timer.cancel() super(ASTMProtocol, self).handle_close()
ajibawa-2023/Python-Code-Large/train/row_1035
69
107
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Import_L10_C0", "label": "logging import logging", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0935, 0.0093, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:ImportFrom_L11_C0", "label": "from asynclib import AsyncChat, call_later", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1028, 0.0093, 0, 0.66, 0.1667, 591, 0, 2, 0, 0, 591, 0, 0], "semantic": {"name": "asynclib", "arg_names": [], "import_names": ["AsyncChat", "call_later"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .asynclib import AsyncChat, call_later"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:ImportFrom_L12_C0", "label": "from records import HeaderRecord, TerminatorRecord", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.1121, 0.0093, 0, 0.66, 0.3333, 186, 0, 2, 0, 0, 186, 0, 0], "semantic": {"name": "records", "arg_names": [], "import_names": ["HeaderRecord", "TerminatorRecord"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .records import HeaderRecord, TerminatorRecord"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:ImportFrom_L13_C0", "label": "from constants import STX, ENQ, ACK\u2026", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.1215, 0.0093, 0, 0.66, 0.5, 208, 0, 6, 0, 0, 208, 0, 0], "semantic": {"name": "constants", "arg_names": [], "import_names": ["STX", "ENQ", "ACK", "NAK", "EOT", "ENCODING"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .constants import STX, ENQ, ACK, NAK, EOT, ENCODING"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L15_C0", "label": "log = getLogger()", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.1402, 0.0093, 0, 0.66, 0.6667, 432, 3, 1, 0, 0, 71, 10, 1], "semantic": {"name": "log", "arg_names": [], "import_names": [], "rhs_call_name": "getLogger", "annotation": ""}, "snippet": "log = logging.getLogger(__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L17_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.1589, 0.0093, 0, 0.66, 0.8333, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = ['ASTMProtocol']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "label": "ASTMProtocol", "type": "class", "loc": [20, 107], "level": 0, "parent": null, "vector": [3, 0, 0.5935, 0.8224, 0, 0.66, 1.0, 400, 0, 13, 0, 0, 658, 0, 20], "semantic": {"name": "ASTMProtocol", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ASTMProtocol(AsyncChat):\n \"\"\"Common ASTM protocol routines.\"\"\"\n\n #: ASTM header record class.\n astm_header = HeaderRecord\n #: ASTM terminator record class.\n astm_terminator = TerminatorRecord\n #: Flag about chunked transfer."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L21_C4", "label": "expression", "type": "expression", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "vector": [8, 1, 0.1963, 0.0093, 1, 0.63, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Common ASTM protocol routines.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L24_C4", "label": "astm_header =", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "vector": [14, 1, 0.2243, 0.0093, 1, 0.63, 0.0476, 266, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "astm_header", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " astm_header = HeaderRecord"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L26_C4", "label": "astm_terminator =", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "vector": [14, 1, 0.243, 0.0093, 1, 0.63, 0.0952, 498, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "astm_terminator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " astm_terminator = TerminatorRecord"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L28_C4", "label": "is_chunked_transfer =", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "vector": [14, 1, 0.2617, 0.0093, 1, 0.63, 0.1429, 288, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "is_chunked_transfer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " is_chunked_transfer = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L30_C4", "label": "timer =", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "vector": [14, 1, 0.2804, 0.0093, 1, 0.63, 0.1905, 541, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "timer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " timer = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L32_C4", "label": "encoding =", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "vector": [14, 1, 0.2991, 0.0093, 1, 0.63, 0.2381, 325, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " encoding = ENCODING"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L33_C4", "label": "strip_terminator =", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "vector": [14, 1, 0.3084, 0.0093, 1, 0.63, 0.2857, 211, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "strip_terminator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " strip_terminator = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L34_C4", "label": "_last_recv_data =", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "vector": [14, 1, 0.3178, 0.0093, 1, 0.63, 0.3333, 85, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "_last_recv_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _last_recv_data = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L35_C4", "label": "_last_sent_data =", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "vector": [14, 1, 0.3271, 0.0093, 1, 0.63, 0.381, 985, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "_last_sent_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _last_sent_data = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L37_C4", "label": "__init__", "type": "function", "loc": [37, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "vector": [2, 1, 0.3598, 0.0374, 1, 0.63, 0.4286, 555, 0, 4, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "sock", "map", "timeout"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, sock=None, map=None, timeout=None):\n super(ASTMProtocol, self).__init__(sock, map)\n if timeout is not None:\n self.timer = call_later(timeout, self.on_timeout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L38_C8", "label": "__init__()", "type": "expression", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L37_C4", "vector": [8, 2, 0.3551, 0.0093, 2, 0.88, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(ASTMProtocol, self).__init__(sock, map)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L39_C8", "label": "if", "type": "if", "loc": [39, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L37_C4", "vector": [4, 2, 0.3692, 0.0187, 2, 0.88, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if timeout is not None:\n self.timer = call_later(timeout, self.on_timeout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L40_C12", "label": "self.timer = call_later()", "type": "assigned_variable", "loc": [40, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L39_C8", "vector": [14, 3, 0.3738, 0.0093, 3, 0.16, 0.0, 407, 3, 2, 0, 0, 824, 10, 1], "semantic": {"name": "self.timer", "arg_names": [], "import_names": [], "rhs_call_name": "call_later", "annotation": ""}, "snippet": " self.timer = call_later(timeout, self.on_timeout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L42_C4", "label": "found_terminator", "type": "function", "loc": [42, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "vector": [2, 1, 0.4159, 0.0561, 1, 0.63, 0.4762, 372, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "found_terminator", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def found_terminator(self):\n while self.inbox:\n data = self.inbox.popleft()\n if not data:\n continue\n self.dispatch(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:While_L43_C8", "label": "while", "type": "while", "loc": [43, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L42_C4", "vector": [5, 2, 0.4206, 0.0467, 2, 0.45, 0.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while self.inbox:\n data = self.inbox.popleft()\n if not data:\n continue\n self.dispatch(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L44_C12", "label": "data = popleft()", "type": "assigned_variable", "loc": [44, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:While_L43_C8", "vector": [14, 3, 0.4112, 0.0093, 3, 0.6, 0.0, 929, 3, 0, 0, 0, 285, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "popleft", "annotation": ""}, "snippet": " data = self.inbox.popleft()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L45_C12", "label": "if", "type": "if", "loc": [45, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:While_L43_C8", "vector": [4, 3, 0.4252, 0.0187, 3, 0.6, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not data:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L47_C12", "label": "dispatch()", "type": "expression", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:While_L43_C8", "vector": [8, 3, 0.4393, 0.0093, 3, 0.6, 1.0, 416, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "dispatch", "annotation": ""}, "snippet": " self.dispatch(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L49_C4", "label": "dispatch", "type": "function", "loc": [49, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "vector": [2, 1, 0.5467, 0.1869, 1, 0.63, 0.5238, 416, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "dispatch", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def dispatch(self, data):\n \"\"\"Dispatcher of received data.\"\"\"\n self._last_recv_data = data\n if data == ENQ:\n handler = self.on_enq\n elif data == ACK:\n handler = self.on_ack\n elif data == NAK:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L50_C8", "label": "expression", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L49_C4", "vector": [8, 2, 0.4673, 0.0093, 2, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Dispatcher of received data.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L51_C8", "label": "self._last_recv_data =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L49_C4", "vector": [14, 2, 0.4766, 0.0093, 2, 0.26, 0.25, 793, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._last_recv_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._last_recv_data = data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L52_C8", "label": "if", "type": "if", "loc": [52, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L49_C4", "vector": [4, 2, 0.5374, 0.1121, 2, 0.26, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if data == ENQ:\n handler = self.on_enq\n elif data == ACK:\n handler = self.on_ack\n elif data == NAK:\n handler = self.on_nak\n elif data == EOT:\n handler = self.on_eot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L53_C12", "label": "handler =", "type": "assigned_variable", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L52_C8", "vector": [14, 3, 0.4953, 0.0093, 3, 0.36, 0.0, 388, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "handler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " handler = self.on_enq"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L54_C8", "label": "if", "type": "if", "loc": [54, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L52_C8", "vector": [4, 3, 0.5467, 0.0935, 3, 0.36, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif data == ACK:\n handler = self.on_ack\n elif data == NAK:\n handler = self.on_nak\n elif data == EOT:\n handler = self.on_eot\n elif data.startswith(STX): # this looks like a message\n handler = self.on_message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L55_C12", "label": "handler =", "type": "assigned_variable", "loc": [55, 55], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L54_C8", "vector": [14, 4, 0.514, 0.0093, 4, 0.21, 0.0, 388, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "handler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " handler = self.on_ack"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L56_C8", "label": "if", "type": "if", "loc": [56, 63], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L54_C8", "vector": [4, 4, 0.5561, 0.0748, 4, 0.21, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif data == NAK:\n handler = self.on_nak\n elif data == EOT:\n handler = self.on_eot\n elif data.startswith(STX): # this looks like a message\n handler = self.on_message\n else:\n handler = lambda: self.default_handler(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L57_C12", "label": "handler =", "type": "assigned_variable", "loc": [57, 57], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L56_C8", "vector": [14, 5, 0.5327, 0.0093, 5, 0.55, 0.0, 388, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "handler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " handler = self.on_nak"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L58_C8", "label": "if", "type": "if", "loc": [58, 63], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L56_C8", "vector": [4, 5, 0.5654, 0.0561, 5, 0.55, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif data == EOT:\n handler = self.on_eot\n elif data.startswith(STX): # this looks like a message\n handler = self.on_message\n else:\n handler = lambda: self.default_handler(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L59_C12", "label": "handler =", "type": "assigned_variable", "loc": [59, 59], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L58_C8", "vector": [14, 6, 0.5514, 0.0093, 6, 0.39, 0.0, 388, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "handler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " handler = self.on_eot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L60_C8", "label": "if", "type": "if", "loc": [60, 63], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L58_C8", "vector": [4, 6, 0.5748, 0.0374, 6, 0.39, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif data.startswith(STX): # this looks like a message\n handler = self.on_message\n else:\n handler = lambda: self.default_handler(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L61_C12", "label": "handler =", "type": "assigned_variable", "loc": [61, 61], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L60_C8", "vector": [14, 7, 0.5701, 0.0093, 7, 0.07, 0.0, 388, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "handler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " handler = self.on_message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L63_C12", "label": "handler =", "type": "assigned_variable", "loc": [63, 63], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L60_C8", "vector": [14, 7, 0.5888, 0.0093, 7, 0.07, 1.0, 388, 9, 0, 0, 0, 0, 0, 1], "semantic": {"name": "handler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " handler = lambda: self.default_handler(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L65_C8", "label": "resp = handler()", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L49_C4", "vector": [14, 2, 0.6075, 0.0093, 2, 0.26, 0.75, 48, 3, 0, 0, 0, 388, 10, 1], "semantic": {"name": "resp", "arg_names": [], "import_names": [], "rhs_call_name": "handler", "annotation": ""}, "snippet": " resp = handler()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L67_C8", "label": "if", "type": "if", "loc": [67, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L49_C4", "vector": [4, 2, 0.6308, 0.0187, 2, 0.26, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if resp is not None:\n self.push(resp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L68_C12", "label": "push()", "type": "expression", "loc": [68, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L67_C8", "vector": [8, 3, 0.6355, 0.0093, 3, 0.8, 0.0, 176, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "push", "arg_names": [], "import_names": [], "rhs_call_name": "push", "annotation": ""}, "snippet": " self.push(resp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L70_C4", "label": "default_handler", "type": "function", "loc": [70, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "vector": [2, 1, 0.6589, 0.0187, 1, 0.63, 0.5714, 187, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "default_handler", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def default_handler(self, data):\n raise ValueError('Unable to dispatch data: %r', data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L73_C4", "label": "push", "type": "function", "loc": [73, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "vector": [2, 1, 0.7009, 0.0467, 1, 0.63, 0.619, 176, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "push", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def push(self, data):\n self._last_sent_data = data\n if self.timer is not None and not self.timer.cancelled:\n self.timer.reset()\n return super(ASTMProtocol, self).push(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L74_C8", "label": "self._last_sent_data =", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L73_C4", "vector": [14, 2, 0.6916, 0.0093, 2, 0.14, 0.0, 267, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._last_sent_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._last_sent_data = data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L75_C8", "label": "if", "type": "if", "loc": [75, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L73_C4", "vector": [4, 2, 0.7056, 0.0187, 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 self.timer is not None and not self.timer.cancelled:\n self.timer.reset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L76_C12", "label": "reset()", "type": "expression", "loc": [76, 76], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L75_C8", "vector": [8, 3, 0.7103, 0.0093, 3, 0.83, 0.0, 944, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reset", "arg_names": [], "import_names": [], "rhs_call_name": "reset", "annotation": ""}, "snippet": " self.timer.reset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Return_L77_C8", "label": "return", "type": "return", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L73_C4", "vector": [13, 2, 0.7196, 0.0093, 2, 0.14, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return super(ASTMProtocol, self).push(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L79_C4", "label": "on_enq", "type": "function", "loc": [79, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "vector": [2, 1, 0.743, 0.0187, 1, 0.63, 0.6667, 197, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "on_enq", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_enq(self):\n \"\"\"Calls on <ENQ> message receiving.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L80_C8", "label": "expression", "type": "expression", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L79_C4", "vector": [8, 2, 0.7477, 0.0093, 2, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Calls on <ENQ> message receiving.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L82_C4", "label": "on_ack", "type": "function", "loc": [82, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "vector": [2, 1, 0.771, 0.0187, 1, 0.63, 0.7143, 6, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "on_ack", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_ack(self):\n \"\"\"Calls on <ACK> message receiving.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L83_C8", "label": "expression", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L82_C4", "vector": [8, 2, 0.7757, 0.0093, 2, 0.96, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Calls on <ACK> message receiving.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L85_C4", "label": "on_nak", "type": "function", "loc": [85, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "vector": [2, 1, 0.7991, 0.0187, 1, 0.63, 0.7619, 54, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "on_nak", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_nak(self):\n \"\"\"Calls on <NAK> message receiving.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L86_C8", "label": "expression", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L85_C4", "vector": [8, 2, 0.8037, 0.0093, 2, 0.1, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Calls on <NAK> message receiving.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L88_C4", "label": "on_eot", "type": "function", "loc": [88, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "vector": [2, 1, 0.8271, 0.0187, 1, 0.63, 0.8095, 163, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "on_eot", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_eot(self):\n \"\"\"Calls on <EOT> message receiving.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L89_C8", "label": "expression", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L88_C4", "vector": [8, 2, 0.8318, 0.0093, 2, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Calls on <EOT> message receiving.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L91_C4", "label": "on_message", "type": "function", "loc": [91, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "vector": [2, 1, 0.8551, 0.0187, 1, 0.63, 0.8571, 365, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "on_message", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_message(self):\n \"\"\"Calls on ASTM message receiving.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L92_C8", "label": "expression", "type": "expression", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L91_C4", "vector": [8, 2, 0.8598, 0.0093, 2, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Calls on ASTM message receiving.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L94_C4", "label": "on_timeout", "type": "function", "loc": [94, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "vector": [2, 1, 0.8925, 0.0374, 1, 0.63, 0.9048, 68, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "on_timeout", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_timeout(self):\n \"\"\"Calls when timeout event occurs. Used to limit waiting time for\n response data.\"\"\"\n log.warning('Communication timeout')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L95_C8", "label": "expression", "type": "expression", "loc": [95, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L94_C4", "vector": [8, 2, 0.8925, 0.0187, 2, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Calls when timeout event occurs. Used to limit waiting time for\n response data.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L97_C8", "label": "warning()", "type": "expression", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L94_C4", "vector": [8, 2, 0.9065, 0.0093, 2, 0.74, 1.0, 320, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warning", "arg_names": [], "import_names": [], "rhs_call_name": "warning", "annotation": ""}, "snippet": " log.warning('Communication timeout')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L99_C4", "label": "handle_read", "type": "function", "loc": [99, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "vector": [2, 1, 0.9393, 0.0374, 1, 0.63, 0.9524, 325, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "handle_read", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_read(self):\n if self.timer is not None and not self.timer.cancelled:\n self.timer.reset()\n super(ASTMProtocol, self).handle_read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L100_C8", "label": "if", "type": "if", "loc": [100, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L99_C4", "vector": [4, 2, 0.9393, 0.0187, 2, 0.75, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.timer is not None and not self.timer.cancelled:\n self.timer.reset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L101_C12", "label": "reset()", "type": "expression", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L100_C8", "vector": [8, 3, 0.9439, 0.0093, 3, 0.93, 0.0, 944, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reset", "arg_names": [], "import_names": [], "rhs_call_name": "reset", "annotation": ""}, "snippet": " self.timer.reset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L102_C8", "label": "handle_read()", "type": "expression", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L99_C4", "vector": [8, 2, 0.9533, 0.0093, 2, 0.75, 1.0, 325, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "handle_read", "arg_names": [], "import_names": [], "rhs_call_name": "handle_read", "annotation": ""}, "snippet": " super(ASTMProtocol, self).handle_read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L104_C4", "label": "handle_close", "type": "function", "loc": [104, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "vector": [2, 1, 0.986, 0.0374, 1, 0.63, 1.0, 320, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "handle_close", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_close(self):\n if self.timer is not None and not self.timer.cancelled:\n self.timer.cancel()\n super(ASTMProtocol, self).handle_close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L105_C8", "label": "if", "type": "if", "loc": [105, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L104_C4", "vector": [4, 2, 0.986, 0.0187, 2, 0.09, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.timer is not None and not self.timer.cancelled:\n self.timer.cancel()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L106_C12", "label": "cancel()", "type": "expression", "loc": [106, 106], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L105_C8", "vector": [8, 3, 0.9907, 0.0093, 3, 0.08, 0.0, 732, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "cancel", "arg_names": [], "import_names": [], "rhs_call_name": "cancel", "annotation": ""}, "snippet": " self.timer.cancel()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L107_C8", "label": "handle_close()", "type": "expression", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L104_C4", "vector": [8, 2, 1.0, 0.0093, 2, 0.09, 1.0, 320, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "handle_close", "arg_names": [], "import_names": [], "rhs_call_name": "handle_close", "annotation": ""}, "snippet": " super(ASTMProtocol, self).handle_close()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:While_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:While_L43_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L44_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:While_L43_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:While_L43_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L52_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L52_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L60_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L60_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L63_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L67_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L68_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Assign_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L75_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Return_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L100_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:If_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L106_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1035:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1035:Expr_L107_C8"}]
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # class BaseASTMError(Exception): """Base ASTM error.""" class InvalidState(BaseASTMError): """Should be raised in case of invalid ASTM handler state.""" class NotAccepted(BaseException): """Received data is not acceptable.""" class Rejected(BaseASTMError): """Should be raised after unsuccessful attempts to send data (receiver sends with <NAK> reply)."""
ajibawa-2023/Python-Code-Large/train/row_1036
8
26
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1036:ClassDef_L10_C0", "label": "BaseASTMError", "type": "class", "loc": [10, 11], "level": 0, "parent": null, "vector": [3, 0, 0.4038, 0.0769, 0, 0.66, 0.0, 305, 0, 0, 0, 0, 645, 0, 0], "semantic": {"name": "BaseASTMError", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BaseASTMError(Exception):\n \"\"\"Base ASTM error.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1036:Expr_L11_C4", "label": "expression", "type": "expression", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1036:ClassDef_L10_C0", "vector": [8, 1, 0.4231, 0.0385, 1, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Base ASTM error.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1036:ClassDef_L14_C0", "label": "InvalidState", "type": "class", "loc": [14, 15], "level": 0, "parent": null, "vector": [3, 0, 0.5577, 0.0769, 0, 0.66, 0.3333, 691, 0, 0, 0, 0, 305, 0, 0], "semantic": {"name": "InvalidState", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class InvalidState(BaseASTMError):\n \"\"\"Should be raised in case of invalid ASTM handler state.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1036:Expr_L15_C4", "label": "expression", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1036:ClassDef_L14_C0", "vector": [8, 1, 0.5769, 0.0385, 1, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Should be raised in case of invalid ASTM handler state.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1036:ClassDef_L18_C0", "label": "NotAccepted", "type": "class", "loc": [18, 19], "level": 0, "parent": null, "vector": [3, 0, 0.7115, 0.0769, 0, 0.66, 0.6667, 221, 0, 0, 0, 0, 903, 0, 0], "semantic": {"name": "NotAccepted", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class NotAccepted(BaseException):\n \"\"\"Received data is not acceptable.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1036:Expr_L19_C4", "label": "expression", "type": "expression", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1036:ClassDef_L18_C0", "vector": [8, 1, 0.7308, 0.0385, 1, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Received data is not acceptable.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1036:ClassDef_L22_C0", "label": "Rejected", "type": "class", "loc": [22, 24], "level": 0, "parent": null, "vector": [3, 0, 0.8846, 0.1154, 0, 0.66, 1.0, 478, 0, 0, 0, 0, 305, 0, 0], "semantic": {"name": "Rejected", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Rejected(BaseASTMError):\n \"\"\"Should be raised after unsuccessful attempts to send data\n (receiver sends with <NAK> reply).\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1036:Expr_L23_C4", "label": "expression", "type": "expression", "loc": [23, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1036:ClassDef_L22_C0", "vector": [8, 1, 0.9038, 0.0769, 1, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Should be raised after unsuccessful attempts to send data\n (receiver sends with <NAK> reply).\"\"\""}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1036:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1036:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1036:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1036:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1036:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1036:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1036:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1036:Expr_L23_C4"}]
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # import logging import socket from .asynclib import loop from .codec import encode from .constants import ENQ, EOT from .exceptions import NotAccepted from .mapping import Record from .protocol import ASTMProtocol log = logging.getLogger(__name__) __all__ = ['Client', 'Emitter'] class RecordsStateMachine(object): """Simple state machine to track emitting ASTM records in right order. :param mapping: Mapping of the ASTM records flow order. Keys should be string and defines record type, while values expected as sequence of other record types that may be used after current one. For example: ``{"H": ["P", "C", "L"]}`` mapping defines that if previous record had ``"H"`` type, then the next one should have ``"P"``, ``"C"`` or ``"L"`` type or :exc:`AssertionError` will be raised. The default mapping reflects common ASTM records flow rules. If this argument specified as :const:`None` no rules will be applied. :type: dict """ def __init__(self, mapping): self.mapping = mapping self.state = None def __call__(self, state): if state is not None: assert self.is_acceptable(state),\ 'invalid state %r, expected one of: %r' \ % (state, self.mapping[self.state]) self.state = state def is_acceptable(self, state): if self.mapping is None: return True if state not in self.mapping: return False next_types = self.mapping[self.state] return '*' in next_types or state in next_types DEFAULT_RECORDS_FLOW_MAP = { None: ['H'], 'H': ['C', 'M', 'P', 'L'], 'P': ['C', 'M', 'O', 'L'], 'O': ['C', 'M', 'P', 'O', 'R', 'L'], 'R': ['C', 'M', 'P', 'O', 'R', 'S', 'L'], 'S': ['C', 'M', 'P', 'O', 'R', 'S', 'L'], 'C': ['*'], 'M': ['*'], 'L': ['H'] } class Emitter(object): """ASTM records emitter for :class:`Client`. Used as wrapper for user provided one to provide proper routines around for sending Header and Terminator records. :param emitter: Generator/coroutine. :param encoding: Data encoding. :type encoding: str :param flow_map: Records flow map. Used by :class:`RecordsStateMachine`. :type: dict :param chunk_size: Chunk size in bytes. If :const:`None`, emitter record wouldn't be split into chunks. :type chunk_size: int :param bulk_mode: Sends all records for single session (starts from Header and ends with Terminator records) via single message instead of sending each record separately. If result message is too long, it may be split by chunks if `chunk_size` is not :const:`None`. Keep in mind, that collecting all records for single session may take some time and server may reject data by timeout reason. :type bulk_mode: bool """ #: Records state machine controls emitting records in right order. It #: receives `records_flow_map` as only argument on Emitter initialization. state_machine = RecordsStateMachine def __init__(self, emitter, flow_map, encoding, chunk_size=None, bulk_mode=False): self._emitter = emitter() self._is_active = False self.encoding = encoding self.records_sm = self.state_machine(flow_map) # flag to signal that user's emitter produces no records self.empty = False # last sent sequence number self.last_seq = 0 self.buffer = [] self.chunk_size = chunk_size self.bulk_mode = bulk_mode def _get_record(self, value=None): record = self._emitter.send(value if self._is_active else None) if not self._is_active: self._is_active = True if isinstance(record, Record): record = record.to_astm() try: self.records_sm(record[0]) except Exception as err: self.throw(type(err), err.args) return record def _send_record(self, record): if self.bulk_mode: records = [record] while True: record = self._get_record(True) records.append(record) if record[0] == 'L': break chunks = encode(records, self.encoding, self.chunk_size) else: self.last_seq += 1 chunks = encode([record], self.encoding, self.chunk_size, self.last_seq) self.buffer.extend(chunks) data = self.buffer.pop(0) self.last_seq += len(self.buffer) if record[0] == 'L': self.last_seq = 0 self.buffer.append(EOT) return data def send(self, value=None): """Passes `value` to the emitter. Semantically acts in same way as :meth:`send` for generators. If the emitter has any value within local `buffer` the returned value will be extracted from it unless `value` is :const:`False`. :param value: Callback value. :const:`True` indicates that previous record was successfully received and accepted by server, :const:`False` signs about his rejection. :type value: bool :return: Next record data to send to server. :rtype: bytes """ if self.buffer and value: return self.buffer.pop(0) record = self._get_record(value) return self._send_record(record) def throw(self, exc_type, exc_val=None, exc_tb=None): """Raises exception inside the emitter. Acts in same way as :meth:`throw` for generators. If the emitter had catch an exception and return any record value, it will be proceeded in common way. """ record = self._emitter.throw(exc_type, exc_val, exc_tb) if record is not None: return self._send_record(record) def close(self): """Closes the emitter. Acts in same way as :meth:`close` for generators. """ self._emitter.close() class Client(ASTMProtocol): """Common ASTM client implementation. :param emitter: Generator function that will produce ASTM records. :type emitter: function :param host: Server IP address or hostname. :type host: str :param port: Server port number. :type port: int :param timeout: Time to wait for response from server. If response wasn't received, the :meth:`on_timeout` will be called. If :const:`None` this timer will be disabled. :type timeout: int :param flow_map: Records flow map. Used by :class:`RecordsStateMachine`. :type: dict :param chunk_size: Chunk size in bytes. :const:`None` value prevents records chunking. :type chunk_size: int :param bulk_mode: Sends all records for single session (starts from Header and ends with Terminator records) via single message instead of sending each record separately. If result message is too long, it may be split by chunks if `chunk_size` is not :const:`None`. Keep in mind, that collecting all records for single session may take some time and server may reject data by timeout reason. :type bulk_mode: bool Base `emitter` is a generator that yield ASTM records one by one preserving their order:: from astm.records import ( HeaderRecord, PatientRecord, OrderRecord, TerminatorRecord ) def emitter(): assert (yield HeaderRecord()), 'header was rejected' ok = yield PatientRecord(name={'last': 'foo', 'first': 'bar'}) if ok: # you also can decide what to do in case of record rejection assert (yield OrderRecord()) yield TerminatorRecord() # we may do not care about rejection :class:`Client` thought :class:`RecordsStateMachine` keep track on this order, raising :exc:`AssertionError` if it is broken. When `emitter` terminates with :exc:`StopIteration` or :exc:`GeneratorExit` exception client connection to server closing too. You may provide endless `emitter` by wrapping function body with ``while True: ...`` loop polling data from source from time to time. Note, that server may have communication timeouts control and may close session after some time of inactivity, so be sure that you're able to send whole session (started by Header record and ended by Terminator one) within limited time frame (commonly 10-15 sec.). """ #: Wrapper of emitter to provide session context and system logic about #: sending head and tail data. emitter_wrapper = Emitter def __init__(self, emitter, host='localhost', port=15200, encoding=None, timeout=20, flow_map=DEFAULT_RECORDS_FLOW_MAP, chunk_size=None, bulk_mode=False): super(Client, self).__init__(timeout=timeout) self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.connect((host, port)) self.emitter = self.emitter_wrapper( emitter, encoding=encoding or self.encoding, flow_map=flow_map, chunk_size=chunk_size, bulk_mode=bulk_mode ) self.terminator = 1 def handle_connect(self): """Initiates ASTM communication session.""" super(Client, self).handle_connect() self._open_session() def handle_close(self): self.emitter.close() super(Client, self).handle_close() def _open_session(self): self.push(ENQ) def _close_session(self, close_connection=False): self.push(EOT) if close_connection: self.close_when_done() def run(self, timeout=1.0, *args, **kwargs): """Enters into the :func:`polling loop <astm.asynclib.loop>` to let client send outgoing requests.""" loop(timeout, *args, **kwargs) def on_enq(self): """Raises :class:`NotAccepted` exception.""" raise NotAccepted('Client should not receive ENQ.') def on_ack(self): """Handles ACK response from server. Provides callback value :const:`True` to the emitter and sends next message to server. """ try: message = self.emitter.send(True) except StopIteration: self._close_session(True) else: self.push(message) if message == EOT: self._open_session() def on_nak(self): """Handles NAK response from server. If it was received on ENQ request, the client tries to repeat last request for allowed amount of attempts. For others it send callback value :const:`False` to the emitter.""" if self._last_sent_data == ENQ: return self.push(ENQ) try: message = self.emitter.send(False) except StopIteration: self._close_session(True) except Exception: self._close_session(True) raise else: self.push(message) if message == EOT: self._open_session() def on_eot(self): """Raises :class:`NotAccepted` exception.""" raise NotAccepted('Client should not receive EOT.') def on_message(self): """Raises :class:`NotAccepted` exception.""" raise NotAccepted('Client should not receive ASTM message.') def on_timeout(self): """Sends final EOT message and closes connection after his receiving.""" super(Client, self).on_timeout() self._close_session(True)
ajibawa-2023/Python-Code-Large/train/row_1037
132
343
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Import_L10_C0", "label": "logging import logging", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0292, 0.0029, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Import_L11_C0", "label": "socket import socket", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0321, 0.0029, 0, 0.66, 0.0769, 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_1037:ImportFrom_L12_C0", "label": "from asynclib import loop", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.035, 0.0029, 0, 0.66, 0.1538, 591, 0, 1, 0, 0, 591, 0, 0], "semantic": {"name": "asynclib", "arg_names": [], "import_names": ["loop"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .asynclib import loop"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:ImportFrom_L13_C0", "label": "from codec import encode", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0379, 0.0029, 0, 0.66, 0.2308, 563, 0, 1, 0, 0, 563, 0, 0], "semantic": {"name": "codec", "arg_names": [], "import_names": ["encode"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .codec import encode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:ImportFrom_L14_C0", "label": "from constants import ENQ, EOT", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0408, 0.0029, 0, 0.66, 0.3077, 208, 0, 2, 0, 0, 208, 0, 0], "semantic": {"name": "constants", "arg_names": [], "import_names": ["ENQ", "EOT"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .constants import ENQ, EOT"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:ImportFrom_L15_C0", "label": "from exceptions import NotAccepted", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0437, 0.0029, 0, 0.66, 0.3846, 63, 0, 1, 0, 0, 63, 0, 0], "semantic": {"name": "exceptions", "arg_names": [], "import_names": ["NotAccepted"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .exceptions import NotAccepted"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:ImportFrom_L16_C0", "label": "from mapping import Record", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0466, 0.0029, 0, 0.66, 0.4615, 351, 0, 1, 0, 0, 351, 0, 0], "semantic": {"name": "mapping", "arg_names": [], "import_names": ["Record"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .mapping import Record"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:ImportFrom_L17_C0", "label": "from protocol import ASTMProtocol", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0496, 0.0029, 0, 0.66, 0.5385, 393, 0, 1, 0, 0, 393, 0, 0], "semantic": {"name": "protocol", "arg_names": [], "import_names": ["ASTMProtocol"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .protocol import ASTMProtocol"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L19_C0", "label": "log = getLogger()", "type": "assigned_variable", "loc": [19, 19], "level": 0, "parent": null, "vector": [14, 0, 0.0554, 0.0029, 0, 0.66, 0.6154, 432, 3, 1, 0, 0, 71, 10, 1], "semantic": {"name": "log", "arg_names": [], "import_names": [], "rhs_call_name": "getLogger", "annotation": ""}, "snippet": "log = logging.getLogger(__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L21_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [21, 21], "level": 0, "parent": null, "vector": [14, 0, 0.0612, 0.0029, 0, 0.66, 0.6923, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = ['Client', 'Emitter']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L24_C0", "label": "RecordsStateMachine", "type": "class", "loc": [24, 56], "level": 0, "parent": null, "vector": [3, 0, 0.1166, 0.0962, 0, 0.66, 0.7692, 446, 0, 3, 0, 0, 186, 0, 1], "semantic": {"name": "RecordsStateMachine", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RecordsStateMachine(object):\n \"\"\"Simple state machine to track emitting ASTM records in right order.\n\n :param mapping: Mapping of the ASTM records flow order.\n Keys should be string and defines record type, while values\n expected as sequence of other record types that may be used\n after current one.\n For example: ``{\"H\": [\"P\", \"C\", \"L\"]}`` mapping defines that"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L25_C4", "label": "expression", "type": "expression", "loc": [25, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L24_C0", "vector": [8, 1, 0.0918, 0.0408, 1, 0.11, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Simple state machine to track emitting ASTM records in right order.\n\n :param mapping: Mapping of the ASTM records flow order.\n Keys should be string and defines record type, while values\n expected as sequence of other record types that may be used\n after current one.\n For example: ``{\"H\": [\"P\", \"C\", \"L\"]}`` mapping defines that\n if previous record had ``\"H\"`` type, then the next one"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L39_C4", "label": "__init__", "type": "function", "loc": [39, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L24_C0", "vector": [2, 1, 0.1166, 0.0087, 1, 0.11, 0.3333, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "mapping"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, mapping):\n self.mapping = mapping\n self.state = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L40_C8", "label": "self.mapping =", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L39_C4", "vector": [14, 2, 0.1166, 0.0029, 2, 0.35, 0.0, 45, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.mapping", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mapping = mapping"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L41_C8", "label": "self.state =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L39_C4", "vector": [14, 2, 0.1195, 0.0029, 2, 0.35, 1.0, 765, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.state", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.state = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L43_C4", "label": "__call__", "type": "function", "loc": [43, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L24_C0", "vector": [2, 1, 0.1327, 0.0175, 1, 0.11, 0.6667, 319, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__call__", "arg_names": ["self", "state"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __call__(self, state):\n if state is not None:\n assert self.is_acceptable(state),\\\n 'invalid state %r, expected one of: %r' \\\n % (state, self.mapping[self.state])\n self.state = state"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L44_C8", "label": "if", "type": "if", "loc": [44, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L43_C4", "vector": [4, 2, 0.1327, 0.0117, 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 state is not None:\n assert self.is_acceptable(state),\\\n 'invalid state %r, expected one of: %r' \\\n % (state, self.mapping[self.state])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L48_C8", "label": "self.state =", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L43_C4", "vector": [14, 2, 0.1399, 0.0029, 2, 0.93, 1.0, 765, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.state", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.state = state"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L50_C4", "label": "is_acceptable", "type": "function", "loc": [50, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L24_C0", "vector": [2, 1, 0.1545, 0.0204, 1, 0.11, 1.0, 400, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "is_acceptable", "arg_names": ["self", "state"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_acceptable(self, state):\n if self.mapping is None:\n return True\n if state not in self.mapping:\n return False\n next_types = self.mapping[self.state]\n return '*' in next_types or state in next_types"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L51_C8", "label": "if", "type": "if", "loc": [51, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L50_C4", "vector": [4, 2, 0.1501, 0.0058, 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 self.mapping is None:\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Return_L52_C12", "label": "return", "type": "return", "loc": [52, 52], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L51_C8", "vector": [13, 3, 0.1516, 0.0029, 3, 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_1037:If_L53_C8", "label": "if", "type": "if", "loc": [53, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L50_C4", "vector": [4, 2, 0.156, 0.0058, 2, 0.66, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if state not in self.mapping:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Return_L54_C12", "label": "return", "type": "return", "loc": [54, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L53_C8", "vector": [13, 3, 0.1574, 0.0029, 3, 0.96, 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_1037:Assign_L55_C8", "label": "next_types =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L50_C4", "vector": [14, 2, 0.1603, 0.0029, 2, 0.66, 0.6667, 394, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "next_types", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " next_types = self.mapping[self.state]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Return_L56_C8", "label": "return", "type": "return", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L50_C4", "vector": [13, 2, 0.1633, 0.0029, 2, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '*' in next_types or state in next_types"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L59_C0", "label": "DEFAULT_RECORDS_FLOW_MAP =", "type": "assigned_variable", "loc": [59, 69], "level": 0, "parent": null, "vector": [14, 0, 0.1866, 0.0321, 0, 0.66, 0.8462, 671, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "DEFAULT_RECORDS_FLOW_MAP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DEFAULT_RECORDS_FLOW_MAP = {\n None: ['H'],\n 'H': ['C', 'M', 'P', 'L'],\n 'P': ['C', 'M', 'O', 'L'],\n 'O': ['C', 'M', 'P', 'O', 'R', 'L'],\n 'R': ['C', 'M', 'P', 'O', 'R', 'S', 'L'],\n 'S': ['C', 'M', 'P', 'O', 'R', 'S', 'L'],\n 'C': ['*'],"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L72_C0", "label": "Emitter", "type": "class", "loc": [72, 190], "level": 0, "parent": null, "vector": [3, 0, 0.3819, 0.3469, 0, 0.66, 0.9231, 186, 0, 6, 0, 0, 186, 0, 22], "semantic": {"name": "Emitter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Emitter(object):\n \"\"\"ASTM records emitter for :class:`Client`.\n\n Used as wrapper for user provided one to provide proper routines around for\n sending Header and Terminator records.\n\n :param emitter: Generator/coroutine.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L73_C4", "label": "expression", "type": "expression", "loc": [73, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L72_C0", "vector": [8, 1, 0.2493, 0.0758, 1, 0.3, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"ASTM records emitter for :class:`Client`.\n\n Used as wrapper for user provided one to provide proper routines around for\n sending Header and Terminator records.\n\n :param emitter: Generator/coroutine.\n\n :param encoding: Data encoding."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L102_C4", "label": "state_machine =", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L72_C0", "vector": [14, 1, 0.2974, 0.0029, 1, 0.3, 0.1429, 876, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "state_machine", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " state_machine = RecordsStateMachine"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L104_C4", "label": "__init__", "type": "function", "loc": [104, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L72_C0", "vector": [2, 1, 0.3207, 0.0379, 1, 0.3, 0.2857, 555, 0, 6, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "emitter", "flow_map", "encoding", "chunk_size", "bulk_mode"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, emitter, flow_map, encoding,\n chunk_size=None, bulk_mode=False):\n self._emitter = emitter()\n self._is_active = False\n self.encoding = encoding\n self.records_sm = self.state_machine(flow_map)\n # flag to signal that user's emitter produces no records\n self.empty = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L106_C8", "label": "self._emitter = emitter()", "type": "assigned_variable", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L104_C4", "vector": [14, 2, 0.309, 0.0029, 2, 0.71, 0.0, 679, 3, 0, 0, 0, 612, 10, 1], "semantic": {"name": "self._emitter", "arg_names": [], "import_names": [], "rhs_call_name": "emitter", "annotation": ""}, "snippet": " self._emitter = emitter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L107_C8", "label": "self._is_active =", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L104_C4", "vector": [14, 2, 0.312, 0.0029, 2, 0.71, 0.125, 510, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self._is_active", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._is_active = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L108_C8", "label": "self.encoding =", "type": "assigned_variable", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L104_C4", "vector": [14, 2, 0.3149, 0.0029, 2, 0.71, 0.25, 564, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.encoding = encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L109_C8", "label": "self.records_sm = state_machine()", "type": "assigned_variable", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L104_C4", "vector": [14, 2, 0.3178, 0.0029, 2, 0.71, 0.375, 277, 3, 1, 0, 0, 876, 10, 1], "semantic": {"name": "self.records_sm", "arg_names": [], "import_names": [], "rhs_call_name": "state_machine", "annotation": ""}, "snippet": " self.records_sm = self.state_machine(flow_map)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L111_C8", "label": "self.empty =", "type": "assigned_variable", "loc": [111, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L104_C4", "vector": [14, 2, 0.3236, 0.0029, 2, 0.71, 0.5, 61, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.empty", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.empty = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L113_C8", "label": "self.last_seq =", "type": "assigned_variable", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L104_C4", "vector": [14, 2, 0.3294, 0.0029, 2, 0.71, 0.625, 533, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.last_seq", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.last_seq = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L114_C8", "label": "self.buffer =", "type": "assigned_variable", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L104_C4", "vector": [14, 2, 0.3324, 0.0029, 2, 0.71, 0.75, 827, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.buffer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.buffer = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L115_C8", "label": "self.chunk_size =", "type": "assigned_variable", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L104_C4", "vector": [14, 2, 0.3353, 0.0029, 2, 0.71, 0.875, 732, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.chunk_size", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.chunk_size = chunk_size"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L116_C8", "label": "self.bulk_mode =", "type": "assigned_variable", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L104_C4", "vector": [14, 2, 0.3382, 0.0029, 2, 0.71, 1.0, 99, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.bulk_mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.bulk_mode = bulk_mode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L118_C4", "label": "_get_record", "type": "function", "loc": [118, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L72_C0", "vector": [2, 1, 0.3586, 0.0321, 1, 0.3, 0.4286, 685, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "_get_record", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_record(self, value=None):\n record = self._emitter.send(value if self._is_active else None)\n if not self._is_active:\n self._is_active = True\n if isinstance(record, Record):\n record = record.to_astm()\n try:\n self.records_sm(record[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L119_C8", "label": "record = send()", "type": "assigned_variable", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L118_C4", "vector": [14, 2, 0.3469, 0.0029, 2, 0.45, 0.0, 667, 3, 1, 0, 0, 826, 10, 1], "semantic": {"name": "record", "arg_names": [], "import_names": [], "rhs_call_name": "send", "annotation": ""}, "snippet": " record = self._emitter.send(value if self._is_active else None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L120_C8", "label": "if", "type": "if", "loc": [120, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L118_C4", "vector": [4, 2, 0.3513, 0.0058, 2, 0.45, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self._is_active:\n self._is_active = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L121_C12", "label": "self._is_active =", "type": "assigned_variable", "loc": [121, 121], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L120_C8", "vector": [14, 3, 0.3528, 0.0029, 3, 0.05, 0.0, 510, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self._is_active", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._is_active = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L122_C8", "label": "if", "type": "if", "loc": [122, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L118_C4", "vector": [4, 2, 0.3571, 0.0058, 2, 0.45, 0.5, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(record, Record):\n record = record.to_astm()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L123_C12", "label": "record = to_astm()", "type": "assigned_variable", "loc": [123, 123], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L122_C8", "vector": [14, 3, 0.3586, 0.0029, 3, 0.57, 0.0, 667, 3, 0, 0, 0, 869, 10, 1], "semantic": {"name": "record", "arg_names": [], "import_names": [], "rhs_call_name": "to_astm", "annotation": ""}, "snippet": " record = record.to_astm()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L124_C8", "label": "try", "type": "try", "loc": [124, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L118_C4", "vector": [7, 2, 0.3659, 0.0117, 2, 0.45, 0.75, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.records_sm(record[0])\n except Exception as err:\n self.throw(type(err), err.args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L125_C12", "label": "records_sm()", "type": "expression", "loc": [125, 125], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L124_C8", "vector": [8, 3, 0.3644, 0.0029, 3, 0.69, 0.0, 593, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "records_sm", "arg_names": [], "import_names": [], "rhs_call_name": "records_sm", "annotation": ""}, "snippet": " self.records_sm(record[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L127_C12", "label": "throw()", "type": "expression", "loc": [127, 127], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L124_C8", "vector": [8, 3, 0.3703, 0.0029, 3, 0.69, 0.0, 792, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "throw", "arg_names": [], "import_names": [], "rhs_call_name": "throw", "annotation": ""}, "snippet": " self.throw(type(err), err.args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Return_L128_C8", "label": "return", "type": "return", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L118_C4", "vector": [13, 2, 0.3732, 0.0029, 2, 0.45, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return record"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L130_C4", "label": "_send_record", "type": "function", "loc": [130, 152], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L72_C0", "vector": [2, 1, 0.4111, 0.0671, 1, 0.3, 0.5714, 82, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "_send_record", "arg_names": ["self", "record"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _send_record(self, record):\n if self.bulk_mode:\n records = [record]\n while True:\n record = self._get_record(True)\n records.append(record)\n if record[0] == 'L':\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L131_C8", "label": "if", "type": "if", "loc": [131, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L130_C4", "vector": [4, 2, 0.398, 0.035, 2, 0.19, 0.0, 0, 7, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.bulk_mode:\n records = [record]\n while True:\n record = self._get_record(True)\n records.append(record)\n if record[0] == 'L':\n break\n chunks = encode(records, self.encoding, self.chunk_size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L132_C12", "label": "records =", "type": "assigned_variable", "loc": [132, 132], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L131_C8", "vector": [14, 3, 0.3848, 0.0029, 3, 0.02, 0.0, 186, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "records", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " records = [record]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:While_L133_C12", "label": "while", "type": "while", "loc": [133, 137], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L131_C8", "vector": [5, 3, 0.3936, 0.0146, 3, 0.02, 0.3333, 0, 1, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n record = self._get_record(True)\n records.append(record)\n if record[0] == 'L':\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L134_C16", "label": "record = _get_record()", "type": "assigned_variable", "loc": [134, 134], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:While_L133_C12", "vector": [14, 4, 0.3907, 0.0029, 4, 0.06, 0.0, 667, 3, 1, 0, 0, 685, 10, 1], "semantic": {"name": "record", "arg_names": [], "import_names": [], "rhs_call_name": "_get_record", "annotation": ""}, "snippet": " record = self._get_record(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L135_C16", "label": "append()", "type": "expression", "loc": [135, 135], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:While_L133_C12", "vector": [8, 4, 0.3936, 0.0029, 4, 0.06, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " records.append(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L136_C16", "label": "if", "type": "if", "loc": [136, 137], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:While_L133_C12", "vector": [4, 4, 0.398, 0.0058, 4, 0.06, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if record[0] == 'L':\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L138_C12", "label": "chunks = encode()", "type": "assigned_variable", "loc": [138, 138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L131_C8", "vector": [14, 3, 0.4023, 0.0029, 3, 0.02, 0.6667, 284, 3, 3, 0, 0, 623, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": " chunks = encode(records, self.encoding, self.chunk_size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L141_C12", "label": "chunks = encode()", "type": "assigned_variable", "loc": [141, 142], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L131_C8", "vector": [14, 3, 0.4125, 0.0058, 3, 0.02, 1.0, 284, 3, 4, 0, 0, 623, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": " chunks = encode([record], self.encoding,\n self.chunk_size, self.last_seq)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L144_C8", "label": "extend()", "type": "expression", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L130_C4", "vector": [8, 2, 0.4198, 0.0029, 2, 0.19, 0.25, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " self.buffer.extend(chunks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L145_C8", "label": "data = pop()", "type": "assigned_variable", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L130_C4", "vector": [14, 2, 0.4227, 0.0029, 2, 0.19, 0.5, 929, 3, 1, 0, 0, 969, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " data = self.buffer.pop(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L148_C8", "label": "if", "type": "if", "loc": [148, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L130_C4", "vector": [4, 2, 0.4344, 0.0087, 2, 0.19, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if record[0] == 'L':\n self.last_seq = 0\n self.buffer.append(EOT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L149_C12", "label": "self.last_seq =", "type": "assigned_variable", "loc": [149, 149], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L148_C8", "vector": [14, 3, 0.4344, 0.0029, 3, 0.77, 0.0, 533, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.last_seq", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.last_seq = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L150_C12", "label": "append()", "type": "expression", "loc": [150, 150], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L148_C8", "vector": [8, 3, 0.4373, 0.0029, 3, 0.77, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.buffer.append(EOT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Return_L152_C8", "label": "return", "type": "return", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L130_C4", "vector": [13, 2, 0.4431, 0.0029, 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 data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L154_C4", "label": "send", "type": "function", "loc": [154, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L72_C0", "vector": [2, 1, 0.4781, 0.0612, 1, 0.3, 0.7143, 826, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "send", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def send(self, value=None):\n \"\"\"Passes `value` to the emitter. Semantically acts in same way as\n :meth:`send` for generators.\n\n If the emitter has any value within local `buffer` the returned value\n will be extracted from it unless `value` is :const:`False`.\n\n :param value: Callback value. :const:`True` indicates that previous"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L155_C8", "label": "expression", "type": "expression", "loc": [155, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L154_C4", "vector": [8, 2, 0.4708, 0.0408, 2, 0.55, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Passes `value` to the emitter. Semantically acts in same way as\n :meth:`send` for generators.\n\n If the emitter has any value within local `buffer` the returned value\n will be extracted from it unless `value` is :const:`False`.\n\n :param value: Callback value. :const:`True` indicates that previous\n record was successfully received and accepted by server,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L169_C8", "label": "if", "type": "if", "loc": [169, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L154_C4", "vector": [4, 2, 0.4942, 0.0058, 2, 0.55, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.buffer and value:\n return self.buffer.pop(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Return_L170_C12", "label": "return", "type": "return", "loc": [170, 170], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L169_C8", "vector": [13, 3, 0.4956, 0.0029, 3, 0.1, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.buffer.pop(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L172_C8", "label": "record = _get_record()", "type": "assigned_variable", "loc": [172, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L154_C4", "vector": [14, 2, 0.5015, 0.0029, 2, 0.55, 0.6667, 667, 3, 1, 0, 0, 685, 10, 1], "semantic": {"name": "record", "arg_names": [], "import_names": [], "rhs_call_name": "_get_record", "annotation": ""}, "snippet": " record = self._get_record(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Return_L174_C8", "label": "return", "type": "return", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L154_C4", "vector": [13, 2, 0.5073, 0.0029, 2, 0.55, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._send_record(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L176_C4", "label": "throw", "type": "function", "loc": [176, 185], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L72_C0", "vector": [2, 1, 0.5262, 0.0292, 1, 0.3, 0.8571, 792, 0, 4, 1, 0, 0, 0, 2], "semantic": {"name": "throw", "arg_names": ["self", "exc_type", "exc_val", "exc_tb"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def throw(self, exc_type, exc_val=None, exc_tb=None):\n \"\"\"Raises exception inside the emitter. Acts in same way as\n :meth:`throw` for generators.\n\n If the emitter had catch an exception and return any record value, it\n will be proceeded in common way.\n \"\"\"\n record = self._emitter.throw(exc_type, exc_val, exc_tb)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L177_C8", "label": "expression", "type": "expression", "loc": [177, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L176_C4", "vector": [8, 2, 0.5233, 0.0175, 2, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Raises exception inside the emitter. Acts in same way as\n :meth:`throw` for generators.\n\n If the emitter had catch an exception and return any record value, it\n will be proceeded in common way.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L183_C8", "label": "record = throw()", "type": "assigned_variable", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L176_C4", "vector": [14, 2, 0.5335, 0.0029, 2, 0.13, 0.5, 667, 3, 3, 0, 0, 792, 10, 1], "semantic": {"name": "record", "arg_names": [], "import_names": [], "rhs_call_name": "throw", "annotation": ""}, "snippet": " record = self._emitter.throw(exc_type, exc_val, exc_tb)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L184_C8", "label": "if", "type": "if", "loc": [184, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L176_C4", "vector": [4, 2, 0.5379, 0.0058, 2, 0.13, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if record is not None:\n return self._send_record(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Return_L185_C12", "label": "return", "type": "return", "loc": [185, 185], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L184_C8", "vector": [13, 3, 0.5394, 0.0029, 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 self._send_record(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L187_C4", "label": "close", "type": "function", "loc": [187, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L72_C0", "vector": [2, 1, 0.5496, 0.0117, 1, 0.3, 1.0, 77, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def close(self):\n \"\"\"Closes the emitter. Acts in same way as :meth:`close` for generators.\n \"\"\"\n self._emitter.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L188_C8", "label": "expression", "type": "expression", "loc": [188, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L187_C4", "vector": [8, 2, 0.5496, 0.0058, 2, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Closes the emitter. Acts in same way as :meth:`close` for generators.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L190_C8", "label": "close()", "type": "expression", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L187_C4", "vector": [8, 2, 0.5539, 0.0029, 2, 0.91, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " self._emitter.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "label": "Client", "type": "class", "loc": [193, 343], "level": 0, "parent": null, "vector": [3, 0, 0.7813, 0.4402, 0, 0.66, 1.0, 412, 0, 12, 0, 0, 400, 0, 31], "semantic": {"name": "Client", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Client(ASTMProtocol):\n \"\"\"Common ASTM client implementation.\n\n :param emitter: Generator function that will produce ASTM records.\n :type emitter: function\n\n :param host: Server IP address or hostname.\n :type host: str"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L194_C4", "label": "expression", "type": "expression", "loc": [194, 249], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "vector": [8, 1, 0.6458, 0.1633, 1, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Common ASTM client implementation.\n\n :param emitter: Generator function that will produce ASTM records.\n :type emitter: function\n\n :param host: Server IP address or hostname.\n :type host: str\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L253_C4", "label": "emitter_wrapper =", "type": "assigned_variable", "loc": [253, 253], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "vector": [14, 1, 0.7376, 0.0029, 1, 0.38, 0.0769, 720, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "emitter_wrapper", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " emitter_wrapper = Emitter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L255_C4", "label": "__init__", "type": "function", "loc": [255, 268], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "vector": [2, 1, 0.7624, 0.0408, 1, 0.38, 0.1538, 555, 0, 9, 0, 0, 0, 0, 5], "semantic": {"name": "__init__", "arg_names": ["self", "emitter", "host", "port", "encoding", "timeout", "flow_map", "chunk_size", "bulk_mode"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, emitter, host='localhost', port=15200,\n encoding=None, timeout=20, flow_map=DEFAULT_RECORDS_FLOW_MAP,\n chunk_size=None, bulk_mode=False):\n super(Client, self).__init__(timeout=timeout)\n self.create_socket(socket.AF_INET, socket.SOCK_STREAM)\n self.connect((host, port))\n self.emitter = self.emitter_wrapper(\n emitter,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L258_C8", "label": "__init__()", "type": "expression", "loc": [258, 258], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L255_C4", "vector": [8, 2, 0.7522, 0.0029, 2, 0.3, 0.0, 555, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Client, self).__init__(timeout=timeout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L259_C8", "label": "create_socket()", "type": "expression", "loc": [259, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L255_C4", "vector": [8, 2, 0.7551, 0.0029, 2, 0.3, 0.25, 444, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "create_socket", "arg_names": [], "import_names": [], "rhs_call_name": "create_socket", "annotation": ""}, "snippet": " self.create_socket(socket.AF_INET, socket.SOCK_STREAM)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L260_C8", "label": "connect()", "type": "expression", "loc": [260, 260], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L255_C4", "vector": [8, 2, 0.758, 0.0029, 2, 0.3, 0.5, 242, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": " self.connect((host, port))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L261_C8", "label": "self.emitter = emitter_wrapper()", "type": "assigned_variable", "loc": [261, 267], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L255_C4", "vector": [14, 2, 0.7697, 0.0204, 2, 0.3, 0.75, 351, 3, 5, 0, 0, 720, 10, 1], "semantic": {"name": "self.emitter", "arg_names": [], "import_names": [], "rhs_call_name": "emitter_wrapper", "annotation": ""}, "snippet": " self.emitter = self.emitter_wrapper(\n emitter,\n encoding=encoding or self.encoding,\n flow_map=flow_map,\n chunk_size=chunk_size,\n bulk_mode=bulk_mode\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L268_C8", "label": "self.terminator =", "type": "assigned_variable", "loc": [268, 268], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L255_C4", "vector": [14, 2, 0.7813, 0.0029, 2, 0.3, 1.0, 568, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.terminator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.terminator = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L270_C4", "label": "handle_connect", "type": "function", "loc": [270, 273], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "vector": [2, 1, 0.7915, 0.0117, 1, 0.38, 0.2308, 411, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "handle_connect", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_connect(self):\n \"\"\"Initiates ASTM communication session.\"\"\"\n super(Client, self).handle_connect()\n self._open_session()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L271_C8", "label": "expression", "type": "expression", "loc": [271, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L270_C4", "vector": [8, 2, 0.7901, 0.0029, 2, 0.52, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Initiates ASTM communication session.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L272_C8", "label": "handle_connect()", "type": "expression", "loc": [272, 272], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L270_C4", "vector": [8, 2, 0.793, 0.0029, 2, 0.52, 0.5, 411, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "handle_connect", "arg_names": [], "import_names": [], "rhs_call_name": "handle_connect", "annotation": ""}, "snippet": " super(Client, self).handle_connect()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L273_C8", "label": "_open_session()", "type": "expression", "loc": [273, 273], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L270_C4", "vector": [8, 2, 0.7959, 0.0029, 2, 0.52, 1.0, 3, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_open_session", "arg_names": [], "import_names": [], "rhs_call_name": "_open_session", "annotation": ""}, "snippet": " self._open_session()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L275_C4", "label": "handle_close", "type": "function", "loc": [275, 277], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "vector": [2, 1, 0.8047, 0.0087, 1, 0.38, 0.3077, 320, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "handle_close", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_close(self):\n self.emitter.close()\n super(Client, self).handle_close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L276_C8", "label": "close()", "type": "expression", "loc": [276, 276], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L275_C4", "vector": [8, 2, 0.8047, 0.0029, 2, 0.93, 0.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " self.emitter.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L277_C8", "label": "handle_close()", "type": "expression", "loc": [277, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L275_C4", "vector": [8, 2, 0.8076, 0.0029, 2, 0.93, 1.0, 320, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "handle_close", "arg_names": [], "import_names": [], "rhs_call_name": "handle_close", "annotation": ""}, "snippet": " super(Client, self).handle_close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L279_C4", "label": "_open_session", "type": "function", "loc": [279, 280], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "vector": [2, 1, 0.8149, 0.0058, 1, 0.38, 0.3846, 3, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_open_session", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _open_session(self):\n self.push(ENQ)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L280_C8", "label": "push()", "type": "expression", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L279_C4", "vector": [8, 2, 0.8163, 0.0029, 2, 0.4, 0.0, 176, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "push", "arg_names": [], "import_names": [], "rhs_call_name": "push", "annotation": ""}, "snippet": " self.push(ENQ)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L282_C4", "label": "_close_session", "type": "function", "loc": [282, 285], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "vector": [2, 1, 0.8265, 0.0117, 1, 0.38, 0.4615, 544, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_close_session", "arg_names": ["self", "close_connection"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _close_session(self, close_connection=False):\n self.push(EOT)\n if close_connection:\n self.close_when_done()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L283_C8", "label": "push()", "type": "expression", "loc": [283, 283], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L282_C4", "vector": [8, 2, 0.8251, 0.0029, 2, 0.4, 0.0, 176, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "push", "arg_names": [], "import_names": [], "rhs_call_name": "push", "annotation": ""}, "snippet": " self.push(EOT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L284_C8", "label": "if", "type": "if", "loc": [284, 285], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L282_C4", "vector": [4, 2, 0.8294, 0.0058, 2, 0.4, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if close_connection:\n self.close_when_done()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L285_C12", "label": "close_when_done()", "type": "expression", "loc": [285, 285], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L284_C8", "vector": [8, 3, 0.8309, 0.0029, 3, 0.5, 0.0, 565, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close_when_done", "arg_names": [], "import_names": [], "rhs_call_name": "close_when_done", "annotation": ""}, "snippet": " self.close_when_done()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L287_C4", "label": "run", "type": "function", "loc": [287, 290], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "vector": [2, 1, 0.8411, 0.0117, 1, 0.38, 0.5385, 679, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": ["self", "timeout", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def run(self, timeout=1.0, *args, **kwargs):\n \"\"\"Enters into the :func:`polling loop <astm.asynclib.loop>` to let\n client send outgoing requests.\"\"\"\n loop(timeout, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L288_C8", "label": "expression", "type": "expression", "loc": [288, 289], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L287_C4", "vector": [8, 2, 0.8411, 0.0058, 2, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Enters into the :func:`polling loop <astm.asynclib.loop>` to let\n client send outgoing requests.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L290_C8", "label": "loop()", "type": "expression", "loc": [290, 290], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L287_C4", "vector": [8, 2, 0.8455, 0.0029, 2, 0.76, 1.0, 848, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "loop", "arg_names": [], "import_names": [], "rhs_call_name": "loop", "annotation": ""}, "snippet": " loop(timeout, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L292_C4", "label": "on_enq", "type": "function", "loc": [292, 294], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "vector": [2, 1, 0.8542, 0.0087, 1, 0.38, 0.6154, 197, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "on_enq", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_enq(self):\n \"\"\"Raises :class:`NotAccepted` exception.\"\"\"\n raise NotAccepted('Client should not receive ENQ.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L293_C8", "label": "expression", "type": "expression", "loc": [293, 293], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L292_C4", "vector": [8, 2, 0.8542, 0.0029, 2, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Raises :class:`NotAccepted` exception.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L296_C4", "label": "on_ack", "type": "function", "loc": [296, 309], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "vector": [2, 1, 0.8819, 0.0408, 1, 0.38, 0.6923, 6, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "on_ack", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_ack(self):\n \"\"\"Handles ACK response from server.\n\n Provides callback value :const:`True` to the emitter and sends next\n message to server.\n \"\"\"\n try:\n message = self.emitter.send(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L297_C8", "label": "expression", "type": "expression", "loc": [297, 301], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L296_C4", "vector": [8, 2, 0.8717, 0.0146, 2, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handles ACK response from server.\n\n Provides callback value :const:`True` to the emitter and sends next\n message to server.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L302_C8", "label": "try", "type": "try", "loc": [302, 309], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L296_C4", "vector": [7, 2, 0.8907, 0.0233, 2, 0.86, 1.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n message = self.emitter.send(True)\n except StopIteration:\n self._close_session(True)\n else:\n self.push(message)\n if message == EOT:\n self._open_session()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L303_C12", "label": "message = send()", "type": "assigned_variable", "loc": [303, 303], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L302_C8", "vector": [14, 3, 0.8834, 0.0029, 3, 0.95, 0.0, 635, 3, 1, 0, 0, 826, 10, 1], "semantic": {"name": "message", "arg_names": [], "import_names": [], "rhs_call_name": "send", "annotation": ""}, "snippet": " message = self.emitter.send(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L305_C12", "label": "_close_session()", "type": "expression", "loc": [305, 305], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L302_C8", "vector": [8, 3, 0.8892, 0.0029, 3, 0.95, 0.0, 544, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_close_session", "arg_names": [], "import_names": [], "rhs_call_name": "_close_session", "annotation": ""}, "snippet": " self._close_session(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L307_C12", "label": "push()", "type": "expression", "loc": [307, 307], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L302_C8", "vector": [8, 3, 0.895, 0.0029, 3, 0.95, 0.5, 176, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "push", "arg_names": [], "import_names": [], "rhs_call_name": "push", "annotation": ""}, "snippet": " self.push(message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L308_C12", "label": "if", "type": "if", "loc": [308, 309], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L302_C8", "vector": [4, 3, 0.8994, 0.0058, 3, 0.95, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if message == EOT:\n self._open_session()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L309_C16", "label": "_open_session()", "type": "expression", "loc": [309, 309], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L308_C12", "vector": [8, 4, 0.9009, 0.0029, 4, 0.31, 0.0, 3, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_open_session", "arg_names": [], "import_names": [], "rhs_call_name": "_open_session", "annotation": ""}, "snippet": " self._open_session()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L311_C4", "label": "on_nak", "type": "function", "loc": [311, 330], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "vector": [2, 1, 0.9344, 0.0583, 1, 0.38, 0.7692, 54, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "on_nak", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_nak(self):\n \"\"\"Handles NAK response from server.\n\n If it was received on ENQ request, the client tries to repeat last\n request for allowed amount of attempts. For others it send callback\n value :const:`False` to the emitter.\"\"\"\n if self._last_sent_data == ENQ:\n return self.push(ENQ)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L312_C8", "label": "expression", "type": "expression", "loc": [312, 316], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L311_C4", "vector": [8, 2, 0.9155, 0.0146, 2, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handles NAK response from server.\n\n If it was received on ENQ request, the client tries to repeat last\n request for allowed amount of attempts. For others it send callback\n value :const:`False` to the emitter.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L317_C8", "label": "if", "type": "if", "loc": [317, 318], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L311_C4", "vector": [4, 2, 0.9257, 0.0058, 2, 0.73, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._last_sent_data == ENQ:\n return self.push(ENQ)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Return_L318_C12", "label": "return", "type": "return", "loc": [318, 318], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L317_C8", "vector": [13, 3, 0.9271, 0.0029, 3, 0.53, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.push(ENQ)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L320_C8", "label": "try", "type": "try", "loc": [320, 330], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L311_C4", "vector": [7, 2, 0.9475, 0.0321, 2, 0.73, 1.0, 0, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n message = self.emitter.send(False)\n except StopIteration:\n self._close_session(True)\n except Exception:\n self._close_session(True)\n raise\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L321_C12", "label": "message = send()", "type": "assigned_variable", "loc": [321, 321], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L320_C8", "vector": [14, 3, 0.9359, 0.0029, 3, 0.91, 0.0, 635, 3, 1, 0, 0, 826, 10, 1], "semantic": {"name": "message", "arg_names": [], "import_names": [], "rhs_call_name": "send", "annotation": ""}, "snippet": " message = self.emitter.send(False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L323_C12", "label": "_close_session()", "type": "expression", "loc": [323, 323], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L320_C8", "vector": [8, 3, 0.9417, 0.0029, 3, 0.91, 0.0, 544, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_close_session", "arg_names": [], "import_names": [], "rhs_call_name": "_close_session", "annotation": ""}, "snippet": " self._close_session(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L325_C12", "label": "_close_session()", "type": "expression", "loc": [325, 325], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L320_C8", "vector": [8, 3, 0.9475, 0.0029, 3, 0.91, 0.0, 544, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_close_session", "arg_names": [], "import_names": [], "rhs_call_name": "_close_session", "annotation": ""}, "snippet": " self._close_session(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L328_C12", "label": "push()", "type": "expression", "loc": [328, 328], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L320_C8", "vector": [8, 3, 0.9563, 0.0029, 3, 0.91, 0.5, 176, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "push", "arg_names": [], "import_names": [], "rhs_call_name": "push", "annotation": ""}, "snippet": " self.push(message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L329_C12", "label": "if", "type": "if", "loc": [329, 330], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L320_C8", "vector": [4, 3, 0.9606, 0.0058, 3, 0.91, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if message == EOT:\n self._open_session()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L330_C16", "label": "_open_session()", "type": "expression", "loc": [330, 330], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L329_C12", "vector": [8, 4, 0.9621, 0.0029, 4, 0.31, 0.0, 3, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_open_session", "arg_names": [], "import_names": [], "rhs_call_name": "_open_session", "annotation": ""}, "snippet": " self._open_session()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L332_C4", "label": "on_eot", "type": "function", "loc": [332, 334], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "vector": [2, 1, 0.9708, 0.0087, 1, 0.38, 0.8462, 163, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "on_eot", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_eot(self):\n \"\"\"Raises :class:`NotAccepted` exception.\"\"\"\n raise NotAccepted('Client should not receive EOT.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L333_C8", "label": "expression", "type": "expression", "loc": [333, 333], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L332_C4", "vector": [8, 2, 0.9708, 0.0029, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Raises :class:`NotAccepted` exception.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L336_C4", "label": "on_message", "type": "function", "loc": [336, 338], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "vector": [2, 1, 0.9825, 0.0087, 1, 0.38, 0.9231, 365, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "on_message", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_message(self):\n \"\"\"Raises :class:`NotAccepted` exception.\"\"\"\n raise NotAccepted('Client should not receive ASTM message.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L337_C8", "label": "expression", "type": "expression", "loc": [337, 337], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L336_C4", "vector": [8, 2, 0.9825, 0.0029, 2, 0.32, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Raises :class:`NotAccepted` exception.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L340_C4", "label": "on_timeout", "type": "function", "loc": [340, 343], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "vector": [2, 1, 0.9956, 0.0117, 1, 0.38, 1.0, 68, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "on_timeout", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_timeout(self):\n \"\"\"Sends final EOT message and closes connection after his receiving.\"\"\"\n super(Client, self).on_timeout()\n self._close_session(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L341_C8", "label": "expression", "type": "expression", "loc": [341, 341], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L340_C4", "vector": [8, 2, 0.9942, 0.0029, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Sends final EOT message and closes connection after his receiving.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L342_C8", "label": "on_timeout()", "type": "expression", "loc": [342, 342], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L340_C4", "vector": [8, 2, 0.9971, 0.0029, 2, 0.83, 0.5, 68, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "on_timeout", "arg_names": [], "import_names": [], "rhs_call_name": "on_timeout", "annotation": ""}, "snippet": " super(Client, self).on_timeout()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L343_C8", "label": "_close_session()", "type": "expression", "loc": [343, 343], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L340_C4", "vector": [8, 2, 1.0, 0.0029, 2, 0.83, 1.0, 544, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_close_session", "arg_names": [], "import_names": [], "rhs_call_name": "_close_session", "annotation": ""}, "snippet": " self._close_session(True)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L39_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L39_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L51_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Return_L52_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Return_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Return_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L120_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L121_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L123_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L125_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L127_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Return_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L131_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L132_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L131_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:While_L133_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:While_L133_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L134_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:While_L133_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L135_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:While_L133_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L136_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L131_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L138_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L131_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L141_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L148_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L149_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L148_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L150_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Return_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Return_L170_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L172_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Return_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L184_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Return_L185_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L187_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L194_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L253_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L255_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L255_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L258_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L255_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L259_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L255_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L260_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L255_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L261_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L255_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L268_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L270_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L271_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L270_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L272_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L270_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L273_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L275_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L275_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L276_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L275_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L279_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L280_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L282_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L283_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L284_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L284_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L285_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L287_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L287_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L288_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L287_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L290_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L292_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L292_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L293_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L296_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L296_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L297_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L296_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L302_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L302_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L303_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L302_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L305_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L302_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L307_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L302_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L308_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L308_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L309_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L311_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L311_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L312_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L311_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L317_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L317_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Return_L318_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L311_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L320_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L320_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Assign_L321_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L320_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L323_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L320_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L325_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L320_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L328_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:Try_L320_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L329_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:If_L329_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L330_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L332_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L332_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L333_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L336_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L336_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L337_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:ClassDef_L193_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L340_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L340_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L341_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L340_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L342_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1037:FunctionDef_L340_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1037:Expr_L343_C8"}]
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # import datetime import decimal import inspect import time import warnings from operator import itemgetter from itertools import islice try: from itertools import izip_longest except ImportError: # Python 3 from itertools import zip_longest as izip_longest from .compat import basestring, unicode, long def make_string(value): if isinstance(value, unicode): return value elif isinstance(value, bytes): return unicode(value, 'utf-8') else: return unicode(value) class Field(object): """Base mapping field class.""" def __init__(self, name=None, default=None, required=False, length=None): self.name = name self.default = default self.required = required self.length = length def __get__(self, instance, owner): if instance is None: return self value = instance._data.get(self.name) if value is not None: value = self._get_value(value) elif self.default is not None: default = self.default if hasattr(default, '__call__'): default = default() value = default return value def __set__(self, instance, value): if value is not None: value = self._set_value(value) instance._data[self.name] = value def _get_value(self, value): return value def _set_value(self, value): value = make_string(value) if self.length is not None and len(value) > self.length: raise ValueError('Field %r value is too long (max %d, got %d)' '' % (self.name, self.length, len(value))) return value class MetaMapping(type): def __new__(mcs, name, bases, d): fields = [] names = [] def merge_fields(items): for name, field in items: if field.name is None: field.name = name if name not in names: fields.append((name, field)) names.append(name) else: fields[names.index(name)] = (name, field) for base in bases: if hasattr(base, '_fields'): merge_fields(base._fields) merge_fields([(k, v) for k, v in d.items() if isinstance(v, Field)]) if '_fields' not in d: d['_fields'] = fields else: merge_fields(d['_fields']) d['_fields'] = fields return super(MetaMapping, mcs).__new__(mcs, name, bases, d) _MappingProxy = MetaMapping('_MappingProxy', (object,), {}) # Python 3 workaround class Mapping(_MappingProxy): def __init__(self, *args, **kwargs): fieldnames = map(itemgetter(0), self._fields) values = dict(izip_longest(fieldnames, args)) values.update(kwargs) self._data = {} for attrname, field in self._fields: attrval = values.pop(attrname, None) if attrval is None: setattr(self, attrname, getattr(self, attrname)) else: setattr(self, attrname, attrval) if values: raise ValueError('Unexpected kwargs found: %r' % values) @classmethod def build(cls, *a): fields = [] newcls = type('Generic' + cls.__name__, (cls,), {}) for field in a: if field.name is None: raise ValueError('Name is required for ordered fields.') setattr(newcls, field.name, field) fields.append((field.name, field)) newcls._fields = fields return newcls def __getitem__(self, key): return self.values()[key] def __setitem__(self, key, value): setattr(self, self._fields[key][0], value) def __delitem__(self, key): self._data[self._fields[key][0]] = None def __iter__(self): return iter(self.values()) def __contains__(self, item): return item in self.values() def __len__(self): return len(self._data) def __eq__(self, other): if len(self) != len(other): return False for key, value in zip(self.keys(), other): if getattr(self, key) != value: return False return True def __ne__(self, other): return not (self == other) def __repr__(self): return '%s(%s)' % (self.__class__.__name__, ', '.join('%s=%r' % (key, value) for key, value in self.items())) def keys(self): return [key for key, field in self._fields] def values(self): return [getattr(self, key) for key in self.keys()] def items(self): return [(key, getattr(self, key)) for key, field in self._fields] def to_astm(self): def values(obj): for key, field in obj._fields: value = obj._data[key] if isinstance(value, Mapping): yield list(values(value)) elif isinstance(value, list): stack = [] for item in value: if isinstance(item, Mapping): stack.append(list(values(item))) else: stack.append(item) yield stack elif value is None and field.required: raise ValueError('Field %r value should not be None' % key) else: yield value return list(values(self)) class Record(Mapping): """ASTM record mapping class.""" class Component(Mapping): """ASTM component mapping class.""" class TextField(Field): """Mapping field for string values.""" def _set_value(self, value): if not isinstance(value, basestring): raise TypeError('String value expected, got %r' % value) return super(TextField, self)._set_value(value) class ConstantField(Field): """Mapping field for constant values. >>> class Record(Mapping): ... type = ConstantField(default='S') >>> rec = Record() >>> rec.type 'S' >>> rec.type = 'W' Traceback (most recent call last): ... ValueError: Field changing not allowed """ def __init__(self, name=None, default=None, field=Field()): super(ConstantField, self).__init__(name, default, True, None) self.field = field self.required = True if self.default is None: raise ValueError('Constant value should be defined') def _get_value(self, value): return self.default def _set_value(self, value): value = self.field._get_value(value) if self.default != value: raise ValueError('Field changing not allowed: got %r, accepts %r' '' % (value, self.default)) return super(ConstantField, self)._set_value(value) class IntegerField(Field): """Mapping field for integer values.""" def _get_value(self, value): return int(value) def _set_value(self, value): if not isinstance(value, (int, long)): try: value = self._get_value(value) except Exception: raise TypeError('Integer value expected, got %r' % value) return super(IntegerField, self)._set_value(value) class DecimalField(Field): """Mapping field for decimal values.""" def _get_value(self, value): return decimal.Decimal(value) def _set_value(self, value): if not isinstance(value, (int, long, float, decimal.Decimal)): raise TypeError('Decimal value expected, got %r' % value) return super(DecimalField, self)._set_value(value) class DateField(Field): """Mapping field for storing date/time values.""" format = '%Y%m%d' def _get_value(self, value): return datetime.datetime.strptime(value, self.format) def _set_value(self, value): if isinstance(value, basestring): value = self._get_value(value) if not isinstance(value, (datetime.datetime, datetime.date)): raise TypeError('Datetime value expected, got %r' % value) return value.strftime(self.format) class TimeField(Field): """Mapping field for storing times.""" format = '%H%M%S' def _get_value(self, value): if isinstance(value, basestring): try: value = value.split('.', 1)[0] # strip out microseconds value = datetime.time(*time.strptime(value, self.format)[3:6]) except ValueError: raise ValueError('Value %r does not match format %s' '' % (value, self.format)) return value def _set_value(self, value): if isinstance(value, basestring): value = self._get_value(value) if not isinstance(value, (datetime.datetime, datetime.time)): raise TypeError('Datetime value expected, got %r' % value) if isinstance(value, datetime.datetime): value = value.time() return value.replace(microsecond=0).strftime(self.format) class DateTimeField(Field): """Mapping field for storing date/time values.""" format = '%Y%m%d%H%M%S' def _get_value(self, value): return datetime.datetime.strptime(value, self.format) def _set_value(self, value): if isinstance(value, basestring): value = self._get_value(value) if not isinstance(value, (datetime.datetime, datetime.date)): raise TypeError('Datetime value expected, got %r' % value) return value.strftime(self.format) class SetField(Field): """Mapping field for predefined set of values.""" def __init__(self, name=None, default=None, required=False, length=None, values=None, field=Field()): super(SetField, self).__init__(name, default, required, length) self.field = field self.values = values and set(values) or set([]) def _get_value(self, value): return self.field._get_value(value) def _set_value(self, value): value = self.field._get_value(value) if value not in self.values: raise ValueError('Unexpectable value %r' % value) return self.field._set_value(value) class ComponentField(Field): """Mapping field for storing record component.""" def __init__(self, mapping, name=None, default=None): self.mapping = mapping default = default or mapping() super(ComponentField, self).__init__(name, default) def _get_value(self, value): if isinstance(value, dict): return self.mapping(**value) elif isinstance(value, self.mapping): return value else: return self.mapping(*value) def _set_value(self, value): if isinstance(value, dict): return self.mapping(**value) elif isinstance(value, self.mapping): return value if isinstance(value, basestring): value = [value] return self.mapping(*value) class RepeatedComponentField(Field): """Mapping field for storing list of record components.""" def __init__(self, field, name=None, default=None): if isinstance(field, ComponentField): self.field = field else: assert isinstance(field, type) and issubclass(field, Mapping) self.field = ComponentField(field) default = default or [] super(RepeatedComponentField, self).__init__(name, default) class Proxy(list): def __init__(self, seq, field): list.__init__(self, seq) self.list = seq self.field = field def _to_list(self): return [list(self.field._get_value(item)) for item in self.list] def __add__(self, other): obj = type(self)(self.list, self.field) obj.extend(other) return obj def __iadd__(self, other): self.extend(other) return self def __mul__(self, other): return type(self)(self.list * other, self.field) def __imul__(self, other): self.list *= other return self def __lt__(self, other): return self._to_list() < other def __le__(self, other): return self._to_list() <= other def __eq__(self, other): return self._to_list() == other def __ne__(self, other): return self._to_list() != other def __ge__(self, other): return self._to_list() >= other def __gt__(self, other): return self._to_list() > other def __repr__(self): return '<ListProxy %s %r>' % (self.list, list(self)) def __str__(self): return str(self.list) def __unicode__(self): return unicode(self.list) def __delitem__(self, index): del self.list[index] def __getitem__(self, index): return self.field._get_value(self.list[index]) def __setitem__(self, index, value): self.list[index] = self.field._set_value(value) def __delslice__(self, i, j): del self.list[i:j] def __getslice__(self, i, j): return self.__class__(self.list[i:j], self.field) def __setslice__(self, i, j, seq): self.list[i:j] = [self.field._set_value(v) for v in seq] def __contains__(self, value): for item in self: if item == value: return True return False def __iter__(self): for index in range(len(self)): yield self[index] def __len__(self): return len(self.list) def __nonzero__(self): return bool(self.list) def __reduce__(self): return self.list.__reduce__() def __reduce_ex__(self, *args, **kwargs): return self.list.__reduce_ex__(*args, **kwargs) def append(self, item): self.list.append(self.field._set_value(item)) def count(self, value): return self._to_list().count(value) def extend(self, other): self.list.extend([self.field._set_value(i) for i in other]) def index(self, value, start=None, stop=None): start = start or 0 for idx, item in enumerate(islice(self, start, stop)): if item == value: return idx + start else: raise ValueError('%r not in list' % value) def insert(self, index, object): self.list.insert(index, self.field._set_value(object)) def remove(self, value): for item in self: if item == value: return self.list.remove(value) raise ValueError('Value %r not in list' % value) def pop(self, index=-1): return self.field._get_value(self.list.pop(index)) def sort(self, cmp=None, key=None, reverse=False): raise NotImplementedError('In place sorting not allowed.') # update docstrings from list for name, obj in inspect.getmembers(Proxy): if getattr(list, name, None) is None\ or name in ['__module__', '__doc__']: continue if not inspect.isfunction(obj): continue obj.__doc__ = getattr(list, name).__doc__ del name, obj def _get_value(self, value): return self.Proxy(value, self.field) def _set_value(self, value): return [self.field._set_value(item) for item in value] class NotUsedField(Field): """Mapping field for value that should be used. Acts as placeholder. On attempt to assign something to it raises :exc:`UserWarning` and rejects assigned value.""" def __init__(self, name=None): super(NotUsedField, self).__init__(name) def _get_value(self, value): return None def _set_value(self, value): warnings.warn('Field %r is not used, any assignments are omitted' '' % self.name, UserWarning) return None
ajibawa-2023/Python-Code-Large/train/row_1038
347
523
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Import_L10_C0", "label": "datetime import datetime", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0191, 0.0019, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime"], "rhs_call_name": "", "annotation": ""}, "snippet": "import datetime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Import_L11_C0", "label": "decimal import decimal", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.021, 0.0019, 0, 0.66, 0.04, 349, 0, 1, 0, 0, 349, 0, 0], "semantic": {"name": "decimal", "arg_names": [], "import_names": ["decimal"], "rhs_call_name": "", "annotation": ""}, "snippet": "import decimal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Import_L12_C0", "label": "inspect import inspect", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0229, 0.0019, 0, 0.66, 0.08, 878, 0, 1, 0, 0, 878, 0, 0], "semantic": {"name": "inspect", "arg_names": [], "import_names": ["inspect"], "rhs_call_name": "", "annotation": ""}, "snippet": "import inspect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Import_L13_C0", "label": "time import time", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0249, 0.0019, 0, 0.66, 0.12, 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_1038:Import_L14_C0", "label": "warnings import warnings", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0268, 0.0019, 0, 0.66, 0.16, 358, 0, 1, 0, 0, 358, 0, 0], "semantic": {"name": "warnings", "arg_names": [], "import_names": ["warnings"], "rhs_call_name": "", "annotation": ""}, "snippet": "import warnings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:ImportFrom_L15_C0", "label": "from operator import itemgetter", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0287, 0.0019, 0, 0.66, 0.2, 616, 0, 1, 0, 0, 616, 0, 0], "semantic": {"name": "operator", "arg_names": [], "import_names": ["itemgetter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from operator import itemgetter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:ImportFrom_L16_C0", "label": "from itertools import islice", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0306, 0.0019, 0, 0.66, 0.24, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "itertools", "arg_names": [], "import_names": ["islice"], "rhs_call_name": "", "annotation": ""}, "snippet": "from itertools import islice"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Try_L17_C0", "label": "try", "type": "try", "loc": [17, 21], "level": 0, "parent": null, "vector": [7, 0, 0.0363, 0.0096, 0, 0.66, 0.28, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from itertools import izip_longest\nexcept ImportError: # Python 3\n from itertools import zip_longest as izip_longest\n from .compat import basestring, unicode, long"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:ImportFrom_L18_C4", "label": "from itertools import izip_longest", "type": "import", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:Try_L17_C0", "vector": [1, 1, 0.0344, 0.0019, 1, 0.08, 0.0, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "itertools", "arg_names": [], "import_names": ["izip_longest"], "rhs_call_name": "", "annotation": ""}, "snippet": " from itertools import izip_longest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:ImportFrom_L20_C4", "label": "from itertools import izip_longest", "type": "import", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:Try_L17_C0", "vector": [1, 1, 0.0382, 0.0019, 1, 0.08, 0.0, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "itertools", "arg_names": [], "import_names": ["izip_longest"], "rhs_call_name": "", "annotation": ""}, "snippet": " from itertools import zip_longest as izip_longest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:ImportFrom_L21_C4", "label": "from compat import basestring, unicode, long", "type": "import", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:Try_L17_C0", "vector": [1, 1, 0.0402, 0.0019, 1, 0.08, 1.0, 238, 0, 3, 0, 0, 238, 0, 0], "semantic": {"name": "compat", "arg_names": [], "import_names": ["basestring", "unicode", "long"], "rhs_call_name": "", "annotation": ""}, "snippet": " from .compat import basestring, unicode, long"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L24_C0", "label": "make_string", "type": "function", "loc": [24, 30], "level": 0, "parent": null, "vector": [2, 0, 0.0516, 0.0134, 0, 0.66, 0.32, 714, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "make_string", "arg_names": ["value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def make_string(value):\n if isinstance(value, unicode):\n return value\n elif isinstance(value, bytes):\n return unicode(value, 'utf-8')\n else:\n return unicode(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L25_C4", "label": "if", "type": "if", "loc": [25, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L24_C0", "vector": [4, 1, 0.0526, 0.0115, 1, 0.1, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, unicode):\n return value\n elif isinstance(value, bytes):\n return unicode(value, 'utf-8')\n else:\n return unicode(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L26_C8", "label": "return", "type": "return", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L25_C4", "vector": [13, 2, 0.0497, 0.0019, 2, 0.05, 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_1038:If_L27_C4", "label": "if", "type": "if", "loc": [27, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L25_C4", "vector": [4, 2, 0.0545, 0.0076, 2, 0.05, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, bytes):\n return unicode(value, 'utf-8')\n else:\n return unicode(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L28_C8", "label": "return", "type": "return", "loc": [28, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L27_C4", "vector": [13, 3, 0.0535, 0.0019, 3, 0.67, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unicode(value, 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L30_C8", "label": "return", "type": "return", "loc": [30, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L27_C4", "vector": [13, 3, 0.0574, 0.0019, 3, 0.67, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unicode(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L33_C0", "label": "Field", "type": "class", "loc": [33, 67], "level": 0, "parent": null, "vector": [3, 0, 0.0956, 0.0669, 0, 0.66, 0.36, 949, 0, 5, 0, 0, 186, 0, 9], "semantic": {"name": "Field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Field(object):\n \"\"\"Base mapping field class.\"\"\"\n def __init__(self, name=None, default=None, required=False, length=None):\n self.name = name\n self.default = default\n self.required = required\n self.length = length\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L34_C4", "label": "expression", "type": "expression", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L33_C0", "vector": [8, 1, 0.065, 0.0019, 1, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Base mapping field class.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L35_C4", "label": "__init__", "type": "function", "loc": [35, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L33_C0", "vector": [2, 1, 0.0707, 0.0096, 1, 0.45, 0.2, 555, 0, 5, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "name", "default", "required", "length"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name=None, default=None, required=False, length=None):\n self.name = name\n self.default = default\n self.required = required\n self.length = length"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L36_C8", "label": "self.name =", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L35_C4", "vector": [14, 2, 0.0688, 0.0019, 2, 0.26, 0.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_1038:Assign_L37_C8", "label": "self.default =", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L35_C4", "vector": [14, 2, 0.0707, 0.0019, 2, 0.26, 0.3333, 762, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.default", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.default = default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L38_C8", "label": "self.required =", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L35_C4", "vector": [14, 2, 0.0727, 0.0019, 2, 0.26, 0.6667, 770, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.required", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.required = required"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L39_C8", "label": "self.length =", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L35_C4", "vector": [14, 2, 0.0746, 0.0019, 2, 0.26, 1.0, 879, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.length", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.length = length"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L41_C4", "label": "__get__", "type": "function", "loc": [41, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L33_C0", "vector": [2, 1, 0.0889, 0.0229, 1, 0.45, 0.4, 93, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "__get__", "arg_names": ["self", "instance", "owner"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __get__(self, instance, owner):\n if instance is None:\n return self\n value = instance._data.get(self.name)\n if value is not None:\n value = self._get_value(value)\n elif self.default is not None:\n default = self.default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L42_C8", "label": "if", "type": "if", "loc": [42, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L41_C4", "vector": [4, 2, 0.0813, 0.0038, 2, 0.17, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if instance is None:\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L43_C12", "label": "return", "type": "return", "loc": [43, 43], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L42_C8", "vector": [13, 3, 0.0822, 0.0019, 3, 0.96, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L44_C8", "label": "value = get()", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L41_C4", "vector": [14, 2, 0.0841, 0.0019, 2, 0.17, 0.3333, 441, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " value = instance._data.get(self.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L45_C8", "label": "if", "type": "if", "loc": [45, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L41_C4", "vector": [4, 2, 0.0918, 0.0134, 2, 0.17, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value is not None:\n value = self._get_value(value)\n elif self.default is not None:\n default = self.default\n if hasattr(default, '__call__'):\n default = default()\n value = default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L46_C12", "label": "value = _get_value()", "type": "assigned_variable", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L45_C8", "vector": [14, 3, 0.088, 0.0019, 3, 0.42, 0.0, 441, 3, 1, 0, 0, 479, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "_get_value", "annotation": ""}, "snippet": " value = self._get_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L47_C8", "label": "if", "type": "if", "loc": [47, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L45_C8", "vector": [4, 3, 0.0937, 0.0096, 3, 0.42, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.default is not None:\n default = self.default\n if hasattr(default, '__call__'):\n default = default()\n value = default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L48_C12", "label": "default =", "type": "assigned_variable", "loc": [48, 48], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L47_C8", "vector": [14, 4, 0.0918, 0.0019, 4, 0.16, 0.0, 977, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "default", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " default = self.default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L49_C12", "label": "if", "type": "if", "loc": [49, 50], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L47_C8", "vector": [4, 4, 0.0946, 0.0038, 4, 0.16, 0.5, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(default, '__call__'):\n default = default()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L50_C16", "label": "default = default()", "type": "assigned_variable", "loc": [50, 50], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L49_C12", "vector": [14, 5, 0.0956, 0.0019, 5, 0.45, 0.0, 977, 3, 0, 0, 0, 977, 10, 1], "semantic": {"name": "default", "arg_names": [], "import_names": [], "rhs_call_name": "default", "annotation": ""}, "snippet": " default = default()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L51_C12", "label": "value =", "type": "assigned_variable", "loc": [51, 51], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L47_C8", "vector": [14, 4, 0.0975, 0.0019, 4, 0.16, 1.0, 441, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L52_C8", "label": "return", "type": "return", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L41_C4", "vector": [13, 2, 0.0994, 0.0019, 2, 0.17, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L54_C4", "label": "__set__", "type": "function", "loc": [54, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L33_C0", "vector": [2, 1, 0.1061, 0.0076, 1, 0.45, 0.6, 145, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__set__", "arg_names": ["self", "instance", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __set__(self, instance, value):\n if value is not None:\n value = self._set_value(value)\n instance._data[self.name] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L55_C8", "label": "if", "type": "if", "loc": [55, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L54_C4", "vector": [4, 2, 0.1061, 0.0038, 2, 0.55, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value is not None:\n value = self._set_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L56_C12", "label": "value = _set_value()", "type": "assigned_variable", "loc": [56, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L55_C8", "vector": [14, 3, 0.1071, 0.0019, 3, 0.48, 0.0, 441, 3, 1, 0, 0, 565, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "_set_value", "annotation": ""}, "snippet": " value = self._set_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L57_C8", "label": "assign", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L54_C4", "vector": [14, 2, 0.109, 0.0019, 2, 0.55, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " instance._data[self.name] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L59_C4", "label": "_get_value", "type": "function", "loc": [59, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L33_C0", "vector": [2, 1, 0.1138, 0.0038, 1, 0.45, 0.8, 479, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "_get_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_value(self, value):\n return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L60_C8", "label": "return", "type": "return", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L59_C4", "vector": [13, 2, 0.1147, 0.0019, 2, 0.7, 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_1038:FunctionDef_L62_C4", "label": "_set_value", "type": "function", "loc": [62, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L33_C0", "vector": [2, 1, 0.1233, 0.0115, 1, 0.45, 1.0, 565, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "_set_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_value(self, value):\n value = make_string(value)\n if self.length is not None and len(value) > self.length:\n raise ValueError('Field %r value is too long (max %d, got %d)'\n '' % (self.name, self.length, len(value)))\n return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L63_C8", "label": "value = make_string()", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L62_C4", "vector": [14, 2, 0.1205, 0.0019, 2, 0.62, 0.0, 441, 3, 1, 0, 0, 714, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "make_string", "annotation": ""}, "snippet": " value = make_string(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L64_C8", "label": "if", "type": "if", "loc": [64, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L62_C4", "vector": [4, 2, 0.1243, 0.0057, 2, 0.62, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.length is not None and len(value) > self.length:\n raise ValueError('Field %r value is too long (max %d, got %d)'\n '' % (self.name, self.length, len(value)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L67_C8", "label": "return", "type": "return", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L62_C4", "vector": [13, 2, 0.1281, 0.0019, 2, 0.62, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L70_C0", "label": "MetaMapping", "type": "class", "loc": [70, 93], "level": 0, "parent": null, "vector": [3, 0, 0.1558, 0.0459, 0, 0.66, 0.4, 378, 0, 2, 0, 0, 801, 0, 11], "semantic": {"name": "MetaMapping", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MetaMapping(type):\n\n def __new__(mcs, name, bases, d):\n fields = []\n names = []\n def merge_fields(items):\n for name, field in items:\n if field.name is None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L72_C4", "label": "__new__", "type": "function", "loc": [72, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L70_C0", "vector": [2, 1, 0.1577, 0.0421, 1, 0.77, 0.0, 42, 0, 4, 1, 0, 0, 0, 11], "semantic": {"name": "__new__", "arg_names": ["mcs", "name", "bases", "d"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __new__(mcs, name, bases, d):\n fields = []\n names = []\n def merge_fields(items):\n for name, field in items:\n if field.name is None:\n field.name = name\n if name not in names:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L73_C8", "label": "fields =", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L72_C4", "vector": [14, 2, 0.1396, 0.0019, 2, 0.99, 0.0, 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_1038:Assign_L74_C8", "label": "names =", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L72_C4", "vector": [14, 2, 0.1415, 0.0019, 2, 0.99, 0.1667, 382, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "names", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " names = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L75_C8", "label": "merge_fields", "type": "function", "loc": [75, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L72_C4", "vector": [2, 2, 0.1511, 0.0172, 2, 0.99, 0.3333, 94, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "merge_fields", "arg_names": ["items"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def merge_fields(items):\n for name, field in items:\n if field.name is None:\n field.name = name\n if name not in names:\n fields.append((name, field))\n names.append(name)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L76_C12", "label": "for name, field", "type": "for", "loc": [76, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L75_C8", "vector": [6, 3, 0.152, 0.0153, 3, 0.8, 0.0, 382, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "name, field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for name, field in items:\n if field.name is None:\n field.name = name\n if name not in names:\n fields.append((name, field))\n names.append(name)\n else:\n fields[names.index(name)] = (name, field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L77_C16", "label": "if", "type": "if", "loc": [77, 78], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L76_C12", "vector": [4, 4, 0.1482, 0.0038, 4, 0.76, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field.name is None:\n field.name = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L78_C20", "label": "field.name =", "type": "assigned_variable", "loc": [78, 78], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L77_C16", "vector": [14, 5, 0.1491, 0.0019, 5, 0.71, 0.0, 245, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "field.name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field.name = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L79_C16", "label": "if", "type": "if", "loc": [79, 83], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L76_C12", "vector": [4, 4, 0.1549, 0.0096, 4, 0.76, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name not in names:\n fields.append((name, field))\n names.append(name)\n else:\n fields[names.index(name)] = (name, field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L80_C20", "label": "append()", "type": "expression", "loc": [80, 80], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L79_C16", "vector": [8, 5, 0.153, 0.0019, 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": " fields.append((name, field))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L81_C20", "label": "append()", "type": "expression", "loc": [81, 81], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L79_C16", "vector": [8, 5, 0.1549, 0.0019, 5, 0.0, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " names.append(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L83_C20", "label": "assign", "type": "assigned_variable", "loc": [83, 83], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L79_C16", "vector": [14, 5, 0.1587, 0.0019, 5, 0.0, 1.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fields[names.index(name)] = (name, field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L84_C8", "label": "for base", "type": "for", "loc": [84, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L72_C4", "vector": [6, 2, 0.1625, 0.0057, 2, 0.99, 0.5, 47, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "base", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for base in bases:\n if hasattr(base, '_fields'):\n merge_fields(base._fields)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L85_C12", "label": "if", "type": "if", "loc": [85, 86], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L84_C8", "vector": [4, 3, 0.1635, 0.0038, 3, 0.56, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(base, '_fields'):\n merge_fields(base._fields)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L86_C16", "label": "merge_fields()", "type": "expression", "loc": [86, 86], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L85_C12", "vector": [8, 4, 0.1644, 0.0019, 4, 0.41, 0.0, 94, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "merge_fields", "arg_names": [], "import_names": [], "rhs_call_name": "merge_fields", "annotation": ""}, "snippet": " merge_fields(base._fields)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L87_C8", "label": "merge_fields()", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L72_C4", "vector": [8, 2, 0.1663, 0.0019, 2, 0.99, 0.6667, 94, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "merge_fields", "arg_names": [], "import_names": [], "rhs_call_name": "merge_fields", "annotation": ""}, "snippet": " merge_fields([(k, v) for k, v in d.items() if isinstance(v, Field)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L88_C8", "label": "if", "type": "if", "loc": [88, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L72_C4", "vector": [4, 2, 0.1721, 0.0096, 2, 0.99, 0.8333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if '_fields' not in d:\n d['_fields'] = fields\n else:\n merge_fields(d['_fields'])\n d['_fields'] = fields"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L89_C12", "label": "assign", "type": "assigned_variable", "loc": [89, 89], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L88_C8", "vector": [14, 3, 0.1702, 0.0019, 3, 0.67, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d['_fields'] = fields"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L91_C12", "label": "merge_fields()", "type": "expression", "loc": [91, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L88_C8", "vector": [8, 3, 0.174, 0.0019, 3, 0.67, 0.5, 94, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "merge_fields", "arg_names": [], "import_names": [], "rhs_call_name": "merge_fields", "annotation": ""}, "snippet": " merge_fields(d['_fields'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L92_C12", "label": "assign", "type": "assigned_variable", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L88_C8", "vector": [14, 3, 0.1759, 0.0019, 3, 0.67, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d['_fields'] = fields"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L93_C8", "label": "return", "type": "return", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L72_C4", "vector": [13, 2, 0.1778, 0.0019, 2, 0.99, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return super(MetaMapping, mcs).__new__(mcs, name, bases, d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L96_C0", "label": "_MappingProxy = MetaMapping()", "type": "assigned_variable", "loc": [96, 96], "level": 0, "parent": null, "vector": [14, 0, 0.1836, 0.0019, 0, 0.66, 0.44, 379, 3, 3, 0, 0, 378, 10, 1], "semantic": {"name": "_MappingProxy", "arg_names": [], "import_names": [], "rhs_call_name": "MetaMapping", "annotation": ""}, "snippet": "_MappingProxy = MetaMapping('_MappingProxy', (object,), {}) # Python 3 workaround"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "label": "Mapping", "type": "class", "loc": [98, 187], "level": 0, "parent": null, "vector": [3, 0, 0.2725, 0.1721, 0, 0.66, 0.48, 66, 0, 16, 0, 0, 379, 0, 42], "semantic": {"name": "Mapping", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Mapping(_MappingProxy):\n\n def __init__(self, *args, **kwargs):\n fieldnames = map(itemgetter(0), self._fields)\n values = dict(izip_longest(fieldnames, args))\n values.update(kwargs)\n self._data = {}\n for attrname, field in self._fields:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L100_C4", "label": "__init__", "type": "function", "loc": [100, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "vector": [2, 1, 0.2027, 0.0249, 1, 0.28, 0.0, 555, 0, 3, 0, 0, 0, 0, 10], "semantic": {"name": "__init__", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *args, **kwargs):\n fieldnames = map(itemgetter(0), self._fields)\n values = dict(izip_longest(fieldnames, args))\n values.update(kwargs)\n self._data = {}\n for attrname, field in self._fields:\n attrval = values.pop(attrname, None)\n if attrval is None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L101_C8", "label": "fieldnames = map()", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L100_C4", "vector": [14, 2, 0.1931, 0.0019, 2, 0.54, 0.0, 948, 3, 2, 0, 0, 53, 10, 2], "semantic": {"name": "fieldnames", "arg_names": [], "import_names": [], "rhs_call_name": "map", "annotation": ""}, "snippet": " fieldnames = map(itemgetter(0), self._fields)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L102_C8", "label": "values = dict()", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L100_C4", "vector": [14, 2, 0.195, 0.0019, 2, 0.54, 0.2, 721, 3, 1, 0, 0, 827, 10, 2], "semantic": {"name": "values", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " values = dict(izip_longest(fieldnames, args))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L103_C8", "label": "update()", "type": "expression", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L100_C4", "vector": [8, 2, 0.1969, 0.0019, 2, 0.54, 0.4, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " values.update(kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L104_C8", "label": "self._data =", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L100_C4", "vector": [14, 2, 0.1989, 0.0019, 2, 0.54, 0.6, 753, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self._data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._data = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L105_C8", "label": "for attrname, field", "type": "for", "loc": [105, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L100_C4", "vector": [6, 2, 0.2055, 0.0115, 2, 0.54, 0.8, 581, 7, 0, 0, 0, 0, 0, 4], "semantic": {"name": "attrname, field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for attrname, field in self._fields:\n attrval = values.pop(attrname, None)\n if attrval is None:\n setattr(self, attrname, getattr(self, attrname))\n else:\n setattr(self, attrname, attrval)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L106_C12", "label": "attrval = pop()", "type": "assigned_variable", "loc": [106, 106], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L105_C8", "vector": [14, 3, 0.2027, 0.0019, 3, 0.87, 0.0, 182, 3, 2, 0, 0, 969, 10, 1], "semantic": {"name": "attrval", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " attrval = values.pop(attrname, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L107_C12", "label": "if", "type": "if", "loc": [107, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L105_C8", "vector": [4, 3, 0.2075, 0.0076, 3, 0.87, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if attrval is None:\n setattr(self, attrname, getattr(self, attrname))\n else:\n setattr(self, attrname, attrval)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L108_C16", "label": "setattr()", "type": "expression", "loc": [108, 108], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L107_C12", "vector": [8, 4, 0.2065, 0.0019, 4, 0.38, 0.0, 501, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(self, attrname, getattr(self, attrname))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L110_C16", "label": "setattr()", "type": "expression", "loc": [110, 110], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L107_C12", "vector": [8, 4, 0.2103, 0.0019, 4, 0.38, 1.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(self, attrname, attrval)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L111_C8", "label": "if", "type": "if", "loc": [111, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L100_C4", "vector": [4, 2, 0.2132, 0.0038, 2, 0.54, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if values:\n raise ValueError('Unexpected kwargs found: %r' % values)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L115_C4", "label": "build", "type": "function", "loc": [115, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "vector": [2, 1, 0.2285, 0.0191, 1, 0.28, 0.0714, 448, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "build", "arg_names": ["cls", "a"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build(cls, *a):\n fields = []\n newcls = type('Generic' + cls.__name__, (cls,), {})\n for field in a:\n if field.name is None:\n raise ValueError('Name is required for ordered fields.')\n setattr(newcls, field.name, field)\n fields.append((field.name, field))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L116_C8", "label": "fields =", "type": "assigned_variable", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L115_C4", "vector": [14, 2, 0.2218, 0.0019, 2, 0.62, 0.0, 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_1038:Assign_L117_C8", "label": "newcls = type()", "type": "assigned_variable", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L115_C4", "vector": [14, 2, 0.2237, 0.0019, 2, 0.62, 0.25, 914, 3, 3, 0, 0, 801, 10, 1], "semantic": {"name": "newcls", "arg_names": [], "import_names": [], "rhs_call_name": "type", "annotation": ""}, "snippet": " newcls = type('Generic' + cls.__name__, (cls,), {})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L118_C8", "label": "for field", "type": "for", "loc": [118, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L115_C4", "vector": [6, 2, 0.2294, 0.0096, 2, 0.62, 0.5, 480, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for field in a:\n if field.name is None:\n raise ValueError('Name is required for ordered fields.')\n setattr(newcls, field.name, field)\n fields.append((field.name, field))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L119_C12", "label": "if", "type": "if", "loc": [119, 120], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L118_C8", "vector": [4, 3, 0.2285, 0.0038, 3, 0.84, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field.name is None:\n raise ValueError('Name is required for ordered fields.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L121_C12", "label": "setattr()", "type": "expression", "loc": [121, 121], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L118_C8", "vector": [8, 3, 0.2314, 0.0019, 3, 0.84, 0.5, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(newcls, field.name, field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L122_C12", "label": "append()", "type": "expression", "loc": [122, 122], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L118_C8", "vector": [8, 3, 0.2333, 0.0019, 3, 0.84, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " fields.append((field.name, field))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L123_C8", "label": "newcls._fields =", "type": "assigned_variable", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L115_C4", "vector": [14, 2, 0.2352, 0.0019, 2, 0.62, 0.75, 112, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "newcls._fields", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newcls._fields = fields"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L124_C8", "label": "return", "type": "return", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L115_C4", "vector": [13, 2, 0.2371, 0.0019, 2, 0.62, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return newcls"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L126_C4", "label": "__getitem__", "type": "function", "loc": [126, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "vector": [2, 1, 0.2419, 0.0038, 1, 0.28, 0.1429, 698, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__getitem__", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, key):\n return self.values()[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L127_C8", "label": "return", "type": "return", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L126_C4", "vector": [13, 2, 0.2428, 0.0019, 2, 0.37, 0.0, 0, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.values()[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L129_C4", "label": "__setitem__", "type": "function", "loc": [129, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "vector": [2, 1, 0.2476, 0.0038, 1, 0.28, 0.2143, 343, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__setitem__", "arg_names": ["self", "key", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __setitem__(self, key, value):\n setattr(self, self._fields[key][0], value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L130_C8", "label": "setattr()", "type": "expression", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L129_C4", "vector": [8, 2, 0.2486, 0.0019, 2, 0.52, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(self, self._fields[key][0], value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L132_C4", "label": "__delitem__", "type": "function", "loc": [132, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "vector": [2, 1, 0.2533, 0.0038, 1, 0.28, 0.2857, 66, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__delitem__", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __delitem__(self, key):\n self._data[self._fields[key][0]] = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L133_C8", "label": "assign", "type": "assigned_variable", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L132_C4", "vector": [14, 2, 0.2543, 0.0019, 2, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._data[self._fields[key][0]] = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L135_C4", "label": "__iter__", "type": "function", "loc": [135, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "vector": [2, 1, 0.2591, 0.0038, 1, 0.28, 0.3571, 891, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n return iter(self.values())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L136_C8", "label": "return", "type": "return", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L135_C4", "vector": [13, 2, 0.26, 0.0019, 2, 0.62, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return iter(self.values())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L138_C4", "label": "__contains__", "type": "function", "loc": [138, 139], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "vector": [2, 1, 0.2648, 0.0038, 1, 0.28, 0.4286, 456, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__contains__", "arg_names": ["self", "item"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __contains__(self, item):\n return item in self.values()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L139_C8", "label": "return", "type": "return", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L138_C4", "vector": [13, 2, 0.2658, 0.0019, 2, 0.26, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return item in self.values()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L141_C4", "label": "__len__", "type": "function", "loc": [141, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "vector": [2, 1, 0.2706, 0.0038, 1, 0.28, 0.5, 76, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__len__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __len__(self):\n return len(self._data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L142_C8", "label": "return", "type": "return", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L141_C4", "vector": [13, 2, 0.2715, 0.0019, 2, 0.01, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self._data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L144_C4", "label": "__eq__", "type": "function", "loc": [144, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "vector": [2, 1, 0.2811, 0.0134, 1, 0.28, 0.5714, 763, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "__eq__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __eq__(self, other):\n if len(self) != len(other):\n return False\n for key, value in zip(self.keys(), other):\n if getattr(self, key) != value:\n return False\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L145_C8", "label": "if", "type": "if", "loc": [145, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L144_C4", "vector": [4, 2, 0.2782, 0.0038, 2, 0.14, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(self) != len(other):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L146_C12", "label": "return", "type": "return", "loc": [146, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L145_C8", "vector": [13, 3, 0.2792, 0.0019, 3, 0.65, 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_1038:For_L147_C8", "label": "for key, value", "type": "for", "loc": [147, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L144_C4", "vector": [6, 2, 0.283, 0.0057, 2, 0.14, 0.5, 839, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, value in zip(self.keys(), other):\n if getattr(self, key) != value:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L148_C12", "label": "if", "type": "if", "loc": [148, 149], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L147_C8", "vector": [4, 3, 0.2839, 0.0038, 3, 0.5, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if getattr(self, key) != value:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L149_C16", "label": "return", "type": "return", "loc": [149, 149], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L148_C12", "vector": [13, 4, 0.2849, 0.0019, 4, 0.11, 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_1038:Return_L150_C8", "label": "return", "type": "return", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L144_C4", "vector": [13, 2, 0.2868, 0.0019, 2, 0.14, 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_1038:FunctionDef_L152_C4", "label": "__ne__", "type": "function", "loc": [152, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "vector": [2, 1, 0.2916, 0.0038, 1, 0.28, 0.6429, 254, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__ne__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __ne__(self, other):\n return not (self == other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L153_C8", "label": "return", "type": "return", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L152_C4", "vector": [13, 2, 0.2925, 0.0019, 2, 0.52, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return not (self == other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L155_C4", "label": "__repr__", "type": "function", "loc": [155, 158], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "vector": [2, 1, 0.2992, 0.0076, 1, 0.28, 0.7143, 204, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "__repr__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __repr__(self):\n return '%s(%s)' % (self.__class__.__name__,\n ', '.join('%s=%r' % (key, value)\n for key, value in self.items()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L156_C8", "label": "return", "type": "return", "loc": [156, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L155_C4", "vector": [13, 2, 0.3002, 0.0057, 2, 0.54, 0.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s(%s)' % (self.__class__.__name__,\n ', '.join('%s=%r' % (key, value)\n for key, value in self.items()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L160_C4", "label": "keys", "type": "function", "loc": [160, 161], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "vector": [2, 1, 0.3069, 0.0038, 1, 0.28, 0.7857, 204, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "keys", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def keys(self):\n return [key for key, field in self._fields]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L161_C8", "label": "return", "type": "return", "loc": [161, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L160_C4", "vector": [13, 2, 0.3078, 0.0019, 2, 0.08, 0.0, 0, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [key for key, field in self._fields]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L163_C4", "label": "values", "type": "function", "loc": [163, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "vector": [2, 1, 0.3126, 0.0038, 1, 0.28, 0.8571, 721, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "values", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def values(self):\n return [getattr(self, key) for key in self.keys()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L164_C8", "label": "return", "type": "return", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L163_C4", "vector": [13, 2, 0.3136, 0.0019, 2, 0.96, 0.0, 0, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [getattr(self, key) for key in self.keys()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L166_C4", "label": "items", "type": "function", "loc": [166, 167], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "vector": [2, 1, 0.3184, 0.0038, 1, 0.28, 0.9286, 339, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "items", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def items(self):\n return [(key, getattr(self, key)) for key, field in self._fields]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L167_C8", "label": "return", "type": "return", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L166_C4", "vector": [13, 2, 0.3193, 0.0019, 2, 0.86, 0.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [(key, getattr(self, key)) for key, field in self._fields]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L169_C4", "label": "to_astm", "type": "function", "loc": [169, 187], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "vector": [2, 1, 0.3403, 0.0363, 1, 0.28, 1.0, 869, 0, 1, 1, 0, 0, 0, 12], "semantic": {"name": "to_astm", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def to_astm(self):\n def values(obj):\n for key, field in obj._fields:\n value = obj._data[key]\n if isinstance(value, Mapping):\n yield list(values(value))\n elif isinstance(value, list):\n stack = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L170_C8", "label": "values", "type": "function", "loc": [170, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L169_C4", "vector": [2, 2, 0.3403, 0.0325, 2, 0.6, 0.0, 721, 0, 1, 0, 0, 0, 0, 10], "semantic": {"name": "values", "arg_names": ["obj"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def values(obj):\n for key, field in obj._fields:\n value = obj._data[key]\n if isinstance(value, Mapping):\n yield list(values(value))\n elif isinstance(value, list):\n stack = []\n for item in value:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L171_C12", "label": "for key, field", "type": "for", "loc": [171, 186], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L170_C8", "vector": [6, 3, 0.3413, 0.0306, 3, 0.58, 0.0, 411, 7, 0, 0, 0, 0, 0, 10], "semantic": {"name": "key, field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, field in obj._fields:\n value = obj._data[key]\n if isinstance(value, Mapping):\n yield list(values(value))\n elif isinstance(value, list):\n stack = []\n for item in value:\n if isinstance(item, Mapping):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L172_C16", "label": "value =", "type": "assigned_variable", "loc": [172, 172], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L171_C12", "vector": [14, 4, 0.3289, 0.0019, 4, 0.3, 0.0, 441, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = obj._data[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L173_C16", "label": "if", "type": "if", "loc": [173, 186], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L171_C12", "vector": [4, 4, 0.3432, 0.0268, 4, 0.3, 1.0, 0, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, Mapping):\n yield list(values(value))\n elif isinstance(value, list):\n stack = []\n for item in value:\n if isinstance(item, Mapping):\n stack.append(list(values(item)))\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L174_C20", "label": "expression", "type": "expression", "loc": [174, 174], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L173_C16", "vector": [8, 5, 0.3327, 0.0019, 5, 0.97, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield list(values(value))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L175_C16", "label": "if", "type": "if", "loc": [175, 186], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L173_C16", "vector": [4, 5, 0.3451, 0.0229, 5, 0.97, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, list):\n stack = []\n for item in value:\n if isinstance(item, Mapping):\n stack.append(list(values(item)))\n else:\n stack.append(item)\n yield stack"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L176_C20", "label": "stack =", "type": "assigned_variable", "loc": [176, 176], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L175_C16", "vector": [14, 6, 0.3365, 0.0019, 6, 0.33, 0.0, 540, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "stack", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " stack = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L177_C20", "label": "for item", "type": "for", "loc": [177, 181], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L175_C16", "vector": [6, 6, 0.3423, 0.0096, 6, 0.33, 0.3333, 434, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in value:\n if isinstance(item, Mapping):\n stack.append(list(values(item)))\n else:\n stack.append(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L178_C24", "label": "if", "type": "if", "loc": [178, 181], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L177_C20", "vector": [4, 7, 0.3432, 0.0076, 7, 0.87, 0.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(item, Mapping):\n stack.append(list(values(item)))\n else:\n stack.append(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L179_C28", "label": "append()", "type": "expression", "loc": [179, 179], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L178_C24", "vector": [8, 8, 0.3423, 0.0019, 8, 0.72, 0.0, 243, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " stack.append(list(values(item)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L181_C28", "label": "append()", "type": "expression", "loc": [181, 181], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L178_C24", "vector": [8, 8, 0.3461, 0.0019, 8, 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": " stack.append(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L182_C20", "label": "expression", "type": "expression", "loc": [182, 182], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L175_C16", "vector": [8, 6, 0.348, 0.0019, 6, 0.33, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield stack"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L183_C16", "label": "if", "type": "if", "loc": [183, 186], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L175_C16", "vector": [4, 6, 0.3528, 0.0076, 6, 0.33, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is None and field.required:\n raise ValueError('Field %r value should not be None' % key)\n else:\n yield value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L186_C20", "label": "expression", "type": "expression", "loc": [186, 186], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L183_C16", "vector": [8, 7, 0.3556, 0.0019, 7, 0.55, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L187_C8", "label": "return", "type": "return", "loc": [187, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L169_C4", "vector": [13, 2, 0.3576, 0.0019, 2, 0.6, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return list(values(self))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L190_C0", "label": "Record", "type": "class", "loc": [190, 191], "level": 0, "parent": null, "vector": [3, 0, 0.3642, 0.0038, 0, 0.66, 0.52, 685, 0, 0, 0, 0, 66, 0, 0], "semantic": {"name": "Record", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Record(Mapping):\n \"\"\"ASTM record mapping class.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L191_C4", "label": "expression", "type": "expression", "loc": [191, 191], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L190_C0", "vector": [8, 1, 0.3652, 0.0019, 1, 0.12, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"ASTM record mapping class.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L194_C0", "label": "Component", "type": "class", "loc": [194, 195], "level": 0, "parent": null, "vector": [3, 0, 0.3719, 0.0038, 0, 0.66, 0.56, 660, 0, 0, 0, 0, 66, 0, 0], "semantic": {"name": "Component", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Component(Mapping):\n \"\"\"ASTM component mapping class.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L195_C4", "label": "expression", "type": "expression", "loc": [195, 195], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L194_C0", "vector": [8, 1, 0.3728, 0.0019, 1, 0.47, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"ASTM component mapping class.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L198_C0", "label": "TextField", "type": "class", "loc": [198, 203], "level": 0, "parent": null, "vector": [3, 0, 0.3834, 0.0115, 0, 0.66, 0.6, 612, 0, 1, 0, 0, 949, 0, 4], "semantic": {"name": "TextField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TextField(Field):\n \"\"\"Mapping field for string values.\"\"\"\n def _set_value(self, value):\n if not isinstance(value, basestring):\n raise TypeError('String value expected, got %r' % value)\n return super(TextField, self)._set_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L199_C4", "label": "expression", "type": "expression", "loc": [199, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L198_C0", "vector": [8, 1, 0.3805, 0.0019, 1, 0.02, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Mapping field for string values.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L200_C4", "label": "_set_value", "type": "function", "loc": [200, 203], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L198_C0", "vector": [2, 1, 0.3853, 0.0076, 1, 0.02, 1.0, 565, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "_set_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_value(self, value):\n if not isinstance(value, basestring):\n raise TypeError('String value expected, got %r' % value)\n return super(TextField, self)._set_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L201_C8", "label": "if", "type": "if", "loc": [201, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L200_C4", "vector": [4, 2, 0.3853, 0.0038, 2, 0.76, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(value, basestring):\n raise TypeError('String value expected, got %r' % value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L203_C8", "label": "return", "type": "return", "loc": [203, 203], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L200_C4", "vector": [13, 2, 0.3881, 0.0019, 2, 0.76, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return super(TextField, self)._set_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L206_C0", "label": "ConstantField", "type": "class", "loc": [206, 234], "level": 0, "parent": null, "vector": [3, 0, 0.4207, 0.0554, 0, 0.66, 0.64, 543, 0, 3, 0, 0, 949, 0, 8], "semantic": {"name": "ConstantField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ConstantField(Field):\n \"\"\"Mapping field for constant values.\n\n >>> class Record(Mapping):\n ... type = ConstantField(default='S')\n >>> rec = Record()\n >>> rec.type\n 'S'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L207_C4", "label": "expression", "type": "expression", "loc": [207, 218], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L206_C0", "vector": [8, 1, 0.4063, 0.0229, 1, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Mapping field for constant values.\n\n >>> class Record(Mapping):\n ... type = ConstantField(default='S')\n >>> rec = Record()\n >>> rec.type\n 'S'\n >>> rec.type = 'W'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L219_C4", "label": "__init__", "type": "function", "loc": [219, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L206_C0", "vector": [2, 1, 0.4235, 0.0115, 1, 0.72, 0.3333, 555, 0, 4, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "name", "default", "field"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name=None, default=None, field=Field()):\n super(ConstantField, self).__init__(name, default, True, None)\n self.field = field\n self.required = True\n if self.default is None:\n raise ValueError('Constant value should be defined')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L220_C8", "label": "__init__()", "type": "expression", "loc": [220, 220], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L219_C4", "vector": [8, 2, 0.4207, 0.0019, 2, 0.37, 0.0, 555, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(ConstantField, self).__init__(name, default, True, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L221_C8", "label": "self.field =", "type": "assigned_variable", "loc": [221, 221], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L219_C4", "vector": [14, 2, 0.4226, 0.0019, 2, 0.37, 0.3333, 951, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.field = field"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L222_C8", "label": "self.required =", "type": "assigned_variable", "loc": [222, 222], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L219_C4", "vector": [14, 2, 0.4245, 0.0019, 2, 0.37, 0.6667, 770, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.required", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.required = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L223_C8", "label": "if", "type": "if", "loc": [223, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L219_C4", "vector": [4, 2, 0.4273, 0.0038, 2, 0.37, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.default is None:\n raise ValueError('Constant value should be defined')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L226_C4", "label": "_get_value", "type": "function", "loc": [226, 227], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L206_C0", "vector": [2, 1, 0.4331, 0.0038, 1, 0.72, 0.6667, 479, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "_get_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_value(self, value):\n return self.default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L227_C8", "label": "return", "type": "return", "loc": [227, 227], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L226_C4", "vector": [13, 2, 0.434, 0.0019, 2, 0.49, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L229_C4", "label": "_set_value", "type": "function", "loc": [229, 234], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L206_C0", "vector": [2, 1, 0.4426, 0.0115, 1, 0.72, 1.0, 565, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "_set_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_value(self, value):\n value = self.field._get_value(value)\n if self.default != value:\n raise ValueError('Field changing not allowed: got %r, accepts %r'\n '' % (value, self.default))\n return super(ConstantField, self)._set_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L230_C8", "label": "value = _get_value()", "type": "assigned_variable", "loc": [230, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L229_C4", "vector": [14, 2, 0.4398, 0.0019, 2, 0.8, 0.0, 441, 3, 1, 0, 0, 479, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "_get_value", "annotation": ""}, "snippet": " value = self.field._get_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L231_C8", "label": "if", "type": "if", "loc": [231, 233], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L229_C4", "vector": [4, 2, 0.4436, 0.0057, 2, 0.8, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.default != value:\n raise ValueError('Field changing not allowed: got %r, accepts %r'\n '' % (value, self.default))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L234_C8", "label": "return", "type": "return", "loc": [234, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L229_C4", "vector": [13, 2, 0.4474, 0.0019, 2, 0.8, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return super(ConstantField, self)._set_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L237_C0", "label": "IntegerField", "type": "class", "loc": [237, 248], "level": 0, "parent": null, "vector": [3, 0, 0.4637, 0.0229, 0, 0.66, 0.68, 877, 0, 2, 0, 0, 949, 0, 6], "semantic": {"name": "IntegerField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class IntegerField(Field):\n \"\"\"Mapping field for integer values.\"\"\"\n def _get_value(self, value):\n return int(value)\n\n def _set_value(self, value):\n if not isinstance(value, (int, long)):\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L238_C4", "label": "expression", "type": "expression", "loc": [238, 238], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L237_C0", "vector": [8, 1, 0.4551, 0.0019, 1, 0.78, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Mapping field for integer values.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L239_C4", "label": "_get_value", "type": "function", "loc": [239, 240], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L237_C0", "vector": [2, 1, 0.4579, 0.0038, 1, 0.78, 0.5, 479, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "_get_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_value(self, value):\n return int(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L240_C8", "label": "return", "type": "return", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L239_C4", "vector": [13, 2, 0.4589, 0.0019, 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 int(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L242_C4", "label": "_set_value", "type": "function", "loc": [242, 248], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L237_C0", "vector": [2, 1, 0.4685, 0.0134, 1, 0.78, 1.0, 565, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "_set_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_value(self, value):\n if not isinstance(value, (int, long)):\n try:\n value = self._get_value(value)\n except Exception:\n raise TypeError('Integer value expected, got %r' % value)\n return super(IntegerField, self)._set_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L243_C8", "label": "if", "type": "if", "loc": [243, 247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L242_C4", "vector": [4, 2, 0.4685, 0.0096, 2, 0.14, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(value, (int, long)):\n try:\n value = self._get_value(value)\n except Exception:\n raise TypeError('Integer value expected, got %r' % value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Try_L244_C12", "label": "try", "type": "try", "loc": [244, 247], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L243_C8", "vector": [7, 3, 0.4694, 0.0076, 3, 0.31, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n value = self._get_value(value)\n except Exception:\n raise TypeError('Integer value expected, got %r' % value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L245_C16", "label": "value = _get_value()", "type": "assigned_variable", "loc": [245, 245], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:Try_L244_C12", "vector": [14, 4, 0.4685, 0.0019, 4, 0.36, 0.0, 441, 3, 1, 0, 0, 479, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "_get_value", "annotation": ""}, "snippet": " value = self._get_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L248_C8", "label": "return", "type": "return", "loc": [248, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L242_C4", "vector": [13, 2, 0.4742, 0.0019, 2, 0.14, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return super(IntegerField, self)._set_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L251_C0", "label": "DecimalField", "type": "class", "loc": [251, 259], "level": 0, "parent": null, "vector": [3, 0, 0.4876, 0.0172, 0, 0.66, 0.72, 888, 0, 2, 0, 0, 949, 0, 5], "semantic": {"name": "DecimalField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DecimalField(Field):\n \"\"\"Mapping field for decimal values.\"\"\"\n def _get_value(self, value):\n return decimal.Decimal(value)\n\n def _set_value(self, value):\n if not isinstance(value, (int, long, float, decimal.Decimal)):\n raise TypeError('Decimal value expected, got %r' % value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L252_C4", "label": "expression", "type": "expression", "loc": [252, 252], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L251_C0", "vector": [8, 1, 0.4818, 0.0019, 1, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Mapping field for decimal values.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L253_C4", "label": "_get_value", "type": "function", "loc": [253, 254], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L251_C0", "vector": [2, 1, 0.4847, 0.0038, 1, 0.03, 0.5, 479, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "_get_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_value(self, value):\n return decimal.Decimal(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L254_C8", "label": "return", "type": "return", "loc": [254, 254], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L253_C4", "vector": [13, 2, 0.4857, 0.0019, 2, 0.54, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return decimal.Decimal(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L256_C4", "label": "_set_value", "type": "function", "loc": [256, 259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L251_C0", "vector": [2, 1, 0.4924, 0.0076, 1, 0.03, 1.0, 565, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "_set_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_value(self, value):\n if not isinstance(value, (int, long, float, decimal.Decimal)):\n raise TypeError('Decimal value expected, got %r' % value)\n return super(DecimalField, self)._set_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L257_C8", "label": "if", "type": "if", "loc": [257, 258], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L256_C4", "vector": [4, 2, 0.4924, 0.0038, 2, 0.8, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(value, (int, long, float, decimal.Decimal)):\n raise TypeError('Decimal value expected, got %r' % value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L259_C8", "label": "return", "type": "return", "loc": [259, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L256_C4", "vector": [13, 2, 0.4952, 0.0019, 2, 0.8, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return super(DecimalField, self)._set_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L262_C0", "label": "DateField", "type": "class", "loc": [262, 273], "level": 0, "parent": null, "vector": [3, 0, 0.5115, 0.0229, 0, 0.66, 0.76, 847, 0, 2, 0, 0, 949, 0, 6], "semantic": {"name": "DateField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DateField(Field):\n \"\"\"Mapping field for storing date/time values.\"\"\"\n format = '%Y%m%d'\n def _get_value(self, value):\n return datetime.datetime.strptime(value, self.format)\n\n def _set_value(self, value):\n if isinstance(value, basestring):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L263_C4", "label": "expression", "type": "expression", "loc": [263, 263], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L262_C0", "vector": [8, 1, 0.5029, 0.0019, 1, 0.9, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Mapping field for storing date/time values.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L264_C4", "label": "format =", "type": "assigned_variable", "loc": [264, 264], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L262_C0", "vector": [14, 1, 0.5048, 0.0019, 1, 0.9, 0.3333, 293, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "format", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " format = '%Y%m%d'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L265_C4", "label": "_get_value", "type": "function", "loc": [265, 266], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L262_C0", "vector": [2, 1, 0.5076, 0.0038, 1, 0.9, 0.6667, 479, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "_get_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_value(self, value):\n return datetime.datetime.strptime(value, self.format)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L266_C8", "label": "return", "type": "return", "loc": [266, 266], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L265_C4", "vector": [13, 2, 0.5086, 0.0019, 2, 0.75, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return datetime.datetime.strptime(value, self.format)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L268_C4", "label": "_set_value", "type": "function", "loc": [268, 273], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L262_C0", "vector": [2, 1, 0.5172, 0.0115, 1, 0.9, 1.0, 565, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "_set_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_value(self, value):\n if isinstance(value, basestring):\n value = self._get_value(value)\n if not isinstance(value, (datetime.datetime, datetime.date)):\n raise TypeError('Datetime value expected, got %r' % value)\n return value.strftime(self.format)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L269_C8", "label": "if", "type": "if", "loc": [269, 270], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L268_C4", "vector": [4, 2, 0.5153, 0.0038, 2, 0.64, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, basestring):\n value = self._get_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L270_C12", "label": "value = _get_value()", "type": "assigned_variable", "loc": [270, 270], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L269_C8", "vector": [14, 3, 0.5163, 0.0019, 3, 0.7, 0.0, 441, 3, 1, 0, 0, 479, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "_get_value", "annotation": ""}, "snippet": " value = self._get_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L271_C8", "label": "if", "type": "if", "loc": [271, 272], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L268_C4", "vector": [4, 2, 0.5191, 0.0038, 2, 0.64, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(value, (datetime.datetime, datetime.date)):\n raise TypeError('Datetime value expected, got %r' % value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L273_C8", "label": "return", "type": "return", "loc": [273, 273], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L268_C4", "vector": [13, 2, 0.522, 0.0019, 2, 0.64, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return value.strftime(self.format)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L276_C0", "label": "TimeField", "type": "class", "loc": [276, 296], "level": 0, "parent": null, "vector": [3, 0, 0.5468, 0.0402, 0, 0.66, 0.8, 82, 0, 2, 0, 0, 949, 0, 13], "semantic": {"name": "TimeField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TimeField(Field):\n \"\"\"Mapping field for storing times.\"\"\"\n format = '%H%M%S'\n def _get_value(self, value):\n if isinstance(value, basestring):\n try:\n value = value.split('.', 1)[0] # strip out microseconds\n value = datetime.time(*time.strptime(value, self.format)[3:6])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L277_C4", "label": "expression", "type": "expression", "loc": [277, 277], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L276_C0", "vector": [8, 1, 0.5296, 0.0019, 1, 0.32, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Mapping field for storing times.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L278_C4", "label": "format =", "type": "assigned_variable", "loc": [278, 278], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L276_C0", "vector": [14, 1, 0.5315, 0.0019, 1, 0.32, 0.3333, 293, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "format", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " format = '%H%M%S'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L279_C4", "label": "_get_value", "type": "function", "loc": [279, 287], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L276_C0", "vector": [2, 1, 0.5411, 0.0172, 1, 0.32, 0.6667, 479, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "_get_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_value(self, value):\n if isinstance(value, basestring):\n try:\n value = value.split('.', 1)[0] # strip out microseconds\n value = datetime.time(*time.strptime(value, self.format)[3:6])\n except ValueError:\n raise ValueError('Value %r does not match format %s'\n '' % (value, self.format))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L280_C8", "label": "if", "type": "if", "loc": [280, 286], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L279_C4", "vector": [4, 2, 0.5411, 0.0134, 2, 0.7, 0.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, basestring):\n try:\n value = value.split('.', 1)[0] # strip out microseconds\n value = datetime.time(*time.strptime(value, self.format)[3:6])\n except ValueError:\n raise ValueError('Value %r does not match format %s'\n '' % (value, self.format))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Try_L281_C12", "label": "try", "type": "try", "loc": [281, 286], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L280_C8", "vector": [7, 3, 0.5421, 0.0115, 3, 0.75, 0.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n value = value.split('.', 1)[0] # strip out microseconds\n value = datetime.time(*time.strptime(value, self.format)[3:6])\n except ValueError:\n raise ValueError('Value %r does not match format %s'\n '' % (value, self.format))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L282_C16", "label": "value =", "type": "assigned_variable", "loc": [282, 282], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:Try_L281_C12", "vector": [14, 4, 0.5392, 0.0019, 4, 0.03, 0.0, 441, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = value.split('.', 1)[0] # strip out microseconds"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L283_C16", "label": "value = time()", "type": "assigned_variable", "loc": [283, 283], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:Try_L281_C12", "vector": [14, 4, 0.5411, 0.0019, 4, 0.03, 1.0, 441, 3, 1, 0, 0, 654, 10, 2], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " value = datetime.time(*time.strptime(value, self.format)[3:6])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L287_C8", "label": "return", "type": "return", "loc": [287, 287], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L279_C4", "vector": [13, 2, 0.5488, 0.0019, 2, 0.7, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L289_C4", "label": "_set_value", "type": "function", "loc": [289, 296], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L276_C0", "vector": [2, 1, 0.5593, 0.0153, 1, 0.32, 1.0, 565, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "_set_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_value(self, value):\n if isinstance(value, basestring):\n value = self._get_value(value)\n if not isinstance(value, (datetime.datetime, datetime.time)):\n raise TypeError('Datetime value expected, got %r' % value)\n if isinstance(value, datetime.datetime):\n value = value.time()\n return value.replace(microsecond=0).strftime(self.format)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L290_C8", "label": "if", "type": "if", "loc": [290, 291], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L289_C4", "vector": [4, 2, 0.5554, 0.0038, 2, 0.67, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, basestring):\n value = self._get_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L291_C12", "label": "value = _get_value()", "type": "assigned_variable", "loc": [291, 291], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L290_C8", "vector": [14, 3, 0.5564, 0.0019, 3, 0.95, 0.0, 441, 3, 1, 0, 0, 479, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "_get_value", "annotation": ""}, "snippet": " value = self._get_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L292_C8", "label": "if", "type": "if", "loc": [292, 293], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L289_C4", "vector": [4, 2, 0.5593, 0.0038, 2, 0.67, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(value, (datetime.datetime, datetime.time)):\n raise TypeError('Datetime value expected, got %r' % value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L294_C8", "label": "if", "type": "if", "loc": [294, 295], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L289_C4", "vector": [4, 2, 0.5631, 0.0038, 2, 0.67, 0.6667, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, datetime.datetime):\n value = value.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L295_C12", "label": "value = time()", "type": "assigned_variable", "loc": [295, 295], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L294_C8", "vector": [14, 3, 0.5641, 0.0019, 3, 0.17, 0.0, 441, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " value = value.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L296_C8", "label": "return", "type": "return", "loc": [296, 296], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L289_C4", "vector": [13, 2, 0.566, 0.0019, 2, 0.67, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return value.replace(microsecond=0).strftime(self.format)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L299_C0", "label": "DateTimeField", "type": "class", "loc": [299, 310], "level": 0, "parent": null, "vector": [3, 0, 0.5822, 0.0229, 0, 0.66, 0.84, 789, 0, 2, 0, 0, 949, 0, 6], "semantic": {"name": "DateTimeField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DateTimeField(Field):\n \"\"\"Mapping field for storing date/time values.\"\"\"\n format = '%Y%m%d%H%M%S'\n def _get_value(self, value):\n return datetime.datetime.strptime(value, self.format)\n\n def _set_value(self, value):\n if isinstance(value, basestring):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L300_C4", "label": "expression", "type": "expression", "loc": [300, 300], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L299_C0", "vector": [8, 1, 0.5736, 0.0019, 1, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Mapping field for storing date/time values.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L301_C4", "label": "format =", "type": "assigned_variable", "loc": [301, 301], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L299_C0", "vector": [14, 1, 0.5755, 0.0019, 1, 0.59, 0.3333, 293, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "format", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " format = '%Y%m%d%H%M%S'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L302_C4", "label": "_get_value", "type": "function", "loc": [302, 303], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L299_C0", "vector": [2, 1, 0.5784, 0.0038, 1, 0.59, 0.6667, 479, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "_get_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_value(self, value):\n return datetime.datetime.strptime(value, self.format)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L303_C8", "label": "return", "type": "return", "loc": [303, 303], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L302_C4", "vector": [13, 2, 0.5793, 0.0019, 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 datetime.datetime.strptime(value, self.format)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L305_C4", "label": "_set_value", "type": "function", "loc": [305, 310], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L299_C0", "vector": [2, 1, 0.588, 0.0115, 1, 0.59, 1.0, 565, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "_set_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_value(self, value):\n if isinstance(value, basestring):\n value = self._get_value(value)\n if not isinstance(value, (datetime.datetime, datetime.date)):\n raise TypeError('Datetime value expected, got %r' % value)\n return value.strftime(self.format)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L306_C8", "label": "if", "type": "if", "loc": [306, 307], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L305_C4", "vector": [4, 2, 0.586, 0.0038, 2, 0.59, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, basestring):\n value = self._get_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L307_C12", "label": "value = _get_value()", "type": "assigned_variable", "loc": [307, 307], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L306_C8", "vector": [14, 3, 0.587, 0.0019, 3, 0.96, 0.0, 441, 3, 1, 0, 0, 479, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "_get_value", "annotation": ""}, "snippet": " value = self._get_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L308_C8", "label": "if", "type": "if", "loc": [308, 309], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L305_C4", "vector": [4, 2, 0.5899, 0.0038, 2, 0.59, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(value, (datetime.datetime, datetime.date)):\n raise TypeError('Datetime value expected, got %r' % value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L310_C8", "label": "return", "type": "return", "loc": [310, 310], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L305_C4", "vector": [13, 2, 0.5927, 0.0019, 2, 0.59, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return value.strftime(self.format)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L313_C0", "label": "SetField", "type": "class", "loc": [313, 329], "level": 0, "parent": null, "vector": [3, 0, 0.6138, 0.0325, 0, 0.66, 0.88, 445, 0, 3, 0, 0, 949, 0, 9], "semantic": {"name": "SetField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SetField(Field):\n \"\"\"Mapping field for predefined set of values.\"\"\"\n def __init__(self, name=None, default=None,\n required=False, length=None,\n values=None, field=Field()):\n super(SetField, self).__init__(name, default, required, length)\n self.field = field\n self.values = values and set(values) or set([])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L314_C4", "label": "expression", "type": "expression", "loc": [314, 314], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L313_C0", "vector": [8, 1, 0.6004, 0.0019, 1, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Mapping field for predefined set of values.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L315_C4", "label": "__init__", "type": "function", "loc": [315, 320], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L313_C0", "vector": [2, 1, 0.6071, 0.0115, 1, 0.59, 0.3333, 555, 0, 7, 0, 0, 0, 0, 5], "semantic": {"name": "__init__", "arg_names": ["self", "name", "default", "required", "length", "values", "field"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name=None, default=None,\n required=False, length=None,\n values=None, field=Field()):\n super(SetField, self).__init__(name, default, required, length)\n self.field = field\n self.values = values and set(values) or set([])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L318_C8", "label": "__init__()", "type": "expression", "loc": [318, 318], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L315_C4", "vector": [8, 2, 0.608, 0.0019, 2, 0.87, 0.0, 555, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(SetField, self).__init__(name, default, required, length)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L319_C8", "label": "self.field =", "type": "assigned_variable", "loc": [319, 319], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L315_C4", "vector": [14, 2, 0.6099, 0.0019, 2, 0.87, 0.5, 951, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.field = field"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L320_C8", "label": "self.values =", "type": "assigned_variable", "loc": [320, 320], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L315_C4", "vector": [14, 2, 0.6119, 0.0019, 2, 0.87, 1.0, 397, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "self.values", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.values = values and set(values) or set([])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L322_C4", "label": "_get_value", "type": "function", "loc": [322, 323], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L313_C0", "vector": [2, 1, 0.6166, 0.0038, 1, 0.59, 0.6667, 479, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "_get_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_value(self, value):\n return self.field._get_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L323_C8", "label": "return", "type": "return", "loc": [323, 323], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L322_C4", "vector": [13, 2, 0.6176, 0.0019, 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.field._get_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L325_C4", "label": "_set_value", "type": "function", "loc": [325, 329], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L313_C0", "vector": [2, 1, 0.6252, 0.0096, 1, 0.59, 1.0, 565, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "_set_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_value(self, value):\n value = self.field._get_value(value)\n if value not in self.values:\n raise ValueError('Unexpectable value %r' % value)\n return self.field._set_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L326_C8", "label": "value = _get_value()", "type": "assigned_variable", "loc": [326, 326], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L325_C4", "vector": [14, 2, 0.6233, 0.0019, 2, 0.12, 0.0, 441, 3, 1, 0, 0, 479, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "_get_value", "annotation": ""}, "snippet": " value = self.field._get_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L327_C8", "label": "if", "type": "if", "loc": [327, 328], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L325_C4", "vector": [4, 2, 0.6262, 0.0038, 2, 0.12, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value not in self.values:\n raise ValueError('Unexpectable value %r' % value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L329_C8", "label": "return", "type": "return", "loc": [329, 329], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L325_C4", "vector": [13, 2, 0.6291, 0.0019, 2, 0.12, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.field._set_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L332_C0", "label": "ComponentField", "type": "class", "loc": [332, 355], "level": 0, "parent": null, "vector": [3, 0, 0.6568, 0.0459, 0, 0.66, 0.92, 660, 0, 3, 0, 0, 949, 0, 12], "semantic": {"name": "ComponentField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ComponentField(Field):\n \"\"\"Mapping field for storing record component.\"\"\"\n def __init__(self, mapping, name=None, default=None):\n self.mapping = mapping\n default = default or mapping()\n super(ComponentField, self).__init__(name, default)\n\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L333_C4", "label": "expression", "type": "expression", "loc": [333, 333], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L332_C0", "vector": [8, 1, 0.6367, 0.0019, 1, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Mapping field for storing record component.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L334_C4", "label": "__init__", "type": "function", "loc": [334, 337], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L332_C0", "vector": [2, 1, 0.6415, 0.0076, 1, 0.88, 0.3333, 555, 0, 4, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "mapping", "name", "default"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, mapping, name=None, default=None):\n self.mapping = mapping\n default = default or mapping()\n super(ComponentField, self).__init__(name, default)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L335_C8", "label": "self.mapping =", "type": "assigned_variable", "loc": [335, 335], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L334_C4", "vector": [14, 2, 0.6405, 0.0019, 2, 0.96, 0.0, 45, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.mapping", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mapping = mapping"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L336_C8", "label": "default =", "type": "assigned_variable", "loc": [336, 336], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L334_C4", "vector": [14, 2, 0.6424, 0.0019, 2, 0.96, 0.5, 977, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "default", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " default = default or mapping()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L337_C8", "label": "__init__()", "type": "expression", "loc": [337, 337], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L334_C4", "vector": [8, 2, 0.6444, 0.0019, 2, 0.96, 1.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(ComponentField, self).__init__(name, default)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L340_C4", "label": "_get_value", "type": "function", "loc": [340, 346], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L332_C0", "vector": [2, 1, 0.6558, 0.0134, 1, 0.88, 0.6667, 479, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "_get_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_value(self, value):\n if isinstance(value, dict):\n return self.mapping(**value)\n elif isinstance(value, self.mapping):\n return value\n else:\n return self.mapping(*value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L341_C8", "label": "if", "type": "if", "loc": [341, 346], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L340_C4", "vector": [4, 2, 0.6568, 0.0115, 2, 0.59, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, dict):\n return self.mapping(**value)\n elif isinstance(value, self.mapping):\n return value\n else:\n return self.mapping(*value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L342_C12", "label": "return", "type": "return", "loc": [342, 342], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L341_C8", "vector": [13, 3, 0.6539, 0.0019, 3, 0.68, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.mapping(**value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L343_C8", "label": "if", "type": "if", "loc": [343, 346], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L341_C8", "vector": [4, 3, 0.6587, 0.0076, 3, 0.68, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, self.mapping):\n return value\n else:\n return self.mapping(*value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L344_C12", "label": "return", "type": "return", "loc": [344, 344], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L343_C8", "vector": [13, 4, 0.6577, 0.0019, 4, 0.29, 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_1038:Return_L346_C12", "label": "return", "type": "return", "loc": [346, 346], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L343_C8", "vector": [13, 4, 0.6616, 0.0019, 4, 0.29, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.mapping(*value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L348_C4", "label": "_set_value", "type": "function", "loc": [348, 355], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L332_C0", "vector": [2, 1, 0.6721, 0.0153, 1, 0.88, 1.0, 565, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "_set_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_value(self, value):\n if isinstance(value, dict):\n return self.mapping(**value)\n elif isinstance(value, self.mapping):\n return value\n if isinstance(value, basestring):\n value = [value]\n return self.mapping(*value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L349_C8", "label": "if", "type": "if", "loc": [349, 352], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L348_C4", "vector": [4, 2, 0.6702, 0.0076, 2, 0.05, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, dict):\n return self.mapping(**value)\n elif isinstance(value, self.mapping):\n return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L350_C12", "label": "return", "type": "return", "loc": [350, 350], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L349_C8", "vector": [13, 3, 0.6692, 0.0019, 3, 0.79, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.mapping(**value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L351_C8", "label": "if", "type": "if", "loc": [351, 352], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L349_C8", "vector": [4, 3, 0.6721, 0.0038, 3, 0.79, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, self.mapping):\n return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L352_C12", "label": "return", "type": "return", "loc": [352, 352], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L351_C8", "vector": [13, 4, 0.673, 0.0019, 4, 0.33, 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_1038:If_L353_C8", "label": "if", "type": "if", "loc": [353, 354], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L348_C4", "vector": [4, 2, 0.6759, 0.0038, 2, 0.05, 0.5, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, basestring):\n value = [value]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L354_C12", "label": "value =", "type": "assigned_variable", "loc": [354, 354], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L353_C8", "vector": [14, 3, 0.6769, 0.0019, 3, 0.24, 0.0, 441, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = [value]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L355_C8", "label": "return", "type": "return", "loc": [355, 355], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L348_C4", "vector": [13, 2, 0.6788, 0.0019, 2, 0.05, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.mapping(*value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L358_C0", "label": "RepeatedComponentField", "type": "class", "loc": [358, 507], "level": 0, "parent": null, "vector": [3, 0, 0.827, 0.2868, 0, 0.66, 0.96, 284, 0, 38, 0, 0, 949, 0, 56], "semantic": {"name": "RepeatedComponentField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RepeatedComponentField(Field):\n \"\"\"Mapping field for storing list of record components.\"\"\"\n def __init__(self, field, name=None, default=None):\n if isinstance(field, ComponentField):\n self.field = field\n else:\n assert isinstance(field, type) and issubclass(field, Mapping)\n self.field = ComponentField(field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L359_C4", "label": "expression", "type": "expression", "loc": [359, 359], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L358_C0", "vector": [8, 1, 0.6864, 0.0019, 1, 0.09, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Mapping field for storing list of record components.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L360_C4", "label": "__init__", "type": "function", "loc": [360, 367], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L358_C0", "vector": [2, 1, 0.695, 0.0153, 1, 0.09, 0.2, 555, 0, 4, 0, 0, 0, 0, 6], "semantic": {"name": "__init__", "arg_names": ["self", "field", "name", "default"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, field, name=None, default=None):\n if isinstance(field, ComponentField):\n self.field = field\n else:\n assert isinstance(field, type) and issubclass(field, Mapping)\n self.field = ComponentField(field)\n default = default or []\n super(RepeatedComponentField, self).__init__(name, default)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L361_C8", "label": "if", "type": "if", "loc": [361, 365], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L360_C4", "vector": [4, 2, 0.6941, 0.0096, 2, 0.36, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(field, ComponentField):\n self.field = field\n else:\n assert isinstance(field, type) and issubclass(field, Mapping)\n self.field = ComponentField(field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L362_C12", "label": "self.field =", "type": "assigned_variable", "loc": [362, 362], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L361_C8", "vector": [14, 3, 0.6922, 0.0019, 3, 0.14, 0.0, 951, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.field = field"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L365_C12", "label": "self.field = ComponentField()", "type": "assigned_variable", "loc": [365, 365], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L361_C8", "vector": [14, 3, 0.6979, 0.0019, 3, 0.14, 1.0, 951, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "self.field", "arg_names": [], "import_names": [], "rhs_call_name": "ComponentField", "annotation": ""}, "snippet": " self.field = ComponentField(field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L366_C8", "label": "default =", "type": "assigned_variable", "loc": [366, 366], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L360_C4", "vector": [14, 2, 0.6998, 0.0019, 2, 0.36, 0.5, 977, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "default", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " default = default or []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L367_C8", "label": "__init__()", "type": "expression", "loc": [367, 367], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L360_C4", "vector": [8, 2, 0.7017, 0.0019, 2, 0.36, 1.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(RepeatedComponentField, self).__init__(name, default)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "label": "Proxy", "type": "class", "loc": [369, 491], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L358_C0", "vector": [3, 1, 0.8222, 0.2352, 1, 0.09, 0.4, 363, 0, 35, 0, 0, 430, 0, 44], "semantic": {"name": "Proxy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Proxy(list):\n def __init__(self, seq, field):\n list.__init__(self, seq)\n self.list = seq\n self.field = field\n\n def _to_list(self):\n return [list(self.field._get_value(item)) for item in self.list]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L370_C8", "label": "__init__", "type": "function", "loc": [370, 373], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.7103, 0.0076, 2, 0.81, 0.0, 555, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "seq", "field"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, seq, field):\n list.__init__(self, seq)\n self.list = seq\n self.field = field"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L371_C12", "label": "__init__()", "type": "expression", "loc": [371, 371], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L370_C8", "vector": [8, 3, 0.7094, 0.0019, 3, 0.02, 0.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " list.__init__(self, seq)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L372_C12", "label": "self.list =", "type": "assigned_variable", "loc": [372, 372], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L370_C8", "vector": [14, 3, 0.7113, 0.0019, 3, 0.02, 0.5, 815, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.list = seq"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L373_C12", "label": "self.field =", "type": "assigned_variable", "loc": [373, 373], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L370_C8", "vector": [14, 3, 0.7132, 0.0019, 3, 0.02, 1.0, 951, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.field = field"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L375_C8", "label": "_to_list", "type": "function", "loc": [375, 376], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.718, 0.0038, 2, 0.81, 0.0294, 727, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "_to_list", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _to_list(self):\n return [list(self.field._get_value(item)) for item in self.list]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L376_C12", "label": "return", "type": "return", "loc": [376, 376], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L375_C8", "vector": [13, 3, 0.7189, 0.0019, 3, 0.81, 0.0, 0, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [list(self.field._get_value(item)) for item in self.list]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L378_C8", "label": "__add__", "type": "function", "loc": [378, 381], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.7256, 0.0076, 2, 0.81, 0.0588, 899, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "__add__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __add__(self, other):\n obj = type(self)(self.list, self.field)\n obj.extend(other)\n return obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L379_C12", "label": "obj =", "type": "assigned_variable", "loc": [379, 379], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L378_C8", "vector": [14, 3, 0.7247, 0.0019, 3, 0.2, 0.0, 505, 3, 2, 0, 0, 0, 10, 2], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj = type(self)(self.list, self.field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L380_C12", "label": "extend()", "type": "expression", "loc": [380, 380], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L378_C8", "vector": [8, 3, 0.7266, 0.0019, 3, 0.2, 0.5, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " obj.extend(other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L381_C12", "label": "return", "type": "return", "loc": [381, 381], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L378_C8", "vector": [13, 3, 0.7285, 0.0019, 3, 0.2, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L383_C8", "label": "__iadd__", "type": "function", "loc": [383, 385], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.7342, 0.0057, 2, 0.81, 0.0882, 944, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__iadd__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iadd__(self, other):\n self.extend(other)\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L384_C12", "label": "extend()", "type": "expression", "loc": [384, 384], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L383_C8", "vector": [8, 3, 0.7342, 0.0019, 3, 0.3, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " self.extend(other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L385_C12", "label": "return", "type": "return", "loc": [385, 385], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L383_C8", "vector": [13, 3, 0.7361, 0.0019, 3, 0.3, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L387_C8", "label": "__mul__", "type": "function", "loc": [387, 388], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.7409, 0.0038, 2, 0.81, 0.1176, 215, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__mul__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __mul__(self, other):\n return type(self)(self.list * other, self.field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L388_C12", "label": "return", "type": "return", "loc": [388, 388], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L387_C8", "vector": [13, 3, 0.7419, 0.0019, 3, 0.89, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return type(self)(self.list * other, self.field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L390_C8", "label": "__imul__", "type": "function", "loc": [390, 392], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.7476, 0.0057, 2, 0.81, 0.1471, 845, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__imul__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __imul__(self, other):\n self.list *= other\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L392_C12", "label": "return", "type": "return", "loc": [392, 392], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L390_C8", "vector": [13, 3, 0.7495, 0.0019, 3, 0.15, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L394_C8", "label": "__lt__", "type": "function", "loc": [394, 395], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.7543, 0.0038, 2, 0.81, 0.1765, 217, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__lt__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __lt__(self, other):\n return self._to_list() < other"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L395_C12", "label": "return", "type": "return", "loc": [395, 395], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L394_C8", "vector": [13, 3, 0.7553, 0.0019, 3, 0.48, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._to_list() < other"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L397_C8", "label": "__le__", "type": "function", "loc": [397, 398], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.76, 0.0038, 2, 0.81, 0.2059, 308, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__le__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __le__(self, other):\n return self._to_list() <= other"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L398_C12", "label": "return", "type": "return", "loc": [398, 398], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L397_C8", "vector": [13, 3, 0.761, 0.0019, 3, 0.1, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._to_list() <= other"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L400_C8", "label": "__eq__", "type": "function", "loc": [400, 401], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.7658, 0.0038, 2, 0.81, 0.2353, 763, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__eq__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __eq__(self, other):\n return self._to_list() == other"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L401_C12", "label": "return", "type": "return", "loc": [401, 401], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L400_C8", "vector": [13, 3, 0.7667, 0.0019, 3, 0.26, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._to_list() == other"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L403_C8", "label": "__ne__", "type": "function", "loc": [403, 404], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.7715, 0.0038, 2, 0.81, 0.2647, 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 self._to_list() != other"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L404_C12", "label": "return", "type": "return", "loc": [404, 404], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L403_C8", "vector": [13, 3, 0.7725, 0.0019, 3, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._to_list() != other"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L406_C8", "label": "__ge__", "type": "function", "loc": [406, 407], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.7772, 0.0038, 2, 0.81, 0.2941, 518, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__ge__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __ge__(self, other):\n return self._to_list() >= other"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L407_C12", "label": "return", "type": "return", "loc": [407, 407], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L406_C8", "vector": [13, 3, 0.7782, 0.0019, 3, 0.04, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._to_list() >= other"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L409_C8", "label": "__gt__", "type": "function", "loc": [409, 410], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.783, 0.0038, 2, 0.81, 0.3235, 974, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__gt__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __gt__(self, other):\n return self._to_list() > other"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L410_C12", "label": "return", "type": "return", "loc": [410, 410], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L409_C8", "vector": [13, 3, 0.7839, 0.0019, 3, 0.27, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._to_list() > other"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L412_C8", "label": "__repr__", "type": "function", "loc": [412, 413], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.7887, 0.0038, 2, 0.81, 0.3529, 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 '<ListProxy %s %r>' % (self.list, list(self))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L413_C12", "label": "return", "type": "return", "loc": [413, 413], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L412_C8", "vector": [13, 3, 0.7897, 0.0019, 3, 0.23, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '<ListProxy %s %r>' % (self.list, list(self))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L415_C8", "label": "__str__", "type": "function", "loc": [415, 416], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.7945, 0.0038, 2, 0.81, 0.3824, 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 str(self.list)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L416_C12", "label": "return", "type": "return", "loc": [416, 416], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L415_C8", "vector": [13, 3, 0.7954, 0.0019, 3, 0.67, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(self.list)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L418_C8", "label": "__unicode__", "type": "function", "loc": [418, 419], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.8002, 0.0038, 2, 0.81, 0.4118, 318, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__unicode__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __unicode__(self):\n return unicode(self.list)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L419_C12", "label": "return", "type": "return", "loc": [419, 419], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L418_C8", "vector": [13, 3, 0.8011, 0.0019, 3, 0.42, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unicode(self.list)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L421_C8", "label": "__delitem__", "type": "function", "loc": [421, 422], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.8059, 0.0038, 2, 0.81, 0.4412, 66, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__delitem__", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __delitem__(self, index):\n del self.list[index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L424_C8", "label": "__getitem__", "type": "function", "loc": [424, 425], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.8117, 0.0038, 2, 0.81, 0.4706, 698, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__getitem__", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, index):\n return self.field._get_value(self.list[index])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L425_C12", "label": "return", "type": "return", "loc": [425, 425], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L424_C8", "vector": [13, 3, 0.8126, 0.0019, 3, 0.65, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.field._get_value(self.list[index])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L427_C8", "label": "__setitem__", "type": "function", "loc": [427, 428], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.8174, 0.0038, 2, 0.81, 0.5, 343, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__setitem__", "arg_names": ["self", "index", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __setitem__(self, index, value):\n self.list[index] = self.field._set_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L428_C12", "label": " = _set_value()", "type": "assigned_variable", "loc": [428, 428], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L427_C8", "vector": [14, 3, 0.8184, 0.0019, 3, 0.47, 0.0, 0, 3, 1, 0, 0, 565, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "_set_value", "annotation": ""}, "snippet": " self.list[index] = self.field._set_value(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L430_C8", "label": "__delslice__", "type": "function", "loc": [430, 431], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.8231, 0.0038, 2, 0.81, 0.5294, 844, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__delslice__", "arg_names": ["self", "i", "j"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __delslice__(self, i, j):\n del self.list[i:j]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L433_C8", "label": "__getslice__", "type": "function", "loc": [433, 434], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.8289, 0.0038, 2, 0.81, 0.5588, 269, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "__getslice__", "arg_names": ["self", "i", "j"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getslice__(self, i, j):\n return self.__class__(self.list[i:j], self.field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L434_C12", "label": "return", "type": "return", "loc": [434, 434], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L433_C8", "vector": [13, 3, 0.8298, 0.0019, 3, 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.__class__(self.list[i:j], self.field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L436_C8", "label": "__setslice__", "type": "function", "loc": [436, 437], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.8346, 0.0038, 2, 0.81, 0.5882, 606, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "__setslice__", "arg_names": ["self", "i", "j", "seq"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __setslice__(self, i, j, seq):\n self.list[i:j] = [self.field._set_value(v) for v in seq]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L437_C12", "label": "assign", "type": "assigned_variable", "loc": [437, 437], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L436_C8", "vector": [14, 3, 0.8356, 0.0019, 3, 0.56, 0.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.list[i:j] = [self.field._set_value(v) for v in seq]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L439_C8", "label": "__contains__", "type": "function", "loc": [439, 443], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.8432, 0.0096, 2, 0.81, 0.6176, 456, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__contains__", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __contains__(self, value):\n for item in self:\n if item == value:\n return True\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L440_C12", "label": "for item", "type": "for", "loc": [440, 442], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L439_C8", "vector": [6, 3, 0.8432, 0.0057, 3, 0.67, 0.0, 434, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in self:\n if item == value:\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L441_C16", "label": "if", "type": "if", "loc": [441, 442], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L440_C12", "vector": [4, 4, 0.8442, 0.0038, 4, 0.98, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if item == value:\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L442_C20", "label": "return", "type": "return", "loc": [442, 442], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L441_C16", "vector": [13, 5, 0.8451, 0.0019, 5, 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_1038:Return_L443_C12", "label": "return", "type": "return", "loc": [443, 443], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L439_C8", "vector": [13, 3, 0.847, 0.0019, 3, 0.67, 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_1038:FunctionDef_L445_C8", "label": "__iter__", "type": "function", "loc": [445, 447], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.8528, 0.0057, 2, 0.81, 0.6471, 891, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n for index in range(len(self)):\n yield self[index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L446_C12", "label": "for index", "type": "for", "loc": [446, 447], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L445_C8", "vector": [6, 3, 0.8537, 0.0038, 3, 0.36, 0.0, 780, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for index in range(len(self)):\n yield self[index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L447_C16", "label": "expression", "type": "expression", "loc": [447, 447], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L446_C12", "vector": [8, 4, 0.8547, 0.0019, 4, 0.06, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield self[index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L449_C8", "label": "__len__", "type": "function", "loc": [449, 450], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.8595, 0.0038, 2, 0.81, 0.6765, 76, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__len__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __len__(self):\n return len(self.list)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L450_C12", "label": "return", "type": "return", "loc": [450, 450], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L449_C8", "vector": [13, 3, 0.8604, 0.0019, 3, 0.34, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self.list)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L452_C8", "label": "__nonzero__", "type": "function", "loc": [452, 453], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.8652, 0.0038, 2, 0.81, 0.7059, 322, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__nonzero__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __nonzero__(self):\n return bool(self.list)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L453_C12", "label": "return", "type": "return", "loc": [453, 453], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L452_C8", "vector": [13, 3, 0.8662, 0.0019, 3, 0.18, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bool(self.list)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L455_C8", "label": "__reduce__", "type": "function", "loc": [455, 456], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.8709, 0.0038, 2, 0.81, 0.7353, 591, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__reduce__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __reduce__(self):\n return self.list.__reduce__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L456_C12", "label": "return", "type": "return", "loc": [456, 456], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L455_C8", "vector": [13, 3, 0.8719, 0.0019, 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.list.__reduce__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L458_C8", "label": "__reduce_ex__", "type": "function", "loc": [458, 459], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.8767, 0.0038, 2, 0.81, 0.7647, 104, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "__reduce_ex__", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __reduce_ex__(self, *args, **kwargs):\n return self.list.__reduce_ex__(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L459_C12", "label": "return", "type": "return", "loc": [459, 459], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L458_C8", "vector": [13, 3, 0.8776, 0.0019, 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 self.list.__reduce_ex__(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L461_C8", "label": "append", "type": "function", "loc": [461, 462], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.8824, 0.0038, 2, 0.81, 0.7941, 243, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": ["self", "item"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def append(self, item):\n self.list.append(self.field._set_value(item))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L462_C12", "label": "append()", "type": "expression", "loc": [462, 462], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L461_C8", "vector": [8, 3, 0.8834, 0.0019, 3, 0.15, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.list.append(self.field._set_value(item))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L464_C8", "label": "count", "type": "function", "loc": [464, 465], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.8881, 0.0038, 2, 0.81, 0.8235, 778, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "count", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def count(self, value):\n return self._to_list().count(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L465_C12", "label": "return", "type": "return", "loc": [465, 465], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L464_C8", "vector": [13, 3, 0.8891, 0.0019, 3, 0.77, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._to_list().count(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L467_C8", "label": "extend", "type": "function", "loc": [467, 468], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.8939, 0.0038, 2, 0.81, 0.8529, 660, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "extend", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def extend(self, other):\n self.list.extend([self.field._set_value(i) for i in other])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L468_C12", "label": "extend()", "type": "expression", "loc": [468, 468], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L467_C8", "vector": [8, 3, 0.8948, 0.0019, 3, 0.45, 0.0, 660, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " self.list.extend([self.field._set_value(i) for i in other])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L470_C8", "label": "index", "type": "function", "loc": [470, 476], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.9044, 0.0134, 2, 0.81, 0.8824, 780, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "index", "arg_names": ["self", "value", "start", "stop"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def index(self, value, start=None, stop=None):\n start = start or 0\n for idx, item in enumerate(islice(self, start, stop)):\n if item == value:\n return idx + start\n else:\n raise ValueError('%r not in list' % value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L471_C12", "label": "start =", "type": "assigned_variable", "loc": [471, 471], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L470_C8", "vector": [14, 3, 0.9006, 0.0019, 3, 0.82, 0.0, 511, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " start = start or 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L472_C12", "label": "for idx, item", "type": "for", "loc": [472, 476], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L470_C8", "vector": [6, 3, 0.9063, 0.0096, 3, 0.82, 1.0, 46, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "idx, item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for idx, item in enumerate(islice(self, start, stop)):\n if item == value:\n return idx + start\n else:\n raise ValueError('%r not in list' % value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L473_C16", "label": "if", "type": "if", "loc": [473, 474], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L472_C12", "vector": [4, 4, 0.9054, 0.0038, 4, 0.51, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if item == value:\n return idx + start"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L474_C20", "label": "return", "type": "return", "loc": [474, 474], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L473_C16", "vector": [13, 5, 0.9063, 0.0019, 5, 0.26, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return idx + start"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L478_C8", "label": "insert", "type": "function", "loc": [478, 479], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.9149, 0.0038, 2, 0.81, 0.9118, 368, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "insert", "arg_names": ["self", "index", "object"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def insert(self, index, object):\n self.list.insert(index, self.field._set_value(object))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L479_C12", "label": "insert()", "type": "expression", "loc": [479, 479], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L478_C8", "vector": [8, 3, 0.9159, 0.0019, 3, 0.37, 0.0, 368, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " self.list.insert(index, self.field._set_value(object))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L481_C8", "label": "remove", "type": "function", "loc": [481, 485], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.9235, 0.0096, 2, 0.81, 0.9412, 185, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "remove", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remove(self, value):\n for item in self:\n if item == value:\n return self.list.remove(value)\n raise ValueError('Value %r not in list' % value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L482_C12", "label": "for item", "type": "for", "loc": [482, 484], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L481_C8", "vector": [6, 3, 0.9235, 0.0057, 3, 0.96, 0.0, 434, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in self:\n if item == value:\n return self.list.remove(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L483_C16", "label": "if", "type": "if", "loc": [483, 484], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L482_C12", "vector": [4, 4, 0.9245, 0.0038, 4, 0.41, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if item == value:\n return self.list.remove(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L484_C20", "label": "return", "type": "return", "loc": [484, 484], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L483_C16", "vector": [13, 5, 0.9254, 0.0019, 5, 0.65, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.list.remove(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L487_C8", "label": "pop", "type": "function", "loc": [487, 488], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.9321, 0.0038, 2, 0.81, 0.9706, 969, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "pop", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pop(self, index=-1):\n return self.field._get_value(self.list.pop(index))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L488_C12", "label": "return", "type": "return", "loc": [488, 488], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L487_C8", "vector": [13, 3, 0.9331, 0.0019, 3, 0.95, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.field._get_value(self.list.pop(index))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L490_C8", "label": "sort", "type": "function", "loc": [490, 491], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "vector": [2, 2, 0.9379, 0.0038, 2, 0.81, 1.0, 489, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": ["self", "cmp", "key", "reverse"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def sort(self, cmp=None, key=None, reverse=False):\n raise NotImplementedError('In place sorting not allowed.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L494_C4", "label": "for name, obj", "type": "for", "loc": [494, 500], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L358_C0", "vector": [6, 1, 0.9503, 0.0134, 1, 0.09, 0.6, 720, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "name, obj", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for name, obj in inspect.getmembers(Proxy):\n if getattr(list, name, None) is None\\\n or name in ['__module__', '__doc__']:\n continue\n if not inspect.isfunction(obj):\n continue\n obj.__doc__ = getattr(list, name).__doc__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L495_C8", "label": "if", "type": "if", "loc": [495, 497], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L494_C4", "vector": [4, 2, 0.9484, 0.0057, 2, 0.12, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if getattr(list, name, None) is None\\\n or name in ['__module__', '__doc__']:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L498_C8", "label": "if", "type": "if", "loc": [498, 499], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L494_C4", "vector": [4, 2, 0.9532, 0.0038, 2, 0.12, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not inspect.isfunction(obj):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L500_C8", "label": "obj.__doc__ =", "type": "assigned_variable", "loc": [500, 500], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L494_C4", "vector": [14, 2, 0.956, 0.0019, 2, 0.12, 1.0, 22, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "obj.__doc__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj.__doc__ = getattr(list, name).__doc__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L503_C4", "label": "_get_value", "type": "function", "loc": [503, 504], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L358_C0", "vector": [2, 1, 0.9627, 0.0038, 1, 0.09, 0.8, 479, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "_get_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_value(self, value):\n return self.Proxy(value, self.field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L504_C8", "label": "return", "type": "return", "loc": [504, 504], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L503_C4", "vector": [13, 2, 0.9637, 0.0019, 2, 0.65, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.Proxy(value, self.field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L506_C4", "label": "_set_value", "type": "function", "loc": [506, 507], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L358_C0", "vector": [2, 1, 0.9685, 0.0038, 1, 0.09, 1.0, 565, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "_set_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_value(self, value):\n return [self.field._set_value(item) for item in value]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L507_C8", "label": "return", "type": "return", "loc": [507, 507], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L506_C4", "vector": [13, 2, 0.9694, 0.0019, 2, 0.11, 0.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [self.field._set_value(item) for item in value]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L510_C0", "label": "NotUsedField", "type": "class", "loc": [510, 523], "level": 0, "parent": null, "vector": [3, 0, 0.9876, 0.0268, 0, 0.66, 1.0, 387, 0, 3, 0, 0, 949, 0, 3], "semantic": {"name": "NotUsedField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class NotUsedField(Field):\n \"\"\"Mapping field for value that should be used. Acts as placeholder.\n On attempt to assign something to it raises :exc:`UserWarning` and rejects\n assigned value.\"\"\"\n def __init__(self, name=None):\n super(NotUsedField, self).__init__(name)\n\n def _get_value(self, value):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L511_C4", "label": "expression", "type": "expression", "loc": [511, 513], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L510_C0", "vector": [8, 1, 0.979, 0.0057, 1, 0.35, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Mapping field for value that should be used. Acts as placeholder.\n On attempt to assign something to it raises :exc:`UserWarning` and rejects\n assigned value.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L514_C4", "label": "__init__", "type": "function", "loc": [514, 515], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L510_C0", "vector": [2, 1, 0.9837, 0.0038, 1, 0.35, 0.3333, 555, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name=None):\n super(NotUsedField, self).__init__(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L515_C8", "label": "__init__()", "type": "expression", "loc": [515, 515], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L514_C4", "vector": [8, 2, 0.9847, 0.0019, 2, 0.17, 0.0, 555, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(NotUsedField, self).__init__(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L517_C4", "label": "_get_value", "type": "function", "loc": [517, 518], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L510_C0", "vector": [2, 1, 0.9895, 0.0038, 1, 0.35, 0.6667, 479, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "_get_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_value(self, value):\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L518_C8", "label": "return", "type": "return", "loc": [518, 518], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L517_C4", "vector": [13, 2, 0.9904, 0.0019, 2, 0.08, 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_1038:FunctionDef_L520_C4", "label": "_set_value", "type": "function", "loc": [520, 523], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L510_C0", "vector": [2, 1, 0.9971, 0.0076, 1, 0.35, 1.0, 565, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "_set_value", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_value(self, value):\n warnings.warn('Field %r is not used, any assignments are omitted'\n '' % self.name, UserWarning)\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L521_C8", "label": "warn()", "type": "expression", "loc": [521, 522], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L520_C4", "vector": [8, 2, 0.9971, 0.0038, 2, 0.5, 0.0, 960, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " warnings.warn('Field %r is not used, any assignments are omitted'\n '' % self.name, UserWarning)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L523_C8", "label": "return", "type": "return", "loc": [523, 523], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L520_C4", "vector": [13, 2, 1.0, 0.0019, 2, 0.5, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1038:Try_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:ImportFrom_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:Try_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:ImportFrom_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:Try_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:ImportFrom_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L49_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L50_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L55_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L56_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L75_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L76_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L77_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L77_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L78_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L76_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L79_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L79_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L80_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L79_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L81_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L79_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L83_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L84_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L85_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L85_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L86_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L89_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L91_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L92_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L106_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L107_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L108_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L107_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L110_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L118_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L119_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L118_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L121_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L118_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L122_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L145_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L146_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L147_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L148_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L148_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L149_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L155_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L155_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L169_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L171_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L171_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L172_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L171_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L173_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L173_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L174_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L173_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L175_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L175_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L176_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L175_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L177_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L177_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L178_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L178_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L179_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L178_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L181_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L175_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L182_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L175_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L183_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L183_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L186_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L169_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L187_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L190_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L191_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L198_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L198_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L200_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L200_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L201_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L200_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L203_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L206_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L207_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L206_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L219_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L219_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L220_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L219_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L221_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L219_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L222_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L219_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L223_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L206_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L226_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L226_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L227_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L206_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L229_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L229_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L230_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L229_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L231_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L229_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L234_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L237_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L238_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L237_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L239_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L239_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L237_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L242_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L242_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L243_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L243_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Try_L244_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:Try_L244_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L245_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L242_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L248_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L252_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L253_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L254_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L256_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L256_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L257_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L256_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L259_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L263_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L264_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L265_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L265_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L266_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L268_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L268_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L269_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L269_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L270_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L268_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L271_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L268_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L273_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L276_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L277_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L276_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L278_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L276_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L279_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L280_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L280_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Try_L281_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:Try_L281_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L282_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:Try_L281_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L283_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L287_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L276_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L289_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L289_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L290_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L290_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L291_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L289_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L292_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L289_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L294_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L294_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L295_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L289_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L296_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L299_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L300_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L299_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L301_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L299_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L303_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L299_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L305_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L305_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L306_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L306_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L307_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L305_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L308_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L305_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L310_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L313_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L314_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L313_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L315_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L315_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L318_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L315_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L319_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L315_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L320_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L313_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L322_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L322_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L323_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L313_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L325_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L326_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L327_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L329_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L332_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L333_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L332_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L334_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L335_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L336_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L337_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L332_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L340_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L340_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L341_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L341_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L342_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L341_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L343_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L343_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L344_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L343_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L346_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L332_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L348_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L348_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L349_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L349_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L350_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L349_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L351_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L351_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L352_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L348_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L353_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L353_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L354_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L348_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L355_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L358_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L359_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L358_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L360_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L360_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L361_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L361_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L362_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L361_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L365_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L360_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L366_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L360_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L367_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L358_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L370_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L370_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L371_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L370_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L372_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L370_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L373_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L375_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L375_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L376_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L378_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L378_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L379_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L378_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L380_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L378_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L381_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L383_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L383_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L384_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L383_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L385_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L387_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L387_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L388_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L390_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L390_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L392_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L394_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L394_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L395_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L397_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L397_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L398_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L400_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L400_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L401_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L403_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L403_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L404_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L406_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L406_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L407_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L409_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L409_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L410_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L412_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L412_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L413_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L415_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L415_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L416_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L418_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L418_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L419_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L421_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L424_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L425_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L427_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L427_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L428_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L430_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L433_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L433_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L434_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L436_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L436_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L437_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L439_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L439_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L440_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L440_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L441_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L441_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L442_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L439_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L443_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L445_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L445_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L446_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L446_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L447_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L449_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L449_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L450_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L452_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L452_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L453_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L455_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L455_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L456_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L458_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L458_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L459_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L461_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L461_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L462_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L464_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L464_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L465_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L467_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L467_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L468_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L470_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L470_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L471_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L470_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L472_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L472_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L473_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L473_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L474_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L478_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L478_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L479_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L481_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L481_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L482_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L482_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L483_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L483_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L484_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L487_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L487_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L488_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L369_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L490_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L358_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L494_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L494_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L495_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L494_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:If_L498_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:For_L494_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Assign_L500_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L358_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L503_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L503_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L504_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L358_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L506_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L506_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L507_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L510_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L511_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L510_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L514_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L514_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L515_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L510_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L517_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L517_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L518_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:ClassDef_L510_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L520_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L520_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Expr_L521_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1038:FunctionDef_L520_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1038:Return_L523_C8"}]
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # __version_info__ = (0, 6, 0, 'dev', 0) __version__ = '{version}{tag}{build}'.format( version='.'.join(map(str, __version_info__[:3])), tag='-' + __version_info__[3] if __version_info__[3] else '', build='.' + str(__version_info__[4]) if __version_info__[4] else '' )
ajibawa-2023/Python-Code-Large/train/row_1039
2
15
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1039:Assign_L10_C0", "label": "__version_info__ =", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.0667, 0, 0.66, 0.0, 218, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "__version_info__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__version_info__ = (0, 6, 0, 'dev', 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1039:Assign_L11_C0", "label": "__version__ = format()", "type": "assigned_variable", "loc": [11, 15], "level": 0, "parent": null, "vector": [14, 0, 0.8667, 0.3333, 0, 0.66, 1.0, 162, 3, 3, 0, 0, 293, 10, 4], "semantic": {"name": "__version__", "arg_names": [], "import_names": [], "rhs_call_name": "format", "annotation": ""}, "snippet": "__version__ = '{version}{tag}{build}'.format(\n version='.'.join(map(str, __version_info__[:3])),\n tag='-' + __version_info__[3] if __version_info__[3] else '',\n build='.' + str(__version_info__[4]) if __version_info__[4] else ''\n)"}]
[]
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # class DummyMixIn(object): _input_buffer = '' addr = ('localhost', 15200) def flush(self): pass def close(self): pass class CallLogger(object): def __init__(self, func): self.func = func self.was_called = False def __call__(self, *args, **kwargs): self.was_called = True return self.func(*args, **kwargs) def track_call(func): return CallLogger(func)
ajibawa-2023/Python-Code-Large/train/row_1040
14
34
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1040:ClassDef_L11_C0", "label": "DummyMixIn", "type": "class", "loc": [11, 19], "level": 0, "parent": null, "vector": [3, 0, 0.4412, 0.2647, 0, 0.66, 0.0, 587, 0, 2, 0, 0, 186, 0, 0], "semantic": {"name": "DummyMixIn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DummyMixIn(object):\n _input_buffer = ''\n addr = ('localhost', 15200)\n\n def flush(self):\n pass\n\n def close(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1040:Assign_L12_C4", "label": "_input_buffer =", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1040:ClassDef_L11_C0", "vector": [14, 1, 0.3529, 0.0294, 1, 0.79, 0.0, 808, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_input_buffer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _input_buffer = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1040:Assign_L13_C4", "label": "addr =", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1040:ClassDef_L11_C0", "vector": [14, 1, 0.3824, 0.0294, 1, 0.79, 0.3333, 526, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "addr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " addr = ('localhost', 15200)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1040:FunctionDef_L15_C4", "label": "flush", "type": "function", "loc": [15, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1040:ClassDef_L11_C0", "vector": [2, 1, 0.4559, 0.0588, 1, 0.79, 0.6667, 439, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "flush", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def flush(self):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1040:FunctionDef_L18_C4", "label": "close", "type": "function", "loc": [18, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1040:ClassDef_L11_C0", "vector": [2, 1, 0.5441, 0.0588, 1, 0.79, 1.0, 77, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "close", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def close(self):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1040:ClassDef_L22_C0", "label": "CallLogger", "type": "class", "loc": [22, 30], "level": 0, "parent": null, "vector": [3, 0, 0.7647, 0.2647, 0, 0.66, 0.5, 415, 0, 2, 0, 0, 186, 0, 1], "semantic": {"name": "CallLogger", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CallLogger(object):\n\n def __init__(self, func):\n self.func = func\n self.was_called = False\n\n def __call__(self, *args, **kwargs):\n self.was_called = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1040:FunctionDef_L24_C4", "label": "__init__", "type": "function", "loc": [24, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1040:ClassDef_L22_C0", "vector": [2, 1, 0.7353, 0.0882, 1, 0.37, 0.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, func):\n self.func = func\n self.was_called = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1040:Assign_L25_C8", "label": "self.func =", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1040:FunctionDef_L24_C4", "vector": [14, 2, 0.7353, 0.0294, 2, 0.56, 0.0, 558, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.func", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.func = func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1040:Assign_L26_C8", "label": "self.was_called =", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1040:FunctionDef_L24_C4", "vector": [14, 2, 0.7647, 0.0294, 2, 0.56, 1.0, 283, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.was_called", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.was_called = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1040:FunctionDef_L28_C4", "label": "__call__", "type": "function", "loc": [28, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1040:ClassDef_L22_C0", "vector": [2, 1, 0.8529, 0.0882, 1, 0.37, 1.0, 319, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "__call__", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __call__(self, *args, **kwargs):\n self.was_called = True\n return self.func(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1040:Assign_L29_C8", "label": "self.was_called =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1040:FunctionDef_L28_C4", "vector": [14, 2, 0.8529, 0.0294, 2, 0.05, 0.0, 283, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.was_called", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.was_called = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1040:Return_L30_C8", "label": "return", "type": "return", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1040:FunctionDef_L28_C4", "vector": [13, 2, 0.8824, 0.0294, 2, 0.05, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.func(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1040:FunctionDef_L33_C0", "label": "track_call", "type": "function", "loc": [33, 34], "level": 0, "parent": null, "vector": [2, 0, 0.9853, 0.0588, 0, 0.66, 1.0, 204, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "track_call", "arg_names": ["func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def track_call(func):\n return CallLogger(func)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1040:Return_L34_C4", "label": "return", "type": "return", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1040:FunctionDef_L33_C0", "vector": [13, 1, 1.0, 0.0294, 1, 0.85, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return CallLogger(func)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1040:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1040:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1040:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1040:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1040:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1040:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1040:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1040:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1040:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1040:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1040:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1040:Assign_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1040:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1040:Assign_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1040:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1040:FunctionDef_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1040:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1040:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1040:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1040:Return_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1040:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1040:Return_L34_C4"}]
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # import os import sys import unittest def suite(): suite = unittest.TestSuite() for root, dirs, files in os.walk('.'): for file in files: if not (file.startswith('test_') and file.endswith('.py')): continue name = file.split('.')[0] modname = os.path.join(root, name).replace(os.path.sep, '.') modname = modname.lstrip('.') tests = unittest.defaultTestLoader.loadTestsFromName(modname) for test in tests: suite.addTests(test) sys.stdout.write('%s : %s tests%s' % (modname, tests.countTestCases(), os.linesep)) sys.stdout.flush() return suite if __name__ == '__main__': unittest.main(defaultTest='suite')
ajibawa-2023/Python-Code-Large/train/row_1041
19
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_1041:Import_L10_C0", "label": "os import os", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.303, 0.0303, 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_1041:Import_L11_C0", "label": "sys import sys", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.0303, 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_1041:Import_L12_C0", "label": "unittest import unittest", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.3636, 0.0303, 0, 0.66, 0.5, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"], "rhs_call_name": "", "annotation": ""}, "snippet": "import unittest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1041:FunctionDef_L14_C0", "label": "suite", "type": "function", "loc": [14, 29], "level": 0, "parent": null, "vector": [2, 0, 0.6515, 0.4848, 0, 0.66, 0.75, 425, 0, 0, 1, 0, 0, 0, 13], "semantic": {"name": "suite", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def suite():\n suite = unittest.TestSuite()\n for root, dirs, files in os.walk('.'):\n for file in files:\n if not (file.startswith('test_') and file.endswith('.py')):\n continue\n name = file.split('.')[0]\n modname = os.path.join(root, name).replace(os.path.sep, '.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1041:Assign_L15_C4", "label": "suite = TestSuite()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1041:FunctionDef_L14_C0", "vector": [14, 1, 0.4545, 0.0303, 1, 0.31, 0.0, 425, 3, 0, 0, 0, 75, 10, 1], "semantic": {"name": "suite", "arg_names": [], "import_names": [], "rhs_call_name": "TestSuite", "annotation": ""}, "snippet": " suite = unittest.TestSuite()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L16_C4", "label": "for root, dirs, files", "type": "for", "loc": [16, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1041:FunctionDef_L14_C0", "vector": [6, 1, 0.6667, 0.3939, 1, 0.31, 0.5, 129, 3, 0, 0, 0, 0, 0, 12], "semantic": {"name": "root, dirs, files", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for root, dirs, files in os.walk('.'):\n for file in files:\n if not (file.startswith('test_') and file.endswith('.py')):\n continue\n name = file.split('.')[0]\n modname = os.path.join(root, name).replace(os.path.sep, '.')\n modname = modname.lstrip('.')\n tests = unittest.defaultTestLoader.loadTestsFromName(modname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L17_C8", "label": "for file", "type": "for", "loc": [17, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L16_C4", "vector": [6, 2, 0.6818, 0.3636, 2, 0.24, 0.0, 107, 2, 0, 0, 0, 0, 0, 11], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for file in files:\n if not (file.startswith('test_') and file.endswith('.py')):\n continue\n name = file.split('.')[0]\n modname = os.path.join(root, name).replace(os.path.sep, '.')\n modname = modname.lstrip('.')\n tests = unittest.defaultTestLoader.loadTestsFromName(modname)\n for test in tests:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1041:If_L18_C12", "label": "if", "type": "if", "loc": [18, 19], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L17_C8", "vector": [4, 3, 0.5606, 0.0606, 3, 0.21, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not (file.startswith('test_') and file.endswith('.py')):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1041:Assign_L20_C12", "label": "name =", "type": "assigned_variable", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L17_C8", "vector": [14, 3, 0.6061, 0.0303, 3, 0.21, 0.1429, 57, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = file.split('.')[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1041:Assign_L21_C12", "label": "modname = replace()", "type": "assigned_variable", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L17_C8", "vector": [14, 3, 0.6364, 0.0303, 3, 0.21, 0.2857, 909, 3, 2, 0, 0, 293, 10, 2], "semantic": {"name": "modname", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " modname = os.path.join(root, name).replace(os.path.sep, '.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1041:Assign_L22_C12", "label": "modname = lstrip()", "type": "assigned_variable", "loc": [22, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L17_C8", "vector": [14, 3, 0.6667, 0.0303, 3, 0.21, 0.4286, 909, 3, 1, 0, 0, 313, 10, 1], "semantic": {"name": "modname", "arg_names": [], "import_names": [], "rhs_call_name": "lstrip", "annotation": ""}, "snippet": " modname = modname.lstrip('.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1041:Assign_L23_C12", "label": "tests = loadTestsFromName()", "type": "assigned_variable", "loc": [23, 23], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L17_C8", "vector": [14, 3, 0.697, 0.0303, 3, 0.21, 0.5714, 416, 3, 1, 0, 0, 509, 10, 1], "semantic": {"name": "tests", "arg_names": [], "import_names": [], "rhs_call_name": "loadTestsFromName", "annotation": ""}, "snippet": " tests = unittest.defaultTestLoader.loadTestsFromName(modname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L24_C12", "label": "for test", "type": "for", "loc": [24, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L17_C8", "vector": [6, 3, 0.7424, 0.0606, 3, 0.21, 0.7143, 224, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for test in tests:\n suite.addTests(test)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1041:Expr_L25_C16", "label": "addTests()", "type": "expression", "loc": [25, 25], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L24_C12", "vector": [8, 4, 0.7576, 0.0303, 4, 0.25, 0.0, 947, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addTests", "arg_names": [], "import_names": [], "rhs_call_name": "addTests", "annotation": ""}, "snippet": " suite.addTests(test)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1041:Expr_L26_C12", "label": "write()", "type": "expression", "loc": [26, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L17_C8", "vector": [8, 3, 0.803, 0.0606, 3, 0.21, 0.8571, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " sys.stdout.write('%s : %s tests%s'\n % (modname, tests.countTestCases(), os.linesep))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1041:Expr_L28_C12", "label": "flush()", "type": "expression", "loc": [28, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L17_C8", "vector": [8, 3, 0.8485, 0.0303, 3, 0.21, 1.0, 439, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "flush", "arg_names": [], "import_names": [], "rhs_call_name": "flush", "annotation": ""}, "snippet": " sys.stdout.flush()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1041:Return_L29_C4", "label": "return", "type": "return", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1041:FunctionDef_L14_C0", "vector": [13, 1, 0.8788, 0.0303, 1, 0.31, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return suite"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1041: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 unittest.main(defaultTest='suite')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1041:Expr_L33_C4", "label": "main()", "type": "expression", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1041:If_L32_C0", "vector": [8, 1, 1.0, 0.0303, 1, 0.03, 0.0, 624, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " unittest.main(defaultTest='suite')"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1041:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1041:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1041:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L17_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1041:If_L18_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L17_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1041:Assign_L20_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L17_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1041:Assign_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L17_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1041:Assign_L22_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L17_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1041:Assign_L23_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L17_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L24_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L24_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1041:Expr_L25_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L17_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1041:Expr_L26_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1041:For_L17_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1041:Expr_L28_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1041:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1041:Return_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1041:If_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1041:Expr_L33_C4"}]
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # """Common ASTM records structure. This module contains base ASTM records mappings with only defined common required fields for most implementations. Others are marked as :class:`~astm.mapping.NotUsedField` and should be defined explicitly for your ASTM realisation. """ from datetime import datetime from .mapping import ( Record, ConstantField, DateTimeField, IntegerField, NotUsedField, TextField, RepeatedComponentField, Component ) __all__ = ['HeaderRecord', 'PatientRecord', 'OrderRecord', 'ResultRecord', 'CommentRecord', 'TerminatorRecord'] #: +-----+--------------+---------------------------------+-------------------+ #: | # | ASTM Field # | ASTM Name | Python alias | #: +=====+==============+=================================+===================+ #: | 1 | 7.1.1 | ASTM Record Type ID | type | #: +-----+--------------+---------------------------------+-------------------+ #: | 2 | 7.1.2 | Delimiter Definition | delimeter | #: +-----+--------------+---------------------------------+-------------------+ #: | 3 | 7.1.3 | Message Control ID | message_id | #: +-----+--------------+---------------------------------+-------------------+ #: | 4 | 7.1.4 | Access Password | password | #: +-----+--------------+---------------------------------+-------------------+ #: | 5 | 7.1.5 | Sender Name or ID | sender | #: +-----+--------------+---------------------------------+-------------------+ #: | 6 | 7.1.6 | Sender Street Address | address | #: +-----+--------------+---------------------------------+-------------------+ #: | 7 | 7.1.7 | Reserved Field | reserved | #: +-----+--------------+---------------------------------+-------------------+ #: | 8 | 7.1.8 | Sender Telephone Number | phone | #: +-----+--------------+---------------------------------+-------------------+ #: | 9 | 7.1.9 | Characteristics of Sender | caps | #: +-----+--------------+---------------------------------+-------------------+ #: | 10 | 7.1.10 | Receiver ID | receiver | #: +-----+--------------+---------------------------------+-------------------+ #: | 11 | 7.1.11 | Comments | comments | #: +-----+--------------+---------------------------------+-------------------+ #: | 12 | 7.1.12 | Processing ID | processing_id | #: +-----+--------------+---------------------------------+-------------------+ #: | 13 | 7.1.13 | Version Number | version | #: +-----+--------------+---------------------------------+-------------------+ #: | 14 | 7.1.14 | Date/Time of Message | timestamp | #: +-----+--------------+---------------------------------+-------------------+ #: HeaderRecord = Record.build( ConstantField(name='type', default='H'), RepeatedComponentField(Component.build( ConstantField(name='_', default=''), TextField(name='__') ), name='delimeter', default=[[], ['', '&']]), # ^^^ workaround to define field: # ConstantField(name='delimeter', default='\^&'), NotUsedField(name='message_id'), NotUsedField(name='password'), NotUsedField(name='sender'), NotUsedField(name='address'), NotUsedField(name='reserved'), NotUsedField(name='phone'), NotUsedField(name='caps'), NotUsedField(name='receiver'), NotUsedField(name='comments'), ConstantField(name='processing_id', default='P'), NotUsedField(name='version'), DateTimeField(name='timestamp', default=datetime.now, required=True), ) #: +-----+--------------+---------------------------------+-------------------+ #: | # | ASTM Field # | ASTM Name | Python alias | #: +=====+==============+=================================+===================+ #: | 1 | 8.1.1 | Record Type ID | type | #: +-----+--------------+---------------------------------+-------------------+ #: | 2 | 8.1.2 | Sequence Number | seq | #: +-----+--------------+---------------------------------+-------------------+ #: | 3 | 8.1.3 | Practice Assigned Patient ID | practice_id | #: +-----+--------------+---------------------------------+-------------------+ #: | 4 | 8.1.4 | Laboratory Assigned Patient ID | laboratory_id | #: +-----+--------------+---------------------------------+-------------------+ #: | 5 | 8.1.5 | Patient ID | id | #: +-----+--------------+---------------------------------+-------------------+ #: | 6 | 8.1.6 | Patient Name | name | #: +-----+--------------+---------------------------------+-------------------+ #: | 7 | 8.1.7 | Mother’s Maiden Name | maiden_name | #: +-----+--------------+---------------------------------+-------------------+ #: | 8 | 8.1.8 | Birthdate | birthdate | #: +-----+--------------+---------------------------------+-------------------+ #: | 9 | 8.1.9 | Patient Sex | sex | #: +-----+--------------+---------------------------------+-------------------+ #: | 10 | 8.1.10 | Patient Race-Ethnic Origin | race | #: +-----+--------------+---------------------------------+-------------------+ #: | 11 | 8.1.11 | Patient Address | address | #: +-----+--------------+---------------------------------+-------------------+ #: | 12 | 8.1.12 | Reserved Field | reserved | #: +-----+--------------+---------------------------------+-------------------+ #: | 13 | 8.1.13 | Patient Telephone Number | phone | #: +-----+--------------+---------------------------------+-------------------+ #: | 14 | 8.1.14 | Attending Physician ID | physician_id | #: +-----+--------------+---------------------------------+-------------------+ #: | 15 | 8.1.15 | Special Field #1 | special_1 | #: +-----+--------------+---------------------------------+-------------------+ #: | 16 | 8.1.16 | Special Field #2 | special_2 | #: +-----+--------------+---------------------------------+-------------------+ #: | 17 | 8.1.17 | Patient Height | height | #: +-----+--------------+---------------------------------+-------------------+ #: | 18 | 8.1.18 | Patient Weight | weight | #: +-----+--------------+---------------------------------+-------------------+ #: | 19 | 8.1.19 | Patient’s Known Diagnosis | diagnosis | #: +-----+--------------+---------------------------------+-------------------+ #: | 20 | 8.1.20 | Patient’s Active Medication | medication | #: +-----+--------------+---------------------------------+-------------------+ #: | 21 | 8.1.21 | Patient’s Diet | diet | #: +-----+--------------+---------------------------------+-------------------+ #: | 22 | 8.1.22 | Practice Field No. 1 | practice_field_1 | #: +-----+--------------+---------------------------------+-------------------+ #: | 23 | 8.1.23 | Practice Field No. 2 | practice_field_2 | #: +-----+--------------+---------------------------------+-------------------+ #: | 24 | 8.1.24 | Admission/Discharge Dates | admission_date | #: +-----+--------------+---------------------------------+-------------------+ #: | 25 | 8.1.25 | Admission Status | admission_status | #: +-----+--------------+---------------------------------+-------------------+ #: | 26 | 8.1.26 | Location | location | #: +-----+--------------+---------------------------------+-------------------+ #: PatientRecord = Record.build( ConstantField(name='type', default='P'), IntegerField(name='seq', default=1, required=True), NotUsedField(name='practice_id'), NotUsedField(name='laboratory_id'), NotUsedField(name='id'), NotUsedField(name='name'), NotUsedField(name='maiden_name'), NotUsedField(name='birthdate'), NotUsedField(name='sex'), NotUsedField(name='race'), NotUsedField(name='address'), NotUsedField(name='reserved'), NotUsedField(name='phone'), NotUsedField(name='physician_id'), NotUsedField(name='special_1'), NotUsedField(name='special_2'), NotUsedField(name='height'), NotUsedField(name='weight'), NotUsedField(name='diagnosis'), NotUsedField(name='medication'), NotUsedField(name='diet'), NotUsedField(name='practice_field_1'), NotUsedField(name='practice_field_2'), NotUsedField(name='admission_date'), NotUsedField(name='admission_status'), NotUsedField(name='location'), NotUsedField(name='diagnostic_code_nature'), NotUsedField(name='diagnostic_code'), NotUsedField(name='religion'), NotUsedField(name='martial_status'), NotUsedField(name='isolation_status'), NotUsedField(name='language'), NotUsedField(name='hospital_service'), NotUsedField(name='hospital_institution'), NotUsedField(name='dosage_category'), ) #: +-----+--------------+--------------------------------+--------------------+ #: | # | ASTM Field # | ASTM Name | Python alias | #: +=====+==============+================================+====================+ #: | 1 | 9.4.1 | Record Type ID | type | #: +-----+--------------+--------------------------------+--------------------+ #: | 2 | 9.4.2 | Sequence Number | seq | #: +-----+--------------+--------------------------------+--------------------+ #: | 3 | 9.4.3 | Specimen ID | sample_id | #: +-----+--------------+--------------------------------+--------------------+ #: | 4 | 9.4.4 | Instrument Specimen ID | instrument | #: +-----+--------------+--------------------------------+--------------------+ #: | 5 | 9.4.5 | Universal Test ID | test | #: +-----+--------------+--------------------------------+--------------------+ #: | 6 | 9.4.6 | Priority | priority | #: +-----+--------------+--------------------------------+--------------------+ #: | 7 | 9.4.7 | Requested/Ordered Date/Time | created_at | #: +-----+--------------+--------------------------------+--------------------+ #: | 8 | 9.4.8 | Specimen Collection Date/Time | sampled_at | #: +-----+--------------+--------------------------------+--------------------+ #: | 9 | 9.4.9 | Collection End Time | collected_at | #: +-----+--------------+--------------------------------+--------------------+ #: | 10 | 9.4.10 | Collection Volume | volume | #: +-----+--------------+--------------------------------+--------------------+ #: | 11 | 9.4.11 | Collector ID | collector | #: +-----+--------------+--------------------------------+--------------------+ #: | 12 | 9.4.12 | Action Code | action_code | #: +-----+--------------+--------------------------------+--------------------+ #: | 13 | 9.4.13 | Danger Code | danger_code | #: +-----+--------------+--------------------------------+--------------------+ #: | 14 | 9.4.14 | Relevant Information | clinical_info | #: +-----+--------------+--------------------------------+--------------------+ #: | 15 | 9.4.15 | Date/Time Specimen Received | delivered_at | #: +-----+--------------+--------------------------------+--------------------+ #: | 16 | 9.4.16 | Specimen Descriptor | biomaterial | #: +-----+--------------+--------------------------------+--------------------+ #: | 17 | 9.4.17 | Ordering Physician | physician | #: +-----+--------------+--------------------------------+--------------------+ #: | 18 | 9.4.18 | Physician’s Telephone # | physician_phone | #: +-----+--------------+--------------------------------+--------------------+ #: | 19 | 9.4.19 | User Field No. 1 | user_field_1 | #: +-----+--------------+--------------------------------+--------------------+ #: | 20 | 9.4.20 | User Field No. 2 | user_field_2 | #: +-----+--------------+--------------------------------+--------------------+ #: | 21 | 9.4.21 | Laboratory Field No. 1 | laboratory_field_1 | #: +-----+--------------+--------------------------------+--------------------+ #: | 22 | 9.4.22 | Laboratory Field No. 2 | laboratory_field_2 | #: +-----+--------------+--------------------------------+--------------------+ #: | 23 | 9.4.23 | Date/Time Reported | modified_at | #: +-----+--------------+--------------------------------+--------------------+ #: | 24 | 9.4.24 | Instrument Charge | instrument_charge | #: +-----+--------------+--------------------------------+--------------------+ #: | 25 | 9.4.25 | Instrument Section ID | instrument_section | #: +-----+--------------+--------------------------------+--------------------+ #: | 26 | 9.4.26 | Report Type | report_type | #: +-----+--------------+--------------------------------+--------------------+ #: OrderRecord = Record.build( ConstantField(name='type', default='O'), IntegerField(name='seq', default=1, required=True), NotUsedField(name='sample_id'), NotUsedField(name='instrument'), NotUsedField(name='test'), NotUsedField(name='priority'), NotUsedField(name='created_at'), NotUsedField(name='sampled_at'), NotUsedField(name='collected_at'), NotUsedField(name='volume'), NotUsedField(name='collector'), NotUsedField(name='action_code'), NotUsedField(name='danger_code'), NotUsedField(name='clinical_info'), NotUsedField(name='delivered_at'), NotUsedField(name='biomaterial'), NotUsedField(name='physician'), NotUsedField(name='physician_phone'), NotUsedField(name='user_field_1'), NotUsedField(name='user_field_2'), NotUsedField(name='laboratory_field_1'), NotUsedField(name='laboratory_field_2'), NotUsedField(name='modified_at'), NotUsedField(name='instrument_charge'), NotUsedField(name='instrument_section'), NotUsedField(name='report_type'), NotUsedField(name='reserved'), NotUsedField(name='location_ward'), NotUsedField(name='infection_flag'), NotUsedField(name='specimen_service'), NotUsedField(name='laboratory') ) #: +-----+--------------+--------------------------------+--------------------+ #: | # | ASTM Field # | ASTM Name | Python alias | #: +=====+==============+================================+====================+ #: | 1 | 10.1.1 | Record Type ID | type | #: +-----+--------------+--------------------------------+--------------------+ #: | 2 | 10.1.2 | Sequence Number | seq | #: +-----+--------------+--------------------------------+--------------------+ #: | 3 | 10.1.3 | Universal Test ID | test | #: +-----+--------------+--------------------------------+--------------------+ #: | 4 | 10.1.4 | Data or Measurement Value | value | #: +-----+--------------+--------------------------------+--------------------+ #: | 5 | 10.1.5 | Units | units | #: +-----+--------------+--------------------------------+--------------------+ #: | 6 | 10.1.6 | Reference Ranges | references | #: +-----+--------------+--------------------------------+--------------------+ #: | 7 | 10.1.7 | Result Abnormal Flags | abnormal_flag | #: +-----+--------------+--------------------------------+--------------------+ #: | 8 | 10.1.8 | Nature of Abnormal Testing | abnormality_nature | #: +-----+--------------+--------------------------------+--------------------+ #: | 9 | 10.1.9 | Results Status | status | #: +-----+--------------+--------------------------------+--------------------+ #: | 10 | 10.1.10 | Date of Change in Instrument | norms_changed_at | #: | | | Normative Values | | #: +-----+--------------+--------------------------------+--------------------+ #: | 11 | 10.1.11 | Operator Identification | operator | #: +-----+--------------+--------------------------------+--------------------+ #: | 12 | 10.1.12 | Date/Time Test Started | started_at | #: +-----+--------------+--------------------------------+--------------------+ #: | 13 | 10.1.13 | Date/Time Test Complete | completed_at | #: +-----+--------------+--------------------------------+--------------------+ #: | 14 | 10.1.14 | Instrument Identification | instrument | #: +-----+--------------+--------------------------------+--------------------+ #: ResultRecord = Record.build( ConstantField(name='type', default='R'), IntegerField(name='seq', default=1, required=True), NotUsedField(name='test'), NotUsedField(name='value'), NotUsedField(name='units'), NotUsedField(name='references'), NotUsedField(name='abnormal_flag'), NotUsedField(name='abnormality_nature'), NotUsedField(name='status'), NotUsedField(name='norms_changed_at'), NotUsedField(name='operator'), NotUsedField(name='started_at'), NotUsedField(name='completed_at'), NotUsedField(name='instrument'), ) #: +-----+--------------+---------------------------------+-------------------+ #: | # | ASTM Field # | ASTM Name | Python alias | #: +=====+==============+=================================+===================+ #: | 1 | 11.1.1 | Record Type ID | type | #: +-----+--------------+---------------------------------+-------------------+ #: | 2 | 11.1.2 | Sequence Number | seq | #: +-----+--------------+---------------------------------+-------------------+ #: | 3 | 11.1.3 | Comment Source | source | #: +-----+--------------+---------------------------------+-------------------+ #: | 4 | 11.1.4 | Comment Text | data | #: +-----+--------------+---------------------------------+-------------------+ #: | 5 | 11.1.5 | Comment Type | ctype | #: +-----+--------------+---------------------------------+-------------------+ #: CommentRecord = Record.build( ConstantField(name='type', default='C'), IntegerField(name='seq', default=1, required=True), NotUsedField(name='source'), NotUsedField(name='data'), NotUsedField(name='ctype') ) #: +-----+--------------+---------------------------------+-------------------+ #: | # | ASTM Field # | ASTM Name | Python alias | #: +=====+==============+=================================+===================+ #: | 1 | 13.1.1 | Record Type ID | type | #: +-----+--------------+---------------------------------+-------------------+ #: | 2 | 13.1.2 | Sequence Number | seq | #: +-----+--------------+---------------------------------+-------------------+ #: | 3 | 13.1.3 | Termination code | code | #: +-----+--------------+---------------------------------+-------------------+ #: TerminatorRecord = Record.build( ConstantField(name='type', default='L'), ConstantField(name='seq', default=1, field=IntegerField()), ConstantField(name='code', default='N') ) #: +-----+--------------+---------------------------------+-------------------+ #: | # | ASTM Field # | ASTM Name | Python alias | #: +=====+==============+=================================+===================+ #: | 1 | 14.1.1 | Record Type ID | type | #: +-----+--------------+---------------------------------+-------------------+ #: | 2 | 14.1.2 | Sequence Number | seq | #: +-----+--------------+---------------------------------+-------------------+ #: | 3 | 14.1.3 | Analytical Method | method | #: +-----+--------------+---------------------------------+-------------------+ #: | 4 | 14.1.4 | Instrumentation | instrument | #: +-----+--------------+---------------------------------+-------------------+ #: | 5 | 14.1.5 | Reagents | reagents | #: +-----+--------------+---------------------------------+-------------------+ #: | 6 | 14.1.6 | Units of Measure | units | #: +-----+--------------+---------------------------------+-------------------+ #: | 7 | 14.1.7 | Quality Control | qc | #: +-----+--------------+---------------------------------+-------------------+ #: | 8 | 14.1.8 | Specimen Descriptor | biomaterial | #: +-----+--------------+---------------------------------+-------------------+ #: | 9 | 14.1.9 | Reserved Field | reserved | #: +-----+--------------+---------------------------------+-------------------+ #: | 10 | 14.1.10 | Container | container | #: +-----+--------------+---------------------------------+-------------------+ #: | 11 | 14.1.11 | Specimen ID | sample_id | #: +-----+--------------+---------------------------------+-------------------+ #: | 12 | 14.1.12 | Analyte | analyte | #: +-----+--------------+---------------------------------+-------------------+ #: | 13 | 14.1.13 | Result | result | #: +-----+--------------+---------------------------------+-------------------+ #: | 14 | 14.1.14 | Result Units | result_units | #: +-----+--------------+---------------------------------+-------------------+ #: | 15 | 14.1.15 | Collection Date and Time | sampled_at | #: +-----+--------------+---------------------------------+-------------------+ #: | 16 | 14.1.16 | Result Date and Time | completed_at | #: +-----+--------------+---------------------------------+-------------------+ #: | 17 | 14.1.17 | Analytical Preprocessing Steps | preanalytics | #: +-----+--------------+---------------------------------+-------------------+ #: | 18 | 14.1.18 | Patient Diagnosis | diagnosis | #: +-----+--------------+---------------------------------+-------------------+ #: | 19 | 14.1.19 | Patient Birthdate | birthdate | #: +-----+--------------+---------------------------------+-------------------+ #: | 20 | 14.1.20 | Patient Sex | sex | #: +-----+--------------+---------------------------------+-------------------+ #: | 21 | 14.1.21 | Patient Race | race | #: +-----+--------------+---------------------------------+-------------------+ #: ScientificRecord = Record.build( ConstantField(name='type', default='S'), IntegerField(name='seq', default=1, required=True), NotUsedField(name='method'), NotUsedField(name='instrument'), NotUsedField(name='reagents'), NotUsedField(name='units'), NotUsedField(name='qc'), NotUsedField(name='biomaterial'), NotUsedField(name='reserved'), NotUsedField(name='container'), NotUsedField(name='sample_id'), NotUsedField(name='analyte'), NotUsedField(name='result'), NotUsedField(name='result_units'), NotUsedField(name='sampled_at'), NotUsedField(name='completed_at'), NotUsedField(name='preanalytics'), NotUsedField(name='diagnosis'), NotUsedField(name='birthdate'), NotUsedField(name='sex'), NotUsedField(name='race'), ) #: +-----+--------------+---------------------------------+-------------------+ #: | # | ASTM Field # | ASTM Name | Python alias | #: +=====+==============+=================================+===================+ #: | 1 | 15.1.1 | Record Type ID | type | #: +-----+--------------+---------------------------------+-------------------+ #: | 2 | 15.1.2 | Sequence Number | seq | #: +-----+--------------+---------------------------------+-------------------+ #: #: .. note:: #: This record, which is similar to the comment record, may be used to send #: complex structures where use of the existing record types would not be #: appropriate. The fields within this record type are defined by the #: manufacturer. #: ManufacturerInfoRecord = Record.build( ConstantField(name='type', default='M'), IntegerField(name='seq', default=1, required=True), )
ajibawa-2023/Python-Code-Large/train/row_1042
12
445
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1042:Expr_L10_C0", "label": "expression", "type": "expression", "loc": [10, 17], "level": 0, "parent": null, "vector": [8, 0, 0.0303, 0.018, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Common ASTM records structure.\n\n\nThis module contains base ASTM records mappings with only defined common\nrequired fields for most implementations. Others are marked as\n:class:`~astm.mapping.NotUsedField` and should be defined explicitly for your\nASTM realisation.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1042:ImportFrom_L20_C0", "label": "from datetime import datetime", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.0449, 0.0022, 0, 0.66, 0.0909, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime"], "rhs_call_name": "", "annotation": ""}, "snippet": "from datetime import datetime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1042:ImportFrom_L21_C0", "label": "from mapping import Record, ConstantField, DateTimeField\u2026", "type": "import", "loc": [21, 25], "level": 0, "parent": null, "vector": [1, 0, 0.0517, 0.0112, 0, 0.66, 0.1818, 351, 0, 8, 0, 0, 351, 0, 0], "semantic": {"name": "mapping", "arg_names": [], "import_names": ["Record", "ConstantField", "DateTimeField", "IntegerField", "NotUsedField", "TextField", "RepeatedComponentField", "Component"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .mapping import (\n Record, ConstantField, DateTimeField, IntegerField, NotUsedField,\n TextField, RepeatedComponentField, Component\n\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1042:Assign_L27_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [27, 28], "level": 0, "parent": null, "vector": [14, 0, 0.0618, 0.0045, 0, 0.66, 0.2727, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = ['HeaderRecord', 'PatientRecord', 'OrderRecord',\n 'ResultRecord', 'CommentRecord', 'TerminatorRecord']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1042:Assign_L62_C0", "label": "HeaderRecord = build()", "type": "assigned_variable", "loc": [62, 82], "level": 0, "parent": null, "vector": [14, 0, 0.1618, 0.0472, 0, 0.66, 0.3636, 193, 3, 14, 0, 0, 448, 10, 18], "semantic": {"name": "HeaderRecord", "arg_names": [], "import_names": [], "rhs_call_name": "build", "annotation": ""}, "snippet": "HeaderRecord = Record.build(\n ConstantField(name='type', default='H'),\n RepeatedComponentField(Component.build(\n ConstantField(name='_', default=''),\n TextField(name='__')\n ), name='delimeter', default=[[], ['', '&']]),\n # ^^^ workaround to define field:\n # ConstantField(name='delimeter', default='\\^&'),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1042:Assign_L141_C0", "label": "PatientRecord = build()", "type": "assigned_variable", "loc": [141, 177], "level": 0, "parent": null, "vector": [14, 0, 0.3573, 0.0831, 0, 0.66, 0.4545, 240, 3, 35, 0, 0, 448, 10, 36], "semantic": {"name": "PatientRecord", "arg_names": [], "import_names": [], "rhs_call_name": "build", "annotation": ""}, "snippet": "PatientRecord = Record.build(\n ConstantField(name='type', default='P'),\n IntegerField(name='seq', default=1, required=True),\n NotUsedField(name='practice_id'),\n NotUsedField(name='laboratory_id'),\n NotUsedField(name='id'),\n NotUsedField(name='name'),\n NotUsedField(name='maiden_name'),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1042:Assign_L236_C0", "label": "OrderRecord = build()", "type": "assigned_variable", "loc": [236, 268], "level": 0, "parent": null, "vector": [14, 0, 0.5663, 0.0742, 0, 0.66, 0.5455, 192, 3, 31, 0, 0, 448, 10, 32], "semantic": {"name": "OrderRecord", "arg_names": [], "import_names": [], "rhs_call_name": "build", "annotation": ""}, "snippet": "OrderRecord = Record.build(\n ConstantField(name='type', default='O'),\n IntegerField(name='seq', default=1, required=True),\n NotUsedField(name='sample_id'),\n NotUsedField(name='instrument'),\n NotUsedField(name='test'),\n NotUsedField(name='priority'),\n NotUsedField(name='created_at'),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1042:Assign_L303_C0", "label": "ResultRecord = build()", "type": "assigned_variable", "loc": [303, 318], "level": 0, "parent": null, "vector": [14, 0, 0.6978, 0.036, 0, 0.66, 0.6364, 325, 3, 14, 0, 0, 448, 10, 15], "semantic": {"name": "ResultRecord", "arg_names": [], "import_names": [], "rhs_call_name": "build", "annotation": ""}, "snippet": "ResultRecord = Record.build(\n ConstantField(name='type', default='R'),\n IntegerField(name='seq', default=1, required=True),\n NotUsedField(name='test'),\n NotUsedField(name='value'),\n NotUsedField(name='units'),\n NotUsedField(name='references'),\n NotUsedField(name='abnormal_flag'),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1042:Assign_L334_C0", "label": "CommentRecord = build()", "type": "assigned_variable", "loc": [334, 340], "level": 0, "parent": null, "vector": [14, 0, 0.7573, 0.0157, 0, 0.66, 0.7273, 495, 3, 5, 0, 0, 448, 10, 6], "semantic": {"name": "CommentRecord", "arg_names": [], "import_names": [], "rhs_call_name": "build", "annotation": ""}, "snippet": "CommentRecord = Record.build(\n ConstantField(name='type', default='C'),\n IntegerField(name='seq', default=1, required=True),\n NotUsedField(name='source'),\n NotUsedField(name='data'),\n NotUsedField(name='ctype')\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1042:Assign_L352_C0", "label": "TerminatorRecord = build()", "type": "assigned_variable", "loc": [352, 356], "level": 0, "parent": null, "vector": [14, 0, 0.7955, 0.0112, 0, 0.66, 0.8182, 586, 3, 3, 0, 0, 448, 10, 5], "semantic": {"name": "TerminatorRecord", "arg_names": [], "import_names": [], "rhs_call_name": "build", "annotation": ""}, "snippet": "TerminatorRecord = Record.build(\n ConstantField(name='type', default='L'),\n ConstantField(name='seq', default=1, field=IntegerField()),\n ConstantField(name='code', default='N')\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1042:Assign_L404_C0", "label": "ScientificRecord = build()", "type": "assigned_variable", "loc": [404, 426], "level": 0, "parent": null, "vector": [14, 0, 0.9326, 0.0517, 0, 0.66, 0.9091, 970, 3, 21, 0, 0, 448, 10, 22], "semantic": {"name": "ScientificRecord", "arg_names": [], "import_names": [], "rhs_call_name": "build", "annotation": ""}, "snippet": "ScientificRecord = Record.build(\n ConstantField(name='type', default='S'),\n IntegerField(name='seq', default=1, required=True),\n NotUsedField(name='method'),\n NotUsedField(name='instrument'),\n NotUsedField(name='reagents'),\n NotUsedField(name='units'),\n NotUsedField(name='qc'),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1042:Assign_L442_C0", "label": "ManufacturerInfoRecord = build()", "type": "assigned_variable", "loc": [442, 445], "level": 0, "parent": null, "vector": [14, 0, 0.9966, 0.009, 0, 0.66, 1.0, 892, 3, 2, 0, 0, 448, 10, 3], "semantic": {"name": "ManufacturerInfoRecord", "arg_names": [], "import_names": [], "rhs_call_name": "build", "annotation": ""}, "snippet": "ManufacturerInfoRecord = Record.build(\n ConstantField(name='type', default='M'),\n IntegerField(name='seq', default=1, required=True),\n)"}]
[]
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # #: ASTM specification base encoding. ENCODING = 'latin-1' #: Message start token. STX = b'\x02' #: Message end token. ETX = b'\x03' #: ASTM session termination token. EOT = b'\x04' #: ASTM session initialization token. ENQ = b'\x05' #: Command accepted token. ACK = b'\x06' #: Command rejected token. NAK = b'\x15' #: Message chunk end token. ETB = b'\x17' LF = b'\x0A' CR = b'\x0D' #: CR + LF shortcut. CRLF = CR + LF #: Message records delimiter. RECORD_SEP = b'\x0D' # \r # #: Record fields delimiter. FIELD_SEP = b'\x7C' # | # #: Delimeter for repeated fields. REPEAT_SEP = b'\x5C' # \ # #: Field components delimiter. COMPONENT_SEP = b'\x5E' # ^ # #: Date escape token. ESCAPE_SEP = b'\x26' # & #
ajibawa-2023/Python-Code-Large/train/row_1043
16
41
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1043:Assign_L11_C0", "label": "ENCODING =", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.2683, 0.0244, 0, 0.66, 0.0, 1, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ENCODING", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ENCODING = 'latin-1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1043:Assign_L14_C0", "label": "STX =", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.3415, 0.0244, 0, 0.66, 0.0667, 693, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "STX", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "STX = b'\\x02'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1043:Assign_L16_C0", "label": "ETX =", "type": "assigned_variable", "loc": [16, 16], "level": 0, "parent": null, "vector": [14, 0, 0.3902, 0.0244, 0, 0.66, 0.1333, 844, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ETX", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ETX = b'\\x03'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1043:Assign_L18_C0", "label": "EOT =", "type": "assigned_variable", "loc": [18, 18], "level": 0, "parent": null, "vector": [14, 0, 0.439, 0.0244, 0, 0.66, 0.2, 63, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "EOT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "EOT = b'\\x04'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1043:Assign_L20_C0", "label": "ENQ =", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.4878, 0.0244, 0, 0.66, 0.2667, 755, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ENQ", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ENQ = b'\\x05'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1043:Assign_L22_C0", "label": "ACK =", "type": "assigned_variable", "loc": [22, 22], "level": 0, "parent": null, "vector": [14, 0, 0.5366, 0.0244, 0, 0.66, 0.3333, 595, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ACK", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ACK = b'\\x06'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1043:Assign_L24_C0", "label": "NAK =", "type": "assigned_variable", "loc": [24, 24], "level": 0, "parent": null, "vector": [14, 0, 0.5854, 0.0244, 0, 0.66, 0.4, 528, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "NAK", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "NAK = b'\\x15'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1043:Assign_L26_C0", "label": "ETB =", "type": "assigned_variable", "loc": [26, 26], "level": 0, "parent": null, "vector": [14, 0, 0.6341, 0.0244, 0, 0.66, 0.4667, 657, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ETB", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ETB = b'\\x17'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1043:Assign_L27_C0", "label": "LF =", "type": "assigned_variable", "loc": [27, 27], "level": 0, "parent": null, "vector": [14, 0, 0.6585, 0.0244, 0, 0.66, 0.5333, 484, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "LF", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "LF = b'\\x0A'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1043:Assign_L28_C0", "label": "CR =", "type": "assigned_variable", "loc": [28, 28], "level": 0, "parent": null, "vector": [14, 0, 0.6829, 0.0244, 0, 0.66, 0.6, 417, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "CR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "CR = b'\\x0D'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1043:Assign_L30_C0", "label": "CRLF =", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.7317, 0.0244, 0, 0.66, 0.6667, 646, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "CRLF", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "CRLF = CR + LF"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1043:Assign_L33_C0", "label": "RECORD_SEP =", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.8049, 0.0244, 0, 0.66, 0.7333, 754, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "RECORD_SEP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "RECORD_SEP = b'\\x0D' # \\r #"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1043:Assign_L35_C0", "label": "FIELD_SEP =", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 0.8537, 0.0244, 0, 0.66, 0.8, 463, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "FIELD_SEP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "FIELD_SEP = b'\\x7C' # | #"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1043:Assign_L37_C0", "label": "REPEAT_SEP =", "type": "assigned_variable", "loc": [37, 37], "level": 0, "parent": null, "vector": [14, 0, 0.9024, 0.0244, 0, 0.66, 0.8667, 63, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "REPEAT_SEP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "REPEAT_SEP = b'\\x5C' # \\ #"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1043:Assign_L39_C0", "label": "COMPONENT_SEP =", "type": "assigned_variable", "loc": [39, 39], "level": 0, "parent": null, "vector": [14, 0, 0.9512, 0.0244, 0, 0.66, 0.9333, 903, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "COMPONENT_SEP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "COMPONENT_SEP = b'\\x5E' # ^ #"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1043:Assign_L41_C0", "label": "ESCAPE_SEP =", "type": "assigned_variable", "loc": [41, 41], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.0244, 0, 0.66, 1.0, 416, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ESCAPE_SEP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ESCAPE_SEP = b'\\x26' # & #"}]
[]
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # """ ``astm.omnilab.server`` - LabOnline server implementation ---------------------------------------------------------- """ from astm.server import BaseRecordsDispatcher from astm.mapping import ( Component, ConstantField, ComponentField, DateTimeField, IntegerField, SetField, TextField, NotUsedField, DateField ) from .common import ( Header, Terminator, CommonPatient as Patient, CommonOrder, CommonResult, CommonComment, Sender ) __all__ = ['RecordsDispatcher', 'Header', 'Patient', 'Order', 'Result', 'Terminator', 'CommentData', 'CompletionDate', 'Instrument', 'Operator', 'Sender', 'Test'] #: Instrument (analyser) information structure. #: #: :param _: Reserved. Not used. #: :type _: None #: #: :param rack: Rack number. Length: 5. #: :type rack: str #: #: :param position: Position number. Length: 3. #: :type position: str #: Instrument = Component.build( TextField(name='_'), TextField(name='rack', length=5), TextField(name='position', length=3), ) #: Test :class:`~astm.mapping.Component` also known as Universal Test ID. #: #: :param _: Reserved. Not used. #: :type _: None #: #: :param __: Reserved. Not used. #: :type __: None #: #: :param ___: Reserved. Not used. #: :type ___: None #: #: :param assay_code: Assay code. Required. Length: 20. #: :type assay_code: str #: #: :param assay_name: Assay name. Length: 8. #: :type assay_name: str #: #: :param dilution: Dilution. Length: 10. #: :type dilution: str #: #: :param status: Assay status. Length: 1. #: :type status: str #: #: :param reagent_lot: Reagent lot. Length: 15. #: :type reagent_lot: str #: #: :param reagent_number: Reagent serial number. Length: 5. #: :type reagent_number: str #: #: :param control_lot: Control lot number. Length: 25. #: :type control_lot: str #: #: :param type: Result type value. One of: ``CE``, ``TX``. #: :type type: str #: Test = Component.build( NotUsedField(name='_'), NotUsedField(name='__'), NotUsedField(name='___'), TextField(name='assay_code', required=True, length=20), TextField(name='assay_name', length=8), TextField(name='dilution', length=10), TextField(name='status', length=1), TextField(name='reagent_lot', length=15), TextField(name='reagent_number', length=5), TextField(name='control_lot', length=25), SetField(name='type', values=('CE', 'TX')) ) #: Information about operator that validated results. #: #: :param code_on_labonline: Operator code on LabOnline. Length: 12. #: :type code_on_labonline: str #: #: :param code_on_analyzer: Operator code on analyser. Length: 20. #: :type code_on_analyzer: str #: Operator = Component.build( TextField(name='code_on_labonline', length=12), TextField(name='code_on_analyzer', length=20), ) #: Completion date time information. #: #: :param labonline: Completion date time on LabOnline. #: :type labonline: datetime.datetime #: #: :param analyzer: Completion date time on analyser. #: :type analyzer: datetime.datetime #: CompletionDate = Component.build( DateTimeField(name='labonline'), DateTimeField(name='analyzer'), ) #: Instrument (analyser) information structure. #: #: :param _: Reserved. Not used. #: :type _: None #: #: :param rack: Rack number. Length: 5. #: :type rack: str #: #: :param position: Position number. Length: 3. #: :type position: str #: Instrument = Component.build( NotUsedField(name='_'), TextField(name='rack', length=5), TextField(name='position', length=3), ) #: Comment control text structure. #: CommentData = Component.build( SetField(name='code', values=('PC', 'RC', 'SC', 'TC', 'CK', 'SE', 'CL', 'TA', 'SS', 'HQ', 'AL', 'PT')), TextField(name='value'), TextField(name='field_1'), TextField(name='field_2'), TextField(name='field_3'), TextField(name='field_4'), TextField(name='field_5'), ) class Order(CommonOrder): """ASTM order record. :param type: Record Type ID. Always ``O``. :type type: str :param seq: Sequence Number. Required. :type seq: int :param sample_id: Sample ID number. Required. Length: 12. :type sample_id: str :param instrument: Instrument specimen ID. :type instrument: :class:`Instrument` :param test: Test information structure (aka Universal Test ID). :type test: :class:`Test` :param priority: Priority flag. Required. Possible values: - ``S``: stat; -``R``: routine. :type priority: str :param created_at: Ordered date and time. Required. :type created_at: datetime.datetime :param sampled_at: Specimen collection date and time. :type sampled_at: datetime.datetime :param collected_at: Collection end time. Not used. :type collected_at: None :param volume: Collection volume. Not used. :type volume: None :param collector: Collector ID. Not used. :type collector: None :param action_code: Action code. Required. Possible values: - :const:`None`: normal order result; - ``Q``: quality control; :type action_code: str :param danger_code: Danger code. Not used. :type danger_code: None :param clinical_info: Revelant clinical info. Not used. :type clinical_info: None :param delivered_at: Date/time specimen received. :type delivered_at: None :param biomaterial: Sample material code. Length: 20. :type biomaterial: str :param physician: Ordering Physician. Not used. :type physician: None :param physician_phone: Physician's phone number. Not used. :type physician_phone: None :param user_field_1: An optional field, it will be send back unchanged to the host along with the result. Length: 20. :type user_field_1: str :param user_field_2: An optional field, it will be send back unchanged to the host along with the result. Length: 1024. :type user_field_2: str :param laboratory_field_1: Laboratory field #1. Not used. :type laboratory_field_1: None :param laboratory_field_2: Primary tube code. Length: 12. :type laboratory_field_2: str :param modified_at: Date and time of last result modification. Not used. :type modified_at: None :param instrument_charge: Instrument charge to computer system. Not used. :type instrument_charge: None :param instrument_section: Instrument section id. Not used. :type instrument_section: None :param report_type: Report type. Always ``F`` which means final order request. :type report_type: str :param reserved: Reserved. Not used. :type reserved: None :param location_ward: Location ward of specimen collection. Not used. :type location_ward: None :param infection_flag: Nosocomial infection flag. Not used. :type infection_flag: None :param specimen_service: Specimen service. Not used. :type specimen_service: None :param laboratory: Production laboratory. Not used. :type laboratory: None """ action_code = SetField(values=(None, 'Q')) instrument = ComponentField(Instrument) report_type = ConstantField(default='F') test = ComponentField(Test) class Result(CommonResult): """ASTM patient record. :param type: Record Type ID. Always ``R``. :type type: str :param seq: Sequence Number. Required. :type seq: int :param test: Test information structure (aka Universal Test ID). :type test: :class:`Test` :param value: Measurement value. Numeric, coded or free text value depending on result type. Required. Length: 1024. :type value: None :param units: Units. Length: 20. :type units: str :param references: Normal reference value interval. :type references: str :param abnormal_flag: Result abnormal flag. Possible values: - ``0``: normal result; - ``1``: result out of normal values; - ``2``: result out of attention values; - ``3``: result out of panic values; +10 Delta-check; +1000 Device alarm. Length: 4. :type abnormal_flag: str :param abnormality_nature: Nature of abnormality testing. Possible values: - ``N``: normal value; - ``L``: below low normal range; - ``H``: above high normal range; - ``LL``: below low critical range; - ``HH``: above high critical range. :type abnormality_nature: str :param status: Result status. ``F`` indicates a final result; ``R`` indicating rerun. Length: 1. :type status: str :param normatives_changed_at: Date of changes in instrument normative values or units. Not used. :type normatives_changed_at: None :param operator: Operator ID. :type operator: :class:`Operator` :param started_at: When works on test was started on. :type started_at: datetime.datetime :param completed_at: When works on test was done. :type completed_at: datetime.datetime :param instrument: Instrument ID. Required. :type instrument: :class:`Instrument` """ abnormal_flag = SetField( field=IntegerField(), length=4, values=(0, 1, 2, 3, 10, 11, 12, 13, 1000, 1001, 1002, 1003, 1010, 1011, 1012, 1013)) abnormality_nature = SetField(values=('N', 'L', 'H', 'LL', 'HH')) completed_at = ComponentField(CompletionDate) created_at = DateField() instrument = TextField(length=16) operator = ComponentField(Operator) references = TextField() sampled_at = DateField() started_at = DateTimeField(required=True) status = SetField(values=('F', 'R')) test = ComponentField(Test) units = TextField(length=20) class Comment(CommonComment): """ASTM patient record. :param type: Record Type ID. Always ``C``. :type type: str :param seq: Sequence Number. Required. :type seq: int :param source: Comment source. Always ``I``. :type source: str :param data: Measurement value. Numeric, coded or free text value depending on result type. Required. Length: 1024. :type data: :class:`CommentData` :param ctype: Comment type. Always ``G``. :type ctype: str """ source = ConstantField(default='I') data = ComponentField(CommentData) class RecordsDispatcher(BaseRecordsDispatcher): """Omnilab specific records dispatcher. Automatically wraps records by related mappings.""" def __init__(self, *args, **kwargs): super(RecordsDispatcher, self).__init__(*args, **kwargs) self.wrappers = { 'H': Header, 'P': Patient, 'O': Order, 'R': Result, 'C': Comment, 'L': Terminator }
ajibawa-2023/Python-Code-Large/train/row_1044
40
385
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Expr_L10_C0", "label": "expression", "type": "expression", "loc": [10, 15], "level": 0, "parent": null, "vector": [8, 0, 0.0325, 0.0156, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n\n``astm.omnilab.server`` - LabOnline server implementation\n----------------------------------------------------------\n\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:ImportFrom_L17_C0", "label": "from astm.server import BaseRecordsDispatcher", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0442, 0.0026, 0, 0.66, 0.0714, 244, 0, 1, 0, 0, 244, 0, 0], "semantic": {"name": "astm.server", "arg_names": [], "import_names": ["BaseRecordsDispatcher"], "rhs_call_name": "", "annotation": ""}, "snippet": "from astm.server import BaseRecordsDispatcher"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:ImportFrom_L18_C0", "label": "from astm.mapping import Component, ConstantField, ComponentField\u2026", "type": "import", "loc": [18, 21], "level": 0, "parent": null, "vector": [1, 0, 0.0506, 0.0104, 0, 0.66, 0.1429, 791, 0, 9, 0, 0, 791, 0, 0], "semantic": {"name": "astm.mapping", "arg_names": [], "import_names": ["Component", "ConstantField", "ComponentField", "DateTimeField", "IntegerField", "SetField", "TextField", "NotUsedField", "DateField"], "rhs_call_name": "", "annotation": ""}, "snippet": "from astm.mapping import (\n Component, ConstantField, ComponentField, DateTimeField, IntegerField,\n SetField, TextField, NotUsedField, DateField\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:ImportFrom_L22_C0", "label": "from common import Header, Terminator, Patient\u2026", "type": "import", "loc": [22, 28], "level": 0, "parent": null, "vector": [1, 0, 0.0649, 0.0182, 0, 0.66, 0.2143, 718, 0, 7, 0, 0, 718, 0, 0], "semantic": {"name": "common", "arg_names": [], "import_names": ["Header", "Terminator", "Patient", "CommonOrder", "CommonResult", "CommonComment", "Sender"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .common import (\n Header, Terminator, CommonPatient as Patient,\n CommonOrder,\n CommonResult,\n CommonComment,\n Sender\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L31_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [31, 34], "level": 0, "parent": null, "vector": [14, 0, 0.0844, 0.0104, 0, 0.66, 0.2857, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = ['RecordsDispatcher',\n 'Header', 'Patient', 'Order', 'Result', 'Terminator',\n 'CommentData', 'CompletionDate', 'Instrument', 'Operator',\n 'Sender', 'Test']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L47_C0", "label": "Instrument = build()", "type": "assigned_variable", "loc": [47, 51], "level": 0, "parent": null, "vector": [14, 0, 0.1273, 0.013, 0, 0.66, 0.3571, 632, 3, 3, 0, 0, 448, 10, 4], "semantic": {"name": "Instrument", "arg_names": [], "import_names": [], "rhs_call_name": "build", "annotation": ""}, "snippet": "Instrument = Component.build(\n TextField(name='_'),\n TextField(name='rack', length=5),\n TextField(name='position', length=3),\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L89_C0", "label": "Test = build()", "type": "assigned_variable", "loc": [89, 101], "level": 0, "parent": null, "vector": [14, 0, 0.2468, 0.0338, 0, 0.66, 0.4286, 786, 3, 11, 0, 0, 448, 10, 12], "semantic": {"name": "Test", "arg_names": [], "import_names": [], "rhs_call_name": "build", "annotation": ""}, "snippet": "Test = Component.build(\n NotUsedField(name='_'),\n NotUsedField(name='__'),\n NotUsedField(name='___'),\n TextField(name='assay_code', required=True, length=20),\n TextField(name='assay_name', length=8),\n TextField(name='dilution', length=10),\n TextField(name='status', length=1),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L112_C0", "label": "Operator = build()", "type": "assigned_variable", "loc": [112, 115], "level": 0, "parent": null, "vector": [14, 0, 0.2948, 0.0104, 0, 0.66, 0.5, 546, 3, 2, 0, 0, 448, 10, 3], "semantic": {"name": "Operator", "arg_names": [], "import_names": [], "rhs_call_name": "build", "annotation": ""}, "snippet": "Operator = Component.build(\n TextField(name='code_on_labonline', length=12),\n TextField(name='code_on_analyzer', length=20),\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L126_C0", "label": "CompletionDate = build()", "type": "assigned_variable", "loc": [126, 129], "level": 0, "parent": null, "vector": [14, 0, 0.3312, 0.0104, 0, 0.66, 0.5714, 58, 3, 2, 0, 0, 448, 10, 3], "semantic": {"name": "CompletionDate", "arg_names": [], "import_names": [], "rhs_call_name": "build", "annotation": ""}, "snippet": "CompletionDate = Component.build(\n DateTimeField(name='labonline'),\n DateTimeField(name='analyzer'),\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L142_C0", "label": "Instrument = build()", "type": "assigned_variable", "loc": [142, 146], "level": 0, "parent": null, "vector": [14, 0, 0.374, 0.013, 0, 0.66, 0.6429, 632, 3, 3, 0, 0, 448, 10, 4], "semantic": {"name": "Instrument", "arg_names": [], "import_names": [], "rhs_call_name": "build", "annotation": ""}, "snippet": "Instrument = Component.build(\n NotUsedField(name='_'),\n TextField(name='rack', length=5),\n TextField(name='position', length=3),\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L150_C0", "label": "CommentData = build()", "type": "assigned_variable", "loc": [150, 159], "level": 0, "parent": null, "vector": [14, 0, 0.4013, 0.026, 0, 0.66, 0.7143, 334, 3, 7, 0, 0, 448, 10, 8], "semantic": {"name": "CommentData", "arg_names": [], "import_names": [], "rhs_call_name": "build", "annotation": ""}, "snippet": "CommentData = Component.build(\n SetField(name='code', values=('PC', 'RC', 'SC', 'TC',\n 'CK', 'SE', 'CL', 'TA', 'SS', 'HQ', 'AL', 'PT')),\n TextField(name='value'),\n TextField(name='field_1'),\n TextField(name='field_2'),\n TextField(name='field_3'),\n TextField(name='field_4'),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L162_C0", "label": "Order", "type": "class", "loc": [162, 267], "level": 0, "parent": null, "vector": [3, 0, 0.5571, 0.2753, 0, 0.66, 0.7857, 480, 0, 0, 0, 0, 220, 0, 4], "semantic": {"name": "Order", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Order(CommonOrder):\n \"\"\"ASTM order record.\n\n :param type: Record Type ID. Always ``O``.\n :type type: str\n\n :param seq: Sequence Number. Required.\n :type seq: int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Expr_L163_C4", "label": "expression", "type": "expression", "loc": [163, 263], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L162_C0", "vector": [8, 1, 0.5532, 0.2623, 1, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"ASTM order record.\n\n :param type: Record Type ID. Always ``O``.\n :type type: str\n\n :param seq: Sequence Number. Required.\n :type seq: int\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L264_C4", "label": "action_code = SetField()", "type": "assigned_variable", "loc": [264, 264], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L162_C0", "vector": [14, 1, 0.6857, 0.0026, 1, 0.86, 0.25, 978, 3, 1, 0, 0, 445, 10, 1], "semantic": {"name": "action_code", "arg_names": [], "import_names": [], "rhs_call_name": "SetField", "annotation": ""}, "snippet": " action_code = SetField(values=(None, 'Q'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L265_C4", "label": "instrument = ComponentField()", "type": "assigned_variable", "loc": [265, 265], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L162_C0", "vector": [14, 1, 0.6883, 0.0026, 1, 0.86, 0.5, 257, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "instrument", "arg_names": [], "import_names": [], "rhs_call_name": "ComponentField", "annotation": ""}, "snippet": " instrument = ComponentField(Instrument)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L266_C4", "label": "report_type = ConstantField()", "type": "assigned_variable", "loc": [266, 266], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L162_C0", "vector": [14, 1, 0.6909, 0.0026, 1, 0.86, 0.75, 786, 3, 1, 0, 0, 543, 10, 1], "semantic": {"name": "report_type", "arg_names": [], "import_names": [], "rhs_call_name": "ConstantField", "annotation": ""}, "snippet": " report_type = ConstantField(default='F')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L267_C4", "label": "test = ComponentField()", "type": "assigned_variable", "loc": [267, 267], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L162_C0", "vector": [14, 1, 0.6935, 0.0026, 1, 0.86, 1.0, 224, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "ComponentField", "annotation": ""}, "snippet": " test = ComponentField(Test)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "label": "Result", "type": "class", "loc": [270, 347], "level": 0, "parent": null, "vector": [3, 0, 0.8013, 0.2026, 0, 0.66, 0.8571, 611, 0, 0, 0, 0, 47, 0, 13], "semantic": {"name": "Result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Result(CommonResult):\n \"\"\"ASTM patient record.\n\n :param type: Record Type ID. Always ``R``.\n :type type: str\n\n :param seq: Sequence Number. Required.\n :type seq: int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Expr_L271_C4", "label": "expression", "type": "expression", "loc": [271, 329], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "vector": [8, 1, 0.7792, 0.1532, 1, 0.96, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"ASTM patient record.\n\n :param type: Record Type ID. Always ``R``.\n :type type: str\n\n :param seq: Sequence Number. Required.\n :type seq: int\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L330_C4", "label": "abnormal_flag = SetField()", "type": "assigned_variable", "loc": [330, 336], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "vector": [14, 1, 0.8649, 0.0182, 1, 0.96, 0.0833, 916, 3, 3, 0, 0, 445, 10, 2], "semantic": {"name": "abnormal_flag", "arg_names": [], "import_names": [], "rhs_call_name": "SetField", "annotation": ""}, "snippet": " abnormal_flag = SetField(\n field=IntegerField(),\n length=4,\n values=(0, 1, 2, 3,\n 10, 11, 12, 13,\n 1000, 1001, 1002, 1003,\n 1010, 1011, 1012, 1013))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L337_C4", "label": "abnormality_nature = SetField()", "type": "assigned_variable", "loc": [337, 337], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "vector": [14, 1, 0.8753, 0.0026, 1, 0.96, 0.1667, 505, 3, 1, 0, 0, 445, 10, 1], "semantic": {"name": "abnormality_nature", "arg_names": [], "import_names": [], "rhs_call_name": "SetField", "annotation": ""}, "snippet": " abnormality_nature = SetField(values=('N', 'L', 'H', 'LL', 'HH'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L338_C4", "label": "completed_at = ComponentField()", "type": "assigned_variable", "loc": [338, 338], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "vector": [14, 1, 0.8779, 0.0026, 1, 0.96, 0.25, 248, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "completed_at", "arg_names": [], "import_names": [], "rhs_call_name": "ComponentField", "annotation": ""}, "snippet": " completed_at = ComponentField(CompletionDate)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L339_C4", "label": "created_at = DateField()", "type": "assigned_variable", "loc": [339, 339], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "vector": [14, 1, 0.8805, 0.0026, 1, 0.96, 0.3333, 642, 3, 0, 0, 0, 847, 10, 1], "semantic": {"name": "created_at", "arg_names": [], "import_names": [], "rhs_call_name": "DateField", "annotation": ""}, "snippet": " created_at = DateField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L340_C4", "label": "instrument = TextField()", "type": "assigned_variable", "loc": [340, 340], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "vector": [14, 1, 0.8831, 0.0026, 1, 0.96, 0.4167, 257, 3, 1, 0, 0, 612, 10, 1], "semantic": {"name": "instrument", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " instrument = TextField(length=16)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L341_C4", "label": "operator = ComponentField()", "type": "assigned_variable", "loc": [341, 341], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "vector": [14, 1, 0.8857, 0.0026, 1, 0.96, 0.5, 616, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "operator", "arg_names": [], "import_names": [], "rhs_call_name": "ComponentField", "annotation": ""}, "snippet": " operator = ComponentField(Operator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L342_C4", "label": "references = TextField()", "type": "assigned_variable", "loc": [342, 342], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "vector": [14, 1, 0.8883, 0.0026, 1, 0.96, 0.5833, 500, 3, 0, 0, 0, 612, 10, 1], "semantic": {"name": "references", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " references = TextField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L343_C4", "label": "sampled_at = DateField()", "type": "assigned_variable", "loc": [343, 343], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "vector": [14, 1, 0.8909, 0.0026, 1, 0.96, 0.6667, 353, 3, 0, 0, 0, 847, 10, 1], "semantic": {"name": "sampled_at", "arg_names": [], "import_names": [], "rhs_call_name": "DateField", "annotation": ""}, "snippet": " sampled_at = DateField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L344_C4", "label": "started_at = DateTimeField()", "type": "assigned_variable", "loc": [344, 344], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "vector": [14, 1, 0.8935, 0.0026, 1, 0.96, 0.75, 917, 3, 1, 0, 0, 789, 10, 1], "semantic": {"name": "started_at", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeField", "annotation": ""}, "snippet": " started_at = DateTimeField(required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L345_C4", "label": "status = SetField()", "type": "assigned_variable", "loc": [345, 345], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "vector": [14, 1, 0.8961, 0.0026, 1, 0.96, 0.8333, 699, 3, 1, 0, 0, 445, 10, 1], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "SetField", "annotation": ""}, "snippet": " status = SetField(values=('F', 'R'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L346_C4", "label": "test = ComponentField()", "type": "assigned_variable", "loc": [346, 346], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "vector": [14, 1, 0.8987, 0.0026, 1, 0.96, 0.9167, 224, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "ComponentField", "annotation": ""}, "snippet": " test = ComponentField(Test)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L347_C4", "label": "units = TextField()", "type": "assigned_variable", "loc": [347, 347], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "vector": [14, 1, 0.9013, 0.0026, 1, 0.96, 1.0, 805, 3, 1, 0, 0, 612, 10, 1], "semantic": {"name": "units", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " units = TextField(length=20)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L350_C0", "label": "Comment", "type": "class", "loc": [350, 370], "level": 0, "parent": null, "vector": [3, 0, 0.9351, 0.0545, 0, 0.66, 0.9286, 846, 0, 0, 0, 0, 240, 0, 2], "semantic": {"name": "Comment", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Comment(CommonComment):\n \"\"\"ASTM patient record.\n\n :param type: Record Type ID. Always ``C``.\n :type type: str\n\n :param seq: Sequence Number. Required.\n :type seq: int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Expr_L351_C4", "label": "expression", "type": "expression", "loc": [351, 368], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L350_C0", "vector": [8, 1, 0.9338, 0.0468, 1, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"ASTM patient record.\n\n :param type: Record Type ID. Always ``C``.\n :type type: str\n\n :param seq: Sequence Number. Required.\n :type seq: int\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L369_C4", "label": "source = ConstantField()", "type": "assigned_variable", "loc": [369, 369], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L350_C0", "vector": [14, 1, 0.9584, 0.0026, 1, 0.73, 0.5, 703, 3, 1, 0, 0, 543, 10, 1], "semantic": {"name": "source", "arg_names": [], "import_names": [], "rhs_call_name": "ConstantField", "annotation": ""}, "snippet": " source = ConstantField(default='I')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L370_C4", "label": "data = ComponentField()", "type": "assigned_variable", "loc": [370, 370], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L350_C0", "vector": [14, 1, 0.961, 0.0026, 1, 0.73, 1.0, 929, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "ComponentField", "annotation": ""}, "snippet": " data = ComponentField(CommentData)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L373_C0", "label": "RecordsDispatcher", "type": "class", "loc": [373, 385], "level": 0, "parent": null, "vector": [3, 0, 0.9844, 0.0338, 0, 0.66, 1.0, 359, 0, 1, 0, 0, 339, 0, 2], "semantic": {"name": "RecordsDispatcher", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RecordsDispatcher(BaseRecordsDispatcher):\n \"\"\"Omnilab specific records dispatcher. Automatically wraps records by\n related mappings.\"\"\"\n def __init__(self, *args, **kwargs):\n super(RecordsDispatcher, self).__init__(*args, **kwargs)\n self.wrappers = {\n 'H': Header,\n 'P': Patient,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Expr_L374_C4", "label": "expression", "type": "expression", "loc": [374, 375], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L373_C0", "vector": [8, 1, 0.9727, 0.0052, 1, 0.02, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Omnilab specific records dispatcher. Automatically wraps records by\n related mappings.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:FunctionDef_L376_C4", "label": "__init__", "type": "function", "loc": [376, 385], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L373_C0", "vector": [2, 1, 0.9883, 0.026, 1, 0.02, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *args, **kwargs):\n super(RecordsDispatcher, self).__init__(*args, **kwargs)\n self.wrappers = {\n 'H': Header,\n 'P': Patient,\n 'O': Order,\n 'R': Result,\n 'C': Comment,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Expr_L377_C8", "label": "__init__()", "type": "expression", "loc": [377, 377], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:FunctionDef_L376_C4", "vector": [8, 2, 0.9792, 0.0026, 2, 0.53, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(RecordsDispatcher, self).__init__(*args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L378_C8", "label": "self.wrappers =", "type": "assigned_variable", "loc": [378, 385], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1044:FunctionDef_L376_C4", "vector": [14, 2, 0.9909, 0.0208, 2, 0.53, 1.0, 520, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.wrappers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.wrappers = {\n 'H': Header,\n 'P': Patient,\n 'O': Order,\n 'R': Result,\n 'C': Comment,\n 'L': Terminator\n }"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Expr_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L264_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L265_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L266_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L267_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Expr_L271_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L330_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L337_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L338_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L339_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L340_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L341_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L342_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L343_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L344_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L345_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L346_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L270_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L347_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L350_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Expr_L351_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L350_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L369_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L350_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L370_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L373_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Expr_L374_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:ClassDef_L373_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:FunctionDef_L376_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:FunctionDef_L376_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Expr_L377_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1044:FunctionDef_L376_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1044:Assign_L378_C8"}]
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # """ ``astm.omnilab.client`` - LabOnline client implementation ---------------------------------------------------------- """ from astm.mapping import ( Component, ConstantField, ComponentField, IntegerField, DateTimeField, RepeatedComponentField, SetField, TextField, NotUsedField ) from .common import ( Header, Terminator, CommonPatient, CommonOrder, CommonResult, CommonComment, Sender ) __all__ = ['Header', 'Patient', 'Order', 'Result', 'Comment', 'Terminator', 'CommentData', 'PatientAge', 'Sender', 'Test'] #: Patient age structure. #: #: :param value: Age value. #: :type value: int #: #: :param unit: Age unit. One of: ``years``, ``months``, ``days``. #: :type unit: str #: PatientAge = Component.build( IntegerField(name='value'), SetField(name='unit', values=('years', 'months', 'days')) ) #: Test :class:`~astm.mapping.Component` also known as Universal Test ID. #: #: :param _: Reserved. Not used. #: :type _: None #: #: :param __: Reserved. Not used. #: :type __: None #: #: :param ___: Reserved. Not used. #: :type ___: None #: #: :param assay_code: Assay code. Required. Length: 20. #: :type assay_code: str #: #: :param assay_name: Assay name. Length: 8. #: :type assay_name: str #: Test = Component.build( NotUsedField(name='_'), NotUsedField(name='__'), NotUsedField(name='___'), TextField(name='assay_code', required=True, length=20), TextField(name='assay_name', length=8), ) #: Comment control data structure. #: CommentData = Component.build( SetField(name='code', values=('PC', 'RC', 'SC', 'TC')), TextField(name='value') ) class Patient(CommonPatient): """ASTM patient record. :param type: Record Type ID. Always ``P``. :type type: str :param seq: Sequence Number. Required. :type seq: int :param practice_id: Practice Assigned Patient ID. Required. Length: 12. :type practice_id: str :param laboratory_id: Laboratory Assigned Patient ID. Required. Length: 16. :type laboratory_id: str :param id: Patient ID. Not used. :type id: None :param name: Patient name. :type name: :class:`PatientName` :param maiden_name: Mother’s Maiden Name. Not used. :type maiden_name: None :param birthdate: Birthdate. :type birthdate: datetime.date :param sex: Patient Sex. One of: ``M`` (male), ``F`` (female), ``I`` (animal), ``None`` is unknown. :type sex: str :param race: Patient Race-Ethnic Origin. Not used. :type race: None :param address: Patient Address. Not used. :type address: None :param reserved: Reserved Field. Not used. :type reserved: None :param phone: Patient Telephone Number. Not used. :type phone: None :param physician_id: Attending Physician. Not used. :type physician_id: None :param special_1: Special Field #1. Not used. :type special_1: None :param special_2: Patient source. Possible values: - ``0``: internal patient; - ``1``: external patient. :type special_2: int :param height: Patient Height. Not used. :type height: None :param weight: Patient Weight. Not used. :type weight: None :param diagnosis: Patient’s Known Diagnosis. Not used. :type diagnosis: None :param medications: Patient’s Active Medications. Not used. :type medications: None :param diet: Patient’s Diet. Not used. :type diet: None :param practice_1: Practice Field No. 1. Not used. :type practice_1: None :param practice_2: Practice Field No. 2. Not used. :type practice_2: None :param admission_date: Admission/Discharge Dates. Not used. :type admission_date: None :param admission_status: Admission Status. Not used. :type admission_status: None :param location: Patient location. Length: 20. :type location: str :param diagnostic_code_nature: Nature of diagnostic code. Not used. :type diagnostic_code_nature: None :param diagnostic_code: Diagnostic code. Not used. :type diagnostic_code: None :param religion: Patient religion. Not used. :type religion: None :param martial_status: Martian status. Not used. :type martial_status: None :param isolation_status: Isolation status. Not used. :type isolation_status: None :param language: Language. Not used. :type language: None :param hospital_service: Hospital service. Not used. :type hospital_service: None :param hospital_institution: Hospital institution. Not used. :type hospital_institution: None :param dosage_category: Dosage category. Not used. :type dosage_category: None """ physician_id = TextField(length=35) special_1 = ComponentField(PatientAge) class Order(CommonOrder): """ASTM order record. :param type: Record Type ID. Always ``O``. :type type: str :param seq: Sequence Number. Required. :type seq: int :param sample_id: Sample ID number. Required. Length: 12. :type sample_id: str :param instrument: Instrument specimen ID. Not used. :type instrument: None :param test: Test information structure (aka Universal Test ID). :type test: :class:`Test` :param priority: Priority flag. Required. Possible values: - ``S``: stat; -``R``: routine. :type priority: str :param created_at: Ordered date and time. Required. :type created_at: datetime.datetime :param sampled_at: Specimen collection date and time. :type sampled_at: datetime.datetime :param collected_at: Collection end time. Not used. :type collected_at: None :param volume: Collection volume. Not used. :type volume: None :param collector: Collector ID. Not used. :type collector: None :param action_code: Action code. Required. Possible values: - ``C``: cancel works for specified tests; - ``A``: add tests to existed specimen; - ``N``: create new order; - ``R``: rerun tests for specified order; :type action_code: str :param danger_code: Danger code. Not used. :type danger_code: None :param clinical_info: Revelant clinical info. Not used. :type clinical_info: None :param delivered_at: Date/time specimen received. :type delivered_at: None :param biomaterial: Sample material code. Length: 20. :type biomaterial: str :param physician: Ordering Physician. Not used. :type physician: None :param physician_phone: Physician's phone number. Not used. :type physician_phone: None :param user_field_1: An optional field, it will be send back unchanged to the host along with the result. Length: 20. :type user_field_1: str :param user_field_2: An optional field, it will be send back unchanged to the host along with the result. Length: 1024. :type user_field_2: str :param laboratory_field_1: In multi-laboratory environment it will be used to indicate which laboratory entering the order. Length: 20. :type laboratory_field_1: str :param laboratory_field_2: Primary tube code. Length: 12. :type laboratory_field_2: str :param modified_at: Date and time of last result modification. Not used. :type modified_at: None :param instrument_charge: Instrument charge to computer system. Not used. :type instrument_charge: None :param instrument_section: Instrument section id. Not used. :type instrument_section: None :param report_type: Report type. Always ``O`` which means normal order request. :type report_type: str :param reserved: Reserved. Not used. :type reserved: None :param location_ward: Location ward of specimen collection. Not used. :type location_ward: None :param infection_flag: Nosocomial infection flag. Not used. :type infection_flag: None :param specimen_service: Specimen service. Not used. :type specimen_service: None :param laboratory: Production laboratory: in multi-laboratory environment indicates laboratory expected to process the order. Length: 20. :type laboratory: str """ action_code = SetField(default='N', values=('C', 'A', 'N', 'R')) created_at = DateTimeField(required=True) laboratory = TextField(length=20) laboratory_field_1 = TextField(length=20) report_type = ConstantField(default='O') sampled_at = DateTimeField() test = RepeatedComponentField(Test) class Result(CommonResult): """ASTM patient record. :param type: Record Type ID. Always ``R``. :type type: str :param seq: Sequence Number. Required. :type seq: int :param test: Test information structure (aka Universal Test ID). :type test: :class:`Test` :param value: Measurement value. Numeric, coded or free text value depending on result type. Required. Length: 1024. :type value: None :param units: Units. Not used. :type units: None :param references: Reference ranges. Not used. :type references: None :param abnormal_flag: Result abnormal flag. Not used. :type abnormal_flag: None :param abnormality_nature: Nature of abnormality testing. Not used. :type abnormality_nature: None :param status: Result status. Not used. :type status: None :param normatives_changed_at: Date of changes in instrument normative values or units. Not used. :type normatives_changed_at: None :param operator: Operator ID. Not used. :type operator: None :param started_at: When works on test was started on. Not used. :type started_at: None :param completed_at: When works on test was done. Required. :type completed_at: datetime.datetime :param instrument: Instrument ID. Not used. :type instrument: None """ test = ComponentField(Test) class Comment(CommonComment): """ASTM patient record. :param type: Record Type ID. Always ``C``. :type type: str :param seq: Sequence Number. Required. :type seq: int :param source: Comment source. Always ``L``. :type source: str :param data: Measurement value. Numeric, coded or free text value depending on result type. Required. Length: 1024. :type data: :class:`CommentData` :param ctype: Comment type. Always ``G``. :type ctype: str """ source = ConstantField(default='L') data = ComponentField(CommentData)
ajibawa-2023/Python-Code-Large/train/row_1045
27
381
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1045:Expr_L10_C0", "label": "expression", "type": "expression", "loc": [10, 15], "level": 0, "parent": null, "vector": [8, 0, 0.0328, 0.0157, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\n\n``astm.omnilab.client`` - LabOnline client implementation\n----------------------------------------------------------\n\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:ImportFrom_L17_C0", "label": "from astm.mapping import Component, ConstantField, ComponentField\u2026", "type": "import", "loc": [17, 20], "level": 0, "parent": null, "vector": [1, 0, 0.0486, 0.0105, 0, 0.66, 0.1, 791, 0, 9, 0, 0, 791, 0, 0], "semantic": {"name": "astm.mapping", "arg_names": [], "import_names": ["Component", "ConstantField", "ComponentField", "IntegerField", "DateTimeField", "RepeatedComponentField", "SetField", "TextField", "NotUsedField"], "rhs_call_name": "", "annotation": ""}, "snippet": "from astm.mapping import (\n Component, ConstantField, ComponentField, IntegerField, DateTimeField,\n RepeatedComponentField, SetField, TextField, NotUsedField\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:ImportFrom_L21_C0", "label": "from common import Header, Terminator, CommonPatient\u2026", "type": "import", "loc": [21, 28], "level": 0, "parent": null, "vector": [1, 0, 0.0643, 0.021, 0, 0.66, 0.2, 718, 0, 7, 0, 0, 718, 0, 0], "semantic": {"name": "common", "arg_names": [], "import_names": ["Header", "Terminator", "CommonPatient", "CommonOrder", "CommonResult", "CommonComment", "Sender"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .common import (\n Header, Terminator,\n CommonPatient,\n CommonOrder,\n CommonResult,\n CommonComment,\n Sender\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L30_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [30, 31], "level": 0, "parent": null, "vector": [14, 0, 0.0801, 0.0052, 0, 0.66, 0.3, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = ['Header', 'Patient', 'Order', 'Result', 'Comment', 'Terminator',\n 'CommentData', 'PatientAge', 'Sender', 'Test']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L41_C0", "label": "PatientAge = build()", "type": "assigned_variable", "loc": [41, 44], "level": 0, "parent": null, "vector": [14, 0, 0.1115, 0.0105, 0, 0.66, 0.4, 282, 3, 2, 0, 0, 448, 10, 3], "semantic": {"name": "PatientAge", "arg_names": [], "import_names": [], "rhs_call_name": "build", "annotation": ""}, "snippet": "PatientAge = Component.build(\n IntegerField(name='value'),\n SetField(name='unit', values=('years', 'months', 'days'))\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L63_C0", "label": "Test = build()", "type": "assigned_variable", "loc": [63, 69], "level": 0, "parent": null, "vector": [14, 0, 0.1732, 0.0184, 0, 0.66, 0.5, 786, 3, 5, 0, 0, 448, 10, 6], "semantic": {"name": "Test", "arg_names": [], "import_names": [], "rhs_call_name": "build", "annotation": ""}, "snippet": "Test = Component.build(\n NotUsedField(name='_'),\n NotUsedField(name='__'),\n NotUsedField(name='___'),\n TextField(name='assay_code', required=True, length=20),\n TextField(name='assay_name', length=8),\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L73_C0", "label": "CommentData = build()", "type": "assigned_variable", "loc": [73, 76], "level": 0, "parent": null, "vector": [14, 0, 0.1955, 0.0105, 0, 0.66, 0.6, 334, 3, 2, 0, 0, 448, 10, 3], "semantic": {"name": "CommentData", "arg_names": [], "import_names": [], "rhs_call_name": "build", "annotation": ""}, "snippet": "CommentData = Component.build(\n SetField(name='code', values=('PC', 'RC', 'SC', 'TC')),\n TextField(name='value')\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L79_C0", "label": "Patient", "type": "class", "loc": [79, 191], "level": 0, "parent": null, "vector": [3, 0, 0.3543, 0.2966, 0, 0.66, 0.7, 35, 0, 0, 0, 0, 33, 0, 2], "semantic": {"name": "Patient", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Patient(CommonPatient):\n \"\"\"ASTM patient record.\n\n :param type: Record Type ID. Always ``P``.\n :type type: str\n\n :param seq: Sequence Number. Required.\n :type seq: int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:Expr_L80_C4", "label": "expression", "type": "expression", "loc": [80, 189], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L79_C0", "vector": [8, 1, 0.353, 0.2887, 1, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"ASTM patient record.\n\n :param type: Record Type ID. Always ``P``.\n :type type: str\n\n :param seq: Sequence Number. Required.\n :type seq: int\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L190_C4", "label": "physician_id = TextField()", "type": "assigned_variable", "loc": [190, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L79_C0", "vector": [14, 1, 0.4987, 0.0026, 1, 0.66, 0.5, 536, 3, 1, 0, 0, 612, 10, 1], "semantic": {"name": "physician_id", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " physician_id = TextField(length=35)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L191_C4", "label": "special_1 = ComponentField()", "type": "assigned_variable", "loc": [191, 191], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L79_C0", "vector": [14, 1, 0.5013, 0.0026, 1, 0.66, 1.0, 191, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "special_1", "arg_names": [], "import_names": [], "rhs_call_name": "ComponentField", "annotation": ""}, "snippet": " special_1 = ComponentField(PatientAge)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L194_C0", "label": "Order", "type": "class", "loc": [194, 308], "level": 0, "parent": null, "vector": [3, 0, 0.6588, 0.3018, 0, 0.66, 0.8, 480, 0, 0, 0, 0, 220, 0, 7], "semantic": {"name": "Order", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Order(CommonOrder):\n \"\"\"ASTM order record.\n\n :param type: Record Type ID. Always ``O``.\n :type type: str\n\n :param seq: Sequence Number. Required.\n :type seq: int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:Expr_L195_C4", "label": "expression", "type": "expression", "loc": [195, 301], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L194_C0", "vector": [8, 1, 0.6509, 0.2808, 1, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"ASTM order record.\n\n :param type: Record Type ID. Always ``O``.\n :type type: str\n\n :param seq: Sequence Number. Required.\n :type seq: int\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L302_C4", "label": "action_code = SetField()", "type": "assigned_variable", "loc": [302, 302], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L194_C0", "vector": [14, 1, 0.7927, 0.0026, 1, 0.94, 0.1429, 978, 3, 2, 0, 0, 445, 10, 1], "semantic": {"name": "action_code", "arg_names": [], "import_names": [], "rhs_call_name": "SetField", "annotation": ""}, "snippet": " action_code = SetField(default='N', values=('C', 'A', 'N', 'R'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L303_C4", "label": "created_at = DateTimeField()", "type": "assigned_variable", "loc": [303, 303], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L194_C0", "vector": [14, 1, 0.7953, 0.0026, 1, 0.94, 0.2857, 642, 3, 1, 0, 0, 789, 10, 1], "semantic": {"name": "created_at", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeField", "annotation": ""}, "snippet": " created_at = DateTimeField(required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L304_C4", "label": "laboratory = TextField()", "type": "assigned_variable", "loc": [304, 304], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L194_C0", "vector": [14, 1, 0.7979, 0.0026, 1, 0.94, 0.4286, 430, 3, 1, 0, 0, 612, 10, 1], "semantic": {"name": "laboratory", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " laboratory = TextField(length=20)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L305_C4", "label": "laboratory_field_1 = TextField()", "type": "assigned_variable", "loc": [305, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L194_C0", "vector": [14, 1, 0.8005, 0.0026, 1, 0.94, 0.5714, 265, 3, 1, 0, 0, 612, 10, 1], "semantic": {"name": "laboratory_field_1", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " laboratory_field_1 = TextField(length=20)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L306_C4", "label": "report_type = ConstantField()", "type": "assigned_variable", "loc": [306, 306], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L194_C0", "vector": [14, 1, 0.8031, 0.0026, 1, 0.94, 0.7143, 786, 3, 1, 0, 0, 543, 10, 1], "semantic": {"name": "report_type", "arg_names": [], "import_names": [], "rhs_call_name": "ConstantField", "annotation": ""}, "snippet": " report_type = ConstantField(default='O')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L307_C4", "label": "sampled_at = DateTimeField()", "type": "assigned_variable", "loc": [307, 307], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L194_C0", "vector": [14, 1, 0.8058, 0.0026, 1, 0.94, 0.8571, 353, 3, 0, 0, 0, 789, 10, 1], "semantic": {"name": "sampled_at", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeField", "annotation": ""}, "snippet": " sampled_at = DateTimeField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L308_C4", "label": "test = RepeatedComponentField()", "type": "assigned_variable", "loc": [308, 308], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L194_C0", "vector": [14, 1, 0.8084, 0.0026, 1, 0.94, 1.0, 224, 3, 1, 0, 0, 284, 10, 1], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "RepeatedComponentField", "annotation": ""}, "snippet": " test = RepeatedComponentField(Test)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L311_C0", "label": "Result", "type": "class", "loc": [311, 358], "level": 0, "parent": null, "vector": [3, 0, 0.878, 0.126, 0, 0.66, 0.9, 611, 0, 0, 0, 0, 47, 0, 1], "semantic": {"name": "Result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Result(CommonResult):\n \"\"\"ASTM patient record.\n\n :param type: Record Type ID. Always ``R``.\n :type type: str\n\n :param seq: Sequence Number. Required.\n :type seq: int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:Expr_L312_C4", "label": "expression", "type": "expression", "loc": [312, 357], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L311_C0", "vector": [8, 1, 0.878, 0.1207, 1, 0.89, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"ASTM patient record.\n\n :param type: Record Type ID. Always ``R``.\n :type type: str\n\n :param seq: Sequence Number. Required.\n :type seq: int\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L358_C4", "label": "test = ComponentField()", "type": "assigned_variable", "loc": [358, 358], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L311_C0", "vector": [14, 1, 0.9396, 0.0026, 1, 0.89, 1.0, 224, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "ComponentField", "annotation": ""}, "snippet": " test = ComponentField(Test)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L361_C0", "label": "Comment", "type": "class", "loc": [361, 381], "level": 0, "parent": null, "vector": [3, 0, 0.9738, 0.0551, 0, 0.66, 1.0, 846, 0, 0, 0, 0, 240, 0, 2], "semantic": {"name": "Comment", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Comment(CommonComment):\n \"\"\"ASTM patient record.\n\n :param type: Record Type ID. Always ``C``.\n :type type: str\n\n :param seq: Sequence Number. Required.\n :type seq: int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:Expr_L362_C4", "label": "expression", "type": "expression", "loc": [362, 379], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L361_C0", "vector": [8, 1, 0.9724, 0.0472, 1, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"ASTM patient record.\n\n :param type: Record Type ID. Always ``C``.\n :type type: str\n\n :param seq: Sequence Number. Required.\n :type seq: int\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L380_C4", "label": "source = ConstantField()", "type": "assigned_variable", "loc": [380, 380], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L361_C0", "vector": [14, 1, 0.9974, 0.0026, 1, 0.91, 0.5, 703, 3, 1, 0, 0, 543, 10, 1], "semantic": {"name": "source", "arg_names": [], "import_names": [], "rhs_call_name": "ConstantField", "annotation": ""}, "snippet": " source = ConstantField(default='L')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L381_C4", "label": "data = ComponentField()", "type": "assigned_variable", "loc": [381, 381], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L361_C0", "vector": [14, 1, 1.0, 0.0026, 1, 0.91, 1.0, 929, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "ComponentField", "annotation": ""}, "snippet": " data = ComponentField(CommentData)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1045:Expr_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L190_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L191_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1045:Expr_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L303_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L304_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L305_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L306_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L307_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L308_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L311_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1045:Expr_L312_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L311_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L358_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L361_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1045:Expr_L362_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L361_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L380_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1045:ClassDef_L361_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1045:Assign_L381_C4"}]
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # from . import client from . import server
ajibawa-2023/Python-Code-Large/train/row_1046
2
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_1046:ImportFrom_L10_C0", "label": "from import client", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.9091, 0.0909, 0, 0.66, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": ["client"], "rhs_call_name": "", "annotation": ""}, "snippet": "from . import client"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1046:ImportFrom_L11_C0", "label": "from import server", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 1.0, 0.0909, 0, 0.66, 1.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": ["server"], "rhs_call_name": "", "annotation": ""}, "snippet": "from . import server"}]
[]
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # from astm import __version__ from astm.mapping import ( Component, ConstantField, ComponentField, DateField, DateTimeField, IntegerField, SetField, TextField ) from astm.records import ( HeaderRecord, PatientRecord, OrderRecord, ResultRecord, CommentRecord, TerminatorRecord ) #: Information about sender. #: #: :param name: Name. #: :type name: str #: #: :param version: Sender software version. #: :type version: str #: Sender = Component.build( TextField(name='name', default='python-astm'), TextField(name='version', default=__version__) ) #: Patient name structure. #: #: :param last: Last name. Length: 50. #: :type last: str #: #: :param first: First name. Length: 50. #: :type first: str #: PatientName = Component.build( TextField(name='last', length=50), TextField(name='first', length=50) ) class Header(HeaderRecord): """ASTM header record. :param type: Record Type ID. Always ``H``. :type type: str :param delimeter: Delimiter Definition. Always ``\^&``. :type delimeter: str :param message_id: Message Control ID. Not used. :type message_id: None :param password: Access Password. Not used. :type password: None :param sender: Information about sender. Optional. :type sender: :class:`Sender` :param address: Sender Street Address. Not used. :type address: None :param reserved: Reserved Field. Not used. :type reserved: None :param phone: Sender Telephone Number. Not used. :type phone: None :param chars: Sender Characteristics. Not used. :type chars: None :param receiver: Information about receiver. Not used. :type receiver: None :param comments: Comments. Not used. :type comments: None :param processing_id: Processing ID. Always ``P``. :type processing_id: str :param version: ASTM Version Number. Always ``E 1394-97``. :type version: str :param timestamp: Date and Time of Message :type timestamp: datetime.datetime """ sender = ComponentField(Sender) processing_id = ConstantField(default='P') version = ConstantField(default='E 1394-97') class CommonPatient(PatientRecord): """ASTM patient record. :param type: Record Type ID. Always ``P``. :type type: str :param seq: Sequence Number. Required. :type seq: int :param practice_id: Practice Assigned Patient ID. Required. Length: 12. :type practice_id: str :param laboratory_id: Laboratory Assigned Patient ID. Required. Length: 16. :type laboratory_id: str :param id: Patient ID. Not used. :type id: None :param name: Patient name. :type name: :class:`PatientName` :param maiden_name: Mother’s Maiden Name. Not used. :type maiden_name: None :param birthdate: Birthdate. :type birthdate: datetime.date :param sex: Patient Sex. One of: ``M`` (male), ``F`` (female), ``I`` (animal), ``None`` is unknown. :type sex: str :param race: Patient Race-Ethnic Origin. Not used. :type race: None :param address: Patient Address. Not used. :type address: None :param reserved: Reserved Field. Not used. :type reserved: None :param phone: Patient Telephone Number. Not used. :type phone: None :param physician_id: Attending Physician. Not used. :type physician_id: None :param special_1: Special Field #1. Not used. :type special_1: None :param special_2: Patient source. Possible values: - ``0``: internal patient; - ``1``: external patient. :type special_2: int :param height: Patient Height. Not used. :type height: None :param weight: Patient Weight. Not used. :type weight: None :param diagnosis: Patient’s Known Diagnosis. Not used. :type diagnosis: None :param medications: Patient’s Active Medications. Not used. :type medications: None :param diet: Patient’s Diet. Not used. :type diet: None :param practice_1: Practice Field No. 1. Not used. :type practice_1: None :param practice_2: Practice Field No. 2. Not used. :type practice_2: None :param admission_date: Admission/Discharge Dates. Not used. :type admission_date: None :param admission_status: Admission Status. Not used. :type admission_status: None :param location: Patient location. Length: 20. :type location: str :param diagnostic_code_nature: Nature of diagnostic code. Not used. :type diagnostic_code_nature: None :param diagnostic_code: Diagnostic code. Not used. :type diagnostic_code: None :param religion: Patient religion. Not used. :type religion: None :param martial_status: Martian status. Not used. :type martial_status: None :param isolation_status: Isolation status. Not used. :type isolation_status: None :param language: Language. Not used. :type language: None :param hospital_service: Hospital service. Not used. :type hospital_service: None :param hospital_institution: Hospital institution. Not used. :type hospital_institution: None :param dosage_category: Dosage category. Not used. :type dosage_category: None """ birthdate = DateField() laboratory_id = TextField(required=True, length=16) location = TextField(length=20) name = ComponentField(PatientName) practice_id = TextField(required=True, length=12) sex = SetField(values=('M', 'F', None, 'I')) special_2 = SetField(values=(0, 1), field=IntegerField()) class CommonOrder(OrderRecord): biomaterial = TextField(length=20) laboratory_field_2 = TextField(length=12) priority = SetField(default='S', values=('S', 'R')) sample_id = TextField(required=True, length=12) user_field_1 = TextField(length=20) user_field_2 = TextField(length=1024) class CommonResult(ResultRecord): completed_at = DateTimeField(required=True) value = TextField(required=True, length=20) class CommonComment(CommentRecord): ctype = ConstantField(default='G') class Terminator(TerminatorRecord): """ASTM terminator record. :param type: Record Type ID. Always ``L``. :type type: str :param seq: Sequential number. Always ``1``. :type seq: int :param code: Termination code. Always ``N``. :type code: str """
ajibawa-2023/Python-Code-Large/train/row_1047
33
248
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1047:ImportFrom_L10_C0", "label": "from astm import __version__", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0403, 0.004, 0, 0.66, 0.0, 367, 0, 1, 0, 0, 367, 0, 0], "semantic": {"name": "astm", "arg_names": [], "import_names": ["__version__"], "rhs_call_name": "", "annotation": ""}, "snippet": "from astm import __version__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:ImportFrom_L11_C0", "label": "from astm.mapping import Component, ConstantField, ComponentField\u2026", "type": "import", "loc": [11, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0504, 0.0161, 0, 0.66, 0.1, 791, 0, 8, 0, 0, 791, 0, 0], "semantic": {"name": "astm.mapping", "arg_names": [], "import_names": ["Component", "ConstantField", "ComponentField", "DateField", "DateTimeField", "IntegerField", "SetField", "TextField"], "rhs_call_name": "", "annotation": ""}, "snippet": "from astm.mapping import (\n Component, ConstantField, ComponentField, DateField, DateTimeField,\n IntegerField, SetField, TextField\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:ImportFrom_L15_C0", "label": "from astm.records import HeaderRecord, PatientRecord, OrderRecord\u2026", "type": "import", "loc": [15, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0665, 0.0161, 0, 0.66, 0.2, 184, 0, 6, 0, 0, 184, 0, 0], "semantic": {"name": "astm.records", "arg_names": [], "import_names": ["HeaderRecord", "PatientRecord", "OrderRecord", "ResultRecord", "CommentRecord", "TerminatorRecord"], "rhs_call_name": "", "annotation": ""}, "snippet": "from astm.records import (\n HeaderRecord, PatientRecord, OrderRecord, ResultRecord, CommentRecord,\n TerminatorRecord\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L28_C0", "label": "Sender = build()", "type": "assigned_variable", "loc": [28, 31], "level": 0, "parent": null, "vector": [14, 0, 0.119, 0.0161, 0, 0.66, 0.3, 771, 3, 2, 0, 0, 448, 10, 3], "semantic": {"name": "Sender", "arg_names": [], "import_names": [], "rhs_call_name": "build", "annotation": ""}, "snippet": "Sender = Component.build(\n TextField(name='name', default='python-astm'),\n TextField(name='version', default=__version__)\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L42_C0", "label": "PatientName = build()", "type": "assigned_variable", "loc": [42, 45], "level": 0, "parent": null, "vector": [14, 0, 0.1754, 0.0161, 0, 0.66, 0.4, 491, 3, 2, 0, 0, 448, 10, 3], "semantic": {"name": "PatientName", "arg_names": [], "import_names": [], "rhs_call_name": "build", "annotation": ""}, "snippet": "PatientName = Component.build(\n TextField(name='last', length=50),\n TextField(name='first', length=50)\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L48_C0", "label": "Header", "type": "class", "loc": [48, 96], "level": 0, "parent": null, "vector": [3, 0, 0.2903, 0.1976, 0, 0.66, 0.5, 976, 0, 0, 0, 0, 193, 0, 3], "semantic": {"name": "Header", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Header(HeaderRecord):\n \"\"\"ASTM header record.\n\n :param type: Record Type ID. Always ``H``.\n :type type: str\n\n :param delimeter: Delimiter Definition. Always ``\\^&``.\n :type delimeter: str"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Expr_L49_C4", "label": "expression", "type": "expression", "loc": [49, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L48_C0", "vector": [8, 1, 0.2843, 0.1774, 1, 0.33, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"ASTM header record.\n\n :param type: Record Type ID. Always ``H``.\n :type type: str\n\n :param delimeter: Delimiter Definition. Always ``\\^&``.\n :type delimeter: str\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L94_C4", "label": "sender = ComponentField()", "type": "assigned_variable", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L48_C0", "vector": [14, 1, 0.379, 0.004, 1, 0.33, 0.3333, 27, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "sender", "arg_names": [], "import_names": [], "rhs_call_name": "ComponentField", "annotation": ""}, "snippet": " sender = ComponentField(Sender)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L95_C4", "label": "processing_id = ConstantField()", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L48_C0", "vector": [14, 1, 0.3831, 0.004, 1, 0.33, 0.6667, 284, 3, 1, 0, 0, 543, 10, 1], "semantic": {"name": "processing_id", "arg_names": [], "import_names": [], "rhs_call_name": "ConstantField", "annotation": ""}, "snippet": " processing_id = ConstantField(default='P')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L96_C4", "label": "version = ConstantField()", "type": "assigned_variable", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L48_C0", "vector": [14, 1, 0.3871, 0.004, 1, 0.33, 1.0, 623, 3, 1, 0, 0, 543, 10, 1], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "ConstantField", "annotation": ""}, "snippet": " version = ConstantField(default='E 1394-97')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L99_C0", "label": "CommonPatient", "type": "class", "loc": [99, 216], "level": 0, "parent": null, "vector": [3, 0, 0.6351, 0.4758, 0, 0.66, 0.6, 33, 0, 0, 0, 0, 240, 0, 8], "semantic": {"name": "CommonPatient", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CommonPatient(PatientRecord):\n \"\"\"ASTM patient record.\n\n :param type: Record Type ID. Always ``P``.\n :type type: str\n\n :param seq: Sequence Number. Required.\n :type seq: int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Expr_L100_C4", "label": "expression", "type": "expression", "loc": [100, 209], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L99_C0", "vector": [8, 1, 0.623, 0.4435, 1, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"ASTM patient record.\n\n :param type: Record Type ID. Always ``P``.\n :type type: str\n\n :param seq: Sequence Number. Required.\n :type seq: int\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L210_C4", "label": "birthdate = DateField()", "type": "assigned_variable", "loc": [210, 210], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L99_C0", "vector": [14, 1, 0.8468, 0.004, 1, 0.71, 0.1429, 489, 3, 0, 0, 0, 847, 10, 1], "semantic": {"name": "birthdate", "arg_names": [], "import_names": [], "rhs_call_name": "DateField", "annotation": ""}, "snippet": " birthdate = DateField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L211_C4", "label": "laboratory_id = TextField()", "type": "assigned_variable", "loc": [211, 211], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L99_C0", "vector": [14, 1, 0.8508, 0.004, 1, 0.71, 0.2857, 348, 3, 2, 0, 0, 612, 10, 1], "semantic": {"name": "laboratory_id", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " laboratory_id = TextField(required=True, length=16)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L212_C4", "label": "location = TextField()", "type": "assigned_variable", "loc": [212, 212], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L99_C0", "vector": [14, 1, 0.8548, 0.004, 1, 0.71, 0.4286, 771, 3, 1, 0, 0, 612, 10, 1], "semantic": {"name": "location", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " location = TextField(length=20)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L213_C4", "label": "name = ComponentField()", "type": "assigned_variable", "loc": [213, 213], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L99_C0", "vector": [14, 1, 0.8589, 0.004, 1, 0.71, 0.5714, 57, 3, 1, 0, 0, 660, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "ComponentField", "annotation": ""}, "snippet": " name = ComponentField(PatientName)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L214_C4", "label": "practice_id = TextField()", "type": "assigned_variable", "loc": [214, 214], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L99_C0", "vector": [14, 1, 0.8629, 0.004, 1, 0.71, 0.7143, 665, 3, 2, 0, 0, 612, 10, 1], "semantic": {"name": "practice_id", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " practice_id = TextField(required=True, length=12)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L215_C4", "label": "sex = SetField()", "type": "assigned_variable", "loc": [215, 215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L99_C0", "vector": [14, 1, 0.8669, 0.004, 1, 0.71, 0.8571, 80, 3, 1, 0, 0, 445, 10, 1], "semantic": {"name": "sex", "arg_names": [], "import_names": [], "rhs_call_name": "SetField", "annotation": ""}, "snippet": " sex = SetField(values=('M', 'F', None, 'I'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L216_C4", "label": "special_2 = SetField()", "type": "assigned_variable", "loc": [216, 216], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L99_C0", "vector": [14, 1, 0.871, 0.004, 1, 0.71, 1.0, 257, 3, 2, 0, 0, 445, 10, 2], "semantic": {"name": "special_2", "arg_names": [], "import_names": [], "rhs_call_name": "SetField", "annotation": ""}, "snippet": " special_2 = SetField(values=(0, 1), field=IntegerField())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L219_C0", "label": "CommonOrder", "type": "class", "loc": [219, 225], "level": 0, "parent": null, "vector": [3, 0, 0.8952, 0.0282, 0, 0.66, 0.7, 220, 0, 0, 0, 0, 192, 0, 6], "semantic": {"name": "CommonOrder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CommonOrder(OrderRecord):\n biomaterial = TextField(length=20)\n laboratory_field_2 = TextField(length=12)\n priority = SetField(default='S', values=('S', 'R'))\n sample_id = TextField(required=True, length=12)\n user_field_1 = TextField(length=20)\n user_field_2 = TextField(length=1024)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L220_C4", "label": "biomaterial = TextField()", "type": "assigned_variable", "loc": [220, 220], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L219_C0", "vector": [14, 1, 0.8871, 0.004, 1, 0.0, 0.0, 401, 3, 1, 0, 0, 612, 10, 1], "semantic": {"name": "biomaterial", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " biomaterial = TextField(length=20)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L221_C4", "label": "laboratory_field_2 = TextField()", "type": "assigned_variable", "loc": [221, 221], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L219_C0", "vector": [14, 1, 0.8911, 0.004, 1, 0.0, 0.2, 278, 3, 1, 0, 0, 612, 10, 1], "semantic": {"name": "laboratory_field_2", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " laboratory_field_2 = TextField(length=12)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L222_C4", "label": "priority = SetField()", "type": "assigned_variable", "loc": [222, 222], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L219_C0", "vector": [14, 1, 0.8952, 0.004, 1, 0.0, 0.4, 22, 3, 2, 0, 0, 445, 10, 1], "semantic": {"name": "priority", "arg_names": [], "import_names": [], "rhs_call_name": "SetField", "annotation": ""}, "snippet": " priority = SetField(default='S', values=('S', 'R'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L223_C4", "label": "sample_id = TextField()", "type": "assigned_variable", "loc": [223, 223], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L219_C0", "vector": [14, 1, 0.8992, 0.004, 1, 0.0, 0.6, 192, 3, 2, 0, 0, 612, 10, 1], "semantic": {"name": "sample_id", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " sample_id = TextField(required=True, length=12)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L224_C4", "label": "user_field_1 = TextField()", "type": "assigned_variable", "loc": [224, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L219_C0", "vector": [14, 1, 0.9032, 0.004, 1, 0.0, 0.8, 100, 3, 1, 0, 0, 612, 10, 1], "semantic": {"name": "user_field_1", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " user_field_1 = TextField(length=20)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L225_C4", "label": "user_field_2 = TextField()", "type": "assigned_variable", "loc": [225, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L219_C0", "vector": [14, 1, 0.9073, 0.004, 1, 0.0, 1.0, 542, 3, 1, 0, 0, 612, 10, 1], "semantic": {"name": "user_field_2", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " user_field_2 = TextField(length=1024)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L228_C0", "label": "CommonResult", "type": "class", "loc": [228, 230], "level": 0, "parent": null, "vector": [3, 0, 0.9234, 0.0121, 0, 0.66, 0.8, 47, 0, 0, 0, 0, 325, 0, 2], "semantic": {"name": "CommonResult", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CommonResult(ResultRecord):\n completed_at = DateTimeField(required=True)\n value = TextField(required=True, length=20)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L229_C4", "label": "completed_at = DateTimeField()", "type": "assigned_variable", "loc": [229, 229], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L228_C0", "vector": [14, 1, 0.9234, 0.004, 1, 0.67, 0.0, 248, 3, 1, 0, 0, 789, 10, 1], "semantic": {"name": "completed_at", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeField", "annotation": ""}, "snippet": " completed_at = DateTimeField(required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L230_C4", "label": "value = TextField()", "type": "assigned_variable", "loc": [230, 230], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L228_C0", "vector": [14, 1, 0.9274, 0.004, 1, 0.67, 1.0, 441, 3, 2, 0, 0, 612, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " value = TextField(required=True, length=20)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L233_C0", "label": "CommonComment", "type": "class", "loc": [233, 234], "level": 0, "parent": null, "vector": [3, 0, 0.9415, 0.0081, 0, 0.66, 0.9, 240, 0, 0, 0, 0, 495, 0, 1], "semantic": {"name": "CommonComment", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CommonComment(CommentRecord):\n ctype = ConstantField(default='G')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L234_C4", "label": "ctype = ConstantField()", "type": "assigned_variable", "loc": [234, 234], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L233_C0", "vector": [14, 1, 0.9435, 0.004, 1, 0.05, 0.0, 53, 3, 1, 0, 0, 543, 10, 1], "semantic": {"name": "ctype", "arg_names": [], "import_names": [], "rhs_call_name": "ConstantField", "annotation": ""}, "snippet": " ctype = ConstantField(default='G')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L237_C0", "label": "Terminator", "type": "class", "loc": [237, 248], "level": 0, "parent": null, "vector": [3, 0, 0.9778, 0.0484, 0, 0.66, 1.0, 804, 0, 0, 0, 0, 586, 0, 0], "semantic": {"name": "Terminator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Terminator(TerminatorRecord):\n \"\"\"ASTM terminator record.\n\n :param type: Record Type ID. Always ``L``.\n :type type: str\n\n :param seq: Sequential number. Always ``1``.\n :type seq: int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1047:Expr_L238_C4", "label": "expression", "type": "expression", "loc": [238, 248], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L237_C0", "vector": [8, 1, 0.9798, 0.0444, 1, 0.32, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"ASTM terminator record.\n\n :param type: Record Type ID. Always ``L``.\n :type type: str\n\n :param seq: Sequential number. Always ``1``.\n :type seq: int\n"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1047:Expr_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1047:Expr_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L210_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L211_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L212_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L213_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L214_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L215_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L216_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L219_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L220_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L219_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L221_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L219_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L222_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L219_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L223_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L219_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L224_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L219_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L228_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L229_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L228_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L230_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L233_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1047:Assign_L234_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1047:ClassDef_L237_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1047:Expr_L238_C4"}]
# -*- coding: utf-8 -*- # # Copyright (C) 2012 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # from .version import __version__, __version_info__ from .exceptions import BaseASTMError, NotAccepted, InvalidState from .codec import ( decode, decode_message, decode_record, encode, encode_message, encode_record, make_checksum ) from .mapping import Record, Component from .records import ( HeaderRecord, PatientRecord, OrderRecord, ResultRecord, CommentRecord, TerminatorRecord ) from .protocol import ASTMProtocol from .client import Client from .server import RequestHandler, Server import logging log = logging.getLogger() class NullHandler(logging.Handler): def emit(self, *args, **kwargs): pass log.addHandler(NullHandler())
ajibawa-2023/Python-Code-Large/train/row_1048
13
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_1048:ImportFrom_L10_C0", "label": "from version import __version__, __version_info__", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.303, 0.0303, 0, 0.66, 0.0, 623, 0, 2, 0, 0, 623, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": ["__version__", "__version_info__"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .version import __version__, __version_info__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1048:ImportFrom_L11_C0", "label": "from exceptions import BaseASTMError, NotAccepted, InvalidState", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.0303, 0, 0.66, 0.0909, 63, 0, 3, 0, 0, 63, 0, 0], "semantic": {"name": "exceptions", "arg_names": [], "import_names": ["BaseASTMError", "NotAccepted", "InvalidState"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .exceptions import BaseASTMError, NotAccepted, InvalidState"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1048:ImportFrom_L12_C0", "label": "from codec import decode, decode_message, decode_record\u2026", "type": "import", "loc": [12, 16], "level": 0, "parent": null, "vector": [1, 0, 0.4242, 0.1515, 0, 0.66, 0.1818, 563, 0, 7, 0, 0, 563, 0, 0], "semantic": {"name": "codec", "arg_names": [], "import_names": ["decode", "decode_message", "decode_record", "encode", "encode_message", "encode_record", "make_checksum"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .codec import (\n decode, decode_message, decode_record,\n encode, encode_message, encode_record,\n make_checksum\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1048:ImportFrom_L17_C0", "label": "from mapping import Record, Component", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.5152, 0.0303, 0, 0.66, 0.2727, 351, 0, 2, 0, 0, 351, 0, 0], "semantic": {"name": "mapping", "arg_names": [], "import_names": ["Record", "Component"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .mapping import Record, Component"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1048:ImportFrom_L18_C0", "label": "from records import HeaderRecord, PatientRecord, OrderRecord\u2026", "type": "import", "loc": [18, 21], "level": 0, "parent": null, "vector": [1, 0, 0.5909, 0.1212, 0, 0.66, 0.3636, 186, 0, 6, 0, 0, 186, 0, 0], "semantic": {"name": "records", "arg_names": [], "import_names": ["HeaderRecord", "PatientRecord", "OrderRecord", "ResultRecord", "CommentRecord", "TerminatorRecord"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .records import (\n HeaderRecord, PatientRecord, OrderRecord,\n ResultRecord, CommentRecord, TerminatorRecord\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1048:ImportFrom_L22_C0", "label": "from protocol import ASTMProtocol", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.6667, 0.0303, 0, 0.66, 0.4545, 393, 0, 1, 0, 0, 393, 0, 0], "semantic": {"name": "protocol", "arg_names": [], "import_names": ["ASTMProtocol"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .protocol import ASTMProtocol"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1048:ImportFrom_L23_C0", "label": "from client import Client", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.697, 0.0303, 0, 0.66, 0.5455, 608, 0, 1, 0, 0, 608, 0, 0], "semantic": {"name": "client", "arg_names": [], "import_names": ["Client"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .client import Client"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1048:ImportFrom_L24_C0", "label": "from server import RequestHandler, Server", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.7273, 0.0303, 0, 0.66, 0.6364, 268, 0, 2, 0, 0, 268, 0, 0], "semantic": {"name": "server", "arg_names": [], "import_names": ["RequestHandler", "Server"], "rhs_call_name": "", "annotation": ""}, "snippet": "from .server import RequestHandler, Server"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1048:Import_L26_C0", "label": "logging import logging", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.7879, 0.0303, 0, 0.66, 0.7273, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1048:Assign_L27_C0", "label": "log = getLogger()", "type": "assigned_variable", "loc": [27, 27], "level": 0, "parent": null, "vector": [14, 0, 0.8182, 0.0303, 0, 0.66, 0.8182, 432, 3, 0, 0, 0, 71, 10, 1], "semantic": {"name": "log", "arg_names": [], "import_names": [], "rhs_call_name": "getLogger", "annotation": ""}, "snippet": "log = logging.getLogger()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1048:ClassDef_L29_C0", "label": "NullHandler", "type": "class", "loc": [29, 31], "level": 0, "parent": null, "vector": [3, 0, 0.9091, 0.0909, 0, 0.66, 0.9091, 694, 0, 1, 0, 0, 981, 0, 0], "semantic": {"name": "NullHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class NullHandler(logging.Handler):\n def emit(self, *args, **kwargs):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1048:FunctionDef_L30_C4", "label": "emit", "type": "function", "loc": [30, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1048:ClassDef_L29_C0", "vector": [2, 1, 0.9242, 0.0606, 1, 0.12, 0.0, 627, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "emit", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def emit(self, *args, **kwargs):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1048:Expr_L33_C0", "label": "addHandler()", "type": "expression", "loc": [33, 33], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0303, 0, 0.66, 1.0, 255, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "addHandler", "arg_names": [], "import_names": [], "rhs_call_name": "addHandler", "annotation": ""}, "snippet": "log.addHandler(NullHandler())"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1048:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1048:FunctionDef_L30_C4"}]
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Alexander Shorin # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # import sys version = '.'.join(map(str, sys.version_info[:2])) if version >= '3.0': basestring = (str, bytes) unicode = str bytes = bytes long = int def buffer(obj, start=None, stop=None): memoryview(obj) if start == None: start = 0 if stop == None: stop = len(obj) x = obj[start:stop] return x else: basestring = basestring unicode = unicode b = bytes = str long = long buffer = buffer b = lambda s: isinstance(s, unicode) and s.encode('latin1') or s u = lambda s: isinstance(s, bytes) and s.decode('utf-8') or s
ajibawa-2023/Python-Code-Large/train/row_1049
22
35
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1049:Import_L10_C0", "label": "sys import sys", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.2857, 0.0286, 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_1049:Assign_L12_C0", "label": "version = join()", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.3429, 0.0286, 0, 0.66, 0.25, 623, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "version = '.'.join(map(str, sys.version_info[:2]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L14_C0", "label": "if", "type": "if", "loc": [14, 32], "level": 0, "parent": null, "vector": [4, 0, 0.6571, 0.5429, 0, 0.66, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if version >= '3.0':\n basestring = (str, bytes)\n unicode = str\n bytes = bytes\n long = int\n def buffer(obj, start=None, stop=None):\n memoryview(obj)\n if start == None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L15_C4", "label": "basestring =", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L14_C0", "vector": [14, 1, 0.4286, 0.0286, 1, 0.21, 0.0, 599, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "basestring", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " basestring = (str, bytes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L16_C4", "label": "unicode =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L14_C0", "vector": [14, 1, 0.4571, 0.0286, 1, 0.21, 0.1111, 733, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "unicode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " unicode = str"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L17_C4", "label": "bytes =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L14_C0", "vector": [14, 1, 0.4857, 0.0286, 1, 0.21, 0.2222, 297, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "bytes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bytes = bytes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L18_C4", "label": "long =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L14_C0", "vector": [14, 1, 0.5143, 0.0286, 1, 0.21, 0.3333, 37, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "long", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " long = int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1049:FunctionDef_L19_C4", "label": "buffer", "type": "function", "loc": [19, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L14_C0", "vector": [2, 1, 0.6429, 0.2286, 1, 0.21, 0.4444, 640, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "buffer", "arg_names": ["obj", "start", "stop"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def buffer(obj, start=None, stop=None):\n memoryview(obj)\n if start == None:\n start = 0\n if stop == None:\n stop = len(obj)\n x = obj[start:stop]\n return x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1049:Expr_L20_C8", "label": "memoryview()", "type": "expression", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1049:FunctionDef_L19_C4", "vector": [8, 2, 0.5714, 0.0286, 2, 0.07, 0.0, 171, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "memoryview", "arg_names": [], "import_names": [], "rhs_call_name": "memoryview", "annotation": ""}, "snippet": " memoryview(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L21_C8", "label": "if", "type": "if", "loc": [21, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1049:FunctionDef_L19_C4", "vector": [4, 2, 0.6143, 0.0571, 2, 0.07, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if start == None:\n start = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L22_C12", "label": "start =", "type": "assigned_variable", "loc": [22, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L21_C8", "vector": [14, 3, 0.6286, 0.0286, 3, 0.34, 0.0, 511, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " start = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L23_C8", "label": "if", "type": "if", "loc": [23, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1049:FunctionDef_L19_C4", "vector": [4, 2, 0.6714, 0.0571, 2, 0.07, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if stop == None:\n stop = len(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L24_C12", "label": "stop = len()", "type": "assigned_variable", "loc": [24, 24], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L23_C8", "vector": [14, 3, 0.6857, 0.0286, 3, 0.78, 0.0, 343, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " stop = len(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L25_C8", "label": "x =", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1049:FunctionDef_L19_C4", "vector": [14, 2, 0.7143, 0.0286, 2, 0.07, 0.75, 190, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " x = obj[start:stop]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1049:Return_L26_C8", "label": "return", "type": "return", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1049:FunctionDef_L19_C4", "vector": [13, 2, 0.7429, 0.0286, 2, 0.07, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L28_C4", "label": "basestring =", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L14_C0", "vector": [14, 1, 0.8, 0.0286, 1, 0.21, 0.5556, 599, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "basestring", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " basestring = basestring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L29_C4", "label": "unicode =", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L14_C0", "vector": [14, 1, 0.8286, 0.0286, 1, 0.21, 0.6667, 733, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "unicode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " unicode = unicode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L30_C4", "label": "b =", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L14_C0", "vector": [14, 1, 0.8571, 0.0286, 1, 0.21, 0.7778, 756, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " b = bytes = str"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L31_C4", "label": "long =", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L14_C0", "vector": [14, 1, 0.8857, 0.0286, 1, 0.21, 0.8889, 37, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "long", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " long = long"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L32_C4", "label": "buffer =", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L14_C0", "vector": [14, 1, 0.9143, 0.0286, 1, 0.21, 1.0, 640, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "buffer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " buffer = buffer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L34_C0", "label": "b =", "type": "assigned_variable", "loc": [34, 34], "level": 0, "parent": null, "vector": [14, 0, 0.9714, 0.0286, 0, 0.66, 0.75, 756, 9, 0, 0, 0, 0, 0, 2], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "b = lambda s: isinstance(s, unicode) and s.encode('latin1') or s"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L35_C0", "label": "u =", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.0286, 0, 0.66, 1.0, 609, 9, 0, 0, 0, 0, 0, 2], "semantic": {"name": "u", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "u = lambda s: isinstance(s, bytes) and s.decode('utf-8') or s"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1049:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1049:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1049:Expr_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1049:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L21_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L22_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1049:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L23_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L24_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1049:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1049:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1049:Return_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1049:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1049:Assign_L32_C4"}]
#==================================================================== # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you 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. # ==================================================================== # # This software consists of voluntary contributions made by many # individuals on behalf of the Apache Software Foundation. For more # information on the Apache Software Foundation, please see # <http://www.apache.org/>. # import os import re import tempfile import shutil ignore_pattern = re.compile('^(.svn|target|bin|classes)') java_pattern = re.compile('^.*\.java') annot_pattern = re.compile('import org\.apache\.http\.annotation\.') def process_dir(dir): files = os.listdir(dir) for file in files: f = os.path.join(dir, file) if os.path.isdir(f): if not ignore_pattern.match(file): process_dir(f) else: if java_pattern.match(file): process_source(f) def process_source(filename): tmp = tempfile.mkstemp() tmpfd = tmp[0] tmpfile = tmp[1] try: changed = False dst = os.fdopen(tmpfd, 'w') try: src = open(filename) try: for line in src: if annot_pattern.match(line): changed = True line = line.replace('import org.apache.http.annotation.', 'import net.jcip.annotations.') dst.write(line) finally: src.close() finally: dst.close(); if changed: shutil.move(tmpfile, filename) else: os.remove(tmpfile) except: os.remove(tmpfile) process_dir('.')
ajibawa-2023/Python-Code-Large/train/row_1050
38
74
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Import_L26_C0", "label": "os import os", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.3514, 0.0135, 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_1050:Import_L27_C0", "label": "re import re", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.3649, 0.0135, 0, 0.66, 0.1111, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Import_L28_C0", "label": "tempfile import tempfile", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.3784, 0.0135, 0, 0.66, 0.2222, 516, 0, 1, 0, 0, 516, 0, 0], "semantic": {"name": "tempfile", "arg_names": [], "import_names": ["tempfile"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tempfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Import_L29_C0", "label": "shutil import shutil", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.3919, 0.0135, 0, 0.66, 0.3333, 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_1050:Assign_L31_C0", "label": "ignore_pattern = compile()", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.4189, 0.0135, 0, 0.66, 0.4444, 989, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "ignore_pattern", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "ignore_pattern = re.compile('^(.svn|target|bin|classes)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Assign_L32_C0", "label": "java_pattern = compile()", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.4324, 0.0135, 0, 0.66, 0.5556, 579, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "java_pattern", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "java_pattern = re.compile('^.*\\.java')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Assign_L33_C0", "label": "annot_pattern = compile()", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.4459, 0.0135, 0, 0.66, 0.6667, 164, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "annot_pattern", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "annot_pattern = re.compile('import org\\.apache\\.http\\.annotation\\.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:FunctionDef_L35_C0", "label": "process_dir", "type": "function", "loc": [35, 44], "level": 0, "parent": null, "vector": [2, 0, 0.5338, 0.1351, 0, 0.66, 0.7778, 660, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "process_dir", "arg_names": ["dir"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def process_dir(dir):\n files = os.listdir(dir)\n for file in files:\n f = os.path.join(dir, file)\n if os.path.isdir(f):\n if not ignore_pattern.match(file):\n process_dir(f)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Assign_L36_C4", "label": "files = listdir()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:FunctionDef_L35_C0", "vector": [14, 1, 0.4865, 0.0135, 1, 0.64, 0.0, 598, 3, 1, 0, 0, 551, 10, 1], "semantic": {"name": "files", "arg_names": [], "import_names": [], "rhs_call_name": "listdir", "annotation": ""}, "snippet": " files = os.listdir(dir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:For_L37_C4", "label": "for file", "type": "for", "loc": [37, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:FunctionDef_L35_C0", "vector": [6, 1, 0.5473, 0.1081, 1, 0.64, 1.0, 107, 2, 0, 0, 0, 0, 0, 6], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for file in files:\n f = os.path.join(dir, file)\n if os.path.isdir(f):\n if not ignore_pattern.match(file):\n process_dir(f)\n else:\n if java_pattern.match(file):\n process_source(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Assign_L38_C8", "label": "f = join()", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:For_L37_C4", "vector": [14, 2, 0.5135, 0.0135, 2, 0.71, 0.0, 899, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " f = os.path.join(dir, file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L39_C8", "label": "if", "type": "if", "loc": [39, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:For_L37_C4", "vector": [4, 2, 0.5608, 0.0811, 2, 0.71, 1.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.isdir(f):\n if not ignore_pattern.match(file):\n process_dir(f)\n else:\n if java_pattern.match(file):\n process_source(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L40_C12", "label": "if", "type": "if", "loc": [40, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L39_C8", "vector": [4, 3, 0.5473, 0.027, 3, 0.8, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not ignore_pattern.match(file):\n process_dir(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Expr_L41_C16", "label": "process_dir()", "type": "expression", "loc": [41, 41], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L40_C12", "vector": [8, 4, 0.5541, 0.0135, 4, 0.34, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "process_dir", "arg_names": [], "import_names": [], "rhs_call_name": "process_dir", "annotation": ""}, "snippet": " process_dir(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L43_C12", "label": "if", "type": "if", "loc": [43, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L39_C8", "vector": [4, 3, 0.5878, 0.027, 3, 0.8, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if java_pattern.match(file):\n process_source(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Expr_L44_C16", "label": "process_source()", "type": "expression", "loc": [44, 44], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L43_C12", "vector": [8, 4, 0.5946, 0.0135, 4, 0.94, 0.0, 173, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "process_source", "arg_names": [], "import_names": [], "rhs_call_name": "process_source", "annotation": ""}, "snippet": " process_source(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:FunctionDef_L46_C0", "label": "process_source", "type": "function", "loc": [46, 72], "level": 0, "parent": null, "vector": [2, 0, 0.7973, 0.3649, 0, 0.66, 0.8889, 173, 0, 1, 0, 0, 0, 0, 11], "semantic": {"name": "process_source", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def process_source(filename):\n tmp = tempfile.mkstemp()\n tmpfd = tmp[0]\n tmpfile = tmp[1]\n try:\n changed = False\n dst = os.fdopen(tmpfd, 'w')\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Assign_L47_C4", "label": "tmp = mkstemp()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:FunctionDef_L46_C0", "vector": [14, 1, 0.6351, 0.0135, 1, 0.14, 0.0, 517, 3, 0, 0, 0, 708, 10, 1], "semantic": {"name": "tmp", "arg_names": [], "import_names": [], "rhs_call_name": "mkstemp", "annotation": ""}, "snippet": " tmp = tempfile.mkstemp()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Assign_L48_C4", "label": "tmpfd =", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:FunctionDef_L46_C0", "vector": [14, 1, 0.6486, 0.0135, 1, 0.14, 0.3333, 608, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tmpfd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tmpfd = tmp[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Assign_L49_C4", "label": "tmpfile =", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:FunctionDef_L46_C0", "vector": [14, 1, 0.6622, 0.0135, 1, 0.14, 0.6667, 719, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tmpfile", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tmpfile = tmp[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L50_C4", "label": "try", "type": "try", "loc": [50, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:FunctionDef_L46_C0", "vector": [7, 1, 0.8243, 0.3108, 1, 0.14, 1.0, 0, 0, 1, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n changed = False\n dst = os.fdopen(tmpfd, 'w')\n try:\n src = open(filename)\n try:\n for line in src:\n if annot_pattern.match(line):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Assign_L51_C8", "label": "changed =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L50_C4", "vector": [14, 2, 0.6892, 0.0135, 2, 0.69, 0.0, 404, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "changed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " changed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Assign_L52_C8", "label": "dst = fdopen()", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L50_C4", "vector": [14, 2, 0.7027, 0.0135, 2, 0.69, 0.3333, 856, 3, 2, 0, 0, 783, 10, 1], "semantic": {"name": "dst", "arg_names": [], "import_names": [], "rhs_call_name": "fdopen", "annotation": ""}, "snippet": " dst = os.fdopen(tmpfd, 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L53_C8", "label": "try", "type": "try", "loc": [53, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L50_C4", "vector": [7, 2, 0.7905, 0.1622, 2, 0.69, 0.6667, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n src = open(filename)\n try:\n for line in src:\n if annot_pattern.match(line):\n changed = True\n line = line.replace('import org.apache.http.annotation.', 'import net.jcip.annotations.')\n dst.write(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Assign_L54_C12", "label": "src = open()", "type": "assigned_variable", "loc": [54, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L53_C8", "vector": [14, 3, 0.7297, 0.0135, 3, 0.0, 0.0, 345, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "src", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " src = open(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L55_C12", "label": "try", "type": "try", "loc": [55, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L53_C8", "vector": [7, 3, 0.7905, 0.1081, 3, 0.0, 0.5, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n for line in src:\n if annot_pattern.match(line):\n changed = True\n line = line.replace('import org.apache.http.annotation.', 'import net.jcip.annotations.')\n dst.write(line)\n finally:\n src.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:For_L56_C16", "label": "for line", "type": "for", "loc": [56, 60], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L55_C12", "vector": [6, 4, 0.7838, 0.0676, 4, 0.34, 0.0, 373, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in src:\n if annot_pattern.match(line):\n changed = True\n line = line.replace('import org.apache.http.annotation.', 'import net.jcip.annotations.')\n dst.write(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L57_C20", "label": "if", "type": "if", "loc": [57, 59], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:For_L56_C16", "vector": [4, 5, 0.7838, 0.0405, 5, 0.25, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if annot_pattern.match(line):\n changed = True\n line = line.replace('import org.apache.http.annotation.', 'import net.jcip.annotations.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Assign_L58_C24", "label": "changed =", "type": "assigned_variable", "loc": [58, 58], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L57_C20", "vector": [14, 6, 0.7838, 0.0135, 6, 0.57, 0.0, 404, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "changed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " changed = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Assign_L59_C24", "label": "line = replace()", "type": "assigned_variable", "loc": [59, 59], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L57_C20", "vector": [14, 6, 0.7973, 0.0135, 6, 0.57, 1.0, 373, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " line = line.replace('import org.apache.http.annotation.', 'import net.jcip.annotations.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Expr_L60_C20", "label": "write()", "type": "expression", "loc": [60, 60], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:For_L56_C16", "vector": [8, 5, 0.8108, 0.0135, 5, 0.25, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " dst.write(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Expr_L62_C15", "label": "close()", "type": "expression", "loc": [62, 62], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L55_C12", "vector": [8, 4, 0.8378, 0.0135, 4, 0.34, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " src.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Expr_L64_C12", "label": "close()", "type": "expression", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L53_C8", "vector": [8, 3, 0.8649, 0.0135, 3, 0.0, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " dst.close();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L66_C8", "label": "if", "type": "if", "loc": [66, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L50_C4", "vector": [4, 2, 0.9122, 0.0541, 2, 0.69, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if changed:\n shutil.move(tmpfile, filename)\n else:\n os.remove(tmpfile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Expr_L67_C12", "label": "move()", "type": "expression", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L66_C8", "vector": [8, 3, 0.9054, 0.0135, 3, 0.77, 0.0, 856, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "move", "arg_names": [], "import_names": [], "rhs_call_name": "move", "annotation": ""}, "snippet": " shutil.move(tmpfile, filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Expr_L69_C12", "label": "remove()", "type": "expression", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L66_C8", "vector": [8, 3, 0.9324, 0.0135, 3, 0.77, 1.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " os.remove(tmpfile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Expr_L72_C8", "label": "remove()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L50_C4", "vector": [8, 2, 0.973, 0.0135, 2, 0.69, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " os.remove(tmpfile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1050:Expr_L74_C0", "label": "process_dir()", "type": "expression", "loc": [74, 74], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0135, 0, 0.66, 1.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "process_dir", "arg_names": [], "import_names": [], "rhs_call_name": "process_dir", "annotation": ""}, "snippet": "process_dir('.')"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1050:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:For_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:For_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:For_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L40_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:Expr_L41_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:Expr_L44_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:Assign_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L55_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:For_L56_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:For_L56_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L57_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L57_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:Assign_L58_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L57_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:Assign_L59_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:For_L56_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:Expr_L60_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L55_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:Expr_L62_C15"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:Expr_L64_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:Expr_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:Expr_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1050:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1050:Expr_L72_C8"}]
#!/usr/bin/env python from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) sys.exit(1) if __name__ == "__main__": execute_manager(settings)
ajibawa-2023/Python-Code-Large/train/row_1051
8
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_1051:ImportFrom_L2_C0", "label": "from django.core.management import execute_manager", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0909, 0, 0.66, 0.0, 879, 0, 1, 0, 0, 879, 0, 0], "semantic": {"name": "django.core.management", "arg_names": [], "import_names": ["execute_manager"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.management import execute_manager"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1051:Try_L3_C0", "label": "try", "type": "try", "loc": [3, 8], "level": 0, "parent": null, "vector": [7, 0, 0.5, 0.5455, 0, 0.66, 0.5, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n import settings # Assumed to be in the same directory.\nexcept ImportError:\n import sys\n sys.stderr.write(\"Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\\nYou'll have to run django-admin.py, passing it your settings module.\\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\\n\" % __file__)\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1051:Import_L4_C4", "label": "settings import settings", "type": "import", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1051:Try_L3_C0", "vector": [1, 1, 0.3636, 0.0909, 1, 0.98, 0.0, 168, 0, 1, 0, 0, 168, 0, 0], "semantic": {"name": "settings", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": " import settings # Assumed to be in the same directory."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1051:Import_L6_C4", "label": "sys import sys", "type": "import", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1051:Try_L3_C0", "vector": [1, 1, 0.5455, 0.0909, 1, 0.98, 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_1051:Expr_L7_C4", "label": "write()", "type": "expression", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1051:Try_L3_C0", "vector": [8, 1, 0.6364, 0.0909, 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": " sys.stderr.write(\"Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\\nYou'll have to run django-admin.py, passing it your settings module.\\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\\n\" % __file__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1051:Expr_L8_C4", "label": "exit()", "type": "expression", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1051:Try_L3_C0", "vector": [8, 1, 0.7273, 0.0909, 1, 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_1051:If_L10_C0", "label": "if", "type": "if", "loc": [10, 11], "level": 0, "parent": null, "vector": [4, 0, 0.9545, 0.1818, 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 execute_manager(settings)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1051:Expr_L11_C4", "label": "execute_manager()", "type": "expression", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1051:If_L10_C0", "vector": [8, 1, 1.0, 0.0909, 1, 0.13, 0.0, 383, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute_manager", "arg_names": [], "import_names": [], "rhs_call_name": "execute_manager", "annotation": ""}, "snippet": " execute_manager(settings)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1051:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1051:Import_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1051:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1051:Import_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1051:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1051:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1051:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1051:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1051:If_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1051:Expr_L11_C4"}]
import os import sys import logging os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) # Google App Engine imports. from google.appengine.ext.webapp import util # Force Django to reload its settings. from django.conf import settings settings._target = None import django.core.handlers.wsgi import django.core.signals import django.db import django.dispatch.dispatcher logging.getLogger().setLevel(logging.DEBUG) django.dispatch.dispatcher.disconnect( django.db._rollback_on_exception, django.core.signals.got_request_exception) def main(): application = django.core.handlers.wsgi.WSGIHandler() util.run_wsgi_app(application) if __name__ == '__main__': main()
ajibawa-2023/Python-Code-Large/train/row_1052
19
31
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1052:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0323, 0.0323, 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_1052:Import_L2_C0", "label": "sys import sys", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0645, 0.0323, 0, 0.66, 0.0667, 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_1052:Import_L3_C0", "label": "logging import logging", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0968, 0.0323, 0, 0.66, 0.1333, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1052:Assign_L5_C0", "label": "assign", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.1613, 0.0323, 0, 0.66, 0.2, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1052:Expr_L6_C0", "label": "insert()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.1935, 0.0323, 0, 0.66, 0.2667, 368, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": "sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1052:ImportFrom_L9_C0", "label": "from google.appengine.ext.webapp import util", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.2903, 0.0323, 0, 0.66, 0.3333, 8, 0, 1, 0, 0, 8, 0, 0], "semantic": {"name": "google.appengine.ext.webapp", "arg_names": [], "import_names": ["util"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext.webapp import util"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1052:ImportFrom_L11_C0", "label": "from django.conf import settings", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.3548, 0.0323, 0, 0.66, 0.4, 128, 0, 1, 0, 0, 128, 0, 0], "semantic": {"name": "django.conf", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1052:Assign_L12_C0", "label": "settings._target =", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.3871, 0.0323, 0, 0.66, 0.4667, 64, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "settings._target", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "settings._target = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1052:Import_L14_C0", "label": "django.core.handlers.wsgi import django.core.handlers.wsgi", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.4516, 0.0323, 0, 0.66, 0.5333, 643, 0, 1, 0, 0, 643, 0, 0], "semantic": {"name": "django.core.handlers.wsgi", "arg_names": [], "import_names": ["django.core.handlers.wsgi"], "rhs_call_name": "", "annotation": ""}, "snippet": "import django.core.handlers.wsgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1052:Import_L15_C0", "label": "django.core.signals import django.core.signals", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.4839, 0.0323, 0, 0.66, 0.6, 436, 0, 1, 0, 0, 436, 0, 0], "semantic": {"name": "django.core.signals", "arg_names": [], "import_names": ["django.core.signals"], "rhs_call_name": "", "annotation": ""}, "snippet": "import django.core.signals"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1052:Import_L16_C0", "label": "django.db import django.db", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.5161, 0.0323, 0, 0.66, 0.6667, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["django.db"], "rhs_call_name": "", "annotation": ""}, "snippet": "import django.db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1052:Import_L17_C0", "label": "django.dispatch.dispatcher import django.dispatch.dispatcher", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.5484, 0.0323, 0, 0.66, 0.7333, 819, 0, 1, 0, 0, 819, 0, 0], "semantic": {"name": "django.dispatch.dispatcher", "arg_names": [], "import_names": ["django.dispatch.dispatcher"], "rhs_call_name": "", "annotation": ""}, "snippet": "import django.dispatch.dispatcher"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1052:Expr_L19_C0", "label": "setLevel()", "type": "expression", "loc": [19, 19], "level": 0, "parent": null, "vector": [8, 0, 0.6129, 0.0323, 0, 0.66, 0.8, 810, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "setLevel", "arg_names": [], "import_names": [], "rhs_call_name": "setLevel", "annotation": ""}, "snippet": "logging.getLogger().setLevel(logging.DEBUG)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1052:Expr_L21_C0", "label": "disconnect()", "type": "expression", "loc": [21, 23], "level": 0, "parent": null, "vector": [8, 0, 0.7097, 0.0968, 0, 0.66, 0.8667, 978, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "disconnect", "arg_names": [], "import_names": [], "rhs_call_name": "disconnect", "annotation": ""}, "snippet": "django.dispatch.dispatcher.disconnect(\n django.db._rollback_on_exception,\n django.core.signals.got_request_exception)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1052:FunctionDef_L26_C0", "label": "main", "type": "function", "loc": [26, 28], "level": 0, "parent": null, "vector": [2, 0, 0.871, 0.0968, 0, 0.66, 0.9333, 624, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n application = django.core.handlers.wsgi.WSGIHandler()\n util.run_wsgi_app(application)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1052:Assign_L27_C2", "label": "application = WSGIHandler()", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1052:FunctionDef_L26_C0", "vector": [14, 1, 0.871, 0.0323, 1, 0.46, 0.0, 244, 3, 0, 0, 0, 465, 10, 1], "semantic": {"name": "application", "arg_names": [], "import_names": [], "rhs_call_name": "WSGIHandler", "annotation": ""}, "snippet": " application = django.core.handlers.wsgi.WSGIHandler()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1052:Expr_L28_C2", "label": "run_wsgi_app()", "type": "expression", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1052:FunctionDef_L26_C0", "vector": [8, 1, 0.9032, 0.0323, 1, 0.46, 1.0, 563, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "run_wsgi_app", "arg_names": [], "import_names": [], "rhs_call_name": "run_wsgi_app", "annotation": ""}, "snippet": " util.run_wsgi_app(application)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1052:If_L30_C0", "label": "if", "type": "if", "loc": [30, 31], "level": 0, "parent": null, "vector": [4, 0, 0.9839, 0.0645, 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_1052:Expr_L31_C2", "label": "main()", "type": "expression", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1052:If_L30_C0", "vector": [8, 1, 1.0, 0.0323, 1, 0.88, 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_1052:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1052:Assign_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1052:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1052:Expr_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1052:If_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1052:Expr_L31_C2"}]
#!/usr/bin/env python from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) sys.exit(1) if __name__ == "__main__": execute_manager(settings)
ajibawa-2023/Python-Code-Large/train/row_1053
8
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_1053:ImportFrom_L2_C0", "label": "from django.core.management import execute_manager", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0909, 0, 0.66, 0.0, 879, 0, 1, 0, 0, 879, 0, 0], "semantic": {"name": "django.core.management", "arg_names": [], "import_names": ["execute_manager"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.management import execute_manager"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1053:Try_L3_C0", "label": "try", "type": "try", "loc": [3, 8], "level": 0, "parent": null, "vector": [7, 0, 0.5, 0.5455, 0, 0.66, 0.5, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n import settings # Assumed to be in the same directory.\nexcept ImportError:\n import sys\n sys.stderr.write(\"Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\\nYou'll have to run django-admin.py, passing it your settings module.\\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\\n\" % __file__)\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1053:Import_L4_C4", "label": "settings import settings", "type": "import", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1053:Try_L3_C0", "vector": [1, 1, 0.3636, 0.0909, 1, 0.54, 0.0, 168, 0, 1, 0, 0, 168, 0, 0], "semantic": {"name": "settings", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": " import settings # Assumed to be in the same directory."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1053:Import_L6_C4", "label": "sys import sys", "type": "import", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1053:Try_L3_C0", "vector": [1, 1, 0.5455, 0.0909, 1, 0.54, 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_1053:Expr_L7_C4", "label": "write()", "type": "expression", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1053:Try_L3_C0", "vector": [8, 1, 0.6364, 0.0909, 1, 0.54, 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(\"Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\\nYou'll have to run django-admin.py, passing it your settings module.\\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\\n\" % __file__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1053:Expr_L8_C4", "label": "exit()", "type": "expression", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1053:Try_L3_C0", "vector": [8, 1, 0.7273, 0.0909, 1, 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_1053:If_L10_C0", "label": "if", "type": "if", "loc": [10, 11], "level": 0, "parent": null, "vector": [4, 0, 0.9545, 0.1818, 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 execute_manager(settings)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1053:Expr_L11_C4", "label": "execute_manager()", "type": "expression", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1053:If_L10_C0", "vector": [8, 1, 1.0, 0.0909, 1, 0.83, 0.0, 383, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute_manager", "arg_names": [], "import_names": [], "rhs_call_name": "execute_manager", "annotation": ""}, "snippet": " execute_manager(settings)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1053:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1053:Import_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1053:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1053:Import_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1053:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1053:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1053:Try_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1053:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1053:If_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1053:Expr_L11_C4"}]
from django.conf.urls.defaults import * urlpatterns = patterns('', # Example: # (r'^16x16/', include('16x16.foo.urls')), # Uncomment this for admin: (r'^send/', 'favicon.views.receiver'), (r'^contrib/', 'favicon.views.contrib'), (r'^toggler/', 'favicon.views.toggler'), (r'^update/', 'favicon.views.update'), (r'^top/', 'favicon.views.top_x'), (r'^api/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<hour>\d{2})/(?P<min>\d{2})/(?P<sec>\d{2})/(?P<micro>\d+)/', 'favicon.views.api'), (r'^image/(?P<id>.+)', 'favicon.views.image'), (r'^toggle/(?P<id>.+)', 'favicon.views.toggle_active'), (r'^$', 'favicon.views.index') )
ajibawa-2023/Python-Code-Large/train/row_1054
2
17
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1054:ImportFrom_L1_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0588, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf.urls.defaults import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1054:Assign_L3_C0", "label": "urlpatterns = patterns()", "type": "assigned_variable", "loc": [3, 17], "level": 0, "parent": null, "vector": [14, 0, 0.5882, 0.8824, 0, 0.66, 1.0, 990, 3, 10, 0, 0, 75, 10, 1], "semantic": {"name": "urlpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "patterns", "annotation": ""}, "snippet": "urlpatterns = patterns('',\n # Example:\n # (r'^16x16/', include('16x16.foo.urls')),\n\n # Uncomment this for admin:\n (r'^send/', 'favicon.views.receiver'),\n (r'^contrib/', 'favicon.views.contrib'),\n (r'^toggler/', 'favicon.views.toggler'),"}]
[]
#from django.db import models from google.appengine.ext import db class Favicon(db.Model): mimetype = db.StringProperty(required=True) favicon_bytes = db.BlobProperty(required=True) active = db.BooleanProperty(default=True) accesses = db.IntegerProperty(default=0) created_at = db.DateTimeProperty(auto_now_add=True) modified_at = db.DateTimeProperty(auto_now=True) class FaviconColor(db.Model): favicon = db.ReferenceProperty(Favicon) r = db.IntegerProperty(default=0) g = db.IntegerProperty(default=0) b = db.IntegerProperty(default=0) class FaviconURI(db.Model): uri = db.StringProperty(required=True) favicon = db.ReferenceProperty(Favicon) created_at = db.DateTimeProperty(auto_now_add=True) modified_at = db.DateTimeProperty(auto_now=True) class Client(db.Model): client_id = db.StringProperty(required=True) created_at = db.DateTimeProperty(auto_now_add=True) modified_at = db.DateTimeProperty(auto_now=True) class Access(db.Model): created_at = db.DateTimeProperty(auto_now_add=True) favicon = db.ReferenceProperty(Favicon) favicon_uri = db.ReferenceProperty(FaviconURI) client = db.ReferenceProperty(Client) # stats objects class CountStat(db.Expando): count = db.IntegerProperty(default=0) type = db.StringProperty() since = db.DateTimeProperty() class DateCountStat(db.Expando): date = db.DateTimeProperty() type = db.StringProperty() count = db.IntegerProperty(default=0)
ajibawa-2023/Python-Code-Large/train/row_1055
35
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_1055:ImportFrom_L2_C0", "label": "from google.appengine.ext import db", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0227, 0, 0.66, 0.0, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["db"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L4_C0", "label": "Favicon", "type": "class", "loc": [4, 10], "level": 0, "parent": null, "vector": [3, 0, 0.1591, 0.1591, 0, 0.66, 0.1429, 148, 0, 0, 0, 0, 697, 0, 6], "semantic": {"name": "Favicon", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Favicon(db.Model):\n mimetype = db.StringProperty(required=True)\n favicon_bytes = db.BlobProperty(required=True)\n active = db.BooleanProperty(default=True)\n accesses = db.IntegerProperty(default=0)\n created_at = db.DateTimeProperty(auto_now_add=True)\n modified_at = db.DateTimeProperty(auto_now=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L5_C2", "label": "mimetype = StringProperty()", "type": "assigned_variable", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L4_C0", "vector": [14, 1, 0.1136, 0.0227, 1, 0.99, 0.0, 290, 3, 1, 0, 0, 882, 10, 1], "semantic": {"name": "mimetype", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " mimetype = db.StringProperty(required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L6_C2", "label": "favicon_bytes = BlobProperty()", "type": "assigned_variable", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L4_C0", "vector": [14, 1, 0.1364, 0.0227, 1, 0.99, 0.2, 675, 3, 1, 0, 0, 928, 10, 1], "semantic": {"name": "favicon_bytes", "arg_names": [], "import_names": [], "rhs_call_name": "BlobProperty", "annotation": ""}, "snippet": " favicon_bytes = db.BlobProperty(required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L7_C2", "label": "active = BooleanProperty()", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L4_C0", "vector": [14, 1, 0.1591, 0.0227, 1, 0.99, 0.4, 91, 3, 1, 0, 0, 863, 10, 1], "semantic": {"name": "active", "arg_names": [], "import_names": [], "rhs_call_name": "BooleanProperty", "annotation": ""}, "snippet": " active = db.BooleanProperty(default=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L8_C2", "label": "accesses = IntegerProperty()", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L4_C0", "vector": [14, 1, 0.1818, 0.0227, 1, 0.99, 0.6, 134, 3, 1, 0, 0, 703, 10, 1], "semantic": {"name": "accesses", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerProperty", "annotation": ""}, "snippet": " accesses = db.IntegerProperty(default=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L9_C2", "label": "created_at = DateTimeProperty()", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L4_C0", "vector": [14, 1, 0.2045, 0.0227, 1, 0.99, 0.8, 642, 3, 1, 0, 0, 721, 10, 1], "semantic": {"name": "created_at", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeProperty", "annotation": ""}, "snippet": " created_at = db.DateTimeProperty(auto_now_add=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L10_C2", "label": "modified_at = DateTimeProperty()", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L4_C0", "vector": [14, 1, 0.2273, 0.0227, 1, 0.99, 1.0, 810, 3, 1, 0, 0, 721, 10, 1], "semantic": {"name": "modified_at", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeProperty", "annotation": ""}, "snippet": " modified_at = db.DateTimeProperty(auto_now=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L12_C0", "label": "FaviconColor", "type": "class", "loc": [12, 16], "level": 0, "parent": null, "vector": [3, 0, 0.3182, 0.1136, 0, 0.66, 0.2857, 862, 0, 0, 0, 0, 697, 0, 4], "semantic": {"name": "FaviconColor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FaviconColor(db.Model):\n favicon = db.ReferenceProperty(Favicon)\n r = db.IntegerProperty(default=0)\n g = db.IntegerProperty(default=0)\n b = db.IntegerProperty(default=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L13_C2", "label": "favicon = ReferenceProperty()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L12_C0", "vector": [14, 1, 0.2955, 0.0227, 1, 0.9, 0.0, 355, 3, 1, 0, 0, 167, 10, 1], "semantic": {"name": "favicon", "arg_names": [], "import_names": [], "rhs_call_name": "ReferenceProperty", "annotation": ""}, "snippet": " favicon = db.ReferenceProperty(Favicon)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L14_C2", "label": "r = IntegerProperty()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L12_C0", "vector": [14, 1, 0.3182, 0.0227, 1, 0.9, 0.3333, 436, 3, 1, 0, 0, 703, 10, 1], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerProperty", "annotation": ""}, "snippet": " r = db.IntegerProperty(default=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L15_C2", "label": "g = IntegerProperty()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L12_C0", "vector": [14, 1, 0.3409, 0.0227, 1, 0.9, 0.6667, 384, 3, 1, 0, 0, 703, 10, 1], "semantic": {"name": "g", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerProperty", "annotation": ""}, "snippet": " g = db.IntegerProperty(default=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L16_C2", "label": "b = IntegerProperty()", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L12_C0", "vector": [14, 1, 0.3636, 0.0227, 1, 0.9, 1.0, 756, 3, 1, 0, 0, 703, 10, 1], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerProperty", "annotation": ""}, "snippet": " b = db.IntegerProperty(default=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L18_C0", "label": "FaviconURI", "type": "class", "loc": [18, 22], "level": 0, "parent": null, "vector": [3, 0, 0.4545, 0.1136, 0, 0.66, 0.4286, 773, 0, 0, 0, 0, 697, 0, 4], "semantic": {"name": "FaviconURI", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FaviconURI(db.Model):\n uri = db.StringProperty(required=True)\n favicon = db.ReferenceProperty(Favicon)\n created_at = db.DateTimeProperty(auto_now_add=True)\n modified_at = db.DateTimeProperty(auto_now=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L19_C2", "label": "uri = StringProperty()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L18_C0", "vector": [14, 1, 0.4318, 0.0227, 1, 0.59, 0.0, 600, 3, 1, 0, 0, 882, 10, 1], "semantic": {"name": "uri", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " uri = db.StringProperty(required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L20_C2", "label": "favicon = ReferenceProperty()", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L18_C0", "vector": [14, 1, 0.4545, 0.0227, 1, 0.59, 0.3333, 355, 3, 1, 0, 0, 167, 10, 1], "semantic": {"name": "favicon", "arg_names": [], "import_names": [], "rhs_call_name": "ReferenceProperty", "annotation": ""}, "snippet": " favicon = db.ReferenceProperty(Favicon)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L21_C2", "label": "created_at = DateTimeProperty()", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L18_C0", "vector": [14, 1, 0.4773, 0.0227, 1, 0.59, 0.6667, 642, 3, 1, 0, 0, 721, 10, 1], "semantic": {"name": "created_at", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeProperty", "annotation": ""}, "snippet": " created_at = db.DateTimeProperty(auto_now_add=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L22_C2", "label": "modified_at = DateTimeProperty()", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L18_C0", "vector": [14, 1, 0.5, 0.0227, 1, 0.59, 1.0, 810, 3, 1, 0, 0, 721, 10, 1], "semantic": {"name": "modified_at", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeProperty", "annotation": ""}, "snippet": " modified_at = db.DateTimeProperty(auto_now=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L24_C0", "label": "Client", "type": "class", "loc": [24, 27], "level": 0, "parent": null, "vector": [3, 0, 0.5795, 0.0909, 0, 0.66, 0.5714, 412, 0, 0, 0, 0, 697, 0, 3], "semantic": {"name": "Client", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Client(db.Model):\n client_id = db.StringProperty(required=True)\n created_at = db.DateTimeProperty(auto_now_add=True)\n modified_at = db.DateTimeProperty(auto_now=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L25_C2", "label": "client_id = StringProperty()", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L24_C0", "vector": [14, 1, 0.5682, 0.0227, 1, 0.27, 0.0, 542, 3, 1, 0, 0, 882, 10, 1], "semantic": {"name": "client_id", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " client_id = db.StringProperty(required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L26_C2", "label": "created_at = DateTimeProperty()", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L24_C0", "vector": [14, 1, 0.5909, 0.0227, 1, 0.27, 0.5, 642, 3, 1, 0, 0, 721, 10, 1], "semantic": {"name": "created_at", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeProperty", "annotation": ""}, "snippet": " created_at = db.DateTimeProperty(auto_now_add=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L27_C2", "label": "modified_at = DateTimeProperty()", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L24_C0", "vector": [14, 1, 0.6136, 0.0227, 1, 0.27, 1.0, 810, 3, 1, 0, 0, 721, 10, 1], "semantic": {"name": "modified_at", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeProperty", "annotation": ""}, "snippet": " modified_at = db.DateTimeProperty(auto_now=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L29_C0", "label": "Access", "type": "class", "loc": [29, 33], "level": 0, "parent": null, "vector": [3, 0, 0.7045, 0.1136, 0, 0.66, 0.7143, 988, 0, 0, 0, 0, 697, 0, 4], "semantic": {"name": "Access", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Access(db.Model):\n created_at = db.DateTimeProperty(auto_now_add=True)\n favicon = db.ReferenceProperty(Favicon)\n favicon_uri = db.ReferenceProperty(FaviconURI)\n client = db.ReferenceProperty(Client)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L30_C2", "label": "created_at = DateTimeProperty()", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L29_C0", "vector": [14, 1, 0.6818, 0.0227, 1, 0.58, 0.0, 642, 3, 1, 0, 0, 721, 10, 1], "semantic": {"name": "created_at", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeProperty", "annotation": ""}, "snippet": " created_at = db.DateTimeProperty(auto_now_add=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L31_C2", "label": "favicon = ReferenceProperty()", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L29_C0", "vector": [14, 1, 0.7045, 0.0227, 1, 0.58, 0.3333, 355, 3, 1, 0, 0, 167, 10, 1], "semantic": {"name": "favicon", "arg_names": [], "import_names": [], "rhs_call_name": "ReferenceProperty", "annotation": ""}, "snippet": " favicon = db.ReferenceProperty(Favicon)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L32_C2", "label": "favicon_uri = ReferenceProperty()", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L29_C0", "vector": [14, 1, 0.7273, 0.0227, 1, 0.58, 0.6667, 541, 3, 1, 0, 0, 167, 10, 1], "semantic": {"name": "favicon_uri", "arg_names": [], "import_names": [], "rhs_call_name": "ReferenceProperty", "annotation": ""}, "snippet": " favicon_uri = db.ReferenceProperty(FaviconURI)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L33_C2", "label": "client = ReferenceProperty()", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L29_C0", "vector": [14, 1, 0.75, 0.0227, 1, 0.58, 1.0, 608, 3, 1, 0, 0, 167, 10, 1], "semantic": {"name": "client", "arg_names": [], "import_names": [], "rhs_call_name": "ReferenceProperty", "annotation": ""}, "snippet": " client = db.ReferenceProperty(Client)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L36_C0", "label": "CountStat", "type": "class", "loc": [36, 39], "level": 0, "parent": null, "vector": [3, 0, 0.8523, 0.0909, 0, 0.66, 0.8571, 466, 0, 0, 0, 0, 323, 0, 3], "semantic": {"name": "CountStat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CountStat(db.Expando):\n count = db.IntegerProperty(default=0)\n type = db.StringProperty()\n since = db.DateTimeProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L37_C2", "label": "count = IntegerProperty()", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L36_C0", "vector": [14, 1, 0.8409, 0.0227, 1, 0.54, 0.0, 778, 3, 1, 0, 0, 703, 10, 1], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerProperty", "annotation": ""}, "snippet": " count = db.IntegerProperty(default=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L38_C2", "label": "type = StringProperty()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L36_C0", "vector": [14, 1, 0.8636, 0.0227, 1, 0.54, 0.5, 801, 3, 0, 0, 0, 882, 10, 1], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " type = db.StringProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L39_C2", "label": "since = DateTimeProperty()", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L36_C0", "vector": [14, 1, 0.8864, 0.0227, 1, 0.54, 1.0, 198, 3, 0, 0, 0, 721, 10, 1], "semantic": {"name": "since", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeProperty", "annotation": ""}, "snippet": " since = db.DateTimeProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L41_C0", "label": "DateCountStat", "type": "class", "loc": [41, 44], "level": 0, "parent": null, "vector": [3, 0, 0.9659, 0.0909, 0, 0.66, 1.0, 627, 0, 0, 0, 0, 323, 0, 3], "semantic": {"name": "DateCountStat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DateCountStat(db.Expando):\n date = db.DateTimeProperty()\n type = db.StringProperty()\n count = db.IntegerProperty(default=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L42_C2", "label": "date = DateTimeProperty()", "type": "assigned_variable", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L41_C0", "vector": [14, 1, 0.9545, 0.0227, 1, 0.94, 0.0, 56, 3, 0, 0, 0, 721, 10, 1], "semantic": {"name": "date", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeProperty", "annotation": ""}, "snippet": " date = db.DateTimeProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L43_C2", "label": "type = StringProperty()", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L41_C0", "vector": [14, 1, 0.9773, 0.0227, 1, 0.94, 0.5, 801, 3, 0, 0, 0, 882, 10, 1], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " type = db.StringProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L44_C2", "label": "count = IntegerProperty()", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L41_C0", "vector": [14, 1, 1.0, 0.0227, 1, 0.94, 1.0, 778, 3, 1, 0, 0, 703, 10, 1], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerProperty", "annotation": ""}, "snippet": " count = db.IntegerProperty(default=0)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L5_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L6_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L7_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L8_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L9_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L10_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L13_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L15_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L22_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1055:ClassDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1055:Assign_L44_C2"}]
from google.appengine.ext import db from google.appengine.ext.db import djangoforms import django from django import http from django import shortcuts from django.core import serializers from favicon.models import Favicon, FaviconURI, Client, Access # as soon as we have an imagine library......
ajibawa-2023/Python-Code-Large/train/row_1056
7
11
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1056:ImportFrom_L1_C0", "label": "from google.appengine.ext import db", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0909, 0, 0.66, 0.0, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["db"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1056:ImportFrom_L2_C0", "label": "from google.appengine.ext.db import djangoforms", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0909, 0, 0.66, 0.1667, 16, 0, 1, 0, 0, 16, 0, 0], "semantic": {"name": "google.appengine.ext.db", "arg_names": [], "import_names": ["djangoforms"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext.db import djangoforms"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1056:Import_L4_C0", "label": "django import django", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.3636, 0.0909, 0, 0.66, 0.3333, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["django"], "rhs_call_name": "", "annotation": ""}, "snippet": "import django"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1056:ImportFrom_L5_C0", "label": "from django import http", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.4545, 0.0909, 0, 0.66, 0.5, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["http"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django import http"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1056:ImportFrom_L6_C0", "label": "from django import shortcuts", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.5455, 0.0909, 0, 0.66, 0.6667, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["shortcuts"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django import shortcuts"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1056:ImportFrom_L7_C0", "label": "from django.core import serializers", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.6364, 0.0909, 0, 0.66, 0.8333, 913, 0, 1, 0, 0, 913, 0, 0], "semantic": {"name": "django.core", "arg_names": [], "import_names": ["serializers"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core import serializers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1056:ImportFrom_L9_C0", "label": "from favicon.models import Favicon, FaviconURI, Client\u2026", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.8182, 0.0909, 0, 0.66, 1.0, 211, 0, 4, 0, 0, 211, 0, 0], "semantic": {"name": "favicon.models", "arg_names": [], "import_names": ["Favicon", "FaviconURI", "Client", "Access"], "rhs_call_name": "", "annotation": ""}, "snippet": "from favicon.models import Favicon, FaviconURI, Client, Access"}]
[]
from favicon.models import Favicon, FaviconURI, Client, Access, CountStat, DateCountStat from datetime import datetime def inc_total_favicons(): total_favicons = CountStat.get_or_insert("total_favicons") total_favicons.count += 1 total_favicons.put() def get_total_favicons(): total_favicons = CountStat.get_by_key_name("total_favicons") return total_favicons.count def inc_total_accesses(): total_accesses = CountStat.get_or_insert("total_accesses") total_accesses.count += 1 total_accesses.put() def get_total_accesses(): total_accesses = CountStat.get_by_key_name("total_accesses") return total_accesses.count def inc_today_accesses(): today = datetime.today() total_accesses_today = DateCountStat.get_or_insert("accesses_%04d%02d%02d" % (today.year, today.month, today.day), date=today) total_accesses_today.type = "accesses" total_accesses_today.count += 1 total_accesses_today.put() def get_today_accesses(): today = datetime.today() total_accesses_today = DateCountStat.get_by_key_name("accesses_%04d%02d%02d" % (today.year, today.month, today.day)) return total_accesses_today.count def inc_today_favicons(): today = datetime.today() total_favicons_today = DateCountStat.get_or_insert("favicons_%04d%02d%02d" % (today.year, today.month, today.day), date=today) total_favicons_today.type = "favicons" total_favicons_today.count += 1 total_favicons_today.put() def get_today_favicons(): today = datetime.today() total_favicons_today = DateCountStat.get_by_key_name("favicons_%04d%02d%02d" % (today.year, today.month, today.day)) return total_favicons_today.count def get_num_favicons(num): counts = DateCountStat.all().filter('type =', 'favicons').order('-date').fetch(num) return [ str(cnt.count) for cnt in counts ] def inc_today_updates(): today = datetime.today() total_updates_today = DateCountStat.get_or_insert("updates_%04d%02d%02d" % (today.year, today.month, today.day), date=today) total_updates_today.type = "updates" total_updates_today.count += 1 total_updates_today.put() def get_today_updates(): today = datetime.today() total_updates_today = DateCountStat.get_by_key_name("updates_%04d%02d%02d" % (today.year, today.month, today.day)) return total_updates_today.count # favicon fetch methods def most_recently_accessed(num): return Access.all().order('-created_at').fetch(num) def most_accessed(num): return Favicon.all().filter('active = ', True).order('-accesses').fetch(num) def most_recently_added(num): return Favicon.all().filter('active = ', True).order('-created_at').fetch(num) def datetime_url(dt): return "/api/%04d/%02d/%02d/%02d/%02d/%02d/%d/" % (dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.microsecond) # hack to make key_name begin with a letter def md5_key(md5): return 'a' + md5
ajibawa-2023/Python-Code-Large/train/row_1057
54
78
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1057:ImportFrom_L1_C0", "label": "from favicon.models import Favicon, FaviconURI, Client\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0128, 0.0128, 0, 0.66, 0.0, 211, 0, 6, 0, 0, 211, 0, 0], "semantic": {"name": "favicon.models", "arg_names": [], "import_names": ["Favicon", "FaviconURI", "Client", "Access", "CountStat", "DateCountStat"], "rhs_call_name": "", "annotation": ""}, "snippet": "from favicon.models import Favicon, FaviconURI, Client, Access, CountStat, DateCountStat"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:ImportFrom_L2_C0", "label": "from datetime import datetime", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0256, 0.0128, 0, 0.66, 0.0588, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime"], "rhs_call_name": "", "annotation": ""}, "snippet": "from datetime import datetime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L4_C0", "label": "inc_total_favicons", "type": "function", "loc": [4, 7], "level": 0, "parent": null, "vector": [2, 0, 0.0705, 0.0513, 0, 0.66, 0.1176, 98, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "inc_total_favicons", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def inc_total_favicons():\n total_favicons = CountStat.get_or_insert(\"total_favicons\")\n total_favicons.count += 1\n total_favicons.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L5_C2", "label": "total_favicons = get_or_insert()", "type": "assigned_variable", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L4_C0", "vector": [14, 1, 0.0641, 0.0128, 1, 0.36, 0.0, 244, 3, 1, 0, 0, 323, 10, 1], "semantic": {"name": "total_favicons", "arg_names": [], "import_names": [], "rhs_call_name": "get_or_insert", "annotation": ""}, "snippet": " total_favicons = CountStat.get_or_insert(\"total_favicons\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Expr_L7_C2", "label": "put()", "type": "expression", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L4_C0", "vector": [8, 1, 0.0897, 0.0128, 1, 0.36, 1.0, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " total_favicons.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L9_C0", "label": "get_total_favicons", "type": "function", "loc": [9, 11], "level": 0, "parent": null, "vector": [2, 0, 0.1282, 0.0385, 0, 0.66, 0.1765, 413, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "get_total_favicons", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_total_favicons():\n total_favicons = CountStat.get_by_key_name(\"total_favicons\")\n return total_favicons.count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L10_C2", "label": "total_favicons = get_by_key_name()", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L9_C0", "vector": [14, 1, 0.1282, 0.0128, 1, 0.9, 0.0, 244, 3, 1, 0, 0, 899, 10, 1], "semantic": {"name": "total_favicons", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_key_name", "annotation": ""}, "snippet": " total_favicons = CountStat.get_by_key_name(\"total_favicons\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Return_L11_C2", "label": "return", "type": "return", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L9_C0", "vector": [13, 1, 0.141, 0.0128, 1, 0.9, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return total_favicons.count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L13_C0", "label": "inc_total_accesses", "type": "function", "loc": [13, 16], "level": 0, "parent": null, "vector": [2, 0, 0.1859, 0.0513, 0, 0.66, 0.2353, 179, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "inc_total_accesses", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def inc_total_accesses():\n total_accesses = CountStat.get_or_insert(\"total_accesses\")\n total_accesses.count += 1\n total_accesses.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L14_C2", "label": "total_accesses = get_or_insert()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L13_C0", "vector": [14, 1, 0.1795, 0.0128, 1, 0.5, 0.0, 790, 3, 1, 0, 0, 323, 10, 1], "semantic": {"name": "total_accesses", "arg_names": [], "import_names": [], "rhs_call_name": "get_or_insert", "annotation": ""}, "snippet": " total_accesses = CountStat.get_or_insert(\"total_accesses\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Expr_L16_C2", "label": "put()", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L13_C0", "vector": [8, 1, 0.2051, 0.0128, 1, 0.5, 1.0, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " total_accesses.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L18_C0", "label": "get_total_accesses", "type": "function", "loc": [18, 20], "level": 0, "parent": null, "vector": [2, 0, 0.2436, 0.0385, 0, 0.66, 0.2941, 563, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "get_total_accesses", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_total_accesses():\n total_accesses = CountStat.get_by_key_name(\"total_accesses\")\n return total_accesses.count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L19_C2", "label": "total_accesses = get_by_key_name()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L18_C0", "vector": [14, 1, 0.2436, 0.0128, 1, 0.47, 0.0, 790, 3, 1, 0, 0, 899, 10, 1], "semantic": {"name": "total_accesses", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_key_name", "annotation": ""}, "snippet": " total_accesses = CountStat.get_by_key_name(\"total_accesses\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Return_L20_C2", "label": "return", "type": "return", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L18_C0", "vector": [13, 1, 0.2564, 0.0128, 1, 0.47, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return total_accesses.count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L22_C0", "label": "inc_today_accesses", "type": "function", "loc": [22, 27], "level": 0, "parent": null, "vector": [2, 0, 0.3141, 0.0769, 0, 0.66, 0.3529, 587, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "inc_today_accesses", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def inc_today_accesses():\n today = datetime.today()\n total_accesses_today = DateCountStat.get_or_insert(\"accesses_%04d%02d%02d\" % (today.year, today.month, today.day), date=today)\n total_accesses_today.type = \"accesses\"\n total_accesses_today.count += 1\n total_accesses_today.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L23_C2", "label": "today = today()", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L22_C0", "vector": [14, 1, 0.2949, 0.0128, 1, 0.92, 0.0, 788, 3, 0, 0, 0, 788, 10, 1], "semantic": {"name": "today", "arg_names": [], "import_names": [], "rhs_call_name": "today", "annotation": ""}, "snippet": " today = datetime.today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L24_C2", "label": "total_accesses_today = get_or_insert()", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L22_C0", "vector": [14, 1, 0.3077, 0.0128, 1, 0.92, 0.3333, 210, 3, 2, 0, 0, 323, 10, 1], "semantic": {"name": "total_accesses_today", "arg_names": [], "import_names": [], "rhs_call_name": "get_or_insert", "annotation": ""}, "snippet": " total_accesses_today = DateCountStat.get_or_insert(\"accesses_%04d%02d%02d\" % (today.year, today.month, today.day), date=today)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L25_C2", "label": "total_accesses_today.type =", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L22_C0", "vector": [14, 1, 0.3205, 0.0128, 1, 0.92, 0.6667, 525, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "total_accesses_today.type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " total_accesses_today.type = \"accesses\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Expr_L27_C2", "label": "put()", "type": "expression", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L22_C0", "vector": [8, 1, 0.3462, 0.0128, 1, 0.92, 1.0, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " total_accesses_today.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L29_C0", "label": "get_today_accesses", "type": "function", "loc": [29, 32], "level": 0, "parent": null, "vector": [2, 0, 0.391, 0.0513, 0, 0.66, 0.4118, 70, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "get_today_accesses", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_today_accesses():\n today = datetime.today()\n total_accesses_today = DateCountStat.get_by_key_name(\"accesses_%04d%02d%02d\" % (today.year, today.month, today.day))\n return total_accesses_today.count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L30_C2", "label": "today = today()", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L29_C0", "vector": [14, 1, 0.3846, 0.0128, 1, 0.13, 0.0, 788, 3, 0, 0, 0, 788, 10, 1], "semantic": {"name": "today", "arg_names": [], "import_names": [], "rhs_call_name": "today", "annotation": ""}, "snippet": " today = datetime.today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L31_C2", "label": "total_accesses_today = get_by_key_name()", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L29_C0", "vector": [14, 1, 0.3974, 0.0128, 1, 0.13, 0.5, 210, 3, 1, 0, 0, 899, 10, 1], "semantic": {"name": "total_accesses_today", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_key_name", "annotation": ""}, "snippet": " total_accesses_today = DateCountStat.get_by_key_name(\"accesses_%04d%02d%02d\" % (today.year, today.month, today.day))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Return_L32_C2", "label": "return", "type": "return", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L29_C0", "vector": [13, 1, 0.4103, 0.0128, 1, 0.13, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return total_accesses_today.count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L34_C0", "label": "inc_today_favicons", "type": "function", "loc": [34, 39], "level": 0, "parent": null, "vector": [2, 0, 0.4679, 0.0769, 0, 0.66, 0.4706, 946, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "inc_today_favicons", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def inc_today_favicons():\n today = datetime.today()\n total_favicons_today = DateCountStat.get_or_insert(\"favicons_%04d%02d%02d\" % (today.year, today.month, today.day), date=today)\n total_favicons_today.type = \"favicons\"\n total_favicons_today.count += 1\n total_favicons_today.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L35_C2", "label": "today = today()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L34_C0", "vector": [14, 1, 0.4487, 0.0128, 1, 0.42, 0.0, 788, 3, 0, 0, 0, 788, 10, 1], "semantic": {"name": "today", "arg_names": [], "import_names": [], "rhs_call_name": "today", "annotation": ""}, "snippet": " today = datetime.today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L36_C2", "label": "total_favicons_today = get_or_insert()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L34_C0", "vector": [14, 1, 0.4615, 0.0128, 1, 0.42, 0.3333, 193, 3, 2, 0, 0, 323, 10, 1], "semantic": {"name": "total_favicons_today", "arg_names": [], "import_names": [], "rhs_call_name": "get_or_insert", "annotation": ""}, "snippet": " total_favicons_today = DateCountStat.get_or_insert(\"favicons_%04d%02d%02d\" % (today.year, today.month, today.day), date=today)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L37_C2", "label": "total_favicons_today.type =", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L34_C0", "vector": [14, 1, 0.4744, 0.0128, 1, 0.42, 0.6667, 641, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "total_favicons_today.type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " total_favicons_today.type = \"favicons\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Expr_L39_C2", "label": "put()", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L34_C0", "vector": [8, 1, 0.5, 0.0128, 1, 0.42, 1.0, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " total_favicons_today.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L41_C0", "label": "get_today_favicons", "type": "function", "loc": [41, 44], "level": 0, "parent": null, "vector": [2, 0, 0.5449, 0.0513, 0, 0.66, 0.5294, 907, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "get_today_favicons", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_today_favicons():\n today = datetime.today()\n total_favicons_today = DateCountStat.get_by_key_name(\"favicons_%04d%02d%02d\" % (today.year, today.month, today.day))\n return total_favicons_today.count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L42_C2", "label": "today = today()", "type": "assigned_variable", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L41_C0", "vector": [14, 1, 0.5385, 0.0128, 1, 0.43, 0.0, 788, 3, 0, 0, 0, 788, 10, 1], "semantic": {"name": "today", "arg_names": [], "import_names": [], "rhs_call_name": "today", "annotation": ""}, "snippet": " today = datetime.today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L43_C2", "label": "total_favicons_today = get_by_key_name()", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L41_C0", "vector": [14, 1, 0.5513, 0.0128, 1, 0.43, 0.5, 193, 3, 1, 0, 0, 899, 10, 1], "semantic": {"name": "total_favicons_today", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_key_name", "annotation": ""}, "snippet": " total_favicons_today = DateCountStat.get_by_key_name(\"favicons_%04d%02d%02d\" % (today.year, today.month, today.day))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Return_L44_C2", "label": "return", "type": "return", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L41_C0", "vector": [13, 1, 0.5641, 0.0128, 1, 0.43, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return total_favicons_today.count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L46_C0", "label": "get_num_favicons", "type": "function", "loc": [46, 48], "level": 0, "parent": null, "vector": [2, 0, 0.6026, 0.0385, 0, 0.66, 0.5882, 27, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "get_num_favicons", "arg_names": ["num"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_num_favicons(num):\n counts = DateCountStat.all().filter('type =', 'favicons').order('-date').fetch(num)\n return [ str(cnt.count) for cnt in counts ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L47_C2", "label": "counts = fetch()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L46_C0", "vector": [14, 1, 0.6026, 0.0128, 1, 0.85, 0.0, 560, 3, 1, 0, 0, 587, 10, 4], "semantic": {"name": "counts", "arg_names": [], "import_names": [], "rhs_call_name": "fetch", "annotation": ""}, "snippet": " counts = DateCountStat.all().filter('type =', 'favicons').order('-date').fetch(num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Return_L48_C2", "label": "return", "type": "return", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L46_C0", "vector": [13, 1, 0.6154, 0.0128, 1, 0.85, 1.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [ str(cnt.count) for cnt in counts ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L50_C0", "label": "inc_today_updates", "type": "function", "loc": [50, 55], "level": 0, "parent": null, "vector": [2, 0, 0.6731, 0.0769, 0, 0.66, 0.6471, 628, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "inc_today_updates", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def inc_today_updates():\n today = datetime.today()\n total_updates_today = DateCountStat.get_or_insert(\"updates_%04d%02d%02d\" % (today.year, today.month, today.day), date=today)\n total_updates_today.type = \"updates\"\n total_updates_today.count += 1\n total_updates_today.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L51_C2", "label": "today = today()", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L50_C0", "vector": [14, 1, 0.6538, 0.0128, 1, 0.27, 0.0, 788, 3, 0, 0, 0, 788, 10, 1], "semantic": {"name": "today", "arg_names": [], "import_names": [], "rhs_call_name": "today", "annotation": ""}, "snippet": " today = datetime.today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L52_C2", "label": "total_updates_today = get_or_insert()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L50_C0", "vector": [14, 1, 0.6667, 0.0128, 1, 0.27, 0.3333, 93, 3, 2, 0, 0, 323, 10, 1], "semantic": {"name": "total_updates_today", "arg_names": [], "import_names": [], "rhs_call_name": "get_or_insert", "annotation": ""}, "snippet": " total_updates_today = DateCountStat.get_or_insert(\"updates_%04d%02d%02d\" % (today.year, today.month, today.day), date=today)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L53_C2", "label": "total_updates_today.type =", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L50_C0", "vector": [14, 1, 0.6795, 0.0128, 1, 0.27, 0.6667, 419, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "total_updates_today.type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " total_updates_today.type = \"updates\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Expr_L55_C2", "label": "put()", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L50_C0", "vector": [8, 1, 0.7051, 0.0128, 1, 0.27, 1.0, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " total_updates_today.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L57_C0", "label": "get_today_updates", "type": "function", "loc": [57, 60], "level": 0, "parent": null, "vector": [2, 0, 0.75, 0.0513, 0, 0.66, 0.7059, 597, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "get_today_updates", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_today_updates():\n today = datetime.today()\n total_updates_today = DateCountStat.get_by_key_name(\"updates_%04d%02d%02d\" % (today.year, today.month, today.day))\n return total_updates_today.count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L58_C2", "label": "today = today()", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L57_C0", "vector": [14, 1, 0.7436, 0.0128, 1, 0.46, 0.0, 788, 3, 0, 0, 0, 788, 10, 1], "semantic": {"name": "today", "arg_names": [], "import_names": [], "rhs_call_name": "today", "annotation": ""}, "snippet": " today = datetime.today()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L59_C2", "label": "total_updates_today = get_by_key_name()", "type": "assigned_variable", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L57_C0", "vector": [14, 1, 0.7564, 0.0128, 1, 0.46, 0.5, 93, 3, 1, 0, 0, 899, 10, 1], "semantic": {"name": "total_updates_today", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_key_name", "annotation": ""}, "snippet": " total_updates_today = DateCountStat.get_by_key_name(\"updates_%04d%02d%02d\" % (today.year, today.month, today.day))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Return_L60_C2", "label": "return", "type": "return", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L57_C0", "vector": [13, 1, 0.7692, 0.0128, 1, 0.46, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return total_updates_today.count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L63_C0", "label": "most_recently_accessed", "type": "function", "loc": [63, 64], "level": 0, "parent": null, "vector": [2, 0, 0.8141, 0.0256, 0, 0.66, 0.7647, 466, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "most_recently_accessed", "arg_names": ["num"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def most_recently_accessed(num):\n return Access.all().order('-created_at').fetch(num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Return_L64_C2", "label": "return", "type": "return", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L63_C0", "vector": [13, 1, 0.8205, 0.0128, 1, 0.94, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Access.all().order('-created_at').fetch(num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L66_C0", "label": "most_accessed", "type": "function", "loc": [66, 67], "level": 0, "parent": null, "vector": [2, 0, 0.8526, 0.0256, 0, 0.66, 0.8235, 13, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "most_accessed", "arg_names": ["num"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def most_accessed(num):\n return Favicon.all().filter('active = ', True).order('-accesses').fetch(num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Return_L67_C2", "label": "return", "type": "return", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L66_C0", "vector": [13, 1, 0.859, 0.0128, 1, 0.83, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Favicon.all().filter('active = ', True).order('-accesses').fetch(num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L69_C0", "label": "most_recently_added", "type": "function", "loc": [69, 70], "level": 0, "parent": null, "vector": [2, 0, 0.891, 0.0256, 0, 0.66, 0.8824, 199, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "most_recently_added", "arg_names": ["num"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def most_recently_added(num):\n return Favicon.all().filter('active = ', True).order('-created_at').fetch(num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Return_L70_C2", "label": "return", "type": "return", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L69_C0", "vector": [13, 1, 0.8974, 0.0128, 1, 0.95, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Favicon.all().filter('active = ', True).order('-created_at').fetch(num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L72_C0", "label": "datetime_url", "type": "function", "loc": [72, 73], "level": 0, "parent": null, "vector": [2, 0, 0.9295, 0.0256, 0, 0.66, 0.9412, 936, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "datetime_url", "arg_names": ["dt"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def datetime_url(dt):\n return \"/api/%04d/%02d/%02d/%02d/%02d/%02d/%d/\" % (dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.microsecond)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Return_L73_C2", "label": "return", "type": "return", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L72_C0", "vector": [13, 1, 0.9359, 0.0128, 1, 0.34, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"/api/%04d/%02d/%02d/%02d/%02d/%02d/%d/\" % (dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.microsecond)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L77_C0", "label": "md5_key", "type": "function", "loc": [77, 78], "level": 0, "parent": null, "vector": [2, 0, 0.9936, 0.0256, 0, 0.66, 1.0, 299, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "md5_key", "arg_names": ["md5"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def md5_key(md5):\n return 'a' + md5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1057:Return_L78_C2", "label": "return", "type": "return", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L77_C0", "vector": [13, 1, 1.0, 0.0128, 1, 0.92, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'a' + md5"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L5_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Expr_L7_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L10_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Return_L11_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Expr_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Return_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L24_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Expr_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Return_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Expr_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Return_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Return_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Expr_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Assign_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Return_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Return_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Return_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Return_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L72_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Return_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1057:FunctionDef_L77_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1057:Return_L78_C2"}]
import logging import sys from google.appengine.ext import db from google.appengine.ext.db import djangoforms import django from django import http from django import shortcuts from datetime import datetime from urllib import quote from favicon.models import Favicon, FaviconURI, Client, Access, CountStat, DateCountStat from favicon.helpers import * def image(request, id): mimetype = "image/png" favicon = Favicon.get_by_key_name(id) if favicon.mimetype: mimetype = favicon.mimetype return http.HttpResponse(favicon.favicon_bytes, mimetype=mimetype) def receiver(request): params = {} # logging.debug("file contents: " + str(request.FILES)) try: if (len(request.FILES['favicon']['content']) > 51200): logging.error("someone posted a favicon thats over 50kB (most are < 1kB), no thank you!") return # hack, key_name cannot begin with a digit md5 = md5_key(request.POST['faviconMD5'][:32]) f = Favicon.get_or_insert(md5, mimetype = request.FILES['favicon']['content-type'], favicon_bytes = request.FILES['favicon']['content']) # inc total_favicons if not f.accesses: inc_total_favicons() inc_today_favicons() f.accesses += 1 f.put() inc_total_accesses() inc_today_accesses() fu = None if request.POST.has_key('faviconURI'): fu = FaviconURI(key_name = request.POST['faviconURI'], uri = request.POST['faviconURI'], favicon = f) fu.put() c = None if request.POST.has_key('clientID'): c = Client(key_name = request.POST['clientID'], client_id = request.POST['clientID']) c.put() a = Access(favicon=f, favicon_uri=fu, client=c) a.put() except: logging.error("Unexpected error: " + str(sys.exc_info())) logging.error(request.FILES) return shortcuts.render_to_response('index.html', params) def contrib(request): params = {} return shortcuts.render_to_response('contrib.html', params) def toggle_active(request, id): favicon = Favicon.get_by_key_name(id) favicon.active = not favicon.active favicon.put() return http.HttpResponseRedirect("/toggler/") def toggler(request): params = {} favicons = Favicon.all().filter('active = ', True) good_keys = [ f.key().id_or_name() for f in favicons ] params['favicons_active'] = good_keys favicons = Favicon.all().filter('active = ', False) bad_keys = [ f.key().id_or_name() for f in favicons ] params['favicons_disabled'] = bad_keys return shortcuts.render_to_response('toggler.html', params) # TODO: implement charts for data def get_sparkline(data): # first stab, not working max_val = float(max(data)) vals = [ str( (d / max_val)*100 ) for d in data ] data_string = ",".join(data) img_string = "http://chart.apis.google.com/chart?chs=100x20&cht=ls&chco=0077CC&chm=B,E6F2FA,0,0,0&chls=1,0,0&chd=t:%s" % (data_string) return img_string def top_x(request): params = {} params['most_recently_created'] = [ f.key().id_or_name() for f in most_recently_added(10) ] params['most_recently_accessed'] = [ f.favicon.key().id_or_name() for f in most_recently_accessed(10) ] params['most_accessed'] = [ f.key().id_or_name() for f in most_accessed(10) ] params['favicon_cnt'] = get_total_favicons() params['favicon_today_cnt'] = get_today_favicons() params['accesses_today_cnt'] = get_today_accesses() return shortcuts.render_to_response('top.html', params) def index(request): params = {} params['favicon_cnt'] = get_total_favicons() params['accesses_cnt'] = get_total_accesses() params['favicon_today_cnt'] = get_today_favicons() params['accesses_today_cnt'] = get_today_accesses() return shortcuts.render_to_response('gears.html', params) def update(request): inc_today_updates() return http.HttpResponseRedirect('/update/update.rdf') def api(request, year, month, day, hour, min, sec, micro): params = {} dt = datetime(int(year), int(month), int(day), int(hour), int(min), int(sec), int(micro)) favicons = Favicon.all().filter('active = ', True).filter('created_at > ', dt).order('created_at').fetch(1000) if not favicons: params['favicons'] = [] params['next_url'] = datetime_url(dt) return shortcuts.render_to_response('api.html', params) keys = [ quote(f.key().id_or_name()) for f in favicons ] next_url = datetime_url(favicons[-1].created_at) params['favicons'] = keys params['next_url'] = next_url return shortcuts.render_to_response('api.html', params)
ajibawa-2023/Python-Code-Large/train/row_1058
99
137
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Import_L1_C0", "label": "logging import logging", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0073, 0.0073, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Import_L2_C0", "label": "sys import sys", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0146, 0.0073, 0, 0.66, 0.05, 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_1058:ImportFrom_L3_C0", "label": "from google.appengine.ext import db", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0219, 0.0073, 0, 0.66, 0.1, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["db"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:ImportFrom_L4_C0", "label": "from google.appengine.ext.db import djangoforms", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0292, 0.0073, 0, 0.66, 0.15, 16, 0, 1, 0, 0, 16, 0, 0], "semantic": {"name": "google.appengine.ext.db", "arg_names": [], "import_names": ["djangoforms"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext.db import djangoforms"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Import_L6_C0", "label": "django import django", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0438, 0.0073, 0, 0.66, 0.2, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["django"], "rhs_call_name": "", "annotation": ""}, "snippet": "import django"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:ImportFrom_L7_C0", "label": "from django import http", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0511, 0.0073, 0, 0.66, 0.25, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["http"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django import http"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:ImportFrom_L8_C0", "label": "from django import shortcuts", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0584, 0.0073, 0, 0.66, 0.3, 294, 0, 1, 0, 0, 294, 0, 0], "semantic": {"name": "django", "arg_names": [], "import_names": ["shortcuts"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django import shortcuts"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:ImportFrom_L10_C0", "label": "from datetime import datetime", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.073, 0.0073, 0, 0.66, 0.35, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetime"], "rhs_call_name": "", "annotation": ""}, "snippet": "from datetime import datetime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:ImportFrom_L11_C0", "label": "from urllib import quote", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0803, 0.0073, 0, 0.66, 0.4, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "urllib", "arg_names": [], "import_names": ["quote"], "rhs_call_name": "", "annotation": ""}, "snippet": "from urllib import quote"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:ImportFrom_L13_C0", "label": "from favicon.models import Favicon, FaviconURI, Client\u2026", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0949, 0.0073, 0, 0.66, 0.45, 211, 0, 6, 0, 0, 211, 0, 0], "semantic": {"name": "favicon.models", "arg_names": [], "import_names": ["Favicon", "FaviconURI", "Client", "Access", "CountStat", "DateCountStat"], "rhs_call_name": "", "annotation": ""}, "snippet": "from favicon.models import Favicon, FaviconURI, Client, Access, CountStat, DateCountStat"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:ImportFrom_L14_C0", "label": "from favicon.helpers import *", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1022, 0.0073, 0, 0.66, 0.5, 503, 0, 1, 0, 0, 503, 0, 0], "semantic": {"name": "favicon.helpers", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from favicon.helpers import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L16_C0", "label": "image", "type": "function", "loc": [16, 20], "level": 0, "parent": null, "vector": [2, 0, 0.1314, 0.0365, 0, 0.66, 0.55, 505, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "image", "arg_names": ["request", "id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def image(request, id):\n mimetype = \"image/png\"\n favicon = Favicon.get_by_key_name(id)\n if favicon.mimetype: mimetype = favicon.mimetype\n return http.HttpResponse(favicon.favicon_bytes, mimetype=mimetype)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L17_C2", "label": "mimetype =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L16_C0", "vector": [14, 1, 0.1241, 0.0073, 1, 0.78, 0.0, 290, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "mimetype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mimetype = \"image/png\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L18_C2", "label": "favicon = get_by_key_name()", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L16_C0", "vector": [14, 1, 0.1314, 0.0073, 1, 0.78, 0.3333, 355, 3, 1, 0, 0, 899, 10, 1], "semantic": {"name": "favicon", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_key_name", "annotation": ""}, "snippet": " favicon = Favicon.get_by_key_name(id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L19_C2", "label": "if", "type": "if", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L16_C0", "vector": [4, 1, 0.1387, 0.0073, 1, 0.78, 0.6667, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if favicon.mimetype: mimetype = favicon.mimetype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L19_C23", "label": "mimetype =", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L19_C2", "vector": [14, 2, 0.1387, 0.0073, 2, 0.75, 0.0, 290, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "mimetype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if favicon.mimetype: mimetype = favicon.mimetype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L20_C2", "label": "return", "type": "return", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L16_C0", "vector": [13, 1, 0.146, 0.0073, 1, 0.78, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return http.HttpResponse(favicon.favicon_bytes, mimetype=mimetype)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L22_C0", "label": "receiver", "type": "function", "loc": [22, 67], "level": 0, "parent": null, "vector": [2, 0, 0.3248, 0.3358, 0, 0.66, 0.6, 513, 0, 1, 1, 0, 0, 0, 22], "semantic": {"name": "receiver", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def receiver(request):\n params = {}\n# logging.debug(\"file contents: \" + str(request.FILES))\n\n try:\n if (len(request.FILES['favicon']['content']) > 51200):\n logging.error(\"someone posted a favicon thats over 50kB (most are < 1kB), no thank you!\")\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L23_C2", "label": "params =", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L22_C0", "vector": [14, 1, 0.1679, 0.0073, 1, 0.24, 0.0, 206, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "label": "try", "type": "try", "loc": [26, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L22_C0", "vector": [7, 1, 0.3321, 0.292, 1, 0.24, 0.5, 0, 0, 1, 0, 0, 0, 0, 21], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if (len(request.FILES['favicon']['content']) > 51200):\n logging.error(\"someone posted a favicon thats over 50kB (most are < 1kB), no thank you!\")\n return\n\n # hack, key_name cannot begin with a digit\n md5 = md5_key(request.POST['faviconMD5'][:32])\n f = Favicon.get_or_insert(md5, "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L27_C4", "label": "if", "type": "if", "loc": [27, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "vector": [4, 2, 0.2044, 0.0219, 2, 0.77, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (len(request.FILES['favicon']['content']) > 51200):\n logging.error(\"someone posted a favicon thats over 50kB (most are < 1kB), no thank you!\")\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L28_C6", "label": "error()", "type": "expression", "loc": [28, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L27_C4", "vector": [8, 3, 0.2044, 0.0073, 3, 0.79, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " logging.error(\"someone posted a favicon thats over 50kB (most are < 1kB), no thank you!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L29_C6", "label": "return", "type": "return", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L27_C4", "vector": [13, 3, 0.2117, 0.0073, 3, 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_1058:Assign_L32_C4", "label": "md5 = md5_key()", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "vector": [14, 2, 0.2336, 0.0073, 2, 0.77, 0.0833, 604, 3, 1, 0, 0, 299, 10, 1], "semantic": {"name": "md5", "arg_names": [], "import_names": [], "rhs_call_name": "md5_key", "annotation": ""}, "snippet": " md5 = md5_key(request.POST['faviconMD5'][:32])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L33_C4", "label": "f = get_or_insert()", "type": "assigned_variable", "loc": [33, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "vector": [14, 2, 0.2482, 0.0219, 2, 0.77, 0.1667, 899, 3, 3, 0, 0, 323, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "get_or_insert", "annotation": ""}, "snippet": " f = Favicon.get_or_insert(md5, \n mimetype = request.FILES['favicon']['content-type'],\n favicon_bytes = request.FILES['favicon']['content'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L38_C4", "label": "if", "type": "if", "loc": [38, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "vector": [4, 2, 0.2847, 0.0219, 2, 0.77, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not f.accesses:\n inc_total_favicons()\n inc_today_favicons()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L39_C6", "label": "inc_total_favicons()", "type": "expression", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L38_C4", "vector": [8, 3, 0.2847, 0.0073, 3, 0.27, 0.0, 98, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "inc_total_favicons", "arg_names": [], "import_names": [], "rhs_call_name": "inc_total_favicons", "annotation": ""}, "snippet": " inc_total_favicons()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L40_C6", "label": "inc_today_favicons()", "type": "expression", "loc": [40, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L38_C4", "vector": [8, 3, 0.292, 0.0073, 3, 0.27, 1.0, 946, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "inc_today_favicons", "arg_names": [], "import_names": [], "rhs_call_name": "inc_today_favicons", "annotation": ""}, "snippet": " inc_today_favicons()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L43_C4", "label": "put()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "vector": [8, 2, 0.3139, 0.0073, 2, 0.77, 0.3333, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " f.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L45_C4", "label": "inc_total_accesses()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "vector": [8, 2, 0.3285, 0.0073, 2, 0.77, 0.4167, 179, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "inc_total_accesses", "arg_names": [], "import_names": [], "rhs_call_name": "inc_total_accesses", "annotation": ""}, "snippet": " inc_total_accesses()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L46_C4", "label": "inc_today_accesses()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "vector": [8, 2, 0.3358, 0.0073, 2, 0.77, 0.5, 587, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "inc_today_accesses", "arg_names": [], "import_names": [], "rhs_call_name": "inc_today_accesses", "annotation": ""}, "snippet": " inc_today_accesses()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L48_C4", "label": "fu =", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "vector": [14, 2, 0.3504, 0.0073, 2, 0.77, 0.5833, 339, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "fu", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fu = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L49_C4", "label": "if", "type": "if", "loc": [49, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "vector": [4, 2, 0.3723, 0.0365, 2, 0.77, 0.6667, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.POST.has_key('faviconURI'):\n fu = FaviconURI(key_name = request.POST['faviconURI'],\n uri = request.POST['faviconURI'],\n favicon = f)\n fu.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L50_C6", "label": "fu = FaviconURI()", "type": "assigned_variable", "loc": [50, 52], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L49_C4", "vector": [14, 3, 0.3723, 0.0219, 3, 0.52, 0.0, 339, 3, 3, 0, 0, 773, 10, 1], "semantic": {"name": "fu", "arg_names": [], "import_names": [], "rhs_call_name": "FaviconURI", "annotation": ""}, "snippet": " fu = FaviconURI(key_name = request.POST['faviconURI'],\n uri = request.POST['faviconURI'],\n favicon = f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L53_C6", "label": "put()", "type": "expression", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L49_C4", "vector": [8, 3, 0.3869, 0.0073, 3, 0.52, 1.0, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " fu.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L55_C4", "label": "c =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "vector": [14, 2, 0.4015, 0.0073, 2, 0.77, 0.75, 411, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L56_C4", "label": "if", "type": "if", "loc": [56, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "vector": [4, 2, 0.4197, 0.0292, 2, 0.77, 0.8333, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.POST.has_key('clientID'):\n c = Client(key_name = request.POST['clientID'],\n client_id = request.POST['clientID'])\n c.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L57_C6", "label": "c = Client()", "type": "assigned_variable", "loc": [57, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L56_C4", "vector": [14, 3, 0.4197, 0.0146, 3, 0.39, 0.0, 411, 3, 2, 0, 0, 412, 10, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "Client", "annotation": ""}, "snippet": " c = Client(key_name = request.POST['clientID'],\n client_id = request.POST['clientID'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L59_C6", "label": "put()", "type": "expression", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L56_C4", "vector": [8, 3, 0.4307, 0.0073, 3, 0.39, 1.0, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " c.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L61_C4", "label": "a = Access()", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "vector": [14, 2, 0.4453, 0.0073, 2, 0.77, 0.9167, 475, 3, 3, 0, 0, 988, 10, 1], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "Access", "annotation": ""}, "snippet": " a = Access(favicon=f, favicon_uri=fu, client=c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L62_C4", "label": "put()", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "vector": [8, 2, 0.4526, 0.0073, 2, 0.77, 1.0, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " a.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L64_C4", "label": "error()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "vector": [8, 2, 0.4672, 0.0073, 2, 0.77, 0.0, 771, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " logging.error(\"Unexpected error: \" + str(sys.exc_info()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L65_C4", "label": "error()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "vector": [8, 2, 0.4745, 0.0073, 2, 0.77, 1.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " logging.error(request.FILES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L67_C2", "label": "return", "type": "return", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L22_C0", "vector": [13, 1, 0.4891, 0.0073, 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 shortcuts.render_to_response('index.html', params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L69_C0", "label": "contrib", "type": "function", "loc": [69, 71], "level": 0, "parent": null, "vector": [2, 0, 0.5109, 0.0219, 0, 0.66, 0.65, 669, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "contrib", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def contrib(request):\n params = {}\n return shortcuts.render_to_response('contrib.html', params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L70_C2", "label": "params =", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L69_C0", "vector": [14, 1, 0.5109, 0.0073, 1, 0.27, 0.0, 206, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L71_C2", "label": "return", "type": "return", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L69_C0", "vector": [13, 1, 0.5182, 0.0073, 1, 0.27, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return shortcuts.render_to_response('contrib.html', params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L73_C0", "label": "toggle_active", "type": "function", "loc": [73, 77], "level": 0, "parent": null, "vector": [2, 0, 0.5474, 0.0365, 0, 0.66, 0.7, 787, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "toggle_active", "arg_names": ["request", "id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def toggle_active(request, id):\n favicon = Favicon.get_by_key_name(id)\n favicon.active = not favicon.active\n favicon.put()\n return http.HttpResponseRedirect(\"/toggler/\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L74_C2", "label": "favicon = get_by_key_name()", "type": "assigned_variable", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L73_C0", "vector": [14, 1, 0.5401, 0.0073, 1, 0.13, 0.0, 355, 3, 1, 0, 0, 899, 10, 1], "semantic": {"name": "favicon", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_key_name", "annotation": ""}, "snippet": " favicon = Favicon.get_by_key_name(id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L75_C2", "label": "favicon.active =", "type": "assigned_variable", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L73_C0", "vector": [14, 1, 0.5474, 0.0073, 1, 0.13, 0.3333, 231, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "favicon.active", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " favicon.active = not favicon.active"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L76_C2", "label": "put()", "type": "expression", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L73_C0", "vector": [8, 1, 0.5547, 0.0073, 1, 0.13, 0.6667, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " favicon.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L77_C2", "label": "return", "type": "return", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L73_C0", "vector": [13, 1, 0.562, 0.0073, 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 http.HttpResponseRedirect(\"/toggler/\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L79_C0", "label": "toggler", "type": "function", "loc": [79, 89], "level": 0, "parent": null, "vector": [2, 0, 0.6131, 0.0803, 0, 0.66, 0.75, 441, 0, 1, 1, 0, 0, 0, 9], "semantic": {"name": "toggler", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def toggler(request):\n params = {}\n favicons = Favicon.all().filter('active = ', True)\n good_keys = [ f.key().id_or_name() for f in favicons ]\n params['favicons_active'] = good_keys\n\n favicons = Favicon.all().filter('active = ', False)\n bad_keys = [ f.key().id_or_name() for f in favicons ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L80_C2", "label": "params =", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L79_C0", "vector": [14, 1, 0.5839, 0.0073, 1, 0.2, 0.0, 206, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L81_C2", "label": "favicons = filter()", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L79_C0", "vector": [14, 1, 0.5912, 0.0073, 1, 0.2, 0.1429, 469, 3, 2, 0, 0, 526, 10, 2], "semantic": {"name": "favicons", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " favicons = Favicon.all().filter('active = ', True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L82_C2", "label": "good_keys =", "type": "assigned_variable", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L79_C0", "vector": [14, 1, 0.5985, 0.0073, 1, 0.2, 0.2857, 757, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "good_keys", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " good_keys = [ f.key().id_or_name() for f in favicons ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L83_C2", "label": "assign", "type": "assigned_variable", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L79_C0", "vector": [14, 1, 0.6058, 0.0073, 1, 0.2, 0.4286, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params['favicons_active'] = good_keys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L85_C2", "label": "favicons = filter()", "type": "assigned_variable", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L79_C0", "vector": [14, 1, 0.6204, 0.0073, 1, 0.2, 0.5714, 469, 3, 2, 0, 0, 526, 10, 2], "semantic": {"name": "favicons", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " favicons = Favicon.all().filter('active = ', False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L86_C2", "label": "bad_keys =", "type": "assigned_variable", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L79_C0", "vector": [14, 1, 0.6277, 0.0073, 1, 0.2, 0.7143, 644, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "bad_keys", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bad_keys = [ f.key().id_or_name() for f in favicons ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L87_C2", "label": "assign", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L79_C0", "vector": [14, 1, 0.635, 0.0073, 1, 0.2, 0.8571, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params['favicons_disabled'] = bad_keys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L89_C2", "label": "return", "type": "return", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L79_C0", "vector": [13, 1, 0.6496, 0.0073, 1, 0.2, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return shortcuts.render_to_response('toggler.html', params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L93_C0", "label": "get_sparkline", "type": "function", "loc": [93, 99], "level": 0, "parent": null, "vector": [2, 0, 0.7007, 0.0511, 0, 0.66, 0.8, 496, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "get_sparkline", "arg_names": ["data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_sparkline(data):\n # first stab, not working \n max_val = float(max(data))\n vals = [ str( (d / max_val)*100 ) for d in data ]\n data_string = \",\".join(data)\n img_string = \"http://chart.apis.google.com/chart?chs=100x20&cht=ls&chco=0077CC&chm=B,E6F2FA,0,0,0&chls=1,0,0&chd=t:%s\" % (data_string)\n return img_string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L95_C2", "label": "max_val = float()", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L93_C0", "vector": [14, 1, 0.6934, 0.0073, 1, 0.44, 0.0, 168, 3, 1, 0, 0, 639, 10, 2], "semantic": {"name": "max_val", "arg_names": [], "import_names": [], "rhs_call_name": "float", "annotation": ""}, "snippet": " max_val = float(max(data))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L96_C2", "label": "vals =", "type": "assigned_variable", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L93_C0", "vector": [14, 1, 0.7007, 0.0073, 1, 0.44, 0.25, 17, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "vals", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " vals = [ str( (d / max_val)*100 ) for d in data ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L97_C2", "label": "data_string = join()", "type": "assigned_variable", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L93_C0", "vector": [14, 1, 0.708, 0.0073, 1, 0.44, 0.5, 433, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "data_string", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " data_string = \",\".join(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L98_C2", "label": "img_string =", "type": "assigned_variable", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L93_C0", "vector": [14, 1, 0.7153, 0.0073, 1, 0.44, 0.75, 528, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "img_string", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " img_string = \"http://chart.apis.google.com/chart?chs=100x20&cht=ls&chco=0077CC&chm=B,E6F2FA,0,0,0&chls=1,0,0&chd=t:%s\" % (data_string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L99_C2", "label": "return", "type": "return", "loc": [99, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L93_C0", "vector": [13, 1, 0.7226, 0.0073, 1, 0.44, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return img_string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L101_C0", "label": "top_x", "type": "function", "loc": [101, 109], "level": 0, "parent": null, "vector": [2, 0, 0.7664, 0.0657, 0, 0.66, 0.85, 748, 0, 1, 1, 0, 0, 0, 13], "semantic": {"name": "top_x", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def top_x(request):\n params = {}\n params['most_recently_created'] = [ f.key().id_or_name() for f in most_recently_added(10) ]\n params['most_recently_accessed'] = [ f.favicon.key().id_or_name() for f in most_recently_accessed(10) ]\n params['most_accessed'] = [ f.key().id_or_name() for f in most_accessed(10) ]\n params['favicon_cnt'] = get_total_favicons()\n params['favicon_today_cnt'] = get_today_favicons()\n params['accesses_today_cnt'] = get_today_accesses()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L102_C2", "label": "params =", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L101_C0", "vector": [14, 1, 0.7445, 0.0073, 1, 0.15, 0.0, 206, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L103_C2", "label": "assign", "type": "assigned_variable", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L101_C0", "vector": [14, 1, 0.7518, 0.0073, 1, 0.15, 0.1429, 0, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params['most_recently_created'] = [ f.key().id_or_name() for f in most_recently_added(10) ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L104_C2", "label": "assign", "type": "assigned_variable", "loc": [104, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L101_C0", "vector": [14, 1, 0.7591, 0.0073, 1, 0.15, 0.2857, 0, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params['most_recently_accessed'] = [ f.favicon.key().id_or_name() for f in most_recently_accessed(10) ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L105_C2", "label": "assign", "type": "assigned_variable", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L101_C0", "vector": [14, 1, 0.7664, 0.0073, 1, 0.15, 0.4286, 0, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params['most_accessed'] = [ f.key().id_or_name() for f in most_accessed(10) ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L106_C2", "label": " = get_total_favicons()", "type": "assigned_variable", "loc": [106, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L101_C0", "vector": [14, 1, 0.7737, 0.0073, 1, 0.15, 0.5714, 0, 3, 0, 0, 0, 413, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get_total_favicons", "annotation": ""}, "snippet": " params['favicon_cnt'] = get_total_favicons()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L107_C2", "label": " = get_today_favicons()", "type": "assigned_variable", "loc": [107, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L101_C0", "vector": [14, 1, 0.781, 0.0073, 1, 0.15, 0.7143, 0, 3, 0, 0, 0, 907, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get_today_favicons", "annotation": ""}, "snippet": " params['favicon_today_cnt'] = get_today_favicons()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L108_C2", "label": " = get_today_accesses()", "type": "assigned_variable", "loc": [108, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L101_C0", "vector": [14, 1, 0.7883, 0.0073, 1, 0.15, 0.8571, 0, 3, 0, 0, 0, 70, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get_today_accesses", "annotation": ""}, "snippet": " params['accesses_today_cnt'] = get_today_accesses()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L109_C2", "label": "return", "type": "return", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L101_C0", "vector": [13, 1, 0.7956, 0.0073, 1, 0.15, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return shortcuts.render_to_response('top.html', params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L111_C0", "label": "index", "type": "function", "loc": [111, 117], "level": 0, "parent": null, "vector": [2, 0, 0.8321, 0.0511, 0, 0.66, 0.9, 780, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "index", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def index(request):\n params = {}\n params['favicon_cnt'] = get_total_favicons()\n params['accesses_cnt'] = get_total_accesses()\n params['favicon_today_cnt'] = get_today_favicons()\n params['accesses_today_cnt'] = get_today_accesses()\n return shortcuts.render_to_response('gears.html', params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L112_C2", "label": "params =", "type": "assigned_variable", "loc": [112, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L111_C0", "vector": [14, 1, 0.8175, 0.0073, 1, 0.29, 0.0, 206, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L113_C2", "label": " = get_total_favicons()", "type": "assigned_variable", "loc": [113, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L111_C0", "vector": [14, 1, 0.8248, 0.0073, 1, 0.29, 0.2, 0, 3, 0, 0, 0, 413, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get_total_favicons", "annotation": ""}, "snippet": " params['favicon_cnt'] = get_total_favicons()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L114_C2", "label": " = get_total_accesses()", "type": "assigned_variable", "loc": [114, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L111_C0", "vector": [14, 1, 0.8321, 0.0073, 1, 0.29, 0.4, 0, 3, 0, 0, 0, 563, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get_total_accesses", "annotation": ""}, "snippet": " params['accesses_cnt'] = get_total_accesses()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L115_C2", "label": " = get_today_favicons()", "type": "assigned_variable", "loc": [115, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L111_C0", "vector": [14, 1, 0.8394, 0.0073, 1, 0.29, 0.6, 0, 3, 0, 0, 0, 907, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get_today_favicons", "annotation": ""}, "snippet": " params['favicon_today_cnt'] = get_today_favicons()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L116_C2", "label": " = get_today_accesses()", "type": "assigned_variable", "loc": [116, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L111_C0", "vector": [14, 1, 0.8467, 0.0073, 1, 0.29, 0.8, 0, 3, 0, 0, 0, 70, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get_today_accesses", "annotation": ""}, "snippet": " params['accesses_today_cnt'] = get_today_accesses()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L117_C2", "label": "return", "type": "return", "loc": [117, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L111_C0", "vector": [13, 1, 0.854, 0.0073, 1, 0.29, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return shortcuts.render_to_response('gears.html', params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L119_C0", "label": "update", "type": "function", "loc": [119, 121], "level": 0, "parent": null, "vector": [2, 0, 0.8759, 0.0219, 0, 0.66, 0.95, 637, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "update", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def update(request):\n inc_today_updates()\n return http.HttpResponseRedirect('/update/update.rdf')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L120_C2", "label": "inc_today_updates()", "type": "expression", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L119_C0", "vector": [8, 1, 0.8759, 0.0073, 1, 0.47, 0.0, 628, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "inc_today_updates", "arg_names": [], "import_names": [], "rhs_call_name": "inc_today_updates", "annotation": ""}, "snippet": " inc_today_updates()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L121_C2", "label": "return", "type": "return", "loc": [121, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L119_C0", "vector": [13, 1, 0.8832, 0.0073, 1, 0.47, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return http.HttpResponseRedirect('/update/update.rdf')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L123_C0", "label": "api", "type": "function", "loc": [123, 137], "level": 0, "parent": null, "vector": [2, 0, 0.9489, 0.1095, 0, 0.66, 1.0, 976, 0, 8, 1, 0, 0, 0, 20], "semantic": {"name": "api", "arg_names": ["request", "year", "month", "day", "hour", "min", "sec", "micro"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def api(request, year, month, day, hour, min, sec, micro):\n params = {}\n dt = datetime(int(year), int(month), int(day), int(hour), int(min), int(sec), int(micro))\n favicons = Favicon.all().filter('active = ', True).filter('created_at > ', dt).order('created_at').fetch(1000)\n if not favicons:\n params['favicons'] = []\n params['next_url'] = datetime_url(dt)\n return shortcuts.render_to_response('api.html', params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L124_C2", "label": "params =", "type": "assigned_variable", "loc": [124, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L123_C0", "vector": [14, 1, 0.9051, 0.0073, 1, 0.67, 0.0, 206, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L125_C2", "label": "dt = datetime()", "type": "assigned_variable", "loc": [125, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L123_C0", "vector": [14, 1, 0.9124, 0.0073, 1, 0.67, 0.125, 455, 3, 7, 0, 0, 426, 10, 8], "semantic": {"name": "dt", "arg_names": [], "import_names": [], "rhs_call_name": "datetime", "annotation": ""}, "snippet": " dt = datetime(int(year), int(month), int(day), int(hour), int(min), int(sec), int(micro))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L126_C2", "label": "favicons = fetch()", "type": "assigned_variable", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L123_C0", "vector": [14, 1, 0.9197, 0.0073, 1, 0.67, 0.25, 469, 3, 1, 0, 0, 587, 10, 5], "semantic": {"name": "favicons", "arg_names": [], "import_names": [], "rhs_call_name": "fetch", "annotation": ""}, "snippet": " favicons = Favicon.all().filter('active = ', True).filter('created_at > ', dt).order('created_at').fetch(1000)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L127_C2", "label": "if", "type": "if", "loc": [127, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L123_C0", "vector": [4, 1, 0.938, 0.0292, 1, 0.67, 0.375, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not favicons:\n params['favicons'] = []\n params['next_url'] = datetime_url(dt)\n return shortcuts.render_to_response('api.html', params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L128_C4", "label": "assign", "type": "assigned_variable", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L127_C2", "vector": [14, 2, 0.9343, 0.0073, 2, 0.2, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params['favicons'] = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L129_C4", "label": " = datetime_url()", "type": "assigned_variable", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L127_C2", "vector": [14, 2, 0.9416, 0.0073, 2, 0.2, 0.5, 0, 3, 1, 0, 0, 936, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "datetime_url", "annotation": ""}, "snippet": " params['next_url'] = datetime_url(dt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L130_C4", "label": "return", "type": "return", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L127_C2", "vector": [13, 2, 0.9489, 0.0073, 2, 0.2, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return shortcuts.render_to_response('api.html', params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L132_C2", "label": "keys =", "type": "assigned_variable", "loc": [132, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L123_C0", "vector": [14, 1, 0.9635, 0.0073, 1, 0.67, 0.5, 204, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "keys", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " keys = [ quote(f.key().id_or_name()) for f in favicons ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L133_C2", "label": "next_url = datetime_url()", "type": "assigned_variable", "loc": [133, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L123_C0", "vector": [14, 1, 0.9708, 0.0073, 1, 0.67, 0.625, 157, 3, 1, 0, 0, 936, 10, 1], "semantic": {"name": "next_url", "arg_names": [], "import_names": [], "rhs_call_name": "datetime_url", "annotation": ""}, "snippet": " next_url = datetime_url(favicons[-1].created_at)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L135_C2", "label": "assign", "type": "assigned_variable", "loc": [135, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L123_C0", "vector": [14, 1, 0.9854, 0.0073, 1, 0.67, 0.75, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params['favicons'] = keys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L136_C2", "label": "assign", "type": "assigned_variable", "loc": [136, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L123_C0", "vector": [14, 1, 0.9927, 0.0073, 1, 0.67, 0.875, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params['next_url'] = next_url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L137_C2", "label": "return", "type": "return", "loc": [137, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L123_C0", "vector": [13, 1, 1.0, 0.0073, 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 shortcuts.render_to_response('api.html', params)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L19_C23"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L28_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L29_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L39_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L40_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L50_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L53_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L57_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L59_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:Try_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L74_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L81_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L85_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L86_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L89_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L95_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L96_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L97_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L98_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L99_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L102_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L103_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L104_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L105_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L106_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L107_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L108_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L109_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L112_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L113_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L114_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L115_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L116_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L117_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Expr_L120_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L121_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L123_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L124_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L123_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L125_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L123_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L126_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L123_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L127_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L127_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L127_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:If_L127_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L123_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L132_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L123_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L133_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L123_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L135_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L123_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Assign_L136_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1058:FunctionDef_L123_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1058:Return_L137_C2"}]
#!/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_1060
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_1060: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_1060: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_1060: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 Oct 16, 2012 Refactored on Jul 4, 2013 @author: Nils Amiet ''' import time import math from contextlib import contextmanager @contextmanager def timer(): '''Context manager used to wrap some code with a timer and print the execution time at the end''' timer = Timer() timer.start() yield timer.stop() print(timer) class Timer: '''Class used to measure the execution time of some code''' MILLIS_PER_SECOND = 1000 MILLIS_PER_MINUTE = MILLIS_PER_SECOND * 60 MILLIS_PER_HOUR = MILLIS_PER_MINUTE * 60 MILLIS_PER_DAY = MILLIS_PER_HOUR * 24 def __init__(self): self.startMillis = 0 self.endMillis = 0 self.totalTimeMillis = 0 def start(self): self.startMillis = int(time.time() * self.MILLIS_PER_SECOND) def stop(self): self.endMillis = int(time.time() * self.MILLIS_PER_SECOND) self.totalTimeMillis = self.endMillis - self.startMillis def __repr__(self): tempTime = self.totalTimeMillis days = math.floor(tempTime / self.MILLIS_PER_DAY) tempTime -= days * self.MILLIS_PER_DAY hours = math.floor(tempTime / self.MILLIS_PER_HOUR) tempTime -= hours * self.MILLIS_PER_HOUR minutes = math.floor(tempTime / self.MILLIS_PER_MINUTE) tempTime -= minutes * self.MILLIS_PER_MINUTE seconds = math.floor(tempTime / self.MILLIS_PER_SECOND) tempTime -= seconds * self.MILLIS_PER_SECOND millis = tempTime timeString = "%s days, %s hours, %s minutes, %s seconds, %s millis." timeString %= (days, hours, minutes, seconds, millis) return timeString
ajibawa-2023/Python-Code-Large/train/row_1061
35
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_1061:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0565, 0.0968, 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 Oct 16, 2012\nRefactored on Jul 4, 2013\n\n@author: Nils Amiet\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Import_L8_C0", "label": "time import time", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.129, 0.0161, 0, 0.66, 0.2, 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_1061:Import_L9_C0", "label": "math import math", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1452, 0.0161, 0, 0.66, 0.4, 526, 0, 1, 0, 0, 526, 0, 0], "semantic": {"name": "math", "arg_names": [], "import_names": ["math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:ImportFrom_L10_C0", "label": "from contextlib import contextmanager", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1613, 0.0161, 0, 0.66, 0.6, 479, 0, 1, 0, 0, 479, 0, 0], "semantic": {"name": "contextlib", "arg_names": [], "import_names": ["contextmanager"], "rhs_call_name": "", "annotation": ""}, "snippet": "from contextlib import contextmanager"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L13_C0", "label": "timer", "type": "function", "loc": [13, 19], "level": 0, "parent": null, "vector": [2, 0, 0.2581, 0.1129, 0, 0.66, 0.8, 541, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "timer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def timer():\n '''Context manager used to wrap some code with a timer and print the execution time at the end'''\n timer = Timer()\n timer.start()\n yield\n timer.stop()\n print(timer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Expr_L14_C4", "label": "expression", "type": "expression", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L13_C0", "vector": [8, 1, 0.2258, 0.0161, 1, 0.55, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Context manager used to wrap some code with a timer and print the execution time at the end'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L15_C4", "label": "timer = Timer()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L13_C0", "vector": [14, 1, 0.2419, 0.0161, 1, 0.55, 0.2, 541, 3, 0, 0, 0, 771, 10, 1], "semantic": {"name": "timer", "arg_names": [], "import_names": [], "rhs_call_name": "Timer", "annotation": ""}, "snippet": " timer = Timer()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Expr_L16_C4", "label": "start()", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L13_C0", "vector": [8, 1, 0.2581, 0.0161, 1, 0.55, 0.4, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " timer.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Expr_L17_C4", "label": "expression", "type": "expression", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L13_C0", "vector": [8, 1, 0.2742, 0.0161, 1, 0.55, 0.6, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Expr_L18_C4", "label": "stop()", "type": "expression", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L13_C0", "vector": [8, 1, 0.2903, 0.0161, 1, 0.55, 0.8, 343, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "stop", "annotation": ""}, "snippet": " timer.stop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Expr_L19_C4", "label": "print()", "type": "expression", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L13_C0", "vector": [8, 1, 0.3065, 0.0161, 1, 0.55, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(timer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:ClassDef_L22_C0", "label": "Timer", "type": "class", "loc": [22, 62], "level": 0, "parent": null, "vector": [3, 0, 0.6774, 0.6613, 0, 0.66, 1.0, 771, 0, 4, 0, 0, 0, 0, 8], "semantic": {"name": "Timer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Timer:\n '''Class used to measure the execution time of some code'''\n \n MILLIS_PER_SECOND = 1000\n MILLIS_PER_MINUTE = MILLIS_PER_SECOND * 60\n MILLIS_PER_HOUR = MILLIS_PER_MINUTE * 60\n MILLIS_PER_DAY = MILLIS_PER_HOUR * 24\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Expr_L23_C4", "label": "expression", "type": "expression", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:ClassDef_L22_C0", "vector": [8, 1, 0.371, 0.0161, 1, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Class used to measure the execution time of some code'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L25_C4", "label": "MILLIS_PER_SECOND =", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:ClassDef_L22_C0", "vector": [14, 1, 0.4032, 0.0161, 1, 0.18, 0.125, 45, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "MILLIS_PER_SECOND", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " MILLIS_PER_SECOND = 1000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L26_C4", "label": "MILLIS_PER_MINUTE =", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:ClassDef_L22_C0", "vector": [14, 1, 0.4194, 0.0161, 1, 0.18, 0.25, 436, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "MILLIS_PER_MINUTE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " MILLIS_PER_MINUTE = MILLIS_PER_SECOND * 60"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L27_C4", "label": "MILLIS_PER_HOUR =", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:ClassDef_L22_C0", "vector": [14, 1, 0.4355, 0.0161, 1, 0.18, 0.375, 308, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "MILLIS_PER_HOUR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " MILLIS_PER_HOUR = MILLIS_PER_MINUTE * 60"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L28_C4", "label": "MILLIS_PER_DAY =", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:ClassDef_L22_C0", "vector": [14, 1, 0.4516, 0.0161, 1, 0.18, 0.5, 195, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "MILLIS_PER_DAY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " MILLIS_PER_DAY = MILLIS_PER_HOUR * 24"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L30_C4", "label": "__init__", "type": "function", "loc": [30, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:ClassDef_L22_C0", "vector": [2, 1, 0.5081, 0.0645, 1, 0.18, 0.625, 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.startMillis = 0\n self.endMillis = 0\n self.totalTimeMillis = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L31_C8", "label": "self.startMillis =", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L30_C4", "vector": [14, 2, 0.5, 0.0161, 2, 0.29, 0.0, 720, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.startMillis", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.startMillis = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L32_C8", "label": "self.endMillis =", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L30_C4", "vector": [14, 2, 0.5161, 0.0161, 2, 0.29, 0.5, 926, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.endMillis", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.endMillis = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L33_C8", "label": "self.totalTimeMillis =", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L30_C4", "vector": [14, 2, 0.5323, 0.0161, 2, 0.29, 1.0, 385, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.totalTimeMillis", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.totalTimeMillis = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L35_C4", "label": "start", "type": "function", "loc": [35, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:ClassDef_L22_C0", "vector": [2, 1, 0.5726, 0.0323, 1, 0.18, 0.75, 511, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "start", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def start(self):\n self.startMillis = int(time.time() * self.MILLIS_PER_SECOND)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L36_C8", "label": "self.startMillis = int()", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L35_C4", "vector": [14, 2, 0.5806, 0.0161, 2, 0.11, 0.0, 720, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "self.startMillis", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " self.startMillis = int(time.time() * self.MILLIS_PER_SECOND)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L38_C4", "label": "stop", "type": "function", "loc": [38, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:ClassDef_L22_C0", "vector": [2, 1, 0.629, 0.0484, 1, 0.18, 0.875, 343, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "stop", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def stop(self):\n self.endMillis = int(time.time() * self.MILLIS_PER_SECOND)\n self.totalTimeMillis = self.endMillis - self.startMillis"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L39_C8", "label": "self.endMillis = int()", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L38_C4", "vector": [14, 2, 0.629, 0.0161, 2, 0.0, 0.0, 926, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "self.endMillis", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " self.endMillis = int(time.time() * self.MILLIS_PER_SECOND)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L40_C8", "label": "self.totalTimeMillis =", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L38_C4", "vector": [14, 2, 0.6452, 0.0161, 2, 0.0, 1.0, 385, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.totalTimeMillis", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.totalTimeMillis = self.endMillis - self.startMillis"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L42_C4", "label": "__repr__", "type": "function", "loc": [42, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:ClassDef_L22_C0", "vector": [2, 1, 0.8387, 0.3387, 1, 0.18, 1.0, 204, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "__repr__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __repr__(self):\n tempTime = self.totalTimeMillis\n \n days = math.floor(tempTime / self.MILLIS_PER_DAY)\n tempTime -= days * self.MILLIS_PER_DAY\n \n hours = math.floor(tempTime / self.MILLIS_PER_HOUR)\n tempTime -= hours * self.MILLIS_PER_HOUR"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L43_C8", "label": "tempTime =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L42_C4", "vector": [14, 2, 0.6935, 0.0161, 2, 0.55, 0.0, 991, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tempTime", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tempTime = self.totalTimeMillis"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L45_C8", "label": "days = floor()", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L42_C4", "vector": [14, 2, 0.7258, 0.0161, 2, 0.55, 0.1429, 939, 3, 1, 0, 0, 956, 10, 1], "semantic": {"name": "days", "arg_names": [], "import_names": [], "rhs_call_name": "floor", "annotation": ""}, "snippet": " days = math.floor(tempTime / self.MILLIS_PER_DAY)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L48_C8", "label": "hours = floor()", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L42_C4", "vector": [14, 2, 0.7742, 0.0161, 2, 0.55, 0.2857, 855, 3, 1, 0, 0, 956, 10, 1], "semantic": {"name": "hours", "arg_names": [], "import_names": [], "rhs_call_name": "floor", "annotation": ""}, "snippet": " hours = math.floor(tempTime / self.MILLIS_PER_HOUR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L51_C8", "label": "minutes = floor()", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L42_C4", "vector": [14, 2, 0.8226, 0.0161, 2, 0.55, 0.4286, 234, 3, 1, 0, 0, 956, 10, 1], "semantic": {"name": "minutes", "arg_names": [], "import_names": [], "rhs_call_name": "floor", "annotation": ""}, "snippet": " minutes = math.floor(tempTime / self.MILLIS_PER_MINUTE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L54_C8", "label": "seconds = floor()", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L42_C4", "vector": [14, 2, 0.871, 0.0161, 2, 0.55, 0.5714, 862, 3, 1, 0, 0, 956, 10, 1], "semantic": {"name": "seconds", "arg_names": [], "import_names": [], "rhs_call_name": "floor", "annotation": ""}, "snippet": " seconds = math.floor(tempTime / self.MILLIS_PER_SECOND)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L57_C8", "label": "millis =", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L42_C4", "vector": [14, 2, 0.9194, 0.0161, 2, 0.55, 0.7143, 889, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "millis", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " millis = tempTime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L59_C8", "label": "timeString =", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L42_C4", "vector": [14, 2, 0.9516, 0.0161, 2, 0.55, 0.8571, 224, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "timeString", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " timeString = \"%s days, %s hours, %s minutes, %s seconds, %s millis.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1061:Return_L62_C8", "label": "return", "type": "return", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L42_C4", "vector": [13, 2, 1.0, 0.0161, 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 timeString"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Expr_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1061:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1061:Return_L62_C8"}]
''' Created on 11 juin 2013 @author: Nils Amiet ''' from subprocess import Popen, PIPE import os class SentiStrength(): '''Wrapper class for SentiStrength java version''' RUN_COMMAND = "java -jar" SENTISTRENGTH_PATH = os.path.join(os.path.dirname(__file__), "SentiStrengthCom.jar") DATA_PATH = os.path.join(os.path.dirname(__file__), "SentStrength_Data_Sept2011/") def __init__(self): pass def classifiy(self, text): commandArgs = "%s %s sentidata %s cmd" % (self.RUN_COMMAND, self.SENTISTRENGTH_PATH, self.DATA_PATH) commandArgs = commandArgs.split(" ") process = Popen(commandArgs, stdin=PIPE, stdout=PIPE, stderr=PIPE) text = text.replace(" ", "+") classification, dummy = process.communicate(text.encode("utf-8")) polarities = classification.split("\n") polarities = [self.polarity(line.strip()) for line in polarities] polarities = [x for x in polarities if x is not None] return polarities def polarity(self, line): val = line.split(" ") try: val = [int(x) for x in val] except: return None return sum(val)
ajibawa-2023/Python-Code-Large/train/row_1062
25
41
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1062:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0732, 0.122, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''\nCreated on 11 juin 2013\n\n@author: Nils Amiet\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1062:ImportFrom_L7_C0", "label": "from subprocess import Popen, PIPE", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1707, 0.0244, 0, 0.66, 0.3333, 394, 0, 2, 0, 0, 394, 0, 0], "semantic": {"name": "subprocess", "arg_names": [], "import_names": ["Popen", "PIPE"], "rhs_call_name": "", "annotation": ""}, "snippet": "from subprocess import Popen, PIPE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1062:Import_L8_C0", "label": "os import os", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.1951, 0.0244, 0, 0.66, 0.6667, 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_1062:ClassDef_L10_C0", "label": "SentiStrength", "type": "class", "loc": [10, 41], "level": 0, "parent": null, "vector": [3, 0, 0.622, 0.7805, 0, 0.66, 1.0, 895, 0, 3, 0, 0, 0, 0, 15], "semantic": {"name": "SentiStrength", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SentiStrength():\n '''Wrapper class for SentiStrength java version'''\n \n RUN_COMMAND = \"java -jar\"\n SENTISTRENGTH_PATH = os.path.join(os.path.dirname(__file__), \"SentiStrengthCom.jar\")\n DATA_PATH = os.path.join(os.path.dirname(__file__), \"SentStrength_Data_Sept2011/\")\n \n def __init__(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1062:Expr_L11_C4", "label": "expression", "type": "expression", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1062:ClassDef_L10_C0", "vector": [8, 1, 0.2683, 0.0244, 1, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Wrapper class for SentiStrength java version'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L13_C4", "label": "RUN_COMMAND =", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1062:ClassDef_L10_C0", "vector": [14, 1, 0.3171, 0.0244, 1, 0.64, 0.1667, 313, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "RUN_COMMAND", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " RUN_COMMAND = \"java -jar\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L14_C4", "label": "SENTISTRENGTH_PATH = join()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1062:ClassDef_L10_C0", "vector": [14, 1, 0.3415, 0.0244, 1, 0.64, 0.3333, 190, 3, 2, 0, 0, 933, 10, 2], "semantic": {"name": "SENTISTRENGTH_PATH", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " SENTISTRENGTH_PATH = os.path.join(os.path.dirname(__file__), \"SentiStrengthCom.jar\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L15_C4", "label": "DATA_PATH = join()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1062:ClassDef_L10_C0", "vector": [14, 1, 0.3659, 0.0244, 1, 0.64, 0.5, 401, 3, 2, 0, 0, 933, 10, 2], "semantic": {"name": "DATA_PATH", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " DATA_PATH = os.path.join(os.path.dirname(__file__), \"SentStrength_Data_Sept2011/\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L17_C4", "label": "__init__", "type": "function", "loc": [17, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1062:ClassDef_L10_C0", "vector": [2, 1, 0.4268, 0.0488, 1, 0.64, 0.6667, 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 pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L20_C4", "label": "classifiy", "type": "function", "loc": [20, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1062:ClassDef_L10_C0", "vector": [2, 1, 0.6341, 0.3171, 1, 0.64, 0.8333, 202, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "classifiy", "arg_names": ["self", "text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def classifiy(self, text):\n commandArgs = \"%s %s sentidata %s cmd\" % (self.RUN_COMMAND, self.SENTISTRENGTH_PATH, self.DATA_PATH)\n commandArgs = commandArgs.split(\" \")\n \n process = Popen(commandArgs, stdin=PIPE, stdout=PIPE, stderr=PIPE)\n text = text.replace(\" \", \"+\")\n classification, dummy = process.communicate(text.encode(\"utf-8\"))\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L21_C8", "label": "commandArgs =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L20_C4", "vector": [14, 2, 0.5122, 0.0244, 2, 0.77, 0.0, 836, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "commandArgs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " commandArgs = \"%s %s sentidata %s cmd\" % (self.RUN_COMMAND, self.SENTISTRENGTH_PATH, self.DATA_PATH)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L22_C8", "label": "commandArgs = split()", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L20_C4", "vector": [14, 2, 0.5366, 0.0244, 2, 0.77, 0.125, 836, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "commandArgs", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " commandArgs = commandArgs.split(\" \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L24_C8", "label": "process = Popen()", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L20_C4", "vector": [14, 2, 0.5854, 0.0244, 2, 0.77, 0.25, 712, 3, 4, 0, 0, 568, 10, 1], "semantic": {"name": "process", "arg_names": [], "import_names": [], "rhs_call_name": "Popen", "annotation": ""}, "snippet": " process = Popen(commandArgs, stdin=PIPE, stdout=PIPE, stderr=PIPE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L25_C8", "label": "text = replace()", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L20_C4", "vector": [14, 2, 0.6098, 0.0244, 2, 0.77, 0.375, 439, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " text = text.replace(\" \", \"+\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L26_C8", "label": "classification, dummy = communicate()", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L20_C4", "vector": [14, 2, 0.6341, 0.0244, 2, 0.77, 0.5, 799, 3, 1, 0, 0, 768, 10, 2], "semantic": {"name": "classification, dummy", "arg_names": [], "import_names": [], "rhs_call_name": "communicate", "annotation": ""}, "snippet": " classification, dummy = process.communicate(text.encode(\"utf-8\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L28_C8", "label": "polarities = split()", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L20_C4", "vector": [14, 2, 0.6829, 0.0244, 2, 0.77, 0.625, 207, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "polarities", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " polarities = classification.split(\"\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L29_C8", "label": "polarities =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L20_C4", "vector": [14, 2, 0.7073, 0.0244, 2, 0.77, 0.75, 207, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "polarities", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " polarities = [self.polarity(line.strip()) for line in polarities]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L30_C8", "label": "polarities =", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L20_C4", "vector": [14, 2, 0.7317, 0.0244, 2, 0.77, 0.875, 207, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "polarities", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " polarities = [x for x in polarities if x is not None]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1062:Return_L32_C8", "label": "return", "type": "return", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L20_C4", "vector": [13, 2, 0.7805, 0.0244, 2, 0.77, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return polarities"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L34_C4", "label": "polarity", "type": "function", "loc": [34, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1062:ClassDef_L10_C0", "vector": [2, 1, 0.9146, 0.1951, 1, 0.64, 1.0, 487, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "polarity", "arg_names": ["self", "line"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def polarity(self, line):\n val = line.split(\" \")\n try:\n val = [int(x) for x in val]\n except:\n return None\n \n return sum(val)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L35_C8", "label": "val = split()", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L34_C4", "vector": [14, 2, 0.8537, 0.0244, 2, 0.98, 0.0, 618, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "val", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " val = line.split(\" \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1062:Try_L36_C8", "label": "try", "type": "try", "loc": [36, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L34_C4", "vector": [7, 2, 0.9146, 0.0976, 2, 0.98, 0.5, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n val = [int(x) for x in val]\n except:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L37_C12", "label": "val =", "type": "assigned_variable", "loc": [37, 37], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1062:Try_L36_C8", "vector": [14, 3, 0.9024, 0.0244, 3, 0.05, 0.0, 618, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "val", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " val = [int(x) for x in val]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1062:Return_L39_C12", "label": "return", "type": "return", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1062:Try_L36_C8", "vector": [13, 3, 0.9512, 0.0244, 3, 0.05, 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_1062:Return_L41_C8", "label": "return", "type": "return", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L34_C4", "vector": [13, 2, 1.0, 0.0244, 2, 0.98, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sum(val)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1062:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1062:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1062:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1062:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1062:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1062:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1062:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1062:Return_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1062:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1062:Try_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1062:Try_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1062:Assign_L37_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1062:Try_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1062:Return_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1062:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1062:Return_L41_C8"}]
from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: #from django.contrib import admin #admin.autodiscover() urlpatterns = patterns('ITInfluence.views', # Examples: # url(r'^$', 'InfrarougeTwitterInfluence.views.home', name='home'), # url(r'^InfrarougeTwitterInfluence/', include('InfrarougeTwitterInfluence.foo.urls')), # Uncomment the admin/doc line below to enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: # url(r'^admin/', include(admin.site.urls)), url(r'^$', 'index'), url(r'^twitter/hashtags/$', 'twitterBrowseHashtags'), url(r'^twitter/hashtag/(?P<hashtag>.+)/$', 'twitterHashtag'), url(r'^twitter/$', 'twitterStats'), url(r'^infrarouge/$', 'infrarougeStats'), url(r'^twitter/tweets/$', 'twitterBrowseTweets'), url(r'^twitter/collect/$', 'twitterShowCollectForm'), url(r'^twitter/stopStreaming/$', 'twitterStopStreaming'), url(r'^twitter/collect/toggleFollowersCollection/$', 'twitterToggleCollectingFollowers'), url(r'^infrarouge/forums/$', 'getInfrarougeForums'), url(r'^twitter/followers-ranking/$', 'twitterFollowersCountRanking'), # infrarouge images url(r'^infrarouge/images/ndi/$', 'getInfrarougeNDI'), url(r'^infrarouge/images/ndi-time/$', 'getInfrarougeNDITimeFigure'), url(r'^infrarouge/images/ndi-replies-count/$', 'getInfrarougeNDIReplyCountFigure'), url(r'^infrarouge/images/replies-graph/$', 'getInfrarougeRepliesGraph'), url(r'^infrarouge/images/user-discussion-graph/$', 'getInfrarougeUserDiscussionGraph'), # twitter images url(r'^twitter/images/ndi/$', 'getTwitterNDI'), url(r'^twitter/images/ndi/(?P<hashtag>.+)/$', 'getTwitterNDISingleHashtag'), url(r'^twitter/images/ndi-time/$', 'getTwitterNDITimeFigure'), url(r'^twitter/images/ndi-replies-count/$', 'getTwitterNDIReplyCountFigure'), url(r'^twitter/images/replies-graph/$', 'getTwitterRepliesGraph'), url(r'^twitter/images/followers-graph/$', 'getTwitterFollowersGraph'), # tools url(r'^tools/showimage/(?P<path>.+)$', 'showImage'), )
ajibawa-2023/Python-Code-Large/train/row_1063
2
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_1063:ImportFrom_L1_C0", "label": "from django.conf.urls import patterns, include, url", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0217, 0.0217, 0, 0.66, 0.0, 528, 0, 3, 0, 0, 528, 0, 0], "semantic": {"name": "django.conf.urls", "arg_names": [], "import_names": ["patterns", "include", "url"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf.urls import patterns, include, url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1063:Assign_L7_C0", "label": "urlpatterns = patterns()", "type": "assigned_variable", "loc": [7, 46], "level": 0, "parent": null, "vector": [14, 0, 0.5761, 0.8696, 0, 0.66, 1.0, 990, 3, 24, 0, 0, 75, 10, 24], "semantic": {"name": "urlpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "patterns", "annotation": ""}, "snippet": "urlpatterns = patterns('ITInfluence.views',\n # Examples:\n # url(r'^$', 'InfrarougeTwitterInfluence.views.home', name='home'),\n # url(r'^InfrarougeTwitterInfluence/', include('InfrarougeTwitterInfluence.foo.urls')),\n\n # Uncomment the admin/doc line below to enable admin documentation:\n # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),\n"}]
[]
# Django settings for InfrarougeTwitterInfluence project. import os PROJECT_PATH = os.path.realpath(os.path.join(os.path.dirname(__file__), os.path.pardir)) DEBUG = False TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS DATABASES = { 'infrarouge': { # SQLite database for Infrarouge data 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': os.path.join(PROJECT_PATH, '../InfrarougeGrabber/infrarouge.db'), # The following settings are not used with sqlite3: 'USER': '', 'PASSWORD': '', 'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. 'PORT': '', # Set to empty string for default. }, 'default': { # MySQL database for Twitter data 'ENGINE': 'django.db.backends.mysql', 'NAME': 'SocialInfluence', 'USER': 'infrarouge', 'PASSWORD': 'infrarouge', 'HOST': '127.0.0.1', 'PORT': '3306', }, } DATABASE_ROUTERS = [ 'ITInfluence.DatabaseRouters.TwitterRouter', ] # Hosts/domain names that are valid for this site; required if DEBUG is False # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts ALLOWED_HOSTS = ["*"] # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. # In a Windows environment this must be set to your system time zone. TIME_ZONE = 'America/Chicago' # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html LANGUAGE_CODE = 'en-us' SITE_ID = 1 # If you set this to False, Django will make some optimizations so as not # to load the internationalization machinery. USE_I18N = True # If you set this to False, Django will not format dates, numbers and # calendars according to the current locale. USE_L10N = True # If you set this to False, Django will not use timezone-aware datetimes. USE_TZ = True # Absolute filesystem path to the directory that will hold user-uploaded files. # Example: "/var/www/example.com/media/" MEDIA_ROOT = '' # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash. # Examples: "http://example.com/media/", "http://media.example.com/" MEDIA_URL = '' # Absolute path to the directory static files should be collected to. # Don't put anything in this directory yourself; store your static files # in apps' "static/" subdirectories and in STATICFILES_DIRS. # Example: "/var/www/example.com/static/" STATIC_ROOT = '' # URL prefix for static files. # Example: "http://example.com/static/", "http://static.example.com/" STATIC_URL = '/static/' # Additional locations of static files STATICFILES_DIRS = ( # Put strings here, like "/home/html/static" or "C:/www/django/static". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. ) # List of finder classes that know how to find static files in # various locations. STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', # 'django.contrib.staticfiles.finders.DefaultStorageFinder', ) # Make this unique, and don't share it with anybody. SECRET_KEY = '(n1hz*0tl2p--qf@mz*7g6r%5z#lm*gx!-d9cu=ebu$ameht=^' # List of callables that know how to import templates from various sources. TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', # 'django.template.loaders.eggs.Loader', ) MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', # Uncomment the next line for simple clickjacking protection: # 'django.middleware.clickjacking.XFrameOptionsMiddleware', ) ROOT_URLCONF = 'InfrarougeTwitterInfluence.urls' # Python dotted path to the WSGI application used by Django's runserver. WSGI_APPLICATION = 'InfrarougeTwitterInfluence.wsgi.application' TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. os.path.join(PROJECT_PATH, "templates"), ) INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', # Uncomment the next line to enable the admin: # 'django.contrib.admin', # Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs', 'ITInfluence', ) # A sample logging configuration. The only tangible logging # performed by this configuration is to send an email to # the site admins on every HTTP 500 error when DEBUG=False. # See http://docs.djangoproject.com/en/dev/topics/logging for # more details on how to customize your logging configuration. LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'filters': { 'require_debug_false': { '()': 'django.utils.log.RequireDebugFalse' } }, 'handlers': { 'mail_admins': { 'level': 'ERROR', 'filters': ['require_debug_false'], 'class': 'django.utils.log.AdminEmailHandler' } }, 'loggers': { 'django.request': { 'handlers': ['mail_admins'], 'level': 'ERROR', 'propagate': True, }, } }
ajibawa-2023/Python-Code-Large/train/row_1064
29
175
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Import_L2_C0", "label": "os import os", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0114, 0.0057, 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_1064:Assign_L4_C0", "label": "PROJECT_PATH = realpath()", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.0229, 0.0057, 0, 0.66, 0.0357, 660, 3, 1, 0, 0, 45, 10, 3], "semantic": {"name": "PROJECT_PATH", "arg_names": [], "import_names": [], "rhs_call_name": "realpath", "annotation": ""}, "snippet": "PROJECT_PATH = os.path.realpath(os.path.join(os.path.dirname(__file__), os.path.pardir))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L6_C0", "label": "DEBUG =", "type": "assigned_variable", "loc": [6, 6], "level": 0, "parent": null, "vector": [14, 0, 0.0343, 0.0057, 0, 0.66, 0.0714, 309, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "DEBUG", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DEBUG = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L7_C0", "label": "TEMPLATE_DEBUG =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.04, 0.0057, 0, 0.66, 0.1071, 7, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "TEMPLATE_DEBUG", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEMPLATE_DEBUG = DEBUG"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L9_C0", "label": "ADMINS =", "type": "assigned_variable", "loc": [9, 11], "level": 0, "parent": null, "vector": [14, 0, 0.0571, 0.0171, 0, 0.66, 0.1429, 223, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "ADMINS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ADMINS = (\n # ('Your Name', 'your_email@example.com'),\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L13_C0", "label": "MANAGERS =", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.0743, 0.0057, 0, 0.66, 0.1786, 275, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "MANAGERS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MANAGERS = ADMINS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L15_C0", "label": "DATABASES =", "type": "assigned_variable", "loc": [15, 33], "level": 0, "parent": null, "vector": [14, 0, 0.1371, 0.1086, 0, 0.66, 0.2143, 12, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "DATABASES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DATABASES = {\n 'infrarouge': { # SQLite database for Infrarouge data\n 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.\n 'NAME': os.path.join(PROJECT_PATH, '../InfrarougeGrabber/infrarouge.db'),\n # The following settings are not used with sqlite3:\n 'USER': '',\n 'PASSWORD': '',\n 'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L35_C0", "label": "DATABASE_ROUTERS =", "type": "assigned_variable", "loc": [35, 37], "level": 0, "parent": null, "vector": [14, 0, 0.2057, 0.0171, 0, 0.66, 0.25, 331, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "DATABASE_ROUTERS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DATABASE_ROUTERS = [\n 'ITInfluence.DatabaseRouters.TwitterRouter',\n ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L42_C0", "label": "ALLOWED_HOSTS =", "type": "assigned_variable", "loc": [42, 42], "level": 0, "parent": null, "vector": [14, 0, 0.24, 0.0057, 0, 0.66, 0.2857, 363, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "ALLOWED_HOSTS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ALLOWED_HOSTS = [\"*\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L48_C0", "label": "TIME_ZONE =", "type": "assigned_variable", "loc": [48, 48], "level": 0, "parent": null, "vector": [14, 0, 0.2743, 0.0057, 0, 0.66, 0.3214, 774, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TIME_ZONE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TIME_ZONE = 'America/Chicago'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L52_C0", "label": "LANGUAGE_CODE =", "type": "assigned_variable", "loc": [52, 52], "level": 0, "parent": null, "vector": [14, 0, 0.2971, 0.0057, 0, 0.66, 0.3571, 450, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "LANGUAGE_CODE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "LANGUAGE_CODE = 'en-us'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L54_C0", "label": "SITE_ID =", "type": "assigned_variable", "loc": [54, 54], "level": 0, "parent": null, "vector": [14, 0, 0.3086, 0.0057, 0, 0.66, 0.3929, 122, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "SITE_ID", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SITE_ID = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L58_C0", "label": "USE_I18N =", "type": "assigned_variable", "loc": [58, 58], "level": 0, "parent": null, "vector": [14, 0, 0.3314, 0.0057, 0, 0.66, 0.4286, 547, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "USE_I18N", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "USE_I18N = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L62_C0", "label": "USE_L10N =", "type": "assigned_variable", "loc": [62, 62], "level": 0, "parent": null, "vector": [14, 0, 0.3543, 0.0057, 0, 0.66, 0.4643, 754, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "USE_L10N", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "USE_L10N = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L65_C0", "label": "USE_TZ =", "type": "assigned_variable", "loc": [65, 65], "level": 0, "parent": null, "vector": [14, 0, 0.3714, 0.0057, 0, 0.66, 0.5, 105, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "USE_TZ", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "USE_TZ = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L69_C0", "label": "MEDIA_ROOT =", "type": "assigned_variable", "loc": [69, 69], "level": 0, "parent": null, "vector": [14, 0, 0.3943, 0.0057, 0, 0.66, 0.5357, 764, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "MEDIA_ROOT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MEDIA_ROOT = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L74_C0", "label": "MEDIA_URL =", "type": "assigned_variable", "loc": [74, 74], "level": 0, "parent": null, "vector": [14, 0, 0.4229, 0.0057, 0, 0.66, 0.5714, 120, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "MEDIA_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MEDIA_URL = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L80_C0", "label": "STATIC_ROOT =", "type": "assigned_variable", "loc": [80, 80], "level": 0, "parent": null, "vector": [14, 0, 0.4571, 0.0057, 0, 0.66, 0.6071, 828, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "STATIC_ROOT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "STATIC_ROOT = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L84_C0", "label": "STATIC_URL =", "type": "assigned_variable", "loc": [84, 84], "level": 0, "parent": null, "vector": [14, 0, 0.48, 0.0057, 0, 0.66, 0.6429, 18, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "STATIC_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "STATIC_URL = '/static/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L87_C0", "label": "STATICFILES_DIRS =", "type": "assigned_variable", "loc": [87, 91], "level": 0, "parent": null, "vector": [14, 0, 0.5086, 0.0286, 0, 0.66, 0.6786, 743, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "STATICFILES_DIRS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "STATICFILES_DIRS = (\n # Put strings here, like \"/home/html/static\" or \"C:/www/django/static\".\n # Always use forward slashes, even on Windows.\n # Don't forget to use absolute paths, not relative paths.\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L95_C0", "label": "STATICFILES_FINDERS =", "type": "assigned_variable", "loc": [95, 99], "level": 0, "parent": null, "vector": [14, 0, 0.5543, 0.0286, 0, 0.66, 0.7143, 94, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "STATICFILES_FINDERS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "STATICFILES_FINDERS = (\n 'django.contrib.staticfiles.finders.FileSystemFinder',\n 'django.contrib.staticfiles.finders.AppDirectoriesFinder',\n# 'django.contrib.staticfiles.finders.DefaultStorageFinder',\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L102_C0", "label": "SECRET_KEY =", "type": "assigned_variable", "loc": [102, 102], "level": 0, "parent": null, "vector": [14, 0, 0.5829, 0.0057, 0, 0.66, 0.75, 112, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SECRET_KEY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SECRET_KEY = '(n1hz*0tl2p--qf@mz*7g6r%5z#lm*gx!-d9cu=ebu$ameht=^'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L105_C0", "label": "TEMPLATE_LOADERS =", "type": "assigned_variable", "loc": [105, 109], "level": 0, "parent": null, "vector": [14, 0, 0.6114, 0.0286, 0, 0.66, 0.7857, 473, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "TEMPLATE_LOADERS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEMPLATE_LOADERS = (\n 'django.template.loaders.filesystem.Loader',\n 'django.template.loaders.app_directories.Loader',\n# 'django.template.loaders.eggs.Loader',\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L111_C0", "label": "MIDDLEWARE_CLASSES =", "type": "assigned_variable", "loc": [111, 119], "level": 0, "parent": null, "vector": [14, 0, 0.6571, 0.0514, 0, 0.66, 0.8214, 641, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "MIDDLEWARE_CLASSES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MIDDLEWARE_CLASSES = (\n 'django.middleware.common.CommonMiddleware',\n 'django.contrib.sessions.middleware.SessionMiddleware',\n 'django.middleware.csrf.CsrfViewMiddleware',\n 'django.contrib.auth.middleware.AuthenticationMiddleware',\n 'django.contrib.messages.middleware.MessageMiddleware',\n # Uncomment the next line for simple clickjacking protection:\n # 'django.middleware.clickjacking.XFrameOptionsMiddleware',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L121_C0", "label": "ROOT_URLCONF =", "type": "assigned_variable", "loc": [121, 121], "level": 0, "parent": null, "vector": [14, 0, 0.6914, 0.0057, 0, 0.66, 0.8571, 281, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROOT_URLCONF", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROOT_URLCONF = 'InfrarougeTwitterInfluence.urls'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L124_C0", "label": "WSGI_APPLICATION =", "type": "assigned_variable", "loc": [124, 124], "level": 0, "parent": null, "vector": [14, 0, 0.7086, 0.0057, 0, 0.66, 0.8929, 483, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "WSGI_APPLICATION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "WSGI_APPLICATION = 'InfrarougeTwitterInfluence.wsgi.application'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L126_C0", "label": "TEMPLATE_DIRS =", "type": "assigned_variable", "loc": [126, 131], "level": 0, "parent": null, "vector": [14, 0, 0.7343, 0.0343, 0, 0.66, 0.9286, 910, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "TEMPLATE_DIRS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEMPLATE_DIRS = (\n # Put strings here, like \"/home/html/django_templates\" or \"C:/www/django/templates\".\n # Always use forward slashes, even on Windows.\n # Don't forget to use absolute paths, not relative paths.\n os.path.join(PROJECT_PATH, \"templates\"),\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L133_C0", "label": "INSTALLED_APPS =", "type": "assigned_variable", "loc": [133, 145], "level": 0, "parent": null, "vector": [14, 0, 0.7943, 0.0743, 0, 0.66, 0.9643, 648, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "INSTALLED_APPS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "INSTALLED_APPS = (\n 'django.contrib.auth',\n 'django.contrib.contenttypes',\n 'django.contrib.sessions',\n 'django.contrib.sites',\n 'django.contrib.messages',\n 'django.contrib.staticfiles',\n # Uncomment the next line to enable the admin:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1064:Assign_L152_C0", "label": "LOGGING =", "type": "assigned_variable", "loc": [152, 174], "level": 0, "parent": null, "vector": [14, 0, 0.9314, 0.1314, 0, 0.66, 1.0, 136, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "LOGGING", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "LOGGING = {\n 'version': 1,\n 'disable_existing_loggers': False,\n 'filters': {\n 'require_debug_false': {\n '()': 'django.utils.log.RequireDebugFalse'\n }\n },"}]
[]
""" WSGI config for InfrarougeTwitterInfluence project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`` setting. Usually you will have the standard Django WSGI application here, but it also might make sense to replace the whole Django WSGI application with a custom one that later delegates to the Django one. For example, you could introduce WSGI middleware here, or combine a Django application with an application of another framework. """ import os # We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks # if running multiple sites in the same mod_wsgi process. To fix this, use # mod_wsgi daemon mode with each site in its own daemon process, or use # os.environ["DJANGO_SETTINGS_MODULE"] = "InfrarougeTwitterInfluence.settings" os.environ.setdefault("DJANGO_SETTINGS_MODULE", "InfrarougeTwitterInfluence.settings") # This application object is used by any WSGI server configured to use this # file. This includes Django's development server, if the WSGI_APPLICATION # setting points here. from django.core.wsgi import get_wsgi_application application = get_wsgi_application() # Apply WSGI middleware here. # from helloworld.wsgi import HelloWorldApplication # application = HelloWorldApplication(application)
ajibawa-2023/Python-Code-Large/train/row_1065
5
32
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1065:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 15], "level": 0, "parent": null, "vector": [8, 0, 0.25, 0.4688, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nWSGI config for InfrarougeTwitterInfluence project.\n\nThis module contains the WSGI application used by Django's development server\nand any production WSGI deployments. It should expose a module-level variable\nnamed ``application``. Django's ``runserver`` and ``runfcgi`` commands discover\nthis application via the ``WSGI_APPLICATION`` setting.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1065:Import_L16_C0", "label": "os import os", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.0312, 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_1065:Expr_L22_C0", "label": "setdefault()", "type": "expression", "loc": [22, 22], "level": 0, "parent": null, "vector": [8, 0, 0.6875, 0.0312, 0, 0.66, 0.5, 262, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": "os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"InfrarougeTwitterInfluence.settings\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1065:ImportFrom_L27_C0", "label": "from django.core.wsgi import get_wsgi_application", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.8438, 0.0312, 0, 0.66, 0.75, 143, 0, 1, 0, 0, 143, 0, 0], "semantic": {"name": "django.core.wsgi", "arg_names": [], "import_names": ["get_wsgi_application"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.wsgi import get_wsgi_application"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1065:Assign_L28_C0", "label": "application = get_wsgi_application()", "type": "assigned_variable", "loc": [28, 28], "level": 0, "parent": null, "vector": [14, 0, 0.875, 0.0312, 0, 0.66, 1.0, 244, 3, 0, 0, 0, 387, 10, 1], "semantic": {"name": "application", "arg_names": [], "import_names": [], "rhs_call_name": "get_wsgi_application", "annotation": ""}, "snippet": "application = get_wsgi_application()"}]
[]
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "InfrarougeTwitterInfluence.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
ajibawa-2023/Python-Code-Large/train/row_1066
6
10
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1066:Import_L2_C0", "label": "os import os", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.1, 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_1066:Import_L3_C0", "label": "sys import sys", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.3, 0.1, 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_1066:If_L5_C0", "label": "if", "type": "if", "loc": [5, 10], "level": 0, "parent": null, "vector": [4, 0, 0.75, 0.6, 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 os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"InfrarougeTwitterInfluence.settings\")\n\n from django.core.management import execute_from_command_line\n\n execute_from_command_line(sys.argv)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1066:Expr_L6_C4", "label": "setdefault()", "type": "expression", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1066:If_L5_C0", "vector": [8, 1, 0.6, 0.1, 1, 0.9, 0.0, 262, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"InfrarougeTwitterInfluence.settings\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1066:ImportFrom_L8_C4", "label": "from django.core.management import execute_from_command_line", "type": "import", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1066:If_L5_C0", "vector": [1, 1, 0.8, 0.1, 1, 0.9, 0.5, 879, 0, 1, 0, 0, 879, 0, 0], "semantic": {"name": "django.core.management", "arg_names": [], "import_names": ["execute_from_command_line"], "rhs_call_name": "", "annotation": ""}, "snippet": " from django.core.management import execute_from_command_line"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1066:Expr_L10_C4", "label": "execute_from_command_line()", "type": "expression", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1066:If_L5_C0", "vector": [8, 1, 1.0, 0.1, 1, 0.9, 1.0, 60, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute_from_command_line", "arg_names": [], "import_names": [], "rhs_call_name": "execute_from_command_line", "annotation": ""}, "snippet": " execute_from_command_line(sys.argv)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1066:If_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1066:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1066:If_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1066:ImportFrom_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1066:If_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1066:Expr_L10_C4"}]
''' Created on 8 juin 2013 @author: Nils Amiet ''' import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import networkx as nx import math import random from django.http.response import HttpResponse class GraphPlotter(): '''Class used to plot networkx graphs with matplotlib''' def __init__(self, dpi=100, width=1600, height=900): self.dpi = dpi self.width = width self.height = height def setFigureSize(self, figure): w = int(self.width/self.dpi) h = int(self.height/self.dpi) figure.set_size_inches(w, h) def bipartiteNodePositions(self, graph): '''Compute layout with nice node positions for a bipartite graph''' bipartiteAttributes = nx.get_node_attributes(graph, "bipartite") partitionA = [node for node in graph.nodes() if bipartiteAttributes[node] is 0] # bipartite=0 partitionB = [node for node in graph.nodes() if bipartiteAttributes[node] is not 0] # bipartite=1 pos = {} for node in partitionA: xCoord = random.uniform(0, 0.2) # random position on the left side yCoord = random.uniform(0, 1) pos[node] = [xCoord, yCoord] for node in partitionB: xCoord = random.uniform(0.8, 1) # random position on the right side yCoord = random.uniform(0, 1) pos[node] = [xCoord, yCoord] return pos def memoryPlot(self, graph, bipartite=False, pos=None, nodeSizes=None, nodeColor='r', nodeLabel="Nodes", nodeLabel2="Nodes 2", edgeLabel="Edges"): '''Plots the network using matplotlib''' if pos is None: # pos = nx.spring_layout(graph) pos = nx.random_layout(graph) nodeSize = 25 edgeWidth = 0.5 if nodeSizes is not None: nodeSize = nodeSizes figure = plt.figure() rect = (0,0,1,1) ax = figure.add_axes(rect) matplotlib.pyplot.axis("off") if bipartite: bipartiteAttributes = nx.get_node_attributes(graph, "bipartite") users = [node for node in graph.nodes() if bipartiteAttributes[node] is 0] # bipartite=0 discussions = [node for node in graph.nodes() if bipartiteAttributes[node] is not 0] # bipartite=1 nx.draw_networkx_nodes(graph, ax=ax, pos=pos, node_size=nodeSize, nodelist=users, label=nodeLabel) nx.draw_networkx_nodes(graph, ax=ax, pos=pos, node_size=nodeSize, nodelist=discussions, node_color='b', label=nodeLabel2) nx.draw_networkx_edges(graph, ax=ax, pos=pos, width=edgeWidth, label=edgeLabel) userCount = len(users) discussionCount = len(discussions) edgeCount = len(graph.edges()) graphInfo = str() + "%s users\n%s discussions\n%s edges\n" % (userCount, discussionCount, edgeCount) figure.text(0,0, graphInfo) else: nx.draw_networkx_nodes(graph, ax=ax, pos=pos, node_size=nodeSize, nodelist=graph.nodes(), node_color=nodeColor, label=nodeLabel) nx.draw_networkx_edges(graph, ax=ax, pos=pos, width=edgeWidth, label=edgeLabel) nodeCount = len(graph.nodes()) edgeCount = len(graph.edges()) graphInfo = str() + "%s nodes \n%s edges\n" % (nodeCount, edgeCount) figure.text(0,0, graphInfo) try: matplotlib.pyplot.legend() except: print("Warning: drawing legend failed") response = HttpResponse(content_type="image/png") self.setFigureSize(figure) figure.savefig(response, format='png', dpi=self.dpi, bbox_inches='tight') return response class TwoDimensionalValuesPlotter(): '''Class used to plot 2D datasets with matplotlib''' def __init__(self, dpi=100, width=1600, height=900): self.dpi = dpi self.width = width self.height = height def setFigureSize(self, figure): w = int(self.width/self.dpi) h = int(self.height/self.dpi) figure.set_size_inches(w, h) def plot(self, xValues, yValues, filename, xlabel, ylabel): figure = plt.figure() subplot = figure.add_subplot(1, 1, 1) subplot.set_xlabel(xlabel) subplot.set_ylabel(ylabel) subplot.grid(True) subplot.plot(xValues, yValues) self.setFigureSize(figure) plt.savefig(filename, dpi=self.dpi) def memoryPlotMultipleDatasets(self, datasets, xlabel, ylabel): '''Plots multiple curves on the same chart''' figure = plt.figure() datasetCount = len(datasets) width = math.ceil(math.sqrt(datasetCount)) for datasetId, dataset in enumerate(datasets): subplot = figure.add_subplot(width, width, datasetId) subplot.set_xlabel(xlabel) subplot.set_ylabel(ylabel) subplot.grid(True) title = dataset[0] xValues = dataset[1][0] yValues = dataset[1][1] subplot.set_title(title) subplot.plot(xValues, yValues) # plot title/axis/labels font size for item in ([subplot.title, subplot.xaxis.label, subplot.yaxis.label] + subplot.get_xticklabels() + subplot.get_yticklabels()): item.set_fontsize(8) figure.tight_layout() response = HttpResponse(content_type="image/png") self.setFigureSize(figure) figure.savefig(response, format='png') return response def memoryPlotMultipleDatasetsMultidimensional(self, datasetsList, xlabel, ylabel): '''Plots multiple subcharts on the same chart''' figure = plt.figure() datasets = zip(*datasetsList) legendData = [1,2] # dummy values datasetCount = len(datasets) width = math.ceil(math.sqrt(datasetCount)) for datasetId, datasetTuple in enumerate(datasets): subplot = figure.add_subplot(width, width, datasetId) subplot.set_xlabel(xlabel) subplot.set_ylabel(ylabel) subplot.grid(True) title = datasetTuple[0][0] for num, dataset in enumerate(datasetTuple): xValues = dataset[1][0] yValues = dataset[1][1] subplot.set_title(title) legendData[num], = subplot.plot(xValues, yValues, label=num) # plot title/axis/labels font size for item in ([subplot.title, subplot.xaxis.label, subplot.yaxis.label] + subplot.get_xticklabels() + subplot.get_yticklabels()): item.set_fontsize(8) figure.tight_layout() figure.legend(legendData, ["equal time intervals", "equal reply count intervals"], loc="lower left", prop={"size": 6}) response = HttpResponse(content_type="image/png") self.setFigureSize(figure) figure.savefig(response, format='png') return response
ajibawa-2023/Python-Code-Large/train/row_1067
137
196
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0153, 0.0255, 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 8 juin 2013\n\n@author: Nils Amiet\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Import_L7_C0", "label": "matplotlib import matplotlib", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0357, 0.0051, 0, 0.66, 0.1111, 75, 0, 1, 0, 0, 75, 0, 0], "semantic": {"name": "matplotlib", "arg_names": [], "import_names": ["matplotlib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import matplotlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L8_C0", "label": "use()", "type": "expression", "loc": [8, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0408, 0.0051, 0, 0.66, 0.2222, 906, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "use", "arg_names": [], "import_names": [], "rhs_call_name": "use", "annotation": ""}, "snippet": "matplotlib.use(\"Agg\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Import_L9_C0", "label": "matplotlib.pyplot import plt", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0459, 0.0051, 0, 0.66, 0.3333, 596, 0, 1, 0, 0, 596, 0, 0], "semantic": {"name": "matplotlib.pyplot", "arg_names": [], "import_names": ["plt"], "rhs_call_name": "", "annotation": ""}, "snippet": "import matplotlib.pyplot as plt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Import_L10_C0", "label": "networkx import nx", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.051, 0.0051, 0, 0.66, 0.4444, 691, 0, 1, 0, 0, 691, 0, 0], "semantic": {"name": "networkx", "arg_names": [], "import_names": ["nx"], "rhs_call_name": "", "annotation": ""}, "snippet": "import networkx as nx"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Import_L11_C0", "label": "math import math", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0561, 0.0051, 0, 0.66, 0.5556, 526, 0, 1, 0, 0, 526, 0, 0], "semantic": {"name": "math", "arg_names": [], "import_names": ["math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Import_L12_C0", "label": "random import random", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0612, 0.0051, 0, 0.66, 0.6667, 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_1067:ImportFrom_L13_C0", "label": "from django.http.response import HttpResponse", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0663, 0.0051, 0, 0.66, 0.7778, 202, 0, 1, 0, 0, 202, 0, 0], "semantic": {"name": "django.http.response", "arg_names": [], "import_names": ["HttpResponse"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.http.response import HttpResponse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L15_C0", "label": "GraphPlotter", "type": "class", "loc": [15, 98], "level": 0, "parent": null, "vector": [3, 0, 0.2883, 0.4286, 0, 0.66, 0.8889, 214, 0, 4, 0, 0, 0, 0, 40], "semantic": {"name": "GraphPlotter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GraphPlotter():\n '''Class used to plot networkx graphs with matplotlib'''\n \n def __init__(self, dpi=100, width=1600, height=900):\n self.dpi = dpi\n self.width = width\n self.height = height\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L16_C4", "label": "expression", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L15_C0", "vector": [8, 1, 0.0816, 0.0051, 1, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Class used to plot networkx graphs with matplotlib'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L18_C4", "label": "__init__", "type": "function", "loc": [18, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L15_C0", "vector": [2, 1, 0.0995, 0.0204, 1, 0.57, 0.25, 555, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "dpi", "width", "height"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, dpi=100, width=1600, height=900):\n self.dpi = dpi\n self.width = width\n self.height = height"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L19_C8", "label": "self.dpi =", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L18_C4", "vector": [14, 2, 0.0969, 0.0051, 2, 0.04, 0.0, 873, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.dpi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dpi = dpi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L20_C8", "label": "self.width =", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L18_C4", "vector": [14, 2, 0.102, 0.0051, 2, 0.04, 0.5, 901, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.width", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.width = width"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L21_C8", "label": "self.height =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L18_C4", "vector": [14, 2, 0.1071, 0.0051, 2, 0.04, 1.0, 466, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.height", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.height = height"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L23_C4", "label": "setFigureSize", "type": "function", "loc": [23, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L15_C0", "vector": [2, 1, 0.125, 0.0204, 1, 0.57, 0.5, 461, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "setFigureSize", "arg_names": ["self", "figure"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setFigureSize(self, figure):\n w = int(self.width/self.dpi)\n h = int(self.height/self.dpi)\n figure.set_size_inches(w, h)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L24_C8", "label": "w = int()", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L23_C4", "vector": [14, 2, 0.1224, 0.0051, 2, 0.46, 0.0, 549, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " w = int(self.width/self.dpi)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L25_C8", "label": "h = int()", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L23_C4", "vector": [14, 2, 0.1276, 0.0051, 2, 0.46, 0.5, 686, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "h", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " h = int(self.height/self.dpi)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L26_C8", "label": "set_size_inches()", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L23_C4", "vector": [8, 2, 0.1327, 0.0051, 2, 0.46, 1.0, 620, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_size_inches", "arg_names": [], "import_names": [], "rhs_call_name": "set_size_inches", "annotation": ""}, "snippet": " figure.set_size_inches(w, h)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L28_C4", "label": "bipartiteNodePositions", "type": "function", "loc": [28, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L15_C0", "vector": [2, 1, 0.1913, 0.102, 1, 0.57, 0.75, 445, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "bipartiteNodePositions", "arg_names": ["self", "graph"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def bipartiteNodePositions(self, graph):\n '''Compute layout with nice node positions for a bipartite graph'''\n bipartiteAttributes = nx.get_node_attributes(graph, \"bipartite\")\n \n partitionA = [node for node in graph.nodes() if bipartiteAttributes[node] is 0] # bipartite=0\n partitionB = [node for node in graph.nodes() if bipartiteAttributes[node] is not 0] # bipartite=1\n \n pos = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L29_C8", "label": "expression", "type": "expression", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L28_C4", "vector": [8, 2, 0.148, 0.0051, 2, 0.22, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Compute layout with nice node positions for a bipartite graph'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L30_C8", "label": "bipartiteAttributes = get_node_attributes()", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L28_C4", "vector": [14, 2, 0.1531, 0.0051, 2, 0.22, 0.1429, 554, 3, 2, 0, 0, 151, 10, 1], "semantic": {"name": "bipartiteAttributes", "arg_names": [], "import_names": [], "rhs_call_name": "get_node_attributes", "annotation": ""}, "snippet": " bipartiteAttributes = nx.get_node_attributes(graph, \"bipartite\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L32_C8", "label": "partitionA =", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L28_C4", "vector": [14, 2, 0.1633, 0.0051, 2, 0.22, 0.2857, 786, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "partitionA", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " partitionA = [node for node in graph.nodes() if bipartiteAttributes[node] is 0] # bipartite=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L33_C8", "label": "partitionB =", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L28_C4", "vector": [14, 2, 0.1684, 0.0051, 2, 0.22, 0.4286, 929, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "partitionB", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " partitionB = [node for node in graph.nodes() if bipartiteAttributes[node] is not 0] # bipartite=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L35_C8", "label": "pos =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L28_C4", "vector": [14, 2, 0.1786, 0.0051, 2, 0.22, 0.5714, 627, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L37_C8", "label": "for node", "type": "for", "loc": [37, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L28_C4", "vector": [6, 2, 0.1964, 0.0204, 2, 0.22, 0.7143, 772, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for node in partitionA:\n xCoord = random.uniform(0, 0.2) # random position on the left side\n yCoord = random.uniform(0, 1)\n pos[node] = [xCoord, yCoord]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L38_C12", "label": "xCoord = uniform()", "type": "assigned_variable", "loc": [38, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L37_C8", "vector": [14, 3, 0.1939, 0.0051, 3, 0.44, 0.0, 883, 3, 2, 0, 0, 463, 10, 1], "semantic": {"name": "xCoord", "arg_names": [], "import_names": [], "rhs_call_name": "uniform", "annotation": ""}, "snippet": " xCoord = random.uniform(0, 0.2) # random position on the left side"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L39_C12", "label": "yCoord = uniform()", "type": "assigned_variable", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L37_C8", "vector": [14, 3, 0.199, 0.0051, 3, 0.44, 0.5, 985, 3, 2, 0, 0, 463, 10, 1], "semantic": {"name": "yCoord", "arg_names": [], "import_names": [], "rhs_call_name": "uniform", "annotation": ""}, "snippet": " yCoord = random.uniform(0, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L40_C12", "label": "assign", "type": "assigned_variable", "loc": [40, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L37_C8", "vector": [14, 3, 0.2041, 0.0051, 3, 0.44, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos[node] = [xCoord, yCoord]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L42_C8", "label": "for node", "type": "for", "loc": [42, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L28_C4", "vector": [6, 2, 0.2219, 0.0204, 2, 0.22, 0.8571, 772, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for node in partitionB:\n xCoord = random.uniform(0.8, 1) # random position on the right side\n yCoord = random.uniform(0, 1)\n pos[node] = [xCoord, yCoord]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L43_C12", "label": "xCoord = uniform()", "type": "assigned_variable", "loc": [43, 43], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L42_C8", "vector": [14, 3, 0.2194, 0.0051, 3, 0.88, 0.0, 883, 3, 2, 0, 0, 463, 10, 1], "semantic": {"name": "xCoord", "arg_names": [], "import_names": [], "rhs_call_name": "uniform", "annotation": ""}, "snippet": " xCoord = random.uniform(0.8, 1) # random position on the right side"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L44_C12", "label": "yCoord = uniform()", "type": "assigned_variable", "loc": [44, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L42_C8", "vector": [14, 3, 0.2245, 0.0051, 3, 0.88, 0.5, 985, 3, 2, 0, 0, 463, 10, 1], "semantic": {"name": "yCoord", "arg_names": [], "import_names": [], "rhs_call_name": "uniform", "annotation": ""}, "snippet": " yCoord = random.uniform(0, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L45_C12", "label": "assign", "type": "assigned_variable", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L42_C8", "vector": [14, 3, 0.2296, 0.0051, 3, 0.88, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos[node] = [xCoord, yCoord]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Return_L47_C8", "label": "return", "type": "return", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L28_C4", "vector": [13, 2, 0.2398, 0.0051, 2, 0.22, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "label": "memoryPlot", "type": "function", "loc": [49, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L15_C0", "vector": [2, 1, 0.375, 0.2551, 1, 0.57, 1.0, 314, 0, 9, 1, 0, 0, 0, 30], "semantic": {"name": "memoryPlot", "arg_names": ["self", "graph", "bipartite", "pos", "nodeSizes", "nodeColor", "nodeLabel", "nodeLabel2", "edgeLabel"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def memoryPlot(self, graph, bipartite=False, pos=None, nodeSizes=None, nodeColor='r', nodeLabel=\"Nodes\", nodeLabel2=\"Nodes 2\", edgeLabel=\"Edges\"):\n '''Plots the network using matplotlib'''\n if pos is None:\n# pos = nx.spring_layout(graph)\n pos = nx.random_layout(graph)\n \n nodeSize = 25\n edgeWidth = 0.5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L50_C8", "label": "expression", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "vector": [8, 2, 0.2551, 0.0051, 2, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Plots the network using matplotlib'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L51_C8", "label": "if", "type": "if", "loc": [51, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "vector": [4, 2, 0.2653, 0.0153, 2, 0.54, 0.0714, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if pos is None:\n# pos = nx.spring_layout(graph)\n pos = nx.random_layout(graph)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L53_C12", "label": "pos = random_layout()", "type": "assigned_variable", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L51_C8", "vector": [14, 3, 0.2704, 0.0051, 3, 0.13, 0.0, 627, 3, 1, 0, 0, 640, 10, 1], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "random_layout", "annotation": ""}, "snippet": " pos = nx.random_layout(graph)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L55_C8", "label": "nodeSize =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "vector": [14, 2, 0.2806, 0.0051, 2, 0.54, 0.1429, 888, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "nodeSize", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nodeSize = 25"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L56_C8", "label": "edgeWidth =", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "vector": [14, 2, 0.2857, 0.0051, 2, 0.54, 0.2143, 803, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "edgeWidth", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " edgeWidth = 0.5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L58_C8", "label": "if", "type": "if", "loc": [58, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "vector": [4, 2, 0.2985, 0.0102, 2, 0.54, 0.2857, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if nodeSizes is not None:\n nodeSize = nodeSizes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L59_C12", "label": "nodeSize =", "type": "assigned_variable", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L58_C8", "vector": [14, 3, 0.301, 0.0051, 3, 0.66, 0.0, 888, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "nodeSize", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nodeSize = nodeSizes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L61_C8", "label": "figure = figure()", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "vector": [14, 2, 0.3112, 0.0051, 2, 0.54, 0.3571, 789, 3, 0, 0, 0, 789, 10, 1], "semantic": {"name": "figure", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": " figure = plt.figure()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L62_C8", "label": "rect =", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "vector": [14, 2, 0.3163, 0.0051, 2, 0.54, 0.4286, 902, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "rect", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rect = (0,0,1,1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L63_C8", "label": "ax = add_axes()", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "vector": [14, 2, 0.3214, 0.0051, 2, 0.54, 0.5, 823, 3, 1, 0, 0, 806, 10, 1], "semantic": {"name": "ax", "arg_names": [], "import_names": [], "rhs_call_name": "add_axes", "annotation": ""}, "snippet": " ax = figure.add_axes(rect)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L64_C8", "label": "axis()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "vector": [8, 2, 0.3265, 0.0051, 2, 0.54, 0.5714, 860, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "axis", "arg_names": [], "import_names": [], "rhs_call_name": "axis", "annotation": ""}, "snippet": " matplotlib.pyplot.axis(\"off\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "label": "if", "type": "if", "loc": [66, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "vector": [4, 2, 0.3929, 0.1173, 2, 0.54, 0.6429, 0, 2, 0, 0, 0, 0, 0, 21], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if bipartite:\n bipartiteAttributes = nx.get_node_attributes(graph, \"bipartite\")\n \n users = [node for node in graph.nodes() if bipartiteAttributes[node] is 0] # bipartite=0\n discussions = [node for node in graph.nodes() if bipartiteAttributes[node] is not 0] # bipartite=1\n \n nx.draw_networkx_nodes(graph, ax=ax, pos=pos, node_size=nodeSize, nodelist=users, label=nodeLabel)\n nx.draw_networkx_nodes(graph, ax=ax, pos=pos, node_size=nodeSize, nodelist=discussions, node_color='b', label=nodeLabel2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L67_C12", "label": "bipartiteAttributes = get_node_attributes()", "type": "assigned_variable", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "vector": [14, 3, 0.3418, 0.0051, 3, 0.7, 0.0, 554, 3, 2, 0, 0, 151, 10, 1], "semantic": {"name": "bipartiteAttributes", "arg_names": [], "import_names": [], "rhs_call_name": "get_node_attributes", "annotation": ""}, "snippet": " bipartiteAttributes = nx.get_node_attributes(graph, \"bipartite\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L69_C12", "label": "users =", "type": "assigned_variable", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "vector": [14, 3, 0.352, 0.0051, 3, 0.7, 0.0625, 395, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "users", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " users = [node for node in graph.nodes() if bipartiteAttributes[node] is 0] # bipartite=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L70_C12", "label": "discussions =", "type": "assigned_variable", "loc": [70, 70], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "vector": [14, 3, 0.3571, 0.0051, 3, 0.7, 0.125, 842, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "discussions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " discussions = [node for node in graph.nodes() if bipartiteAttributes[node] is not 0] # bipartite=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L72_C12", "label": "draw_networkx_nodes()", "type": "expression", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "vector": [8, 3, 0.3673, 0.0051, 3, 0.7, 0.1875, 952, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "draw_networkx_nodes", "arg_names": [], "import_names": [], "rhs_call_name": "draw_networkx_nodes", "annotation": ""}, "snippet": " nx.draw_networkx_nodes(graph, ax=ax, pos=pos, node_size=nodeSize, nodelist=users, label=nodeLabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L73_C12", "label": "draw_networkx_nodes()", "type": "expression", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "vector": [8, 3, 0.3724, 0.0051, 3, 0.7, 0.25, 952, 3, 7, 0, 0, 0, 0, 1], "semantic": {"name": "draw_networkx_nodes", "arg_names": [], "import_names": [], "rhs_call_name": "draw_networkx_nodes", "annotation": ""}, "snippet": " nx.draw_networkx_nodes(graph, ax=ax, pos=pos, node_size=nodeSize, nodelist=discussions, node_color='b', label=nodeLabel2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L74_C12", "label": "draw_networkx_edges()", "type": "expression", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "vector": [8, 3, 0.3776, 0.0051, 3, 0.7, 0.3125, 867, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "draw_networkx_edges", "arg_names": [], "import_names": [], "rhs_call_name": "draw_networkx_edges", "annotation": ""}, "snippet": " nx.draw_networkx_edges(graph, ax=ax, pos=pos, width=edgeWidth, label=edgeLabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L76_C12", "label": "userCount = len()", "type": "assigned_variable", "loc": [76, 76], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "vector": [14, 3, 0.3878, 0.0051, 3, 0.7, 0.375, 177, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "userCount", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " userCount = len(users)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L77_C12", "label": "discussionCount = len()", "type": "assigned_variable", "loc": [77, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "vector": [14, 3, 0.3929, 0.0051, 3, 0.7, 0.4375, 557, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "discussionCount", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " discussionCount = len(discussions)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L78_C12", "label": "edgeCount = len()", "type": "assigned_variable", "loc": [78, 78], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "vector": [14, 3, 0.398, 0.0051, 3, 0.7, 0.5, 659, 3, 1, 0, 0, 890, 10, 2], "semantic": {"name": "edgeCount", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " edgeCount = len(graph.edges())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L79_C12", "label": "graphInfo =", "type": "assigned_variable", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "vector": [14, 3, 0.4031, 0.0051, 3, 0.7, 0.5625, 653, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "graphInfo", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " graphInfo = str() + \"%s users\\n%s discussions\\n%s edges\\n\" % (userCount, discussionCount, edgeCount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L80_C12", "label": "text()", "type": "expression", "loc": [80, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "vector": [8, 3, 0.4082, 0.0051, 3, 0.7, 0.625, 439, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "text", "annotation": ""}, "snippet": " figure.text(0,0, graphInfo)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L82_C12", "label": "draw_networkx_nodes()", "type": "expression", "loc": [82, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "vector": [8, 3, 0.4184, 0.0051, 3, 0.7, 0.6875, 952, 3, 7, 0, 0, 0, 0, 2], "semantic": {"name": "draw_networkx_nodes", "arg_names": [], "import_names": [], "rhs_call_name": "draw_networkx_nodes", "annotation": ""}, "snippet": " nx.draw_networkx_nodes(graph, ax=ax, pos=pos, node_size=nodeSize, nodelist=graph.nodes(), node_color=nodeColor, label=nodeLabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L83_C12", "label": "draw_networkx_edges()", "type": "expression", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "vector": [8, 3, 0.4235, 0.0051, 3, 0.7, 0.75, 867, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "draw_networkx_edges", "arg_names": [], "import_names": [], "rhs_call_name": "draw_networkx_edges", "annotation": ""}, "snippet": " nx.draw_networkx_edges(graph, ax=ax, pos=pos, width=edgeWidth, label=edgeLabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L85_C12", "label": "nodeCount = len()", "type": "assigned_variable", "loc": [85, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "vector": [14, 3, 0.4337, 0.0051, 3, 0.7, 0.8125, 371, 3, 1, 0, 0, 890, 10, 2], "semantic": {"name": "nodeCount", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " nodeCount = len(graph.nodes())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L86_C12", "label": "edgeCount = len()", "type": "assigned_variable", "loc": [86, 86], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "vector": [14, 3, 0.4388, 0.0051, 3, 0.7, 0.875, 659, 3, 1, 0, 0, 890, 10, 2], "semantic": {"name": "edgeCount", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " edgeCount = len(graph.edges())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L87_C12", "label": "graphInfo =", "type": "assigned_variable", "loc": [87, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "vector": [14, 3, 0.4439, 0.0051, 3, 0.7, 0.9375, 653, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "graphInfo", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " graphInfo = str() + \"%s nodes \\n%s edges\\n\" % (nodeCount, edgeCount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L88_C12", "label": "text()", "type": "expression", "loc": [88, 88], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "vector": [8, 3, 0.449, 0.0051, 3, 0.7, 1.0, 439, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "text", "annotation": ""}, "snippet": " figure.text(0,0, graphInfo)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Try_L90_C8", "label": "try", "type": "try", "loc": [90, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "vector": [7, 2, 0.4668, 0.0204, 2, 0.54, 0.7143, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n matplotlib.pyplot.legend()\n except:\n print(\"Warning: drawing legend failed\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L91_C12", "label": "legend()", "type": "expression", "loc": [91, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:Try_L90_C8", "vector": [8, 3, 0.4643, 0.0051, 3, 0.65, 0.0, 880, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "legend", "arg_names": [], "import_names": [], "rhs_call_name": "legend", "annotation": ""}, "snippet": " matplotlib.pyplot.legend()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L93_C12", "label": "print()", "type": "expression", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:Try_L90_C8", "vector": [8, 3, 0.4745, 0.0051, 3, 0.65, 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: drawing legend failed\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L95_C8", "label": "response = HttpResponse()", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "vector": [14, 2, 0.4847, 0.0051, 2, 0.54, 0.7857, 511, 3, 1, 0, 0, 994, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "HttpResponse", "annotation": ""}, "snippet": " response = HttpResponse(content_type=\"image/png\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L96_C8", "label": "setFigureSize()", "type": "expression", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "vector": [8, 2, 0.4898, 0.0051, 2, 0.54, 0.8571, 461, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setFigureSize", "arg_names": [], "import_names": [], "rhs_call_name": "setFigureSize", "annotation": ""}, "snippet": " self.setFigureSize(figure)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L97_C8", "label": "savefig()", "type": "expression", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "vector": [8, 2, 0.4949, 0.0051, 2, 0.54, 0.9286, 677, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": " figure.savefig(response, format='png', dpi=self.dpi, bbox_inches='tight')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Return_L98_C8", "label": "return", "type": "return", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "vector": [13, 2, 0.5, 0.0051, 2, 0.54, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L100_C0", "label": "TwoDimensionalValuesPlotter", "type": "class", "loc": [100, 196], "level": 0, "parent": null, "vector": [3, 0, 0.7551, 0.4949, 0, 0.66, 1.0, 195, 0, 5, 0, 0, 0, 0, 50], "semantic": {"name": "TwoDimensionalValuesPlotter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TwoDimensionalValuesPlotter():\n '''Class used to plot 2D datasets with matplotlib'''\n \n def __init__(self, dpi=100, width=1600, height=900):\n self.dpi = dpi\n self.width = width\n self.height = height\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L101_C4", "label": "expression", "type": "expression", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L100_C0", "vector": [8, 1, 0.5153, 0.0051, 1, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Class used to plot 2D datasets with matplotlib'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L103_C4", "label": "__init__", "type": "function", "loc": [103, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L100_C0", "vector": [2, 1, 0.5332, 0.0204, 1, 0.73, 0.2, 555, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "dpi", "width", "height"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, dpi=100, width=1600, height=900):\n self.dpi = dpi\n self.width = width\n self.height = height"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L104_C8", "label": "self.dpi =", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L103_C4", "vector": [14, 2, 0.5306, 0.0051, 2, 0.61, 0.0, 873, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.dpi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dpi = dpi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L105_C8", "label": "self.width =", "type": "assigned_variable", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L103_C4", "vector": [14, 2, 0.5357, 0.0051, 2, 0.61, 0.5, 901, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.width", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.width = width"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L106_C8", "label": "self.height =", "type": "assigned_variable", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L103_C4", "vector": [14, 2, 0.5408, 0.0051, 2, 0.61, 1.0, 466, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.height", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.height = height"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L108_C4", "label": "setFigureSize", "type": "function", "loc": [108, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L100_C0", "vector": [2, 1, 0.5587, 0.0204, 1, 0.73, 0.4, 461, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "setFigureSize", "arg_names": ["self", "figure"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setFigureSize(self, figure):\n w = int(self.width/self.dpi)\n h = int(self.height/self.dpi)\n figure.set_size_inches(w, h)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L109_C8", "label": "w = int()", "type": "assigned_variable", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L108_C4", "vector": [14, 2, 0.5561, 0.0051, 2, 0.01, 0.0, 549, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " w = int(self.width/self.dpi)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L110_C8", "label": "h = int()", "type": "assigned_variable", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L108_C4", "vector": [14, 2, 0.5612, 0.0051, 2, 0.01, 0.5, 686, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "h", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " h = int(self.height/self.dpi)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L111_C8", "label": "set_size_inches()", "type": "expression", "loc": [111, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L108_C4", "vector": [8, 2, 0.5663, 0.0051, 2, 0.01, 1.0, 620, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_size_inches", "arg_names": [], "import_names": [], "rhs_call_name": "set_size_inches", "annotation": ""}, "snippet": " figure.set_size_inches(w, h)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L113_C4", "label": "plot", "type": "function", "loc": [113, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L100_C0", "vector": [2, 1, 0.6046, 0.0612, 1, 0.73, 0.6, 929, 0, 6, 0, 0, 0, 0, 8], "semantic": {"name": "plot", "arg_names": ["self", "xValues", "yValues", "filename", "xlabel", "ylabel"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def plot(self, xValues, yValues, filename, xlabel, ylabel):\n figure = plt.figure()\n \n subplot = figure.add_subplot(1, 1, 1)\n subplot.set_xlabel(xlabel)\n subplot.set_ylabel(ylabel)\n subplot.grid(True)\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L114_C8", "label": "figure = figure()", "type": "assigned_variable", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L113_C4", "vector": [14, 2, 0.5816, 0.0051, 2, 0.84, 0.0, 789, 3, 0, 0, 0, 789, 10, 1], "semantic": {"name": "figure", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": " figure = plt.figure()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L116_C8", "label": "subplot = add_subplot()", "type": "assigned_variable", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L113_C4", "vector": [14, 2, 0.5918, 0.0051, 2, 0.84, 0.1429, 905, 3, 3, 0, 0, 449, 10, 1], "semantic": {"name": "subplot", "arg_names": [], "import_names": [], "rhs_call_name": "add_subplot", "annotation": ""}, "snippet": " subplot = figure.add_subplot(1, 1, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L117_C8", "label": "set_xlabel()", "type": "expression", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L113_C4", "vector": [8, 2, 0.5969, 0.0051, 2, 0.84, 0.2857, 441, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "set_xlabel", "annotation": ""}, "snippet": " subplot.set_xlabel(xlabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L118_C8", "label": "set_ylabel()", "type": "expression", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L113_C4", "vector": [8, 2, 0.602, 0.0051, 2, 0.84, 0.4286, 408, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "set_ylabel", "annotation": ""}, "snippet": " subplot.set_ylabel(ylabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L119_C8", "label": "grid()", "type": "expression", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L113_C4", "vector": [8, 2, 0.6071, 0.0051, 2, 0.84, 0.5714, 690, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "grid", "arg_names": [], "import_names": [], "rhs_call_name": "grid", "annotation": ""}, "snippet": " subplot.grid(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L121_C8", "label": "plot()", "type": "expression", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L113_C4", "vector": [8, 2, 0.6173, 0.0051, 2, 0.84, 0.7143, 929, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " subplot.plot(xValues, yValues)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L123_C8", "label": "setFigureSize()", "type": "expression", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L113_C4", "vector": [8, 2, 0.6276, 0.0051, 2, 0.84, 0.8571, 461, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setFigureSize", "arg_names": [], "import_names": [], "rhs_call_name": "setFigureSize", "annotation": ""}, "snippet": " self.setFigureSize(figure)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L124_C8", "label": "savefig()", "type": "expression", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L113_C4", "vector": [8, 2, 0.6327, 0.0051, 2, 0.84, 1.0, 677, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": " plt.savefig(filename, dpi=self.dpi)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L126_C4", "label": "memoryPlotMultipleDatasets", "type": "function", "loc": [126, 158], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L100_C0", "vector": [2, 1, 0.7245, 0.1684, 1, 0.73, 0.8, 412, 0, 4, 1, 0, 0, 0, 18], "semantic": {"name": "memoryPlotMultipleDatasets", "arg_names": ["self", "datasets", "xlabel", "ylabel"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def memoryPlotMultipleDatasets(self, datasets, xlabel, ylabel):\n '''Plots multiple curves on the same chart'''\n figure = plt.figure()\n \n datasetCount = len(datasets)\n width = math.ceil(math.sqrt(datasetCount))\n for datasetId, dataset in enumerate(datasets):\n subplot = figure.add_subplot(width, width, datasetId)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L127_C8", "label": "expression", "type": "expression", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L126_C4", "vector": [8, 2, 0.648, 0.0051, 2, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Plots multiple curves on the same chart'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L128_C8", "label": "figure = figure()", "type": "assigned_variable", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L126_C4", "vector": [14, 2, 0.6531, 0.0051, 2, 0.95, 0.1111, 789, 3, 0, 0, 0, 789, 10, 1], "semantic": {"name": "figure", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": " figure = plt.figure()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L130_C8", "label": "datasetCount = len()", "type": "assigned_variable", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L126_C4", "vector": [14, 2, 0.6633, 0.0051, 2, 0.95, 0.2222, 557, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "datasetCount", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " datasetCount = len(datasets)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L131_C8", "label": "width = ceil()", "type": "assigned_variable", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L126_C4", "vector": [14, 2, 0.6684, 0.0051, 2, 0.95, 0.3333, 989, 3, 1, 0, 0, 211, 10, 2], "semantic": {"name": "width", "arg_names": [], "import_names": [], "rhs_call_name": "ceil", "annotation": ""}, "snippet": " width = math.ceil(math.sqrt(datasetCount))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L132_C8", "label": "for datasetId, dataset", "type": "for", "loc": [132, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L126_C4", "vector": [6, 2, 0.7194, 0.0969, 2, 0.95, 0.4444, 519, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "datasetId, dataset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for datasetId, dataset in enumerate(datasets):\n subplot = figure.add_subplot(width, width, datasetId)\n \n subplot.set_xlabel(xlabel)\n subplot.set_ylabel(ylabel)\n subplot.grid(True)\n \n title = dataset[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L133_C12", "label": "subplot = add_subplot()", "type": "assigned_variable", "loc": [133, 133], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L132_C8", "vector": [14, 3, 0.6786, 0.0051, 3, 0.35, 0.0, 905, 3, 3, 0, 0, 449, 10, 1], "semantic": {"name": "subplot", "arg_names": [], "import_names": [], "rhs_call_name": "add_subplot", "annotation": ""}, "snippet": " subplot = figure.add_subplot(width, width, datasetId)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L135_C12", "label": "set_xlabel()", "type": "expression", "loc": [135, 135], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L132_C8", "vector": [8, 3, 0.6888, 0.0051, 3, 0.35, 0.1111, 441, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "set_xlabel", "annotation": ""}, "snippet": " subplot.set_xlabel(xlabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L136_C12", "label": "set_ylabel()", "type": "expression", "loc": [136, 136], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L132_C8", "vector": [8, 3, 0.6939, 0.0051, 3, 0.35, 0.2222, 408, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "set_ylabel", "annotation": ""}, "snippet": " subplot.set_ylabel(ylabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L137_C12", "label": "grid()", "type": "expression", "loc": [137, 137], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L132_C8", "vector": [8, 3, 0.699, 0.0051, 3, 0.35, 0.3333, 690, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "grid", "arg_names": [], "import_names": [], "rhs_call_name": "grid", "annotation": ""}, "snippet": " subplot.grid(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L139_C12", "label": "title =", "type": "assigned_variable", "loc": [139, 139], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L132_C8", "vector": [14, 3, 0.7092, 0.0051, 3, 0.35, 0.4444, 48, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " title = dataset[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L141_C12", "label": "xValues =", "type": "assigned_variable", "loc": [141, 141], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L132_C8", "vector": [14, 3, 0.7194, 0.0051, 3, 0.35, 0.5556, 543, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "xValues", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xValues = dataset[1][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L143_C12", "label": "yValues =", "type": "assigned_variable", "loc": [143, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L132_C8", "vector": [14, 3, 0.7296, 0.0051, 3, 0.35, 0.6667, 456, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "yValues", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yValues = dataset[1][1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L144_C12", "label": "set_title()", "type": "expression", "loc": [144, 144], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L132_C8", "vector": [8, 3, 0.7347, 0.0051, 3, 0.35, 0.7778, 145, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_title", "arg_names": [], "import_names": [], "rhs_call_name": "set_title", "annotation": ""}, "snippet": " subplot.set_title(title)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L146_C12", "label": "plot()", "type": "expression", "loc": [146, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L132_C8", "vector": [8, 3, 0.7449, 0.0051, 3, 0.35, 0.8889, 929, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "plot", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " subplot.plot(xValues, yValues)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L149_C12", "label": "for item", "type": "for", "loc": [149, 150], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L132_C8", "vector": [6, 3, 0.7628, 0.0102, 3, 0.35, 1.0, 434, 4, 0, 0, 0, 0, 0, 3], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in ([subplot.title, subplot.xaxis.label, subplot.yaxis.label] + subplot.get_xticklabels() + subplot.get_yticklabels()):\n item.set_fontsize(8)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L150_C16", "label": "set_fontsize()", "type": "expression", "loc": [150, 150], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L149_C12", "vector": [8, 4, 0.7653, 0.0051, 4, 0.7, 0.0, 298, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_fontsize", "arg_names": [], "import_names": [], "rhs_call_name": "set_fontsize", "annotation": ""}, "snippet": " item.set_fontsize(8)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L152_C8", "label": "tight_layout()", "type": "expression", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L126_C4", "vector": [8, 2, 0.7755, 0.0051, 2, 0.95, 0.5556, 673, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "tight_layout", "arg_names": [], "import_names": [], "rhs_call_name": "tight_layout", "annotation": ""}, "snippet": " figure.tight_layout()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L154_C8", "label": "response = HttpResponse()", "type": "assigned_variable", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L126_C4", "vector": [14, 2, 0.7857, 0.0051, 2, 0.95, 0.6667, 511, 3, 1, 0, 0, 994, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "HttpResponse", "annotation": ""}, "snippet": " response = HttpResponse(content_type=\"image/png\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L155_C8", "label": "setFigureSize()", "type": "expression", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L126_C4", "vector": [8, 2, 0.7908, 0.0051, 2, 0.95, 0.7778, 461, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setFigureSize", "arg_names": [], "import_names": [], "rhs_call_name": "setFigureSize", "annotation": ""}, "snippet": " self.setFigureSize(figure)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L156_C8", "label": "savefig()", "type": "expression", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L126_C4", "vector": [8, 2, 0.7959, 0.0051, 2, 0.95, 0.8889, 677, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": " figure.savefig(response, format='png')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Return_L158_C8", "label": "return", "type": "return", "loc": [158, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L126_C4", "vector": [13, 2, 0.8061, 0.0051, 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 response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "label": "memoryPlotMultipleDatasetsMultidimensional", "type": "function", "loc": [160, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L100_C0", "vector": [2, 1, 0.9082, 0.1888, 1, 0.73, 1.0, 702, 0, 4, 1, 0, 0, 0, 21], "semantic": {"name": "memoryPlotMultipleDatasetsMultidimensional", "arg_names": ["self", "datasetsList", "xlabel", "ylabel"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def memoryPlotMultipleDatasetsMultidimensional(self, datasetsList, xlabel, ylabel):\n '''Plots multiple subcharts on the same chart'''\n figure = plt.figure()\n \n datasets = zip(*datasetsList)\n legendData = [1,2] # dummy values\n \n datasetCount = len(datasets)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L161_C8", "label": "expression", "type": "expression", "loc": [161, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "vector": [8, 2, 0.8214, 0.0051, 2, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Plots multiple subcharts on the same chart'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L162_C8", "label": "figure = figure()", "type": "assigned_variable", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "vector": [14, 2, 0.8265, 0.0051, 2, 0.38, 0.0833, 789, 3, 0, 0, 0, 789, 10, 1], "semantic": {"name": "figure", "arg_names": [], "import_names": [], "rhs_call_name": "figure", "annotation": ""}, "snippet": " figure = plt.figure()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L164_C8", "label": "datasets = zip()", "type": "assigned_variable", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "vector": [14, 2, 0.8367, 0.0051, 2, 0.38, 0.1667, 661, 3, 1, 0, 0, 814, 10, 1], "semantic": {"name": "datasets", "arg_names": [], "import_names": [], "rhs_call_name": "zip", "annotation": ""}, "snippet": " datasets = zip(*datasetsList)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L165_C8", "label": "legendData =", "type": "assigned_variable", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "vector": [14, 2, 0.8418, 0.0051, 2, 0.38, 0.25, 626, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "legendData", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " legendData = [1,2] # dummy values"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L167_C8", "label": "datasetCount = len()", "type": "assigned_variable", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "vector": [14, 2, 0.852, 0.0051, 2, 0.38, 0.3333, 557, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "datasetCount", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " datasetCount = len(datasets)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L168_C8", "label": "width = ceil()", "type": "assigned_variable", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "vector": [14, 2, 0.8571, 0.0051, 2, 0.38, 0.4167, 989, 3, 1, 0, 0, 211, 10, 2], "semantic": {"name": "width", "arg_names": [], "import_names": [], "rhs_call_name": "ceil", "annotation": ""}, "snippet": " width = math.ceil(math.sqrt(datasetCount))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L169_C8", "label": "for datasetId, datasetTuple", "type": "for", "loc": [169, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "vector": [6, 2, 0.9107, 0.102, 2, 0.38, 0.5, 537, 3, 0, 0, 0, 0, 0, 11], "semantic": {"name": "datasetId, datasetTuple", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for datasetId, datasetTuple in enumerate(datasets):\n subplot = figure.add_subplot(width, width, datasetId)\n \n subplot.set_xlabel(xlabel)\n subplot.set_ylabel(ylabel)\n subplot.grid(True)\n \n title = datasetTuple[0][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L170_C12", "label": "subplot = add_subplot()", "type": "assigned_variable", "loc": [170, 170], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L169_C8", "vector": [14, 3, 0.8673, 0.0051, 3, 0.6, 0.0, 905, 3, 3, 0, 0, 449, 10, 1], "semantic": {"name": "subplot", "arg_names": [], "import_names": [], "rhs_call_name": "add_subplot", "annotation": ""}, "snippet": " subplot = figure.add_subplot(width, width, datasetId)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L172_C12", "label": "set_xlabel()", "type": "expression", "loc": [172, 172], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L169_C8", "vector": [8, 3, 0.8776, 0.0051, 3, 0.6, 0.1667, 441, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "set_xlabel", "annotation": ""}, "snippet": " subplot.set_xlabel(xlabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L173_C12", "label": "set_ylabel()", "type": "expression", "loc": [173, 173], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L169_C8", "vector": [8, 3, 0.8827, 0.0051, 3, 0.6, 0.3333, 408, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "set_ylabel", "annotation": ""}, "snippet": " subplot.set_ylabel(ylabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L174_C12", "label": "grid()", "type": "expression", "loc": [174, 174], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L169_C8", "vector": [8, 3, 0.8878, 0.0051, 3, 0.6, 0.5, 690, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "grid", "arg_names": [], "import_names": [], "rhs_call_name": "grid", "annotation": ""}, "snippet": " subplot.grid(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L176_C12", "label": "title =", "type": "assigned_variable", "loc": [176, 176], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L169_C8", "vector": [14, 3, 0.898, 0.0051, 3, 0.6, 0.6667, 48, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " title = datasetTuple[0][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L178_C12", "label": "for num, dataset", "type": "for", "loc": [178, 184], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L169_C8", "vector": [6, 3, 0.9235, 0.0357, 3, 0.6, 0.8333, 655, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "num, dataset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for num, dataset in enumerate(datasetTuple):\n xValues = dataset[1][0]\n \n yValues = dataset[1][1]\n subplot.set_title(title)\n \n legendData[num], = subplot.plot(xValues, yValues, label=num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L179_C16", "label": "xValues =", "type": "assigned_variable", "loc": [179, 179], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L178_C12", "vector": [14, 4, 0.9133, 0.0051, 4, 0.84, 0.0, 543, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "xValues", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xValues = dataset[1][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L181_C16", "label": "yValues =", "type": "assigned_variable", "loc": [181, 181], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L178_C12", "vector": [14, 4, 0.9235, 0.0051, 4, 0.84, 0.3333, 456, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "yValues", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yValues = dataset[1][1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L182_C16", "label": "set_title()", "type": "expression", "loc": [182, 182], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L178_C12", "vector": [8, 4, 0.9286, 0.0051, 4, 0.84, 0.6667, 145, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_title", "arg_names": [], "import_names": [], "rhs_call_name": "set_title", "annotation": ""}, "snippet": " subplot.set_title(title)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L184_C16", "label": " = plot()", "type": "assigned_variable", "loc": [184, 184], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L178_C12", "vector": [14, 4, 0.9388, 0.0051, 4, 0.84, 1.0, 0, 3, 3, 0, 0, 929, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "plot", "annotation": ""}, "snippet": " legendData[num], = subplot.plot(xValues, yValues, label=num)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L187_C12", "label": "for item", "type": "for", "loc": [187, 188], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L169_C8", "vector": [6, 3, 0.9566, 0.0102, 3, 0.6, 1.0, 434, 4, 0, 0, 0, 0, 0, 3], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in ([subplot.title, subplot.xaxis.label, subplot.yaxis.label] + subplot.get_xticklabels() + subplot.get_yticklabels()):\n item.set_fontsize(8)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L188_C16", "label": "set_fontsize()", "type": "expression", "loc": [188, 188], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L187_C12", "vector": [8, 4, 0.9592, 0.0051, 4, 0.8, 0.0, 298, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_fontsize", "arg_names": [], "import_names": [], "rhs_call_name": "set_fontsize", "annotation": ""}, "snippet": " item.set_fontsize(8)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L190_C8", "label": "tight_layout()", "type": "expression", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "vector": [8, 2, 0.9694, 0.0051, 2, 0.38, 0.5833, 673, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "tight_layout", "arg_names": [], "import_names": [], "rhs_call_name": "tight_layout", "annotation": ""}, "snippet": " figure.tight_layout()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L191_C8", "label": "legend()", "type": "expression", "loc": [191, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "vector": [8, 2, 0.9745, 0.0051, 2, 0.38, 0.6667, 880, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "legend", "arg_names": [], "import_names": [], "rhs_call_name": "legend", "annotation": ""}, "snippet": " figure.legend(legendData, [\"equal time intervals\", \"equal reply count intervals\"], loc=\"lower left\", prop={\"size\": 6})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L193_C8", "label": "response = HttpResponse()", "type": "assigned_variable", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "vector": [14, 2, 0.9847, 0.0051, 2, 0.38, 0.75, 511, 3, 1, 0, 0, 994, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "HttpResponse", "annotation": ""}, "snippet": " response = HttpResponse(content_type=\"image/png\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L194_C8", "label": "setFigureSize()", "type": "expression", "loc": [194, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "vector": [8, 2, 0.9898, 0.0051, 2, 0.38, 0.8333, 461, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setFigureSize", "arg_names": [], "import_names": [], "rhs_call_name": "setFigureSize", "annotation": ""}, "snippet": " self.setFigureSize(figure)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L195_C8", "label": "savefig()", "type": "expression", "loc": [195, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "vector": [8, 2, 0.9949, 0.0051, 2, 0.38, 0.9167, 677, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": " figure.savefig(response, format='png')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1067:Return_L196_C8", "label": "return", "type": "return", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "vector": [13, 2, 1.0, 0.0051, 2, 0.38, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L44_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Return_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L51_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L70_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L72_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L73_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L77_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L80_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L82_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L83_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L85_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L86_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L87_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L88_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Try_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:Try_L90_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L91_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:Try_L90_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L93_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Return_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L108_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L108_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L108_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L132_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L133_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L132_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L135_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L132_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L136_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L132_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L137_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L132_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L139_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L132_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L141_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L132_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L143_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L132_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L144_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L132_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L146_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L132_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L149_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L149_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L150_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Return_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:ClassDef_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L170_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L172_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L173_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L174_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L176_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L178_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L178_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L179_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L178_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L181_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L178_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L182_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L178_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L184_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L187_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:For_L187_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L188_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L191_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Assign_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Expr_L195_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1067:FunctionDef_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1067:Return_L196_C8"}]
# coding: utf-8 ''' Created on 18 juin 2013 @author: Nils Amiet ''' import nltk def isEnglishTweet(text): ''' Checks that the ratio of unknown words in the given text does not exceed a threshold. Words are checked against an English dictionary of 235k words provided by NLTK ''' filterList = ["#", "RT", ".", ":", ",", ";", "'", "(", ")", "{", "}", "[", "]", "~", "\"", "?", "!"] for sign in filterList: text = text.replace(sign, "") text = [word for word in text.split(" ") if not word.startswith("http") and not word.startswith("@")] englishWords = set(w.lower() for w in nltk.corpus.words.words()) textWords = set(w.lower() for w in text) unknownWords = textWords - englishWords unknownCount = len(unknownWords) textCount = len(textWords) unknownFraction = unknownCount / float(textCount) threshold = 0.5 return unknownFraction <= threshold
ajibawa-2023/Python-Code-Large/train/row_1068
16
32
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1068:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 6], "level": 0, "parent": null, "vector": [8, 0, 0.125, 0.1562, 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 18 juin 2013\n\n@author: Nils Amiet\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1068:Import_L8_C0", "label": "nltk import nltk", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.0312, 0, 0.66, 0.5, 371, 0, 1, 0, 0, 371, 0, 0], "semantic": {"name": "nltk", "arg_names": [], "import_names": ["nltk"], "rhs_call_name": "", "annotation": ""}, "snippet": "import nltk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "label": "isEnglishTweet", "type": "function", "loc": [10, 32], "level": 0, "parent": null, "vector": [2, 0, 0.6562, 0.7188, 0, 0.66, 1.0, 168, 0, 1, 1, 0, 0, 0, 12], "semantic": {"name": "isEnglishTweet", "arg_names": ["text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def isEnglishTweet(text):\n '''\n Checks that the ratio of unknown words in the given text does not exceed a threshold.\n Words are checked against an English dictionary of 235k words provided by NLTK\n '''\n filterList = [\"#\", \"RT\", \".\", \":\", \",\", \";\", \"'\", \"(\", \")\", \"{\", \"}\", \"[\", \"]\", \"~\", \"\\\"\", \"?\", \"!\"]\n \n for sign in filterList:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1068:Expr_L11_C4", "label": "expression", "type": "expression", "loc": [11, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "vector": [8, 1, 0.3906, 0.125, 1, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Checks that the ratio of unknown words in the given text does not exceed a threshold.\n Words are checked against an English dictionary of 235k words provided by NLTK\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1068:Assign_L15_C4", "label": "filterList =", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "vector": [14, 1, 0.4688, 0.0312, 1, 0.88, 0.0909, 190, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "filterList", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filterList = [\"#\", \"RT\", \".\", \":\", \",\", \";\", \"'\", \"(\", \")\", \"{\", \"}\", \"[\", \"]\", \"~\", \"\\\"\", \"?\", \"!\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1068:For_L17_C4", "label": "for sign", "type": "for", "loc": [17, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "vector": [6, 1, 0.5469, 0.0625, 1, 0.88, 0.1818, 448, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sign", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for sign in filterList:\n text = text.replace(sign, \"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1068:Assign_L18_C8", "label": "text = replace()", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1068:For_L17_C4", "vector": [14, 2, 0.5625, 0.0312, 2, 0.78, 0.0, 439, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " text = text.replace(sign, \"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1068:Assign_L20_C4", "label": "text =", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "vector": [14, 1, 0.625, 0.0312, 1, 0.88, 0.2727, 439, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = [word for word in text.split(\" \") if not word.startswith(\"http\") and not word.startswith(\"@\")]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1068:Assign_L22_C4", "label": "englishWords = set()", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "vector": [14, 1, 0.6875, 0.0312, 1, 0.88, 0.3636, 616, 3, 1, 0, 0, 21, 10, 3], "semantic": {"name": "englishWords", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " englishWords = set(w.lower() for w in nltk.corpus.words.words())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1068:Assign_L23_C4", "label": "textWords = set()", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "vector": [14, 1, 0.7188, 0.0312, 1, 0.88, 0.4545, 271, 3, 1, 0, 0, 21, 10, 2], "semantic": {"name": "textWords", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " textWords = set(w.lower() for w in text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1068:Assign_L24_C4", "label": "unknownWords =", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "vector": [14, 1, 0.75, 0.0312, 1, 0.88, 0.5455, 448, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "unknownWords", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " unknownWords = textWords - englishWords"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1068:Assign_L26_C4", "label": "unknownCount = len()", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "vector": [14, 1, 0.8125, 0.0312, 1, 0.88, 0.6364, 259, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "unknownCount", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " unknownCount = len(unknownWords)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1068:Assign_L27_C4", "label": "textCount = len()", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "vector": [14, 1, 0.8438, 0.0312, 1, 0.88, 0.7273, 746, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "textCount", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " textCount = len(textWords)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1068:Assign_L29_C4", "label": "unknownFraction =", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "vector": [14, 1, 0.9062, 0.0312, 1, 0.88, 0.8182, 601, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "unknownFraction", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " unknownFraction = unknownCount / float(textCount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1068:Assign_L30_C4", "label": "threshold =", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "vector": [14, 1, 0.9375, 0.0312, 1, 0.88, 0.9091, 635, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "threshold", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " threshold = 0.5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1068:Return_L32_C4", "label": "return", "type": "return", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "vector": [13, 1, 1.0, 0.0312, 1, 0.88, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unknownFraction <= threshold"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1068:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1068:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1068:For_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1068:For_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1068:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1068:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1068:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1068:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1068:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1068:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1068:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1068:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1068:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1068:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1068:Return_L32_C4"}]
from django.db import models import django.db.models.options as options options.DEFAULT_NAMES = options.DEFAULT_NAMES + ('isTwitterModel',) # Create your models here. '''Twitter models''' class Tweet(models.Model): class Meta(): isTwitterModel = True id = models.DecimalField(primary_key=True, max_digits=20, decimal_places=0) in_reply_to_status_id = models.DecimalField(max_digits=20, decimal_places=0) user = models.ForeignKey("User") text = models.TextField() created_at = models.DateTimeField() polarity = models.FloatField() polarity_ready = models.BooleanField() hashtags = models.TextField() class User(models.Model): class Meta(): isTwitterModel = True id = models.DecimalField(primary_key=True, max_digits=20, decimal_places=0) screen_name = models.TextField() statuses_count = models.DecimalField(max_digits=20, decimal_places=0) friends_count = models.DecimalField(max_digits=20, decimal_places=0) followers_count = models.DecimalField(max_digits=20, decimal_places=0) lang = models.TextField() followers_ready = models.BooleanField() user_ready = models.BooleanField() class Friendship(models.Model): class Meta(): isTwitterModel = True # user follows followed_user user = models.ForeignKey("User", related_name="twitter_user_follow_source") followed_user = models.ForeignKey("User", related_name="twitter_user_follow_destination") '''Infrarouge models''' class InfrarougeUser(models.Model): class Meta(): db_table = "user" id = models.IntegerField(primary_key=True) name = models.TextField() class InfrarougeForum(models.Model): class Meta(): db_table = "forum" id = models.IntegerField(primary_key=True) title = models.TextField() description = models.TextField() class InfrarougeForumThread(models.Model): class Meta(): db_table = "forumthread" id = models.IntegerField(primary_key=True) title = models.TextField() description = models.TextField() url = models.TextField() fkparentforum = models.ForeignKey("InfrarougeForum") fkauthor = models.ForeignKey("InfrarougeUser") class InfrarougeThreadMessage(models.Model): class Meta(): db_table = "threadmessage" id = models.IntegerField(primary_key=True) message = models.TextField() fkforumthread = models.ForeignKey("InfrarougeForumThread") fkauthor = models.ForeignKey("InfrarougeUser") timestamp = models.DateTimeField() polarity = models.FloatField() # does not work because Django doesn't support tables without primary keys or tables with composed primary key (more than 1 column) class InfrarougeReply(models.Model): class Meta(): db_table = "reply" id = models.IntegerField(primary_key=True) fkfrom = models.ForeignKey("InfrarougeUser", related_name="infrarougeuser_infrarougereply_from") fkto = models.ForeignKey("InfrarougeUser", related_name="infrarougeuser_infrarougereply_to") fkthreadmessage = models.ForeignKey("InfrarougeThreadMessage")
ajibawa-2023/Python-Code-Large/train/row_1069
68
89
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1069:ImportFrom_L1_C0", "label": "from django.db import models", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0112, 0.0112, 0, 0.66, 0.0, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["models"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db import models"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Import_L2_C0", "label": "django.db.models.options import options", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0225, 0.0112, 0, 0.66, 0.0833, 962, 0, 1, 0, 0, 962, 0, 0], "semantic": {"name": "django.db.models.options", "arg_names": [], "import_names": ["options"], "rhs_call_name": "", "annotation": ""}, "snippet": "import django.db.models.options as options"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L4_C0", "label": "options.DEFAULT_NAMES =", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.0449, 0.0112, 0, 0.66, 0.1667, 74, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "options.DEFAULT_NAMES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "options.DEFAULT_NAMES = options.DEFAULT_NAMES + ('isTwitterModel',)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Expr_L7_C0", "label": "expression", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0787, 0.0112, 0, 0.66, 0.25, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''Twitter models'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L8_C0", "label": "Tweet", "type": "class", "loc": [8, 19], "level": 0, "parent": null, "vector": [3, 0, 0.1517, 0.1348, 0, 0.66, 0.3333, 221, 0, 0, 0, 0, 996, 0, 8], "semantic": {"name": "Tweet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Tweet(models.Model):\n class Meta():\n isTwitterModel = True\n \n id = models.DecimalField(primary_key=True, max_digits=20, decimal_places=0)\n in_reply_to_status_id = models.DecimalField(max_digits=20, decimal_places=0)\n user = models.ForeignKey(\"User\")\n text = models.TextField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L9_C4", "label": "Meta", "type": "class", "loc": [9, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L8_C0", "vector": [3, 1, 0.1067, 0.0225, 1, 0.6, 0.0, 130, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta():\n isTwitterModel = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L10_C8", "label": "isTwitterModel =", "type": "assigned_variable", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L9_C4", "vector": [14, 2, 0.1124, 0.0112, 2, 0.98, 0.0, 376, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "isTwitterModel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " isTwitterModel = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L12_C4", "label": "id = DecimalField()", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L8_C0", "vector": [14, 1, 0.1348, 0.0112, 1, 0.6, 0.125, 941, 3, 3, 0, 0, 888, 10, 1], "semantic": {"name": "id", "arg_names": [], "import_names": [], "rhs_call_name": "DecimalField", "annotation": ""}, "snippet": " id = models.DecimalField(primary_key=True, max_digits=20, decimal_places=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L13_C4", "label": "in_reply_to_status_id = DecimalField()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L8_C0", "vector": [14, 1, 0.1461, 0.0112, 1, 0.6, 0.25, 394, 3, 2, 0, 0, 888, 10, 1], "semantic": {"name": "in_reply_to_status_id", "arg_names": [], "import_names": [], "rhs_call_name": "DecimalField", "annotation": ""}, "snippet": " in_reply_to_status_id = models.DecimalField(max_digits=20, decimal_places=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L14_C4", "label": "user = ForeignKey()", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L8_C0", "vector": [14, 1, 0.1573, 0.0112, 1, 0.6, 0.375, 503, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "ForeignKey", "annotation": ""}, "snippet": " user = models.ForeignKey(\"User\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L15_C4", "label": "text = TextField()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L8_C0", "vector": [14, 1, 0.1685, 0.0112, 1, 0.6, 0.5, 439, 3, 0, 0, 0, 612, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " text = models.TextField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L16_C4", "label": "created_at = DateTimeField()", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L8_C0", "vector": [14, 1, 0.1798, 0.0112, 1, 0.6, 0.625, 642, 3, 0, 0, 0, 789, 10, 1], "semantic": {"name": "created_at", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeField", "annotation": ""}, "snippet": " created_at = models.DateTimeField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L17_C4", "label": "polarity = FloatField()", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L8_C0", "vector": [14, 1, 0.191, 0.0112, 1, 0.6, 0.75, 487, 3, 0, 0, 0, 649, 10, 1], "semantic": {"name": "polarity", "arg_names": [], "import_names": [], "rhs_call_name": "FloatField", "annotation": ""}, "snippet": " polarity = models.FloatField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L18_C4", "label": "polarity_ready = BooleanField()", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L8_C0", "vector": [14, 1, 0.2022, 0.0112, 1, 0.6, 0.875, 596, 3, 0, 0, 0, 498, 10, 1], "semantic": {"name": "polarity_ready", "arg_names": [], "import_names": [], "rhs_call_name": "BooleanField", "annotation": ""}, "snippet": " polarity_ready = models.BooleanField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L19_C4", "label": "hashtags = TextField()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L8_C0", "vector": [14, 1, 0.2135, 0.0112, 1, 0.6, 1.0, 366, 3, 0, 0, 0, 612, 10, 1], "semantic": {"name": "hashtags", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " hashtags = models.TextField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L21_C0", "label": "User", "type": "class", "loc": [21, 32], "level": 0, "parent": null, "vector": [3, 0, 0.2978, 0.1348, 0, 0.66, 0.4167, 61, 0, 0, 0, 0, 996, 0, 8], "semantic": {"name": "User", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class User(models.Model):\n class Meta():\n isTwitterModel = True\n \n id = models.DecimalField(primary_key=True, max_digits=20, decimal_places=0)\n screen_name = models.TextField()\n statuses_count = models.DecimalField(max_digits=20, decimal_places=0)\n friends_count = models.DecimalField(max_digits=20, decimal_places=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L22_C4", "label": "Meta", "type": "class", "loc": [22, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L21_C0", "vector": [3, 1, 0.2528, 0.0225, 1, 0.96, 0.0, 130, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta():\n isTwitterModel = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L23_C8", "label": "isTwitterModel =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L22_C4", "vector": [14, 2, 0.2584, 0.0112, 2, 0.6, 0.0, 376, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "isTwitterModel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " isTwitterModel = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L25_C4", "label": "id = DecimalField()", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L21_C0", "vector": [14, 1, 0.2809, 0.0112, 1, 0.96, 0.125, 941, 3, 3, 0, 0, 888, 10, 1], "semantic": {"name": "id", "arg_names": [], "import_names": [], "rhs_call_name": "DecimalField", "annotation": ""}, "snippet": " id = models.DecimalField(primary_key=True, max_digits=20, decimal_places=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L26_C4", "label": "screen_name = TextField()", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L21_C0", "vector": [14, 1, 0.2921, 0.0112, 1, 0.96, 0.25, 600, 3, 0, 0, 0, 612, 10, 1], "semantic": {"name": "screen_name", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " screen_name = models.TextField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L27_C4", "label": "statuses_count = DecimalField()", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L21_C0", "vector": [14, 1, 0.3034, 0.0112, 1, 0.96, 0.375, 812, 3, 2, 0, 0, 888, 10, 1], "semantic": {"name": "statuses_count", "arg_names": [], "import_names": [], "rhs_call_name": "DecimalField", "annotation": ""}, "snippet": " statuses_count = models.DecimalField(max_digits=20, decimal_places=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L28_C4", "label": "friends_count = DecimalField()", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L21_C0", "vector": [14, 1, 0.3146, 0.0112, 1, 0.96, 0.5, 540, 3, 2, 0, 0, 888, 10, 1], "semantic": {"name": "friends_count", "arg_names": [], "import_names": [], "rhs_call_name": "DecimalField", "annotation": ""}, "snippet": " friends_count = models.DecimalField(max_digits=20, decimal_places=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L29_C4", "label": "followers_count = DecimalField()", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L21_C0", "vector": [14, 1, 0.3258, 0.0112, 1, 0.96, 0.625, 440, 3, 2, 0, 0, 888, 10, 1], "semantic": {"name": "followers_count", "arg_names": [], "import_names": [], "rhs_call_name": "DecimalField", "annotation": ""}, "snippet": " followers_count = models.DecimalField(max_digits=20, decimal_places=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L30_C4", "label": "lang = TextField()", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L21_C0", "vector": [14, 1, 0.3371, 0.0112, 1, 0.96, 0.75, 312, 3, 0, 0, 0, 612, 10, 1], "semantic": {"name": "lang", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " lang = models.TextField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L31_C4", "label": "followers_ready = BooleanField()", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L21_C0", "vector": [14, 1, 0.3483, 0.0112, 1, 0.96, 0.875, 108, 3, 0, 0, 0, 498, 10, 1], "semantic": {"name": "followers_ready", "arg_names": [], "import_names": [], "rhs_call_name": "BooleanField", "annotation": ""}, "snippet": " followers_ready = models.BooleanField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L32_C4", "label": "user_ready = BooleanField()", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L21_C0", "vector": [14, 1, 0.3596, 0.0112, 1, 0.96, 1.0, 247, 3, 0, 0, 0, 498, 10, 1], "semantic": {"name": "user_ready", "arg_names": [], "import_names": [], "rhs_call_name": "BooleanField", "annotation": ""}, "snippet": " user_ready = models.BooleanField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L34_C0", "label": "Friendship", "type": "class", "loc": [34, 40], "level": 0, "parent": null, "vector": [3, 0, 0.4157, 0.0787, 0, 0.66, 0.5, 401, 0, 0, 0, 0, 996, 0, 2], "semantic": {"name": "Friendship", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Friendship(models.Model):\n class Meta():\n isTwitterModel = True\n \n # user follows followed_user\n user = models.ForeignKey(\"User\", related_name=\"twitter_user_follow_source\")\n followed_user = models.ForeignKey(\"User\", related_name=\"twitter_user_follow_destination\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L35_C4", "label": "Meta", "type": "class", "loc": [35, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L34_C0", "vector": [3, 1, 0.3989, 0.0225, 1, 0.66, 0.0, 130, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta():\n isTwitterModel = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L36_C8", "label": "isTwitterModel =", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L35_C4", "vector": [14, 2, 0.4045, 0.0112, 2, 0.94, 0.0, 376, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "isTwitterModel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " isTwitterModel = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L39_C4", "label": "user = ForeignKey()", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L34_C0", "vector": [14, 1, 0.4382, 0.0112, 1, 0.66, 0.5, 503, 3, 2, 0, 0, 140, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "ForeignKey", "annotation": ""}, "snippet": " user = models.ForeignKey(\"User\", related_name=\"twitter_user_follow_source\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L40_C4", "label": "followed_user = ForeignKey()", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L34_C0", "vector": [14, 1, 0.4494, 0.0112, 1, 0.66, 1.0, 277, 3, 2, 0, 0, 140, 10, 1], "semantic": {"name": "followed_user", "arg_names": [], "import_names": [], "rhs_call_name": "ForeignKey", "annotation": ""}, "snippet": " followed_user = models.ForeignKey(\"User\", related_name=\"twitter_user_follow_destination\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Expr_L43_C0", "label": "expression", "type": "expression", "loc": [43, 43], "level": 0, "parent": null, "vector": [8, 0, 0.4831, 0.0112, 0, 0.66, 0.5833, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''Infrarouge models'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L44_C0", "label": "InfrarougeUser", "type": "class", "loc": [44, 49], "level": 0, "parent": null, "vector": [3, 0, 0.5225, 0.0674, 0, 0.66, 0.6667, 95, 0, 0, 0, 0, 996, 0, 2], "semantic": {"name": "InfrarougeUser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class InfrarougeUser(models.Model):\n class Meta():\n db_table = \"user\"\n \n id = models.IntegerField(primary_key=True)\n name = models.TextField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L45_C4", "label": "Meta", "type": "class", "loc": [45, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L44_C0", "vector": [3, 1, 0.5112, 0.0225, 1, 0.27, 0.0, 130, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta():\n db_table = \"user\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L46_C8", "label": "db_table =", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L45_C4", "vector": [14, 2, 0.5169, 0.0112, 2, 0.93, 0.0, 111, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "db_table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " db_table = \"user\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L48_C4", "label": "id = IntegerField()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L44_C0", "vector": [14, 1, 0.5393, 0.0112, 1, 0.27, 0.5, 941, 3, 1, 0, 0, 877, 10, 1], "semantic": {"name": "id", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerField", "annotation": ""}, "snippet": " id = models.IntegerField(primary_key=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L49_C4", "label": "name = TextField()", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L44_C0", "vector": [14, 1, 0.5506, 0.0112, 1, 0.27, 1.0, 57, 3, 0, 0, 0, 612, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " name = models.TextField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L51_C0", "label": "InfrarougeForum", "type": "class", "loc": [51, 57], "level": 0, "parent": null, "vector": [3, 0, 0.6067, 0.0787, 0, 0.66, 0.75, 141, 0, 0, 0, 0, 996, 0, 3], "semantic": {"name": "InfrarougeForum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class InfrarougeForum(models.Model):\n class Meta():\n db_table = \"forum\"\n \n id = models.IntegerField(primary_key=True)\n title = models.TextField()\n description = models.TextField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L52_C4", "label": "Meta", "type": "class", "loc": [52, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L51_C0", "vector": [3, 1, 0.5899, 0.0225, 1, 0.64, 0.0, 130, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta():\n db_table = \"forum\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L53_C8", "label": "db_table =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L52_C4", "vector": [14, 2, 0.5955, 0.0112, 2, 0.21, 0.0, 111, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "db_table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " db_table = \"forum\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L55_C4", "label": "id = IntegerField()", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L51_C0", "vector": [14, 1, 0.618, 0.0112, 1, 0.64, 0.3333, 941, 3, 1, 0, 0, 877, 10, 1], "semantic": {"name": "id", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerField", "annotation": ""}, "snippet": " id = models.IntegerField(primary_key=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L56_C4", "label": "title = TextField()", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L51_C0", "vector": [14, 1, 0.6292, 0.0112, 1, 0.64, 0.6667, 48, 3, 0, 0, 0, 612, 10, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " title = models.TextField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L57_C4", "label": "description = TextField()", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L51_C0", "vector": [14, 1, 0.6404, 0.0112, 1, 0.64, 1.0, 306, 3, 0, 0, 0, 612, 10, 1], "semantic": {"name": "description", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " description = models.TextField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L59_C0", "label": "InfrarougeForumThread", "type": "class", "loc": [59, 68], "level": 0, "parent": null, "vector": [3, 0, 0.7135, 0.1124, 0, 0.66, 0.8333, 64, 0, 0, 0, 0, 996, 0, 6], "semantic": {"name": "InfrarougeForumThread", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class InfrarougeForumThread(models.Model):\n class Meta():\n db_table = \"forumthread\"\n \n id = models.IntegerField(primary_key=True)\n title = models.TextField()\n description = models.TextField()\n url = models.TextField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L60_C4", "label": "Meta", "type": "class", "loc": [60, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L59_C0", "vector": [3, 1, 0.6798, 0.0225, 1, 0.53, 0.0, 130, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta():\n db_table = \"forumthread\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L61_C8", "label": "db_table =", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L60_C4", "vector": [14, 2, 0.6854, 0.0112, 2, 0.81, 0.0, 111, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "db_table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " db_table = \"forumthread\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L63_C4", "label": "id = IntegerField()", "type": "assigned_variable", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L59_C0", "vector": [14, 1, 0.7079, 0.0112, 1, 0.53, 0.1667, 941, 3, 1, 0, 0, 877, 10, 1], "semantic": {"name": "id", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerField", "annotation": ""}, "snippet": " id = models.IntegerField(primary_key=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L64_C4", "label": "title = TextField()", "type": "assigned_variable", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L59_C0", "vector": [14, 1, 0.7191, 0.0112, 1, 0.53, 0.3333, 48, 3, 0, 0, 0, 612, 10, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " title = models.TextField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L65_C4", "label": "description = TextField()", "type": "assigned_variable", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L59_C0", "vector": [14, 1, 0.7303, 0.0112, 1, 0.53, 0.5, 306, 3, 0, 0, 0, 612, 10, 1], "semantic": {"name": "description", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " description = models.TextField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L66_C4", "label": "url = TextField()", "type": "assigned_variable", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L59_C0", "vector": [14, 1, 0.7416, 0.0112, 1, 0.53, 0.6667, 789, 3, 0, 0, 0, 612, 10, 1], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " url = models.TextField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L67_C4", "label": "fkparentforum = ForeignKey()", "type": "assigned_variable", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L59_C0", "vector": [14, 1, 0.7528, 0.0112, 1, 0.53, 0.8333, 744, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "fkparentforum", "arg_names": [], "import_names": [], "rhs_call_name": "ForeignKey", "annotation": ""}, "snippet": " fkparentforum = models.ForeignKey(\"InfrarougeForum\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L68_C4", "label": "fkauthor = ForeignKey()", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L59_C0", "vector": [14, 1, 0.764, 0.0112, 1, 0.53, 1.0, 118, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "fkauthor", "arg_names": [], "import_names": [], "rhs_call_name": "ForeignKey", "annotation": ""}, "snippet": " fkauthor = models.ForeignKey(\"InfrarougeUser\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L70_C0", "label": "InfrarougeThreadMessage", "type": "class", "loc": [70, 79], "level": 0, "parent": null, "vector": [3, 0, 0.8371, 0.1124, 0, 0.66, 0.9167, 881, 0, 0, 0, 0, 996, 0, 6], "semantic": {"name": "InfrarougeThreadMessage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class InfrarougeThreadMessage(models.Model):\n class Meta():\n db_table = \"threadmessage\"\n \n id = models.IntegerField(primary_key=True)\n message = models.TextField()\n fkforumthread = models.ForeignKey(\"InfrarougeForumThread\")\n fkauthor = models.ForeignKey(\"InfrarougeUser\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L71_C4", "label": "Meta", "type": "class", "loc": [71, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L70_C0", "vector": [3, 1, 0.8034, 0.0225, 1, 0.86, 0.0, 130, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta():\n db_table = \"threadmessage\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L72_C8", "label": "db_table =", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L71_C4", "vector": [14, 2, 0.809, 0.0112, 2, 0.58, 0.0, 111, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "db_table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " db_table = \"threadmessage\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L74_C4", "label": "id = IntegerField()", "type": "assigned_variable", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L70_C0", "vector": [14, 1, 0.8315, 0.0112, 1, 0.86, 0.1667, 941, 3, 1, 0, 0, 877, 10, 1], "semantic": {"name": "id", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerField", "annotation": ""}, "snippet": " id = models.IntegerField(primary_key=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L75_C4", "label": "message = TextField()", "type": "assigned_variable", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L70_C0", "vector": [14, 1, 0.8427, 0.0112, 1, 0.86, 0.3333, 635, 3, 0, 0, 0, 612, 10, 1], "semantic": {"name": "message", "arg_names": [], "import_names": [], "rhs_call_name": "TextField", "annotation": ""}, "snippet": " message = models.TextField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L76_C4", "label": "fkforumthread = ForeignKey()", "type": "assigned_variable", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L70_C0", "vector": [14, 1, 0.8539, 0.0112, 1, 0.86, 0.5, 749, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "fkforumthread", "arg_names": [], "import_names": [], "rhs_call_name": "ForeignKey", "annotation": ""}, "snippet": " fkforumthread = models.ForeignKey(\"InfrarougeForumThread\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L77_C4", "label": "fkauthor = ForeignKey()", "type": "assigned_variable", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L70_C0", "vector": [14, 1, 0.8652, 0.0112, 1, 0.86, 0.6667, 118, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "fkauthor", "arg_names": [], "import_names": [], "rhs_call_name": "ForeignKey", "annotation": ""}, "snippet": " fkauthor = models.ForeignKey(\"InfrarougeUser\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L78_C4", "label": "timestamp = DateTimeField()", "type": "assigned_variable", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L70_C0", "vector": [14, 1, 0.8764, 0.0112, 1, 0.86, 0.8333, 834, 3, 0, 0, 0, 789, 10, 1], "semantic": {"name": "timestamp", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeField", "annotation": ""}, "snippet": " timestamp = models.DateTimeField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L79_C4", "label": "polarity = FloatField()", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L70_C0", "vector": [14, 1, 0.8876, 0.0112, 1, 0.86, 1.0, 487, 3, 0, 0, 0, 649, 10, 1], "semantic": {"name": "polarity", "arg_names": [], "import_names": [], "rhs_call_name": "FloatField", "annotation": ""}, "snippet": " polarity = models.FloatField()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L82_C0", "label": "InfrarougeReply", "type": "class", "loc": [82, 89], "level": 0, "parent": null, "vector": [3, 0, 0.9607, 0.0899, 0, 0.66, 1.0, 729, 0, 0, 0, 0, 996, 0, 4], "semantic": {"name": "InfrarougeReply", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class InfrarougeReply(models.Model):\n class Meta():\n db_table = \"reply\"\n \n id = models.IntegerField(primary_key=True)\n fkfrom = models.ForeignKey(\"InfrarougeUser\", related_name=\"infrarougeuser_infrarougereply_from\")\n fkto = models.ForeignKey(\"InfrarougeUser\", related_name=\"infrarougeuser_infrarougereply_to\")\n fkthreadmessage = models.ForeignKey(\"InfrarougeThreadMessage\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L83_C4", "label": "Meta", "type": "class", "loc": [83, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L82_C0", "vector": [3, 1, 0.9382, 0.0225, 1, 0.04, 0.0, 130, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Meta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Meta():\n db_table = \"reply\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L84_C8", "label": "db_table =", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L83_C4", "vector": [14, 2, 0.9438, 0.0112, 2, 0.07, 0.0, 111, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "db_table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " db_table = \"reply\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L86_C4", "label": "id = IntegerField()", "type": "assigned_variable", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L82_C0", "vector": [14, 1, 0.9663, 0.0112, 1, 0.04, 0.25, 941, 3, 1, 0, 0, 877, 10, 1], "semantic": {"name": "id", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerField", "annotation": ""}, "snippet": " id = models.IntegerField(primary_key=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L87_C4", "label": "fkfrom = ForeignKey()", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L82_C0", "vector": [14, 1, 0.9775, 0.0112, 1, 0.04, 0.5, 763, 3, 2, 0, 0, 140, 10, 1], "semantic": {"name": "fkfrom", "arg_names": [], "import_names": [], "rhs_call_name": "ForeignKey", "annotation": ""}, "snippet": " fkfrom = models.ForeignKey(\"InfrarougeUser\", related_name=\"infrarougeuser_infrarougereply_from\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L88_C4", "label": "fkto = ForeignKey()", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L82_C0", "vector": [14, 1, 0.9888, 0.0112, 1, 0.04, 0.75, 721, 3, 2, 0, 0, 140, 10, 1], "semantic": {"name": "fkto", "arg_names": [], "import_names": [], "rhs_call_name": "ForeignKey", "annotation": ""}, "snippet": " fkto = models.ForeignKey(\"InfrarougeUser\", related_name=\"infrarougeuser_infrarougereply_to\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L89_C4", "label": "fkthreadmessage = ForeignKey()", "type": "assigned_variable", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L82_C0", "vector": [14, 1, 1.0, 0.0112, 1, 0.04, 1.0, 717, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "fkthreadmessage", "arg_names": [], "import_names": [], "rhs_call_name": "ForeignKey", "annotation": ""}, "snippet": " fkthreadmessage = models.ForeignKey(\"InfrarougeThreadMessage\")"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1069:ClassDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1069:Assign_L89_C4"}]
# coding: utf-8 ''' Created on 4 jul 2013 @author: Nils Amiet ''' import unittest import os, sys ''' Required for running the script from anywhere outside eclipse''' os.chdir(os.path.dirname(os.path.realpath(__file__))) sys.path.append('..') from SentiStrength.sentistrength import SentiStrength from Tools.Timer import Timer from ITInfluence.language import isEnglishTweet from ITInfluence.polarity import PolarityCounter class SentiStrengthTest(unittest.TestCase): '''Tests for SentiStrength''' def testPerformance(self): line = "Even though it looked good at first, this movie is utterly bad." text = line textCount = 16000 # claims to annotate 16k texts in a second for unused in range(textCount): text += "\n" + line timer = Timer() timer.start() s = SentiStrength() unused = s.classifiy(text) timer.stop() # Allow some margin because 16k is not many, it works best with larger amounts. # For instance with 160k the relative margin is much smaller. margin = 1000 expectedTime = 1000 + margin experimentalValue = timer.totalTimeMillis <= expectedTime expectedValue = True errorMessage = "Took %s millis." % timer.totalTimeMillis self.assertEqual(experimentalValue, expectedValue, errorMessage) class LanguageTest(unittest.TestCase): '''Tests for the language filter module''' def testTexts(self): texts = [ (False, "Je me promène le long de la côte sud-ouest de l'afrique"), (True, "I live in New York because I think it's the most beautiful city in the world"), (False, "Je t'aime"), (True, "I love you"), # English tweets (True, "RT @bidon Beau gave Luke a hickey.. Really shouldn't be jealous..@BrooksBeau @luke_brooks WANT ONE:( http://t.co/0uBKDDZSIB"), (True, "#GGM I love socks too ,me Too. @AHuston_FanPage @NicolasCageFake @elderkeeper @AlbusDumby7 @mondesdegwenn @J0HNNYDepp http://t.co/OsTX4MdxvY"), (True, "RT @mashable: Don't Bother Following the Fiat Abarth 500 (@Abarth500_DE) on Twitter — It's Too Damn Fast http://t.co/5XopBSt4IS #innovative"), # Foreign tweets (False, "Amacın 2 tane ağaçtan çok daha derin olduğu ortada ama TR bölünmez! @yigitbulutt http://t.co/7t3vHf7VDd"), (False, "RT @MlaniX1: Voila la photo pour vous remercier grâce a vous je suis a plus de 500 followers merci beaucoup &lt;3 http://t.co/Uv5YXmPuvM"), (False, "RT @ta9ton: 不覚にもイオン閉店に間に合わず隔離された僕は… http://t.co/zRnOnpTFVN"), ] # We'd like to have the full debug in case more than one text fails exception = None for expectedValue, text in texts: experimentalValue = isEnglishTweet(text) errorMessage = "False classification of text %s" % text try: self.assertEqual(expectedValue, experimentalValue, errorMessage) except Exception as e: print(e) exception = e if exception is not None: raise exception class PolarityTests(unittest.TestCase): '''Tests for polarity counting''' def setUp(self): r1 = {"from": 4, "to": 5, "polarity": 0.8} r2 = {"from": 5, "to": 4, "polarity": 0.2} r3 = {"from": 4, "to": 2, "polarity": -0.3} r4 = {"from": 2, "to": 5, "polarity": 0.1} self.replies = [r1, r2, r3, r4] def testPolarity(self): polarityCounter = PolarityCounter(self.replies) ranking = polarityCounter.polarityDifferenceRanking() experimentalValue = ranking[0][0] # node 2 should be first because it has the greatest polarity difference expectedValue = 2 errorMessage = "Incorrect ranking. User %s should be first" % expectedValue self.assertEqual(experimentalValue, expectedValue, errorMessage) def testNDI(self): polarityCounter = PolarityCounter(self.replies) experimentalValue = polarityCounter.NDI # NDI = sum of squares of differences # = (0.5)^2 + (0.5)^2 + (1.0)^2 # = 0.25 + 0.25 + 1 # = 1.5 expectedValue = 1.5 errorMessage = "Wrong NDI value. Expected: %s, experimental: %s" % (expectedValue, experimentalValue) self.assertEqual(experimentalValue, expectedValue, errorMessage) if __name__ == "__main__": unittest.main()
ajibawa-2023/Python-Code-Large/train/row_1070
64
119
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0336, 0.042, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''\nCreated on 4 jul 2013\n\n@author: Nils Amiet\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Import_L10_C0", "label": "unittest import unittest", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.084, 0.0084, 0, 0.66, 0.0769, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"], "rhs_call_name": "", "annotation": ""}, "snippet": "import unittest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Import_L11_C0", "label": "os import os, sys", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0924, 0.0084, 0, 0.66, 0.1538, 688, 0, 2, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os, sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L13_C0", "label": "expression", "type": "expression", "loc": [13, 13], "level": 0, "parent": null, "vector": [8, 0, 0.1092, 0.0084, 0, 0.66, 0.2308, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "''' Required for running the script from anywhere outside eclipse'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L14_C0", "label": "chdir()", "type": "expression", "loc": [14, 14], "level": 0, "parent": null, "vector": [8, 0, 0.1176, 0.0084, 0, 0.66, 0.3077, 122, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "chdir", "arg_names": [], "import_names": [], "rhs_call_name": "chdir", "annotation": ""}, "snippet": "os.chdir(os.path.dirname(os.path.realpath(__file__)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L15_C0", "label": "append()", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 0.1261, 0.0084, 0, 0.66, 0.3846, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "sys.path.append('..')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:ImportFrom_L17_C0", "label": "from SentiStrength.sentistrength import SentiStrength", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0084, 0, 0.66, 0.4615, 822, 0, 1, 0, 0, 822, 0, 0], "semantic": {"name": "SentiStrength.sentistrength", "arg_names": [], "import_names": ["SentiStrength"], "rhs_call_name": "", "annotation": ""}, "snippet": "from SentiStrength.sentistrength import SentiStrength"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:ImportFrom_L18_C0", "label": "from Tools.Timer import Timer", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1513, 0.0084, 0, 0.66, 0.5385, 642, 0, 1, 0, 0, 642, 0, 0], "semantic": {"name": "Tools.Timer", "arg_names": [], "import_names": ["Timer"], "rhs_call_name": "", "annotation": ""}, "snippet": "from Tools.Timer import Timer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:ImportFrom_L19_C0", "label": "from ITInfluence.language import isEnglishTweet", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.1597, 0.0084, 0, 0.66, 0.6154, 673, 0, 1, 0, 0, 673, 0, 0], "semantic": {"name": "ITInfluence.language", "arg_names": [], "import_names": ["isEnglishTweet"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ITInfluence.language import isEnglishTweet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:ImportFrom_L20_C0", "label": "from ITInfluence.polarity import PolarityCounter", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.1681, 0.0084, 0, 0.66, 0.6923, 330, 0, 1, 0, 0, 330, 0, 0], "semantic": {"name": "ITInfluence.polarity", "arg_names": [], "import_names": ["PolarityCounter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ITInfluence.polarity import PolarityCounter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:ClassDef_L24_C0", "label": "SentiStrengthTest", "type": "class", "loc": [24, 48], "level": 0, "parent": null, "vector": [3, 0, 0.3025, 0.2101, 0, 0.66, 0.7692, 618, 0, 1, 0, 0, 878, 0, 7], "semantic": {"name": "SentiStrengthTest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SentiStrengthTest(unittest.TestCase):\n '''Tests for SentiStrength'''\n \n def testPerformance(self):\n line = \"Even though it looked good at first, this movie is utterly bad.\"\n text = line\n textCount = 16000 # claims to annotate 16k texts in a second\n for unused in range(textCount):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L25_C4", "label": "expression", "type": "expression", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:ClassDef_L24_C0", "vector": [8, 1, 0.2101, 0.0084, 1, 0.69, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Tests for SentiStrength'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "label": "testPerformance", "type": "function", "loc": [27, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:ClassDef_L24_C0", "vector": [2, 1, 0.3151, 0.1849, 1, 0.69, 1.0, 26, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "testPerformance", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testPerformance(self):\n line = \"Even though it looked good at first, this movie is utterly bad.\"\n text = line\n textCount = 16000 # claims to annotate 16k texts in a second\n for unused in range(textCount):\n text += \"\\n\" + line\n \n timer = Timer()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L28_C8", "label": "line =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "vector": [14, 2, 0.2353, 0.0084, 2, 0.01, 0.0, 373, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " line = \"Even though it looked good at first, this movie is utterly bad.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L29_C8", "label": "text =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "vector": [14, 2, 0.2437, 0.0084, 2, 0.01, 0.0714, 439, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = line"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L30_C8", "label": "textCount =", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "vector": [14, 2, 0.2521, 0.0084, 2, 0.01, 0.1429, 746, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "textCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " textCount = 16000 # claims to annotate 16k texts in a second"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:For_L31_C8", "label": "for unused", "type": "for", "loc": [31, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "vector": [6, 2, 0.2647, 0.0168, 2, 0.01, 0.2143, 416, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "unused", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for unused in range(textCount):\n text += \"\\n\" + line"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L34_C8", "label": "timer = Timer()", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "vector": [14, 2, 0.2857, 0.0084, 2, 0.01, 0.2857, 541, 3, 0, 0, 0, 771, 10, 1], "semantic": {"name": "timer", "arg_names": [], "import_names": [], "rhs_call_name": "Timer", "annotation": ""}, "snippet": " timer = Timer()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L35_C8", "label": "start()", "type": "expression", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "vector": [8, 2, 0.2941, 0.0084, 2, 0.01, 0.3571, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " timer.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L36_C8", "label": "s = SentiStrength()", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "vector": [14, 2, 0.3025, 0.0084, 2, 0.01, 0.4286, 553, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "SentiStrength", "annotation": ""}, "snippet": " s = SentiStrength()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L37_C8", "label": "unused = classifiy()", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "vector": [14, 2, 0.3109, 0.0084, 2, 0.01, 0.5, 416, 3, 1, 0, 0, 202, 10, 1], "semantic": {"name": "unused", "arg_names": [], "import_names": [], "rhs_call_name": "classifiy", "annotation": ""}, "snippet": " unused = s.classifiy(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L38_C8", "label": "stop()", "type": "expression", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "vector": [8, 2, 0.3193, 0.0084, 2, 0.01, 0.5714, 343, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "stop", "annotation": ""}, "snippet": " timer.stop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L42_C8", "label": "margin =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "vector": [14, 2, 0.3529, 0.0084, 2, 0.01, 0.6429, 91, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "margin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " margin = 1000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L43_C8", "label": "expectedTime =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "vector": [14, 2, 0.3613, 0.0084, 2, 0.01, 0.7143, 760, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "expectedTime", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expectedTime = 1000 + margin "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L44_C8", "label": "experimentalValue =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "vector": [14, 2, 0.3697, 0.0084, 2, 0.01, 0.7857, 137, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "experimentalValue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " experimentalValue = timer.totalTimeMillis <= expectedTime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L45_C8", "label": "expectedValue =", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "vector": [14, 2, 0.3782, 0.0084, 2, 0.01, 0.8571, 49, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "expectedValue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expectedValue = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L46_C8", "label": "errorMessage =", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "vector": [14, 2, 0.3866, 0.0084, 2, 0.01, 0.9286, 937, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "errorMessage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " errorMessage = \"Took %s millis.\" % timer.totalTimeMillis"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L48_C8", "label": "assertEqual()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "vector": [8, 2, 0.4034, 0.0084, 2, 0.01, 1.0, 299, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(experimentalValue, expectedValue, errorMessage)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:ClassDef_L50_C0", "label": "LanguageTest", "type": "class", "loc": [50, 82], "level": 0, "parent": null, "vector": [3, 0, 0.5546, 0.2773, 0, 0.66, 0.8462, 75, 0, 1, 0, 0, 878, 0, 3], "semantic": {"name": "LanguageTest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class LanguageTest(unittest.TestCase):\n '''Tests for the language filter module'''\n \n def testTexts(self):\n texts = [\n (False, \"Je me prom\u00e8ne le long de la c\u00f4te sud-ouest de l'afrique\"),\n (True, \"I live in New York because I think it's the most beautiful city in the world\"),\n (False, \"Je t'aime\"),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L51_C4", "label": "expression", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:ClassDef_L50_C0", "vector": [8, 1, 0.4286, 0.0084, 1, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Tests for the language filter module'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L53_C4", "label": "testTexts", "type": "function", "loc": [53, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:ClassDef_L50_C0", "vector": [2, 1, 0.5672, 0.2521, 1, 0.45, 1.0, 758, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "testTexts", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testTexts(self):\n texts = [\n (False, \"Je me prom\u00e8ne le long de la c\u00f4te sud-ouest de l'afrique\"),\n (True, \"I live in New York because I think it's the most beautiful city in the world\"),\n (False, \"Je t'aime\"),\n (True, \"I love you\"),\n # English tweets\n (True, \"RT @bidon Beau gave Luke a hickey.. Really shouldn't be jealous..@BrooksBeau @luke_brooks WANT ONE:( http://t.co/0uBKDDZSIB\"),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L54_C8", "label": "texts =", "type": "assigned_variable", "loc": [54, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L53_C4", "vector": [14, 2, 0.5084, 0.1176, 2, 0.58, 0.0, 460, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "texts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " texts = [\n (False, \"Je me prom\u00e8ne le long de la c\u00f4te sud-ouest de l'afrique\"),\n (True, \"I live in New York because I think it's the most beautiful city in the world\"),\n (False, \"Je t'aime\"),\n (True, \"I love you\"),\n # English tweets\n (True, \"RT @bidon Beau gave Luke a hickey.. Really shouldn't be jealous..@BrooksBeau @luke_brooks WANT ONE:( http://t.co/0uBKDDZSIB\"),\n (True, \"#GGM I love socks too ,me Too. @AHuston_FanPage @NicolasCageFake @elderkeeper @AlbusDumby7 @mondesdegwenn @J0HNNYDepp http://t.co/OsTX4MdxvY\"),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L70_C8", "label": "exception =", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L53_C4", "vector": [14, 2, 0.5882, 0.0084, 2, 0.58, 0.3333, 69, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "exception", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " exception = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:For_L72_C8", "label": "for expectedValue, text", "type": "for", "loc": [72, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L53_C4", "vector": [6, 2, 0.6345, 0.0672, 2, 0.58, 0.6667, 161, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "expectedValue, text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for expectedValue, text in texts:\n experimentalValue = isEnglishTweet(text)\n errorMessage = \"False classification of text %s\" % text\n try:\n self.assertEqual(expectedValue, experimentalValue, errorMessage)\n except Exception as e:\n print(e)\n exception = e"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L73_C12", "label": "experimentalValue = isEnglishTweet()", "type": "assigned_variable", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:For_L72_C8", "vector": [14, 3, 0.6134, 0.0084, 3, 0.75, 0.0, 137, 3, 1, 0, 0, 168, 10, 1], "semantic": {"name": "experimentalValue", "arg_names": [], "import_names": [], "rhs_call_name": "isEnglishTweet", "annotation": ""}, "snippet": " experimentalValue = isEnglishTweet(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L74_C12", "label": "errorMessage =", "type": "assigned_variable", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:For_L72_C8", "vector": [14, 3, 0.6218, 0.0084, 3, 0.75, 0.5, 937, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "errorMessage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " errorMessage = \"False classification of text %s\" % text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Try_L75_C12", "label": "try", "type": "try", "loc": [75, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:For_L72_C8", "vector": [7, 3, 0.6471, 0.042, 3, 0.75, 1.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.assertEqual(expectedValue, experimentalValue, errorMessage)\n except Exception as e:\n print(e)\n exception = e"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L76_C16", "label": "assertEqual()", "type": "expression", "loc": [76, 76], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:Try_L75_C12", "vector": [8, 4, 0.6387, 0.0084, 4, 0.66, 0.0, 299, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(expectedValue, experimentalValue, errorMessage)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L78_C16", "label": "print()", "type": "expression", "loc": [78, 78], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:Try_L75_C12", "vector": [8, 4, 0.6555, 0.0084, 4, 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(e)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L79_C16", "label": "exception =", "type": "assigned_variable", "loc": [79, 79], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:Try_L75_C12", "vector": [14, 4, 0.6639, 0.0084, 4, 0.66, 1.0, 69, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "exception", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " exception = e"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:If_L81_C8", "label": "if", "type": "if", "loc": [81, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L53_C4", "vector": [4, 2, 0.6849, 0.0168, 2, 0.58, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if exception is not None:\n raise exception"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:ClassDef_L84_C0", "label": "PolarityTests", "type": "class", "loc": [84, 116], "level": 0, "parent": null, "vector": [3, 0, 0.8403, 0.2773, 0, 0.66, 0.9231, 941, 0, 3, 0, 0, 878, 0, 5], "semantic": {"name": "PolarityTests", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PolarityTests(unittest.TestCase):\n '''Tests for polarity counting'''\n \n def setUp(self):\n r1 = {\"from\": 4, \"to\": 5, \"polarity\": 0.8}\n r2 = {\"from\": 5, \"to\": 4, \"polarity\": 0.2}\n r3 = {\"from\": 4, \"to\": 2, \"polarity\": -0.3}\n r4 = {\"from\": 2, \"to\": 5, \"polarity\": 0.1}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L85_C4", "label": "expression", "type": "expression", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:ClassDef_L84_C0", "vector": [8, 1, 0.7143, 0.0084, 1, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Tests for polarity counting'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L87_C4", "label": "setUp", "type": "function", "loc": [87, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:ClassDef_L84_C0", "vector": [2, 1, 0.7521, 0.0504, 1, 0.75, 0.3333, 952, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "setUp", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setUp(self):\n r1 = {\"from\": 4, \"to\": 5, \"polarity\": 0.8}\n r2 = {\"from\": 5, \"to\": 4, \"polarity\": 0.2}\n r3 = {\"from\": 4, \"to\": 2, \"polarity\": -0.3}\n r4 = {\"from\": 2, \"to\": 5, \"polarity\": 0.1}\n self.replies = [r1, r2, r3, r4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L88_C8", "label": "r1 =", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L87_C4", "vector": [14, 2, 0.7395, 0.0084, 2, 0.64, 0.0, 648, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "r1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r1 = {\"from\": 4, \"to\": 5, \"polarity\": 0.8}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L89_C8", "label": "r2 =", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L87_C4", "vector": [14, 2, 0.7479, 0.0084, 2, 0.64, 0.25, 959, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "r2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r2 = {\"from\": 5, \"to\": 4, \"polarity\": 0.2}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L90_C8", "label": "r3 =", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L87_C4", "vector": [14, 2, 0.7563, 0.0084, 2, 0.64, 0.5, 837, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "r3", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r3 = {\"from\": 4, \"to\": 2, \"polarity\": -0.3}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L91_C8", "label": "r4 =", "type": "assigned_variable", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L87_C4", "vector": [14, 2, 0.7647, 0.0084, 2, 0.64, 0.75, 470, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "r4", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r4 = {\"from\": 2, \"to\": 5, \"polarity\": 0.1}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L92_C8", "label": "self.replies =", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L87_C4", "vector": [14, 2, 0.7731, 0.0084, 2, 0.64, 1.0, 50, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.replies", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.replies = [r1, r2, r3, r4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L94_C4", "label": "testPolarity", "type": "function", "loc": [94, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:ClassDef_L84_C0", "vector": [2, 1, 0.8277, 0.084, 1, 0.75, 0.6667, 964, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "testPolarity", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testPolarity(self):\n polarityCounter = PolarityCounter(self.replies)\n ranking = polarityCounter.polarityDifferenceRanking()\n \n experimentalValue = ranking[0][0]\n # node 2 should be first because it has the greatest polarity difference\n expectedValue = 2\n errorMessage = \"Incorrect ranking. User %s should be first\" % expectedValue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L95_C8", "label": "polarityCounter = PolarityCounter()", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L94_C4", "vector": [14, 2, 0.7983, 0.0084, 2, 0.16, 0.0, 889, 3, 1, 0, 0, 151, 10, 1], "semantic": {"name": "polarityCounter", "arg_names": [], "import_names": [], "rhs_call_name": "PolarityCounter", "annotation": ""}, "snippet": " polarityCounter = PolarityCounter(self.replies)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L96_C8", "label": "ranking = polarityDifferenceRanking()", "type": "assigned_variable", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L94_C4", "vector": [14, 2, 0.8067, 0.0084, 2, 0.16, 0.2, 761, 3, 0, 0, 0, 615, 10, 1], "semantic": {"name": "ranking", "arg_names": [], "import_names": [], "rhs_call_name": "polarityDifferenceRanking", "annotation": ""}, "snippet": " ranking = polarityCounter.polarityDifferenceRanking()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L98_C8", "label": "experimentalValue =", "type": "assigned_variable", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L94_C4", "vector": [14, 2, 0.8235, 0.0084, 2, 0.16, 0.4, 137, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "experimentalValue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " experimentalValue = ranking[0][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L100_C8", "label": "expectedValue =", "type": "assigned_variable", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L94_C4", "vector": [14, 2, 0.8403, 0.0084, 2, 0.16, 0.6, 49, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "expectedValue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expectedValue = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L101_C8", "label": "errorMessage =", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L94_C4", "vector": [14, 2, 0.8487, 0.0084, 2, 0.16, 0.8, 937, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "errorMessage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " errorMessage = \"Incorrect ranking. User %s should be first\" % expectedValue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L103_C8", "label": "assertEqual()", "type": "expression", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L94_C4", "vector": [8, 2, 0.8655, 0.0084, 2, 0.16, 1.0, 299, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(experimentalValue, expectedValue, errorMessage)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L105_C4", "label": "testNDI", "type": "function", "loc": [105, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:ClassDef_L84_C0", "vector": [2, 1, 0.9286, 0.1008, 1, 0.75, 1.0, 718, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "testNDI", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testNDI(self):\n polarityCounter = PolarityCounter(self.replies)\n \n experimentalValue = polarityCounter.NDI\n # NDI = sum of squares of differences\n # = (0.5)^2 + (0.5)^2 + (1.0)^2\n # = 0.25 + 0.25 + 1\n # = 1.5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L106_C8", "label": "polarityCounter = PolarityCounter()", "type": "assigned_variable", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L105_C4", "vector": [14, 2, 0.8908, 0.0084, 2, 0.5, 0.0, 889, 3, 1, 0, 0, 151, 10, 1], "semantic": {"name": "polarityCounter", "arg_names": [], "import_names": [], "rhs_call_name": "PolarityCounter", "annotation": ""}, "snippet": " polarityCounter = PolarityCounter(self.replies)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L108_C8", "label": "experimentalValue =", "type": "assigned_variable", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L105_C4", "vector": [14, 2, 0.9076, 0.0084, 2, 0.5, 0.25, 137, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "experimentalValue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " experimentalValue = polarityCounter.NDI"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L113_C8", "label": "expectedValue =", "type": "assigned_variable", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L105_C4", "vector": [14, 2, 0.9496, 0.0084, 2, 0.5, 0.5, 49, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "expectedValue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expectedValue = 1.5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L114_C8", "label": "errorMessage =", "type": "assigned_variable", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L105_C4", "vector": [14, 2, 0.958, 0.0084, 2, 0.5, 0.75, 937, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "errorMessage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " errorMessage = \"Wrong NDI value. Expected: %s, experimental: %s\" % (expectedValue, experimentalValue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L116_C8", "label": "assertEqual()", "type": "expression", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L105_C4", "vector": [8, 2, 0.9748, 0.0084, 2, 0.5, 1.0, 299, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(experimentalValue, expectedValue, errorMessage)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:If_L118_C0", "label": "if", "type": "if", "loc": [118, 119], "level": 0, "parent": null, "vector": [4, 0, 0.9958, 0.0168, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n unittest.main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L119_C4", "label": "main()", "type": "expression", "loc": [119, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1070:If_L118_C0", "vector": [8, 1, 1.0, 0.0084, 1, 0.77, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " unittest.main()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1070:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:For_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:ClassDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:For_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:For_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L73_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:For_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:For_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Try_L75_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:Try_L75_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L76_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:Try_L75_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L78_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:Try_L75_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L79_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:If_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:ClassDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:ClassDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:ClassDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:ClassDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Assign_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1070:If_L118_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1070:Expr_L119_C4"}]
''' Created on 13 juin 2013 @author: Nils Amiet ''' from ITInfluence.models import Tweet def getAllHashtags(): tweets = Tweet.objects.all().exclude(hashtags="") hashtags = {} for tweet in tweets: currentTweetHashtags = tweet.hashtags.split(" ") for tag in currentTweetHashtags: try: hashtags[tag] += 1 except KeyError: hashtags[tag] = 1 hashtags = [(x,y) for x, y in hashtags.items()] return hashtags def getSimilarHashtags(hashtag): similarHashtags = {} tweets = Tweet.objects.all().exclude(hashtags="").filter(hashtags__contains=hashtag) for tweet in tweets: currentTweetHashtags = tweet.hashtags.split(" ") try: currentTweetHashtags.remove(hashtag) except: pass for tag in currentTweetHashtags: try: similarHashtags[tag] += 1 except KeyError: similarHashtags[tag] = 1 similarHashtags = [(x,y) for x, y in similarHashtags.items()] return similarHashtags
ajibawa-2023/Python-Code-Large/train/row_1071
24
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_1071:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0714, 0.119, 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 13 juin 2013\n\n@author: Nils Amiet\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:ImportFrom_L7_C0", "label": "from ITInfluence.models import Tweet", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0238, 0, 0.66, 0.3333, 316, 0, 1, 0, 0, 316, 0, 0], "semantic": {"name": "ITInfluence.models", "arg_names": [], "import_names": ["Tweet"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ITInfluence.models import Tweet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:FunctionDef_L9_C0", "label": "getAllHashtags", "type": "function", "loc": [9, 22], "level": 0, "parent": null, "vector": [2, 0, 0.369, 0.3333, 0, 0.66, 0.6667, 225, 0, 0, 1, 0, 0, 0, 4], "semantic": {"name": "getAllHashtags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getAllHashtags():\n tweets = Tweet.objects.all().exclude(hashtags=\"\")\n hashtags = {}\n \n for tweet in tweets:\n currentTweetHashtags = tweet.hashtags.split(\" \")\n for tag in currentTweetHashtags:\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:Assign_L10_C4", "label": "tweets = exclude()", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1071:FunctionDef_L9_C0", "vector": [14, 1, 0.2381, 0.0238, 1, 0.41, 0.0, 680, 3, 1, 0, 0, 739, 10, 2], "semantic": {"name": "tweets", "arg_names": [], "import_names": [], "rhs_call_name": "exclude", "annotation": ""}, "snippet": " tweets = Tweet.objects.all().exclude(hashtags=\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:Assign_L11_C4", "label": "hashtags =", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1071:FunctionDef_L9_C0", "vector": [14, 1, 0.2619, 0.0238, 1, 0.41, 0.25, 366, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "hashtags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hashtags = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:For_L13_C4", "label": "for tweet", "type": "for", "loc": [13, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1071:FunctionDef_L9_C0", "vector": [6, 1, 0.381, 0.1667, 1, 0.41, 0.5, 392, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "tweet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for tweet in tweets:\n currentTweetHashtags = tweet.hashtags.split(\" \")\n for tag in currentTweetHashtags:\n try:\n hashtags[tag] += 1\n except KeyError:\n hashtags[tag] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:Assign_L14_C8", "label": "currentTweetHashtags = split()", "type": "assigned_variable", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1071:For_L13_C4", "vector": [14, 2, 0.3333, 0.0238, 2, 0.15, 0.0, 323, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "currentTweetHashtags", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " currentTweetHashtags = tweet.hashtags.split(\" \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:For_L15_C8", "label": "for tag", "type": "for", "loc": [15, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1071:For_L13_C4", "vector": [6, 2, 0.4048, 0.119, 2, 0.15, 1.0, 732, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for tag in currentTweetHashtags:\n try:\n hashtags[tag] += 1\n except KeyError:\n hashtags[tag] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:Try_L16_C12", "label": "try", "type": "try", "loc": [16, 19], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1071:For_L15_C8", "vector": [7, 3, 0.4167, 0.0952, 3, 0.04, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n hashtags[tag] += 1\n except KeyError:\n hashtags[tag] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:Assign_L19_C16", "label": "assign", "type": "assigned_variable", "loc": [19, 19], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1071:Try_L16_C12", "vector": [14, 4, 0.4524, 0.0238, 4, 0.53, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hashtags[tag] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:Assign_L21_C4", "label": "hashtags =", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1071:FunctionDef_L9_C0", "vector": [14, 1, 0.5, 0.0238, 1, 0.41, 0.75, 366, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "hashtags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hashtags = [(x,y) for x, y in hashtags.items()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:Return_L22_C4", "label": "return", "type": "return", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1071:FunctionDef_L9_C0", "vector": [13, 1, 0.5238, 0.0238, 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 hashtags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:FunctionDef_L24_C0", "label": "getSimilarHashtags", "type": "function", "loc": [24, 42], "level": 0, "parent": null, "vector": [2, 0, 0.7857, 0.4524, 0, 0.66, 1.0, 383, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "getSimilarHashtags", "arg_names": ["hashtag"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getSimilarHashtags(hashtag):\n similarHashtags = {}\n \n tweets = Tweet.objects.all().exclude(hashtags=\"\").filter(hashtags__contains=hashtag)\n \n for tweet in tweets:\n currentTweetHashtags = tweet.hashtags.split(\" \")\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:Assign_L25_C4", "label": "similarHashtags =", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1071:FunctionDef_L24_C0", "vector": [14, 1, 0.5952, 0.0238, 1, 0.69, 0.0, 843, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "similarHashtags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " similarHashtags = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:Assign_L27_C4", "label": "tweets = filter()", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1071:FunctionDef_L24_C0", "vector": [14, 1, 0.6429, 0.0238, 1, 0.69, 0.25, 680, 3, 1, 0, 0, 526, 10, 3], "semantic": {"name": "tweets", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " tweets = Tweet.objects.all().exclude(hashtags=\"\").filter(hashtags__contains=hashtag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:For_L29_C4", "label": "for tweet", "type": "for", "loc": [29, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1071:FunctionDef_L24_C0", "vector": [6, 1, 0.8095, 0.2619, 1, 0.69, 0.5, 392, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "tweet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for tweet in tweets:\n currentTweetHashtags = tweet.hashtags.split(\" \")\n try:\n currentTweetHashtags.remove(hashtag)\n except:\n pass\n for tag in currentTweetHashtags:\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:Assign_L30_C8", "label": "currentTweetHashtags = split()", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1071:For_L29_C4", "vector": [14, 2, 0.7143, 0.0238, 2, 0.45, 0.0, 323, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "currentTweetHashtags", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " currentTweetHashtags = tweet.hashtags.split(\" \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:Try_L31_C8", "label": "try", "type": "try", "loc": [31, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1071:For_L29_C4", "vector": [7, 2, 0.7738, 0.0952, 2, 0.45, 0.5, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n currentTweetHashtags.remove(hashtag)\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:Expr_L32_C12", "label": "remove()", "type": "expression", "loc": [32, 32], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1071:Try_L31_C8", "vector": [8, 3, 0.7619, 0.0238, 3, 0.36, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " currentTweetHashtags.remove(hashtag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:For_L35_C8", "label": "for tag", "type": "for", "loc": [35, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1071:For_L29_C4", "vector": [6, 2, 0.881, 0.119, 2, 0.45, 1.0, 732, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for tag in currentTweetHashtags:\n try:\n similarHashtags[tag] += 1\n except KeyError:\n similarHashtags[tag] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:Try_L36_C12", "label": "try", "type": "try", "loc": [36, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1071:For_L35_C8", "vector": [7, 3, 0.8929, 0.0952, 3, 0.42, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n similarHashtags[tag] += 1\n except KeyError:\n similarHashtags[tag] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:Assign_L39_C16", "label": "assign", "type": "assigned_variable", "loc": [39, 39], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1071:Try_L36_C12", "vector": [14, 4, 0.9286, 0.0238, 4, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " similarHashtags[tag] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:Assign_L41_C4", "label": "similarHashtags =", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1071:FunctionDef_L24_C0", "vector": [14, 1, 0.9762, 0.0238, 1, 0.69, 0.75, 843, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "similarHashtags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " similarHashtags = [(x,y) for x, y in similarHashtags.items()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1071:Return_L42_C4", "label": "return", "type": "return", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1071:FunctionDef_L24_C0", "vector": [13, 1, 1.0, 0.0238, 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 similarHashtags"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1071:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1071:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1071:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1071:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1071:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1071:For_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1071:For_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1071:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1071:For_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1071:For_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1071:For_L15_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1071:Try_L16_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1071:Try_L16_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1071:Assign_L19_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1071:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1071:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1071:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1071:Return_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1071:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1071:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1071:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1071:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1071:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1071:For_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1071:For_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1071:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1071:For_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1071:Try_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1071:Try_L31_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1071:Expr_L32_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1071:For_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1071:For_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1071:For_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1071:Try_L36_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1071:Try_L36_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1071:Assign_L39_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1071:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1071:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1071:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1071:Return_L42_C4"}]
''' Created on 10 juin 2013 @author: Nils Amiet ''' import threading from ITInfluence.models import User, Friendship from ITInfluence.twitter import TwitterREST rest = TwitterREST() def collectRequest(query): userRequestPerMinute = 1 followersPerRequest = 5000 val = User.objects.raw(query, [followersPerRequest]) req = val[0].req try: minutes = req / userRequestPerMinute hours = minutes / 60 days = hours / 24 return days, hours, minutes except: return 0, 0, 0 def getTotalTimeToCollectFollowers(): '''Returns an estimation of the time required to collect all the followers for the users in the database''' query = """ SELECT id, sum(IF(followers_count, ceiling(followers_count/%s), 1)) as req FROM ITInfluence_user WHERE followers_count > 0 """ return collectRequest(query) def getRemainingTimeToCollectFollowers(): '''Returns an estimation of the time required to collect the followers for the users that we didnt get the followers yet.''' query = """ SELECT id, sum(IF(followers_count, ceiling(followers_count/%s), 1)) as req FROM ITInfluence_user WHERE followers_ready=0 """ return collectRequest(query) def collectFollowersData(): '''Collect the followers for all users in the database that have not their followers collected yet''' print("Started collecting followers.") users = User.objects.all().filter(followers_ready=False).filter(followers_count__gte=1) for user in users: # stop collecting if asked if not rest.isCollectingFollowers: return followers = rest.getFollowers(int(user.id), getAll=True) # rate limited 15 every 15 minutes if followers is None: print("Stopped collecting followers.") return # stop collecting print("Collected %s followers" % len(followers)) print("Inserting collected followers into database...") for follower in followers: # stop collecting if asked if not rest.isCollectingFollowers: print("Stopped collecting followers.") return source = user try: destination = User.objects.get(id=follower) except: # destination = createUser(follower) destination = User(id=follower) destination.followers_ready = True destination.user_ready = False destination.statuses_count = 0 destination.friends_count = 0 destination.followers_count = 0 destination.save() friendship = Friendship(user=destination, followed_user=source) friendship.save() user.followers_ready = True user.save() print("...done inserting followers for this user!") print("Stopped collecting followers.") rest.isCollectingFollowers = False def runFollowersCollection(): thread = threading.Thread(target=collectFollowersData) thread.daemon = True thread.start() def toggleFollowersCollection(): rest.isCollectingFollowers = not rest.isCollectingFollowers if rest.isCollectingFollowers: runFollowersCollection() def createUser(userId): user = rest.getUser(userId) # rate limited 180 every 15 minutes return user
ajibawa-2023/Python-Code-Large/train/row_1072
69
108
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0278, 0.0463, 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 10 juin 2013\n\n@author: Nils Amiet\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Import_L7_C0", "label": "threading import threading", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0648, 0.0093, 0, 0.66, 0.0909, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["threading"], "rhs_call_name": "", "annotation": ""}, "snippet": "import threading"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:ImportFrom_L9_C0", "label": "from ITInfluence.models import User, Friendship", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0093, 0, 0.66, 0.1818, 316, 0, 2, 0, 0, 316, 0, 0], "semantic": {"name": "ITInfluence.models", "arg_names": [], "import_names": ["User", "Friendship"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ITInfluence.models import User, Friendship"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:ImportFrom_L10_C0", "label": "from ITInfluence.twitter import TwitterREST", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0926, 0.0093, 0, 0.66, 0.2727, 470, 0, 1, 0, 0, 470, 0, 0], "semantic": {"name": "ITInfluence.twitter", "arg_names": [], "import_names": ["TwitterREST"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ITInfluence.twitter import TwitterREST"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L12_C0", "label": "rest = TwitterREST()", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.1111, 0.0093, 0, 0.66, 0.3636, 788, 3, 0, 0, 0, 361, 10, 1], "semantic": {"name": "rest", "arg_names": [], "import_names": [], "rhs_call_name": "TwitterREST", "annotation": ""}, "snippet": "rest = TwitterREST()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L14_C0", "label": "collectRequest", "type": "function", "loc": [14, 27], "level": 0, "parent": null, "vector": [2, 0, 0.1898, 0.1296, 0, 0.66, 0.4545, 78, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "collectRequest", "arg_names": ["query"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def collectRequest(query):\n userRequestPerMinute = 1\n followersPerRequest = 5000\n \n val = User.objects.raw(query, [followersPerRequest])\n req = val[0].req\n try:\n minutes = req / userRequestPerMinute"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L15_C4", "label": "userRequestPerMinute =", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L14_C0", "vector": [14, 1, 0.1389, 0.0093, 1, 0.29, 0.0, 501, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "userRequestPerMinute", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userRequestPerMinute = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L16_C4", "label": "followersPerRequest =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L14_C0", "vector": [14, 1, 0.1481, 0.0093, 1, 0.29, 0.25, 406, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "followersPerRequest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " followersPerRequest = 5000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L18_C4", "label": "val = raw()", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L14_C0", "vector": [14, 1, 0.1667, 0.0093, 1, 0.29, 0.5, 618, 3, 2, 0, 0, 23, 10, 1], "semantic": {"name": "val", "arg_names": [], "import_names": [], "rhs_call_name": "raw", "annotation": ""}, "snippet": " val = User.objects.raw(query, [followersPerRequest])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L19_C4", "label": "req =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L14_C0", "vector": [14, 1, 0.1759, 0.0093, 1, 0.29, 0.75, 233, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "req", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " req = val[0].req"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L20_C4", "label": "try", "type": "try", "loc": [20, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L14_C0", "vector": [7, 1, 0.2176, 0.0741, 1, 0.29, 1.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n minutes = req / userRequestPerMinute\n hours = minutes / 60\n days = hours / 24\n \n return days, hours, minutes\n except:\n return 0, 0, 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L21_C8", "label": "minutes =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L20_C4", "vector": [14, 2, 0.1944, 0.0093, 2, 0.5, 0.0, 234, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "minutes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " minutes = req / userRequestPerMinute"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L22_C8", "label": "hours =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L20_C4", "vector": [14, 2, 0.2037, 0.0093, 2, 0.5, 0.3333, 855, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "hours", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hours = minutes / 60"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L23_C8", "label": "days =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L20_C4", "vector": [14, 2, 0.213, 0.0093, 2, 0.5, 0.6667, 939, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "days", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " days = hours / 24"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Return_L25_C8", "label": "return", "type": "return", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L20_C4", "vector": [13, 2, 0.2315, 0.0093, 2, 0.5, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return days, hours, minutes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Return_L27_C8", "label": "return", "type": "return", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L20_C4", "vector": [13, 2, 0.25, 0.0093, 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, 0, 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L29_C0", "label": "getTotalTimeToCollectFollowers", "type": "function", "loc": [29, 37], "level": 0, "parent": null, "vector": [2, 0, 0.3056, 0.0833, 0, 0.66, 0.5455, 821, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "getTotalTimeToCollectFollowers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getTotalTimeToCollectFollowers():\n '''Returns an estimation of the time required to collect all the followers for the users in the database'''\n \n query = \"\"\"\n SELECT id, sum(IF(followers_count, ceiling(followers_count/%s), 1)) as req\n FROM ITInfluence_user\n WHERE followers_count > 0\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L30_C4", "label": "expression", "type": "expression", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L29_C0", "vector": [8, 1, 0.2778, 0.0093, 1, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Returns an estimation of the time required to collect all the followers for the users in the database'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L32_C4", "label": "query =", "type": "assigned_variable", "loc": [32, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L29_C0", "vector": [14, 1, 0.3148, 0.0463, 1, 0.05, 0.5, 546, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query = \"\"\"\n SELECT id, sum(IF(followers_count, ceiling(followers_count/%s), 1)) as req\n FROM ITInfluence_user\n WHERE followers_count > 0\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Return_L37_C4", "label": "return", "type": "return", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L29_C0", "vector": [13, 1, 0.3426, 0.0093, 1, 0.05, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return collectRequest(query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L39_C0", "label": "getRemainingTimeToCollectFollowers", "type": "function", "loc": [39, 47], "level": 0, "parent": null, "vector": [2, 0, 0.3981, 0.0833, 0, 0.66, 0.6364, 24, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "getRemainingTimeToCollectFollowers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getRemainingTimeToCollectFollowers():\n '''Returns an estimation of the time required to collect the followers for the users that we didnt get the followers yet.'''\n \n query = \"\"\"\n SELECT id, sum(IF(followers_count, ceiling(followers_count/%s), 1)) as req\n FROM ITInfluence_user\n WHERE followers_ready=0\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L40_C4", "label": "expression", "type": "expression", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L39_C0", "vector": [8, 1, 0.3704, 0.0093, 1, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Returns an estimation of the time required to collect the followers for the users that we didnt get the followers yet.'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L42_C4", "label": "query =", "type": "assigned_variable", "loc": [42, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L39_C0", "vector": [14, 1, 0.4074, 0.0463, 1, 0.71, 0.5, 546, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query = \"\"\"\n SELECT id, sum(IF(followers_count, ceiling(followers_count/%s), 1)) as req\n FROM ITInfluence_user\n WHERE followers_ready=0\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Return_L47_C4", "label": "return", "type": "return", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L39_C0", "vector": [13, 1, 0.4352, 0.0093, 1, 0.71, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return collectRequest(query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L49_C0", "label": "collectFollowersData", "type": "function", "loc": [49, 92], "level": 0, "parent": null, "vector": [2, 0, 0.6528, 0.4074, 0, 0.66, 0.7273, 232, 0, 0, 0, 0, 0, 0, 19], "semantic": {"name": "collectFollowersData", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def collectFollowersData():\n '''Collect the followers for all users in the database that have not their followers collected yet'''\n print(\"Started collecting followers.\")\n users = User.objects.all().filter(followers_ready=False).filter(followers_count__gte=1)\n \n for user in users:\n # stop collecting if asked\n if not rest.isCollectingFollowers:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L50_C4", "label": "expression", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L49_C0", "vector": [8, 1, 0.463, 0.0093, 1, 0.58, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Collect the followers for all users in the database that have not their followers collected yet'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L51_C4", "label": "print()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L49_C0", "vector": [8, 1, 0.4722, 0.0093, 1, 0.58, 0.2, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Started collecting followers.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L52_C4", "label": "users = filter()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L49_C0", "vector": [14, 1, 0.4815, 0.0093, 1, 0.58, 0.4, 395, 3, 1, 0, 0, 526, 10, 3], "semantic": {"name": "users", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " users = User.objects.all().filter(followers_ready=False).filter(followers_count__gte=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L54_C4", "label": "for user", "type": "for", "loc": [54, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L49_C0", "vector": [6, 1, 0.6667, 0.3426, 1, 0.58, 0.6, 503, 2, 0, 0, 0, 0, 0, 14], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for user in users:\n # stop collecting if asked\n if not rest.isCollectingFollowers:\n return\n followers = rest.getFollowers(int(user.id), getAll=True) # rate limited 15 every 15 minutes\n if followers is None:\n print(\"Stopped collecting followers.\")\n return # stop collecting"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:If_L56_C8", "label": "if", "type": "if", "loc": [56, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L54_C4", "vector": [4, 2, 0.5231, 0.0185, 2, 0.52, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not rest.isCollectingFollowers:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Return_L57_C12", "label": "return", "type": "return", "loc": [57, 57], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:If_L56_C8", "vector": [13, 3, 0.5278, 0.0093, 3, 0.22, 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_1072:Assign_L58_C8", "label": "followers = getFollowers()", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L54_C4", "vector": [14, 2, 0.537, 0.0093, 2, 0.52, 0.125, 530, 3, 2, 0, 0, 892, 10, 2], "semantic": {"name": "followers", "arg_names": [], "import_names": [], "rhs_call_name": "getFollowers", "annotation": ""}, "snippet": " followers = rest.getFollowers(int(user.id), getAll=True) # rate limited 15 every 15 minutes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:If_L59_C8", "label": "if", "type": "if", "loc": [59, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L54_C4", "vector": [4, 2, 0.5556, 0.0278, 2, 0.52, 0.25, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if followers is None:\n print(\"Stopped collecting followers.\")\n return # stop collecting"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L60_C12", "label": "print()", "type": "expression", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:If_L59_C8", "vector": [8, 3, 0.5556, 0.0093, 3, 0.9, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Stopped collecting followers.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Return_L61_C12", "label": "return", "type": "return", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:If_L59_C8", "vector": [13, 3, 0.5648, 0.0093, 3, 0.9, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return # stop collecting"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L62_C8", "label": "print()", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L54_C4", "vector": [8, 2, 0.5741, 0.0093, 2, 0.52, 0.375, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Collected %s followers\" % len(followers))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L64_C8", "label": "print()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L54_C4", "vector": [8, 2, 0.5926, 0.0093, 2, 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": " print(\"Inserting collected followers into database...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L65_C8", "label": "for follower", "type": "for", "loc": [65, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L54_C4", "vector": [6, 2, 0.6991, 0.2037, 2, 0.52, 0.625, 382, 2, 0, 0, 0, 0, 0, 6], "semantic": {"name": "follower", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for follower in followers:\n # stop collecting if asked\n if not rest.isCollectingFollowers:\n print(\"Stopped collecting followers.\")\n return\n \n source = user\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:If_L67_C12", "label": "if", "type": "if", "loc": [67, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L65_C8", "vector": [4, 3, 0.6296, 0.0278, 3, 0.78, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not rest.isCollectingFollowers:\n print(\"Stopped collecting followers.\")\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L68_C16", "label": "print()", "type": "expression", "loc": [68, 68], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:If_L67_C12", "vector": [8, 4, 0.6296, 0.0093, 4, 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": " print(\"Stopped collecting followers.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Return_L69_C16", "label": "return", "type": "return", "loc": [69, 69], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:If_L67_C12", "vector": [13, 4, 0.6389, 0.0093, 4, 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_1072:Assign_L71_C12", "label": "source =", "type": "assigned_variable", "loc": [71, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L65_C8", "vector": [14, 3, 0.6574, 0.0093, 3, 0.78, 0.25, 703, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source = user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L72_C12", "label": "try", "type": "try", "loc": [72, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L65_C8", "vector": [7, 3, 0.7176, 0.1111, 3, 0.78, 0.5, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n destination = User.objects.get(id=follower)\n except:\n# destination = createUser(follower)\n destination = User(id=follower)\n destination.followers_ready = True\n destination.user_ready = False\n destination.statuses_count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L73_C16", "label": "destination = get()", "type": "assigned_variable", "loc": [73, 73], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L72_C12", "vector": [14, 4, 0.6759, 0.0093, 4, 0.49, 0.0, 615, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "destination", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " destination = User.objects.get(id=follower)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L76_C16", "label": "destination = User()", "type": "assigned_variable", "loc": [76, 76], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L72_C12", "vector": [14, 4, 0.7037, 0.0093, 4, 0.49, 0.0, 615, 3, 1, 0, 0, 61, 10, 1], "semantic": {"name": "destination", "arg_names": [], "import_names": [], "rhs_call_name": "User", "annotation": ""}, "snippet": " destination = User(id=follower)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L77_C16", "label": "destination.followers_ready =", "type": "assigned_variable", "loc": [77, 77], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L72_C12", "vector": [14, 4, 0.713, 0.0093, 4, 0.49, 0.1667, 819, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "destination.followers_ready", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " destination.followers_ready = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L78_C16", "label": "destination.user_ready =", "type": "assigned_variable", "loc": [78, 78], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L72_C12", "vector": [14, 4, 0.7222, 0.0093, 4, 0.49, 0.3333, 784, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "destination.user_ready", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " destination.user_ready = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L79_C16", "label": "destination.statuses_count =", "type": "assigned_variable", "loc": [79, 79], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L72_C12", "vector": [14, 4, 0.7315, 0.0093, 4, 0.49, 0.5, 635, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "destination.statuses_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " destination.statuses_count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L80_C16", "label": "destination.friends_count =", "type": "assigned_variable", "loc": [80, 80], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L72_C12", "vector": [14, 4, 0.7407, 0.0093, 4, 0.49, 0.6667, 502, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "destination.friends_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " destination.friends_count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L81_C16", "label": "destination.followers_count =", "type": "assigned_variable", "loc": [81, 81], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L72_C12", "vector": [14, 4, 0.75, 0.0093, 4, 0.49, 0.8333, 581, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "destination.followers_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " destination.followers_count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L83_C16", "label": "save()", "type": "expression", "loc": [83, 83], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L72_C12", "vector": [8, 4, 0.7685, 0.0093, 4, 0.49, 1.0, 928, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " destination.save()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L85_C12", "label": "friendship = Friendship()", "type": "assigned_variable", "loc": [85, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L65_C8", "vector": [14, 3, 0.787, 0.0093, 3, 0.78, 0.75, 778, 3, 2, 0, 0, 401, 10, 1], "semantic": {"name": "friendship", "arg_names": [], "import_names": [], "rhs_call_name": "Friendship", "annotation": ""}, "snippet": " friendship = Friendship(user=destination, followed_user=source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L86_C12", "label": "save()", "type": "expression", "loc": [86, 86], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L65_C8", "vector": [8, 3, 0.7963, 0.0093, 3, 0.78, 1.0, 928, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " friendship.save()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L88_C8", "label": "user.followers_ready =", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L54_C4", "vector": [14, 2, 0.8148, 0.0093, 2, 0.52, 0.75, 760, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "user.followers_ready", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user.followers_ready = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L89_C8", "label": "save()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L54_C4", "vector": [8, 2, 0.8241, 0.0093, 2, 0.52, 0.875, 928, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " user.save()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L90_C8", "label": "print()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L54_C4", "vector": [8, 2, 0.8333, 0.0093, 2, 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": " print(\"...done inserting followers for this user!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L91_C4", "label": "print()", "type": "expression", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L49_C0", "vector": [8, 1, 0.8426, 0.0093, 1, 0.58, 0.8, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Stopped collecting followers.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L92_C4", "label": "rest.isCollectingFollowers =", "type": "assigned_variable", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L49_C0", "vector": [14, 1, 0.8519, 0.0093, 1, 0.58, 1.0, 620, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "rest.isCollectingFollowers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rest.isCollectingFollowers = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L94_C0", "label": "runFollowersCollection", "type": "function", "loc": [94, 97], "level": 0, "parent": null, "vector": [2, 0, 0.8843, 0.037, 0, 0.66, 0.8182, 14, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "runFollowersCollection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def runFollowersCollection():\n thread = threading.Thread(target=collectFollowersData)\n thread.daemon = True\n thread.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L95_C4", "label": "thread = Thread()", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L94_C0", "vector": [14, 1, 0.8796, 0.0093, 1, 0.29, 0.0, 260, 3, 1, 0, 0, 134, 10, 1], "semantic": {"name": "thread", "arg_names": [], "import_names": [], "rhs_call_name": "Thread", "annotation": ""}, "snippet": " thread = threading.Thread(target=collectFollowersData)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L96_C4", "label": "thread.daemon =", "type": "assigned_variable", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L94_C0", "vector": [14, 1, 0.8889, 0.0093, 1, 0.29, 0.5, 123, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "thread.daemon", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " thread.daemon = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L97_C4", "label": "start()", "type": "expression", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L94_C0", "vector": [8, 1, 0.8981, 0.0093, 1, 0.29, 1.0, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " thread.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L99_C0", "label": "toggleFollowersCollection", "type": "function", "loc": [99, 103], "level": 0, "parent": null, "vector": [2, 0, 0.9352, 0.0463, 0, 0.66, 0.9091, 901, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "toggleFollowersCollection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def toggleFollowersCollection():\n rest.isCollectingFollowers = not rest.isCollectingFollowers\n \n if rest.isCollectingFollowers:\n runFollowersCollection()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L100_C4", "label": "rest.isCollectingFollowers =", "type": "assigned_variable", "loc": [100, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L99_C0", "vector": [14, 1, 0.9259, 0.0093, 1, 0.47, 0.0, 620, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rest.isCollectingFollowers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rest.isCollectingFollowers = not rest.isCollectingFollowers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:If_L102_C4", "label": "if", "type": "if", "loc": [102, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L99_C0", "vector": [4, 1, 0.9491, 0.0185, 1, 0.47, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if rest.isCollectingFollowers:\n runFollowersCollection()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L103_C8", "label": "runFollowersCollection()", "type": "expression", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:If_L102_C4", "vector": [8, 2, 0.9537, 0.0093, 2, 0.68, 0.0, 14, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "runFollowersCollection", "arg_names": [], "import_names": [], "rhs_call_name": "runFollowersCollection", "annotation": ""}, "snippet": " runFollowersCollection()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L105_C0", "label": "createUser", "type": "function", "loc": [105, 108], "level": 0, "parent": null, "vector": [2, 0, 0.9861, 0.037, 0, 0.66, 1.0, 861, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "createUser", "arg_names": ["userId"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def createUser(userId):\n user = rest.getUser(userId) # rate limited 180 every 15 minutes\n \n return user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L106_C4", "label": "user = getUser()", "type": "assigned_variable", "loc": [106, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L105_C0", "vector": [14, 1, 0.9815, 0.0093, 1, 0.42, 0.0, 503, 3, 1, 0, 0, 726, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "getUser", "annotation": ""}, "snippet": " user = rest.getUser(userId) # rate limited 180 every 15 minutes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1072:Return_L108_C4", "label": "return", "type": "return", "loc": [108, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L105_C0", "vector": [13, 1, 1.0, 0.0093, 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 user"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Return_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Return_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Return_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Return_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:If_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Return_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:If_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L60_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Return_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L65_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:If_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:If_L67_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L68_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:If_L67_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Return_L69_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L65_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L65_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L72_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L72_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L73_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L72_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L76_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L72_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L77_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L72_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L78_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L72_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L79_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L72_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L80_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L72_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L81_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:Try_L72_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L83_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L65_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L85_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L65_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L86_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:For_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:If_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:If_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Expr_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L105_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Assign_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1072:FunctionDef_L105_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1072:Return_L108_C4"}]
''' Created on 18 juin 2013 @author: Nils Amiet ''' from ITInfluence.models import Tweet, User, Friendship import networkx as nx import math class TwitterFollowersGraphBuilder(): ''' Builds the followers graph ''' def __init__(self): self.graph = nx.DiGraph() self.nodeSizes = [] self.nodeFriendCounts = [] print("Building graph...") print("Running user query...") maxFollowersCount = 500 minFollowersCount = 5000 ### You can uncomment one of the following lines with "users = ..." at your choice # All users that have at most 500 followers users = User.objects.all().filter(followers_count__lte=maxFollowersCount).exclude(followers_count=0) # All users that have at least 5000 followers # users = User.objects.all().filter(followers_count__gte=minFollowersCount).exclude(followers_count=0) # All users than have at least one follower # users = User.objects.all().exclude(followers_count=0) # Don't run this one if you have less than 16GB memory on large networks (>10M) # users = User.objects.all() print("done!") self.buildGraph(users) print("...done building graph!") print("Processed %s users" % len(users)) def buildGraph(self, users): print("Counting users...") userCount = len(users) print("done!") counter = 0 for user in users: percentage = 100*(float(counter)/userCount) print("Processing user %s/%s (%s" %(counter, userCount, percentage) + "%)") userId = int(user.id) self.graph.add_node(userId) userWeight = self.getWeight(int(user.followers_count)) friendships = Friendship.objects.all().filter(user__id=int(user.id)) friendshipCount = friendships.count() friendshipCounter = 0 for friendship in friendships: percentage = 100*(float(friendshipCounter)/friendshipCount) print("Processing friendship %s/%s (%s" %(friendshipCounter, friendshipCount, percentage) + "%)"+ " - User: %s" % percentage + "%") self.graph.add_edge(userId, int(friendship.followed_user.id)) friendshipCounter += 1 counter += 1 nodeCount = len(self.graph.nodes()) counter = 1 for node in self.graph.nodes(): percentage = 100*(float(counter)/nodeCount) print("Processing node %s/%s (%s" %(counter, nodeCount, percentage) + "%)") user = User.objects.get(id=node) userWeight = self.getWeight(int(user.followers_count)) self.nodeSizes += [userWeight] userFriendsCount = self.graph.out_degree(node) self.nodeFriendCounts += [userFriendsCount] counter += 1 def getWeight(self, followers): nodeSize = 25 logBase = 10 return nodeSize + 4 ** math.log(followers, logBase) class TwitterGraphBuilder(): ''' Builds the replies graph for collected Twitter data ''' def __init__(self, hashtagOfInterest="summer"): ''' Constructor ''' self.graph = nx.DiGraph() print("Building graph...") print("Running tweet query...") ### Uncomment one of the following lines "tweets = ..." # Use a not so frequent hashtag, fast computation tweets = Tweet.objects.all().filter(hashtags__icontains=hashtagOfInterest) # Don't run this if you have less than 32GB memory for large networks (>10M). # tweets = Tweet.objects.all() self.buildGraph(tweets) print("...done building graph!") def buildGraph(self, tweets): tweetCount = len(tweets) counter = 0 for tweet in tweets: percentage = 100*(float(counter)/tweetCount) print("Processing tweet %s/%s (%s" %(counter, tweetCount, percentage) + "%)") author = tweet.user replyTo = int(tweet.in_reply_to_status_id) if replyTo is 0: # it's a reply to all of the author's followers followers = self.getFollowers(author) followersCount = len(followers) followerCounter = 0 for follower in followers: followerPercentage = 100*(float(followerCounter)/followersCount) print("Processing follower %s/%s (%s" %(followerCounter, followersCount, followerPercentage) + "%)" + " - Tweet: %s" % percentage + "%") self.addReply(author, follower.user) followerCounter += 1 else: try: toUser = User.objects.get(replyTo) self.addReply(author, toUser) except: # print("Warning: in_reply_to user doesn't exist") pass counter += 1 def getFollowers(self, user): friendships = Friendship.objects.all().filter(followed_user__id=int(user.id)) return friendships def addReply(self, fromUser, toUser): self.graph.add_edge(int(fromUser.id), int(toUser.id))
ajibawa-2023/Python-Code-Large/train/row_1073
83
145
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0207, 0.0345, 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 18 juin 2013\n\n@author: Nils Amiet\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:ImportFrom_L7_C0", "label": "from ITInfluence.models import Tweet, User, Friendship", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0483, 0.0069, 0, 0.66, 0.2, 316, 0, 3, 0, 0, 316, 0, 0], "semantic": {"name": "ITInfluence.models", "arg_names": [], "import_names": ["Tweet", "User", "Friendship"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ITInfluence.models import Tweet, User, Friendship"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Import_L8_C0", "label": "networkx import nx", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0552, 0.0069, 0, 0.66, 0.4, 691, 0, 1, 0, 0, 691, 0, 0], "semantic": {"name": "networkx", "arg_names": [], "import_names": ["nx"], "rhs_call_name": "", "annotation": ""}, "snippet": "import networkx as nx"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Import_L9_C0", "label": "math import math", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0621, 0.0069, 0, 0.66, 0.6, 526, 0, 1, 0, 0, 526, 0, 0], "semantic": {"name": "math", "arg_names": [], "import_names": ["math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:ClassDef_L11_C0", "label": "TwitterFollowersGraphBuilder", "type": "class", "loc": [11, 82], "level": 0, "parent": null, "vector": [3, 0, 0.3207, 0.4966, 0, 0.66, 0.8, 918, 0, 3, 0, 0, 0, 0, 38], "semantic": {"name": "TwitterFollowersGraphBuilder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TwitterFollowersGraphBuilder():\n '''\n Builds the followers graph\n '''\n \n def __init__(self):\n self.graph = nx.DiGraph()\n self.nodeSizes = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L12_C4", "label": "expression", "type": "expression", "loc": [12, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:ClassDef_L11_C0", "vector": [8, 1, 0.0897, 0.0207, 1, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Builds the followers graph\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "label": "__init__", "type": "function", "loc": [16, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:ClassDef_L11_C0", "vector": [2, 1, 0.1862, 0.1586, 1, 0.54, 0.3333, 555, 0, 1, 0, 0, 0, 0, 11], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n self.graph = nx.DiGraph()\n self.nodeSizes = []\n self.nodeFriendCounts = []\n \n print(\"Building graph...\")\n print(\"Running user query...\")\n maxFollowersCount = 500"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L17_C8", "label": "self.graph = DiGraph()", "type": "assigned_variable", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "vector": [14, 2, 0.1172, 0.0069, 2, 0.11, 0.0, 90, 3, 0, 0, 0, 22, 10, 1], "semantic": {"name": "self.graph", "arg_names": [], "import_names": [], "rhs_call_name": "DiGraph", "annotation": ""}, "snippet": " self.graph = nx.DiGraph()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L18_C8", "label": "self.nodeSizes =", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "vector": [14, 2, 0.1241, 0.0069, 2, 0.11, 0.0909, 468, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.nodeSizes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.nodeSizes = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L19_C8", "label": "self.nodeFriendCounts =", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "vector": [14, 2, 0.131, 0.0069, 2, 0.11, 0.1818, 500, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.nodeFriendCounts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.nodeFriendCounts = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L21_C8", "label": "print()", "type": "expression", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "vector": [8, 2, 0.1448, 0.0069, 2, 0.11, 0.2727, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Building graph...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L22_C8", "label": "print()", "type": "expression", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "vector": [8, 2, 0.1517, 0.0069, 2, 0.11, 0.3636, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Running user query...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L23_C8", "label": "maxFollowersCount =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "vector": [14, 2, 0.1586, 0.0069, 2, 0.11, 0.4545, 14, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "maxFollowersCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " maxFollowersCount = 500"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L24_C8", "label": "minFollowersCount =", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "vector": [14, 2, 0.1655, 0.0069, 2, 0.11, 0.5455, 677, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "minFollowersCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " minFollowersCount = 5000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L27_C8", "label": "users = exclude()", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "vector": [14, 2, 0.1862, 0.0069, 2, 0.11, 0.6364, 395, 3, 1, 0, 0, 739, 10, 3], "semantic": {"name": "users", "arg_names": [], "import_names": [], "rhs_call_name": "exclude", "annotation": ""}, "snippet": " users = User.objects.all().filter(followers_count__lte=maxFollowersCount).exclude(followers_count=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L34_C8", "label": "print()", "type": "expression", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "vector": [8, 2, 0.2345, 0.0069, 2, 0.11, 0.7273, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"done!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L36_C8", "label": "buildGraph()", "type": "expression", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "vector": [8, 2, 0.2483, 0.0069, 2, 0.11, 0.8182, 428, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "buildGraph", "arg_names": [], "import_names": [], "rhs_call_name": "buildGraph", "annotation": ""}, "snippet": " self.buildGraph(users)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L37_C8", "label": "print()", "type": "expression", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "vector": [8, 2, 0.2552, 0.0069, 2, 0.11, 0.9091, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"...done building graph!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L38_C8", "label": "print()", "type": "expression", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "vector": [8, 2, 0.2621, 0.0069, 2, 0.11, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Processed %s users\" % len(users))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L40_C4", "label": "buildGraph", "type": "function", "loc": [40, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:ClassDef_L11_C0", "vector": [2, 1, 0.4034, 0.2621, 1, 0.54, 0.6667, 428, 0, 2, 0, 0, 0, 0, 26], "semantic": {"name": "buildGraph", "arg_names": ["self", "users"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def buildGraph(self, users):\n print(\"Counting users...\")\n userCount = len(users)\n print(\"done!\")\n counter = 0\n for user in users:\n percentage = 100*(float(counter)/userCount)\n print(\"Processing user %s/%s (%s\" %(counter, userCount, percentage) + \"%)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L41_C8", "label": "print()", "type": "expression", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L40_C4", "vector": [8, 2, 0.2828, 0.0069, 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(\"Counting users...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L42_C8", "label": "userCount = len()", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L40_C4", "vector": [14, 2, 0.2897, 0.0069, 2, 0.6, 0.1429, 177, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "userCount", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " userCount = len(users)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L43_C8", "label": "print()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L40_C4", "vector": [8, 2, 0.2966, 0.0069, 2, 0.6, 0.2857, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"done!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L44_C8", "label": "counter =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L40_C4", "vector": [14, 2, 0.3034, 0.0069, 2, 0.6, 0.4286, 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_1073:For_L45_C8", "label": "for user", "type": "for", "loc": [45, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L40_C4", "vector": [6, 2, 0.3724, 0.131, 2, 0.6, 0.5714, 503, 2, 0, 0, 0, 0, 0, 14], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for user in users:\n percentage = 100*(float(counter)/userCount)\n print(\"Processing user %s/%s (%s\" %(counter, userCount, percentage) + \"%)\")\n userId = int(user.id)\n self.graph.add_node(userId)\n userWeight = self.getWeight(int(user.followers_count))\n \n friendships = Friendship.objects.all().filter(user__id=int(user.id))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L46_C12", "label": "percentage =", "type": "assigned_variable", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L45_C8", "vector": [14, 3, 0.3172, 0.0069, 3, 0.36, 0.0, 568, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "percentage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " percentage = 100*(float(counter)/userCount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L47_C12", "label": "print()", "type": "expression", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L45_C8", "vector": [8, 3, 0.3241, 0.0069, 3, 0.36, 0.125, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Processing user %s/%s (%s\" %(counter, userCount, percentage) + \"%)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L48_C12", "label": "userId = int()", "type": "assigned_variable", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L45_C8", "vector": [14, 3, 0.331, 0.0069, 3, 0.36, 0.25, 303, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "userId", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " userId = int(user.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L49_C12", "label": "add_node()", "type": "expression", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L45_C8", "vector": [8, 3, 0.3379, 0.0069, 3, 0.36, 0.375, 659, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add_node", "arg_names": [], "import_names": [], "rhs_call_name": "add_node", "annotation": ""}, "snippet": " self.graph.add_node(userId)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L50_C12", "label": "userWeight = getWeight()", "type": "assigned_variable", "loc": [50, 50], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L45_C8", "vector": [14, 3, 0.3448, 0.0069, 3, 0.36, 0.5, 375, 3, 1, 0, 0, 760, 10, 2], "semantic": {"name": "userWeight", "arg_names": [], "import_names": [], "rhs_call_name": "getWeight", "annotation": ""}, "snippet": " userWeight = self.getWeight(int(user.followers_count))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L52_C12", "label": "friendships = filter()", "type": "assigned_variable", "loc": [52, 52], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L45_C8", "vector": [14, 3, 0.3586, 0.0069, 3, 0.36, 0.625, 755, 3, 1, 0, 0, 526, 10, 3], "semantic": {"name": "friendships", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " friendships = Friendship.objects.all().filter(user__id=int(user.id))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L54_C12", "label": "friendshipCount = count()", "type": "assigned_variable", "loc": [54, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L45_C8", "vector": [14, 3, 0.3724, 0.0069, 3, 0.36, 0.75, 286, 3, 0, 0, 0, 778, 10, 1], "semantic": {"name": "friendshipCount", "arg_names": [], "import_names": [], "rhs_call_name": "count", "annotation": ""}, "snippet": " friendshipCount = friendships.count()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L55_C12", "label": "friendshipCounter =", "type": "assigned_variable", "loc": [55, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L45_C8", "vector": [14, 3, 0.3793, 0.0069, 3, 0.36, 0.875, 600, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "friendshipCounter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " friendshipCounter = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L57_C12", "label": "for friendship", "type": "for", "loc": [57, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L45_C8", "vector": [6, 3, 0.4069, 0.0345, 3, 0.36, 1.0, 778, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "friendship", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for friendship in friendships:\n percentage = 100*(float(friendshipCounter)/friendshipCount)\n print(\"Processing friendship %s/%s (%s\" %(friendshipCounter, friendshipCount, percentage) + \"%)\"+ \" - User: %s\" % percentage + \"%\")\n self.graph.add_edge(userId, int(friendship.followed_user.id))\n friendshipCounter += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L58_C16", "label": "percentage =", "type": "assigned_variable", "loc": [58, 58], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L57_C12", "vector": [14, 4, 0.4, 0.0069, 4, 0.42, 0.0, 568, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "percentage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " percentage = 100*(float(friendshipCounter)/friendshipCount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L59_C16", "label": "print()", "type": "expression", "loc": [59, 59], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L57_C12", "vector": [8, 4, 0.4069, 0.0069, 4, 0.42, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Processing friendship %s/%s (%s\" %(friendshipCounter, friendshipCount, percentage) + \"%)\"+ \" - User: %s\" % percentage + \"%\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L60_C16", "label": "add_edge()", "type": "expression", "loc": [60, 60], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L57_C12", "vector": [8, 4, 0.4138, 0.0069, 4, 0.42, 1.0, 76, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "add_edge", "arg_names": [], "import_names": [], "rhs_call_name": "add_edge", "annotation": ""}, "snippet": " self.graph.add_edge(userId, int(friendship.followed_user.id))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L65_C8", "label": "nodeCount = len()", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L40_C4", "vector": [14, 2, 0.4483, 0.0069, 2, 0.6, 0.7143, 371, 3, 1, 0, 0, 890, 10, 2], "semantic": {"name": "nodeCount", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " nodeCount = len(self.graph.nodes())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L66_C8", "label": "counter =", "type": "assigned_variable", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L40_C4", "vector": [14, 2, 0.4552, 0.0069, 2, 0.6, 0.8571, 7, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "counter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " counter = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L67_C8", "label": "for node", "type": "for", "loc": [67, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L40_C4", "vector": [6, 2, 0.4966, 0.0759, 2, 0.6, 1.0, 772, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for node in self.graph.nodes():\n percentage = 100*(float(counter)/nodeCount)\n print(\"Processing node %s/%s (%s\" %(counter, nodeCount, percentage) + \"%)\")\n user = User.objects.get(id=node)\n userWeight = self.getWeight(int(user.followers_count))\n self.nodeSizes += [userWeight]\n \n userFriendsCount = self.graph.out_degree(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L68_C12", "label": "percentage =", "type": "assigned_variable", "loc": [68, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L67_C8", "vector": [14, 3, 0.469, 0.0069, 3, 0.97, 0.0, 568, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "percentage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " percentage = 100*(float(counter)/nodeCount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L69_C12", "label": "print()", "type": "expression", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L67_C8", "vector": [8, 3, 0.4759, 0.0069, 3, 0.97, 0.25, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Processing node %s/%s (%s\" %(counter, nodeCount, percentage) + \"%)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L70_C12", "label": "user = get()", "type": "assigned_variable", "loc": [70, 70], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L67_C8", "vector": [14, 3, 0.4828, 0.0069, 3, 0.97, 0.5, 503, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " user = User.objects.get(id=node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L71_C12", "label": "userWeight = getWeight()", "type": "assigned_variable", "loc": [71, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L67_C8", "vector": [14, 3, 0.4897, 0.0069, 3, 0.97, 0.75, 375, 3, 1, 0, 0, 760, 10, 2], "semantic": {"name": "userWeight", "arg_names": [], "import_names": [], "rhs_call_name": "getWeight", "annotation": ""}, "snippet": " userWeight = self.getWeight(int(user.followers_count))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L74_C12", "label": "userFriendsCount = out_degree()", "type": "assigned_variable", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L67_C8", "vector": [14, 3, 0.5103, 0.0069, 3, 0.97, 1.0, 440, 3, 1, 0, 0, 464, 10, 1], "semantic": {"name": "userFriendsCount", "arg_names": [], "import_names": [], "rhs_call_name": "out_degree", "annotation": ""}, "snippet": " userFriendsCount = self.graph.out_degree(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L79_C4", "label": "getWeight", "type": "function", "loc": [79, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:ClassDef_L11_C0", "vector": [2, 1, 0.5552, 0.0276, 1, 0.54, 1.0, 760, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "getWeight", "arg_names": ["self", "followers"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def getWeight(self, followers):\n nodeSize = 25\n logBase = 10\n return nodeSize + 4 ** math.log(followers, logBase)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L80_C8", "label": "nodeSize =", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L79_C4", "vector": [14, 2, 0.5517, 0.0069, 2, 0.33, 0.0, 888, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "nodeSize", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nodeSize = 25"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L81_C8", "label": "logBase =", "type": "assigned_variable", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L79_C4", "vector": [14, 2, 0.5586, 0.0069, 2, 0.33, 0.5, 794, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "logBase", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " logBase = 10"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Return_L82_C8", "label": "return", "type": "return", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L79_C4", "vector": [13, 2, 0.5655, 0.0069, 2, 0.33, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return nodeSize + 4 ** math.log(followers, logBase)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:ClassDef_L88_C0", "label": "TwitterGraphBuilder", "type": "class", "loc": [88, 145], "level": 0, "parent": null, "vector": [3, 0, 0.8034, 0.4, 0, 0.66, 1.0, 235, 0, 4, 0, 0, 0, 0, 24], "semantic": {"name": "TwitterGraphBuilder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TwitterGraphBuilder():\n '''\n Builds the replies graph for collected Twitter data\n '''\n\n def __init__(self, hashtagOfInterest=\"summer\"):\n '''\n Constructor"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L89_C4", "label": "expression", "type": "expression", "loc": [89, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:ClassDef_L88_C0", "vector": [8, 1, 0.6207, 0.0207, 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 Builds the replies graph for collected Twitter data\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L93_C4", "label": "__init__", "type": "function", "loc": [93, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:ClassDef_L88_C0", "vector": [2, 1, 0.6897, 0.1034, 1, 0.03, 0.25, 555, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "__init__", "arg_names": ["self", "hashtagOfInterest"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, hashtagOfInterest=\"summer\"):\n '''\n Constructor\n '''\n self.graph = nx.DiGraph()\n \n print(\"Building graph...\")\n print(\"Running tweet query...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L94_C8", "label": "expression", "type": "expression", "loc": [94, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L93_C4", "vector": [8, 2, 0.6552, 0.0207, 2, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Constructor\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L97_C8", "label": "self.graph = DiGraph()", "type": "assigned_variable", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L93_C4", "vector": [14, 2, 0.669, 0.0069, 2, 0.72, 0.1667, 90, 3, 0, 0, 0, 22, 10, 1], "semantic": {"name": "self.graph", "arg_names": [], "import_names": [], "rhs_call_name": "DiGraph", "annotation": ""}, "snippet": " self.graph = nx.DiGraph()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L99_C8", "label": "print()", "type": "expression", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L93_C4", "vector": [8, 2, 0.6828, 0.0069, 2, 0.72, 0.3333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Building graph...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L100_C8", "label": "print()", "type": "expression", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L93_C4", "vector": [8, 2, 0.6897, 0.0069, 2, 0.72, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Running tweet query...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L103_C8", "label": "tweets = filter()", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L93_C4", "vector": [14, 2, 0.7103, 0.0069, 2, 0.72, 0.6667, 680, 3, 1, 0, 0, 526, 10, 2], "semantic": {"name": "tweets", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " tweets = Tweet.objects.all().filter(hashtags__icontains=hashtagOfInterest)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L106_C8", "label": "buildGraph()", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L93_C4", "vector": [8, 2, 0.731, 0.0069, 2, 0.72, 0.8333, 428, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "buildGraph", "arg_names": [], "import_names": [], "rhs_call_name": "buildGraph", "annotation": ""}, "snippet": " self.buildGraph(tweets)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L107_C8", "label": "print()", "type": "expression", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L93_C4", "vector": [8, 2, 0.7379, 0.0069, 2, 0.72, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"...done building graph!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L109_C4", "label": "buildGraph", "type": "function", "loc": [109, 138], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:ClassDef_L88_C0", "vector": [2, 1, 0.8517, 0.2069, 1, 0.03, 0.5, 428, 0, 2, 0, 0, 0, 0, 11], "semantic": {"name": "buildGraph", "arg_names": ["self", "tweets"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def buildGraph(self, tweets):\n tweetCount = len(tweets)\n counter = 0\n for tweet in tweets:\n percentage = 100*(float(counter)/tweetCount)\n print(\"Processing tweet %s/%s (%s\" %(counter, tweetCount, percentage) + \"%)\")\n author = tweet.user\n replyTo = int(tweet.in_reply_to_status_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L110_C8", "label": "tweetCount = len()", "type": "assigned_variable", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L109_C4", "vector": [14, 2, 0.7586, 0.0069, 2, 0.6, 0.0, 318, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "tweetCount", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " tweetCount = len(tweets)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L111_C8", "label": "counter =", "type": "assigned_variable", "loc": [111, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L109_C4", "vector": [14, 2, 0.7655, 0.0069, 2, 0.6, 0.5, 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_1073:For_L112_C8", "label": "for tweet", "type": "for", "loc": [112, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L109_C4", "vector": [6, 2, 0.8621, 0.1862, 2, 0.6, 1.0, 392, 2, 0, 0, 0, 0, 0, 10], "semantic": {"name": "tweet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for tweet in tweets:\n percentage = 100*(float(counter)/tweetCount)\n print(\"Processing tweet %s/%s (%s\" %(counter, tweetCount, percentage) + \"%)\")\n author = tweet.user\n replyTo = int(tweet.in_reply_to_status_id)\n \n if replyTo is 0:\n # it's a reply to all of the author's followers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L113_C12", "label": "percentage =", "type": "assigned_variable", "loc": [113, 113], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L112_C8", "vector": [14, 3, 0.7793, 0.0069, 3, 0.5, 0.0, 568, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "percentage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " percentage = 100*(float(counter)/tweetCount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L114_C12", "label": "print()", "type": "expression", "loc": [114, 114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L112_C8", "vector": [8, 3, 0.7862, 0.0069, 3, 0.5, 0.25, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Processing tweet %s/%s (%s\" %(counter, tweetCount, percentage) + \"%)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L115_C12", "label": "author =", "type": "assigned_variable", "loc": [115, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L112_C8", "vector": [14, 3, 0.7931, 0.0069, 3, 0.5, 0.5, 355, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "author", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " author = tweet.user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L116_C12", "label": "replyTo = int()", "type": "assigned_variable", "loc": [116, 116], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L112_C8", "vector": [14, 3, 0.8, 0.0069, 3, 0.5, 0.75, 914, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "replyTo", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " replyTo = int(tweet.in_reply_to_status_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:If_L118_C12", "label": "if", "type": "if", "loc": [118, 136], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L112_C8", "vector": [4, 3, 0.8759, 0.131, 3, 0.5, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if replyTo is 0:\n # it's a reply to all of the author's followers\n followers = self.getFollowers(author)\n \n followersCount = len(followers)\n followerCounter = 0\n for follower in followers:\n followerPercentage = 100*(float(followerCounter)/followersCount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L120_C16", "label": "followers = getFollowers()", "type": "assigned_variable", "loc": [120, 120], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:If_L118_C12", "vector": [14, 4, 0.8276, 0.0069, 4, 0.53, 0.0, 530, 3, 1, 0, 0, 892, 10, 1], "semantic": {"name": "followers", "arg_names": [], "import_names": [], "rhs_call_name": "getFollowers", "annotation": ""}, "snippet": " followers = self.getFollowers(author)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L122_C16", "label": "followersCount = len()", "type": "assigned_variable", "loc": [122, 122], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:If_L118_C12", "vector": [14, 4, 0.8414, 0.0069, 4, 0.53, 0.25, 684, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "followersCount", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " followersCount = len(followers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L123_C16", "label": "followerCounter =", "type": "assigned_variable", "loc": [123, 123], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:If_L118_C12", "vector": [14, 4, 0.8483, 0.0069, 4, 0.53, 0.5, 341, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "followerCounter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " followerCounter = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L124_C16", "label": "for follower", "type": "for", "loc": [124, 129], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:If_L118_C12", "vector": [6, 4, 0.8724, 0.0414, 4, 0.53, 0.75, 382, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "follower", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for follower in followers:\n followerPercentage = 100*(float(followerCounter)/followersCount)\n print(\"Processing follower %s/%s (%s\" %(followerCounter, followersCount, followerPercentage) + \"%)\" + \" - Tweet: %s\" % percentage + \"%\")\n self.addReply(author, follower.user)\n \n followerCounter += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L125_C20", "label": "followerPercentage =", "type": "assigned_variable", "loc": [125, 125], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L124_C16", "vector": [14, 5, 0.8621, 0.0069, 5, 0.09, 0.0, 721, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "followerPercentage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " followerPercentage = 100*(float(followerCounter)/followersCount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L126_C20", "label": "print()", "type": "expression", "loc": [126, 126], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L124_C16", "vector": [8, 5, 0.869, 0.0069, 5, 0.09, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Processing follower %s/%s (%s\" %(followerCounter, followersCount, followerPercentage) + \"%)\" + \" - Tweet: %s\" % percentage + \"%\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L127_C20", "label": "addReply()", "type": "expression", "loc": [127, 127], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L124_C16", "vector": [8, 5, 0.8759, 0.0069, 5, 0.09, 1.0, 213, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "addReply", "arg_names": [], "import_names": [], "rhs_call_name": "addReply", "annotation": ""}, "snippet": " self.addReply(author, follower.user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Try_L131_C16", "label": "try", "type": "try", "loc": [131, 136], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:If_L118_C12", "vector": [7, 4, 0.9207, 0.0414, 4, 0.53, 1.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n toUser = User.objects.get(replyTo)\n self.addReply(author, toUser)\n except:\n# print(\"Warning: in_reply_to user doesn't exist\")\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L132_C20", "label": "toUser = get()", "type": "assigned_variable", "loc": [132, 132], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:Try_L131_C16", "vector": [14, 5, 0.9103, 0.0069, 5, 0.17, 0.0, 343, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "toUser", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " toUser = User.objects.get(replyTo)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L133_C20", "label": "addReply()", "type": "expression", "loc": [133, 133], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:Try_L131_C16", "vector": [8, 5, 0.9172, 0.0069, 5, 0.17, 1.0, 213, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "addReply", "arg_names": [], "import_names": [], "rhs_call_name": "addReply", "annotation": ""}, "snippet": " self.addReply(author, toUser)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L140_C4", "label": "getFollowers", "type": "function", "loc": [140, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:ClassDef_L88_C0", "vector": [2, 1, 0.9724, 0.0207, 1, 0.03, 0.75, 892, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "getFollowers", "arg_names": ["self", "user"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def getFollowers(self, user):\n friendships = Friendship.objects.all().filter(followed_user__id=int(user.id))\n return friendships"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L141_C8", "label": "friendships = filter()", "type": "assigned_variable", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L140_C4", "vector": [14, 2, 0.9724, 0.0069, 2, 0.66, 0.0, 755, 3, 1, 0, 0, 526, 10, 3], "semantic": {"name": "friendships", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " friendships = Friendship.objects.all().filter(followed_user__id=int(user.id))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Return_L142_C8", "label": "return", "type": "return", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L140_C4", "vector": [13, 2, 0.9793, 0.0069, 2, 0.66, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return friendships"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L144_C4", "label": "addReply", "type": "function", "loc": [144, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:ClassDef_L88_C0", "vector": [2, 1, 0.9966, 0.0138, 1, 0.03, 1.0, 213, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "addReply", "arg_names": ["self", "fromUser", "toUser"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def addReply(self, fromUser, toUser):\n self.graph.add_edge(int(fromUser.id), int(toUser.id))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L145_C8", "label": "add_edge()", "type": "expression", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L144_C4", "vector": [8, 2, 1.0, 0.0069, 2, 0.86, 0.0, 76, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "add_edge", "arg_names": [], "import_names": [], "rhs_call_name": "add_edge", "annotation": ""}, "snippet": " self.graph.add_edge(int(fromUser.id), int(toUser.id))"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1073:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L50_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L52_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L57_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L58_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L57_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L59_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L57_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L60_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L67_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L68_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L67_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L67_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L70_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L67_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L67_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Return_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:ClassDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:ClassDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:ClassDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L112_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L113_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L112_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L114_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L112_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L115_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L112_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L116_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L112_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:If_L118_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:If_L118_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L120_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:If_L118_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L122_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:If_L118_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L123_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:If_L118_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L124_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L124_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L125_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L124_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L126_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:For_L124_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L127_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:If_L118_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Try_L131_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:Try_L131_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L132_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:Try_L131_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L133_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:ClassDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L140_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Assign_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L140_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Return_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:ClassDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1073:FunctionDef_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1073:Expr_L145_C8"}]
# coding: utf-8 ''' Created on 23 mai 2013 @author: Nils Amiet ''' class PolarityCounter: polarityCounts = {} RECEIVED = "recv" SENT = "sent" AVERAGE = "avg" NDI = -1 # network disagreement index def __init__(self, replies): ''' Replies: a list of replies with the attributes "from", "to" and "polarity" ''' self.replies = replies self.edges = [] self.countPolarities() self.computeAveragePolarities() self.computeNDI() def countPolarities(self): for reply in self.replies: fromUser = reply["from"] toUser = reply["to"] polarity = reply["polarity"] # negative polarity becomes 0 and positive becomes 1 polarity = 0 if polarity <= 0 else 1 try: fromUserCounts = self.polarityCounts[fromUser][self.SENT] except KeyError: self.polarityCounts[fromUser] = {self.RECEIVED : {}, self.SENT: {}, self.AVERAGE: None} fromUserCounts = self.polarityCounts[fromUser][self.SENT] try: toUserCounts = self.polarityCounts[toUser][self.RECEIVED] except KeyError: self.polarityCounts[toUser] = {self.RECEIVED : {}, self.SENT: {}, self.AVERAGE: None} toUserCounts = self.polarityCounts[toUser][self.RECEIVED] try: fromUserCounts[polarity] += 1 except: fromUserCounts[polarity] = 1 try: toUserCounts[polarity] += 1 except: toUserCounts[polarity] = 1 def computeAveragePolarities(self): for user, userCounts in self.polarityCounts.items(): try: receivedPositive = userCounts[self.RECEIVED][1] except: receivedPositive = 0 try: receivedNegative = userCounts[self.RECEIVED][0] except: receivedNegative = 0 try: sentPositive = userCounts[self.SENT][1] except: sentPositive = 0 try: sentNegative = userCounts[self.SENT][0] except: sentNegative = 0 try: recv = (receivedPositive - receivedNegative) / float(receivedPositive + receivedNegative) except: pass # user never received a message try: sent = (sentPositive - sentNegative) / float(sentPositive + sentNegative) except: pass # user never sent a message try: userCounts[self.AVERAGE] = abs(recv - sent) except: pass # user never received or sent a message def computeNDI(self): self.computeEdges() sumNDI = 0 for edge in self.edges: weight = 1 firstUser = edge["from"] secondUser = edge["to"] try: firstUserOpinion = self.polarityCounts[firstUser][self.AVERAGE] / float(2) except: firstUserOpinion = 0 try: secondUserOpinion = self.polarityCounts[secondUser][self.AVERAGE] / float(2) except: secondUserOpinion = 0 increment = weight * ((firstUserOpinion - secondUserOpinion)**2) sumNDI += increment self.NDI = sumNDI def computeEdges(self): for reply in self.replies: if not self.contains(reply, self.edges): self.edges += [reply] def contains(self, reply, edges): for edge in edges: if self.isSameMessage(reply, edge): return True return False def isSameMessage(self, reply, reply2): return reply["from"] == reply2["from"] and reply["to"] == reply2["to"] or reply["from"] == reply2["to"] and reply["to"] == reply2["from"] def polarityDifferenceRanking(self): users = {user: userCounts[self.AVERAGE] for user, userCounts in self.polarityCounts.items() if not userCounts[self.AVERAGE] == None} ranking = sorted(users.items(), key=lambda x: x[1], reverse=True) return ranking
ajibawa-2023/Python-Code-Large/train/row_1074
81
127
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0315, 0.0394, 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 23 mai 2013\n\n@author: Nils Amiet\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "label": "PolarityCounter", "type": "class", "loc": [8, 127], "level": 0, "parent": null, "vector": [3, 0, 0.5315, 0.9449, 0, 0.66, 1.0, 151, 0, 8, 0, 0, 0, 0, 15], "semantic": {"name": "PolarityCounter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PolarityCounter:\n \n polarityCounts = {}\n RECEIVED = \"recv\"\n SENT = \"sent\"\n AVERAGE = \"avg\"\n NDI = -1 # network disagreement index\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L10_C4", "label": "polarityCounts =", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "vector": [14, 1, 0.0787, 0.0079, 1, 0.13, 0.0, 540, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "polarityCounts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " polarityCounts = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L11_C4", "label": "RECEIVED =", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "vector": [14, 1, 0.0866, 0.0079, 1, 0.13, 0.0833, 640, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "RECEIVED", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " RECEIVED = \"recv\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L12_C4", "label": "SENT =", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "vector": [14, 1, 0.0945, 0.0079, 1, 0.13, 0.1667, 217, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SENT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " SENT = \"sent\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L13_C4", "label": "AVERAGE =", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "vector": [14, 1, 0.1024, 0.0079, 1, 0.13, 0.25, 795, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "AVERAGE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " AVERAGE = \"avg\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L14_C4", "label": "NDI =", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "vector": [14, 1, 0.1102, 0.0079, 1, 0.13, 0.3333, 225, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "NDI", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " NDI = -1 # network disagreement index"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L16_C4", "label": "__init__", "type": "function", "loc": [16, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "vector": [2, 1, 0.1575, 0.0709, 1, 0.13, 0.4167, 555, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "replies"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, replies):\n '''\n Replies: a list of replies with the attributes \"from\", \"to\" and \"polarity\"\n '''\n self.replies = replies\n self.edges = []\n self.countPolarities()\n self.computeAveragePolarities()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Expr_L17_C8", "label": "expression", "type": "expression", "loc": [17, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L16_C4", "vector": [8, 2, 0.1417, 0.0236, 2, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Replies: a list of replies with the attributes \"from\", \"to\" and \"polarity\"\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L20_C8", "label": "self.replies =", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L16_C4", "vector": [14, 2, 0.1575, 0.0079, 2, 0.84, 0.2, 50, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.replies", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.replies = replies"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L21_C8", "label": "self.edges =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L16_C4", "vector": [14, 2, 0.1654, 0.0079, 2, 0.84, 0.4, 911, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.edges", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.edges = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Expr_L22_C8", "label": "countPolarities()", "type": "expression", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L16_C4", "vector": [8, 2, 0.1732, 0.0079, 2, 0.84, 0.6, 6, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "countPolarities", "arg_names": [], "import_names": [], "rhs_call_name": "countPolarities", "annotation": ""}, "snippet": " self.countPolarities()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Expr_L23_C8", "label": "computeAveragePolarities()", "type": "expression", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L16_C4", "vector": [8, 2, 0.1811, 0.0079, 2, 0.84, 0.8, 836, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "computeAveragePolarities", "arg_names": [], "import_names": [], "rhs_call_name": "computeAveragePolarities", "annotation": ""}, "snippet": " self.computeAveragePolarities()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Expr_L24_C8", "label": "computeNDI()", "type": "expression", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L16_C4", "vector": [8, 2, 0.189, 0.0079, 2, 0.84, 1.0, 850, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "computeNDI", "arg_names": [], "import_names": [], "rhs_call_name": "computeNDI", "annotation": ""}, "snippet": " self.computeNDI()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L26_C4", "label": "countPolarities", "type": "function", "loc": [26, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "vector": [2, 1, 0.315, 0.2283, 1, 0.13, 0.5, 6, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "countPolarities", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def countPolarities(self):\n for reply in self.replies:\n fromUser = reply[\"from\"]\n toUser = reply[\"to\"]\n polarity = reply[\"polarity\"]\n # negative polarity becomes 0 and positive becomes 1\n polarity = 0 if polarity <= 0 else 1\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L27_C8", "label": "for reply", "type": "for", "loc": [27, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L26_C4", "vector": [6, 2, 0.3189, 0.2205, 2, 0.37, 0.0, 714, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for reply in self.replies:\n fromUser = reply[\"from\"]\n toUser = reply[\"to\"]\n polarity = reply[\"polarity\"]\n # negative polarity becomes 0 and positive becomes 1\n polarity = 0 if polarity <= 0 else 1\n \n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L28_C12", "label": "fromUser =", "type": "assigned_variable", "loc": [28, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L27_C8", "vector": [14, 3, 0.2205, 0.0079, 3, 0.7, 0.0, 820, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fromUser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fromUser = reply[\"from\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L29_C12", "label": "toUser =", "type": "assigned_variable", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L27_C8", "vector": [14, 3, 0.2283, 0.0079, 3, 0.7, 0.1429, 343, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "toUser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " toUser = reply[\"to\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L30_C12", "label": "polarity =", "type": "assigned_variable", "loc": [30, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L27_C8", "vector": [14, 3, 0.2362, 0.0079, 3, 0.7, 0.2857, 487, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "polarity", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " polarity = reply[\"polarity\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L32_C12", "label": "polarity =", "type": "assigned_variable", "loc": [32, 32], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L27_C8", "vector": [14, 3, 0.252, 0.0079, 3, 0.7, 0.4286, 487, 8, 0, 0, 0, 0, 0, 0], "semantic": {"name": "polarity", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " polarity = 0 if polarity <= 0 else 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L34_C12", "label": "try", "type": "try", "loc": [34, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L27_C8", "vector": [7, 3, 0.2835, 0.0394, 3, 0.7, 0.5714, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n fromUserCounts = self.polarityCounts[fromUser][self.SENT]\n except KeyError:\n self.polarityCounts[fromUser] = {self.RECEIVED : {}, self.SENT: {}, self.AVERAGE: None}\n fromUserCounts = self.polarityCounts[fromUser][self.SENT]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L35_C16", "label": "fromUserCounts =", "type": "assigned_variable", "loc": [35, 35], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L34_C12", "vector": [14, 4, 0.2756, 0.0079, 4, 0.35, 0.0, 498, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fromUserCounts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fromUserCounts = self.polarityCounts[fromUser][self.SENT]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L37_C16", "label": "assign", "type": "assigned_variable", "loc": [37, 37], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L34_C12", "vector": [14, 4, 0.2913, 0.0079, 4, 0.35, 0.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.polarityCounts[fromUser] = {self.RECEIVED : {}, self.SENT: {}, self.AVERAGE: None}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L38_C16", "label": "fromUserCounts =", "type": "assigned_variable", "loc": [38, 38], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L34_C12", "vector": [14, 4, 0.2992, 0.0079, 4, 0.35, 1.0, 498, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fromUserCounts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fromUserCounts = self.polarityCounts[fromUser][self.SENT]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L40_C12", "label": "try", "type": "try", "loc": [40, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L27_C8", "vector": [7, 3, 0.3307, 0.0394, 3, 0.7, 0.7143, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n toUserCounts = self.polarityCounts[toUser][self.RECEIVED]\n except KeyError:\n self.polarityCounts[toUser] = {self.RECEIVED : {}, self.SENT: {}, self.AVERAGE: None}\n toUserCounts = self.polarityCounts[toUser][self.RECEIVED]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L41_C16", "label": "toUserCounts =", "type": "assigned_variable", "loc": [41, 41], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L40_C12", "vector": [14, 4, 0.3228, 0.0079, 4, 0.74, 0.0, 513, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "toUserCounts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " toUserCounts = self.polarityCounts[toUser][self.RECEIVED]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L43_C16", "label": "assign", "type": "assigned_variable", "loc": [43, 43], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L40_C12", "vector": [14, 4, 0.3386, 0.0079, 4, 0.74, 0.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.polarityCounts[toUser] = {self.RECEIVED : {}, self.SENT: {}, self.AVERAGE: None}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L44_C16", "label": "toUserCounts =", "type": "assigned_variable", "loc": [44, 44], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L40_C12", "vector": [14, 4, 0.3465, 0.0079, 4, 0.74, 1.0, 513, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "toUserCounts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " toUserCounts = self.polarityCounts[toUser][self.RECEIVED]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L46_C12", "label": "try", "type": "try", "loc": [46, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L27_C8", "vector": [7, 3, 0.374, 0.0315, 3, 0.7, 0.8571, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n fromUserCounts[polarity] += 1\n except:\n fromUserCounts[polarity] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L49_C16", "label": "assign", "type": "assigned_variable", "loc": [49, 49], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L46_C12", "vector": [14, 4, 0.3858, 0.0079, 4, 0.35, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fromUserCounts[polarity] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L51_C12", "label": "try", "type": "try", "loc": [51, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L27_C8", "vector": [7, 3, 0.4134, 0.0315, 3, 0.7, 1.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n toUserCounts[polarity] += 1\n except:\n toUserCounts[polarity] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L54_C16", "label": "assign", "type": "assigned_variable", "loc": [54, 54], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L51_C12", "vector": [14, 4, 0.4252, 0.0079, 4, 0.9, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " toUserCounts[polarity] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L56_C4", "label": "computeAveragePolarities", "type": "function", "loc": [56, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "vector": [2, 1, 0.5551, 0.2362, 1, 0.13, 0.5833, 836, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "computeAveragePolarities", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def computeAveragePolarities(self): \n for user, userCounts in self.polarityCounts.items():\n try:\n receivedPositive = userCounts[self.RECEIVED][1]\n except:\n receivedPositive = 0\n try:\n receivedNegative = userCounts[self.RECEIVED][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L57_C8", "label": "for user, userCounts", "type": "for", "loc": [57, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L56_C4", "vector": [6, 2, 0.5591, 0.2283, 2, 0.22, 0.0, 452, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "user, userCounts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for user, userCounts in self.polarityCounts.items():\n try:\n receivedPositive = userCounts[self.RECEIVED][1]\n except:\n receivedPositive = 0\n try:\n receivedNegative = userCounts[self.RECEIVED][0]\n except:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L58_C12", "label": "try", "type": "try", "loc": [58, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L57_C8", "vector": [7, 3, 0.4685, 0.0315, 3, 0.12, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n receivedPositive = userCounts[self.RECEIVED][1]\n except:\n receivedPositive = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L59_C16", "label": "receivedPositive =", "type": "assigned_variable", "loc": [59, 59], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L58_C12", "vector": [14, 4, 0.4646, 0.0079, 4, 0.16, 0.0, 748, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "receivedPositive", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " receivedPositive = userCounts[self.RECEIVED][1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L61_C16", "label": "receivedPositive =", "type": "assigned_variable", "loc": [61, 61], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L58_C12", "vector": [14, 4, 0.4803, 0.0079, 4, 0.16, 0.0, 748, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "receivedPositive", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " receivedPositive = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L62_C12", "label": "try", "type": "try", "loc": [62, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L57_C8", "vector": [7, 3, 0.5, 0.0315, 3, 0.12, 0.1667, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n receivedNegative = userCounts[self.RECEIVED][0]\n except:\n receivedNegative = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L63_C16", "label": "receivedNegative =", "type": "assigned_variable", "loc": [63, 63], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L62_C12", "vector": [14, 4, 0.4961, 0.0079, 4, 0.46, 0.0, 54, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "receivedNegative", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " receivedNegative = userCounts[self.RECEIVED][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L65_C16", "label": "receivedNegative =", "type": "assigned_variable", "loc": [65, 65], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L62_C12", "vector": [14, 4, 0.5118, 0.0079, 4, 0.46, 0.0, 54, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "receivedNegative", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " receivedNegative = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L66_C12", "label": "try", "type": "try", "loc": [66, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L57_C8", "vector": [7, 3, 0.5315, 0.0315, 3, 0.12, 0.3333, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n sentPositive = userCounts[self.SENT][1]\n except:\n sentPositive = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L67_C16", "label": "sentPositive =", "type": "assigned_variable", "loc": [67, 67], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L66_C12", "vector": [14, 4, 0.5276, 0.0079, 4, 0.58, 0.0, 158, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sentPositive", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sentPositive = userCounts[self.SENT][1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L69_C16", "label": "sentPositive =", "type": "assigned_variable", "loc": [69, 69], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L66_C12", "vector": [14, 4, 0.5433, 0.0079, 4, 0.58, 0.0, 158, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "sentPositive", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sentPositive = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L70_C12", "label": "try", "type": "try", "loc": [70, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L57_C8", "vector": [7, 3, 0.563, 0.0315, 3, 0.12, 0.5, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n sentNegative = userCounts[self.SENT][0]\n except:\n sentNegative = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L71_C16", "label": "sentNegative =", "type": "assigned_variable", "loc": [71, 71], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L70_C12", "vector": [14, 4, 0.5591, 0.0079, 4, 0.01, 0.0, 381, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sentNegative", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sentNegative = userCounts[self.SENT][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L73_C16", "label": "sentNegative =", "type": "assigned_variable", "loc": [73, 73], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L70_C12", "vector": [14, 4, 0.5748, 0.0079, 4, 0.01, 0.0, 381, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "sentNegative", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sentNegative = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L74_C12", "label": "try", "type": "try", "loc": [74, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L57_C8", "vector": [7, 3, 0.5945, 0.0315, 3, 0.12, 0.6667, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n recv = (receivedPositive - receivedNegative) / float(receivedPositive + receivedNegative)\n except:\n pass # user never received a message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L75_C16", "label": "recv =", "type": "assigned_variable", "loc": [75, 75], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L74_C12", "vector": [14, 4, 0.5906, 0.0079, 4, 0.46, 0.0, 178, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "recv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " recv = (receivedPositive - receivedNegative) / float(receivedPositive + receivedNegative)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L78_C12", "label": "try", "type": "try", "loc": [78, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L57_C8", "vector": [7, 3, 0.626, 0.0315, 3, 0.12, 0.8333, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n sent = (sentPositive - sentNegative) / float(sentPositive + sentNegative)\n except:\n pass # user never sent a message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L79_C16", "label": "sent =", "type": "assigned_variable", "loc": [79, 79], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L78_C12", "vector": [14, 4, 0.622, 0.0079, 4, 0.45, 0.0, 928, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sent = (sentPositive - sentNegative) / float(sentPositive + sentNegative)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L82_C12", "label": "try", "type": "try", "loc": [82, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L57_C8", "vector": [7, 3, 0.6575, 0.0315, 3, 0.12, 1.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n userCounts[self.AVERAGE] = abs(recv - sent)\n except:\n pass # user never received or sent a message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L83_C16", "label": " = abs()", "type": "assigned_variable", "loc": [83, 83], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L82_C12", "vector": [14, 4, 0.6535, 0.0079, 4, 0.41, 0.0, 0, 3, 1, 0, 0, 799, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "abs", "annotation": ""}, "snippet": " userCounts[self.AVERAGE] = abs(recv - sent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L87_C4", "label": "computeNDI", "type": "function", "loc": [87, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "vector": [2, 1, 0.7677, 0.1732, 1, 0.13, 0.6667, 850, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "computeNDI", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def computeNDI(self):\n self.computeEdges()\n \n sumNDI = 0\n for edge in self.edges:\n weight = 1\n firstUser = edge[\"from\"]\n secondUser = edge[\"to\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Expr_L88_C8", "label": "computeEdges()", "type": "expression", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L87_C4", "vector": [8, 2, 0.6929, 0.0079, 2, 0.77, 0.0, 846, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "computeEdges", "arg_names": [], "import_names": [], "rhs_call_name": "computeEdges", "annotation": ""}, "snippet": " self.computeEdges()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L90_C8", "label": "sumNDI =", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L87_C4", "vector": [14, 2, 0.7087, 0.0079, 2, 0.77, 0.3333, 251, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "sumNDI", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sumNDI = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L91_C8", "label": "for edge", "type": "for", "loc": [91, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L87_C4", "vector": [6, 2, 0.7756, 0.126, 2, 0.77, 0.6667, 860, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "edge", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for edge in self.edges:\n weight = 1\n firstUser = edge[\"from\"]\n secondUser = edge[\"to\"]\n try:\n firstUserOpinion = self.polarityCounts[firstUser][self.AVERAGE] / float(2)\n except:\n firstUserOpinion = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L92_C12", "label": "weight =", "type": "assigned_variable", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L91_C8", "vector": [14, 3, 0.7244, 0.0079, 3, 0.03, 0.0, 205, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "weight", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " weight = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L93_C12", "label": "firstUser =", "type": "assigned_variable", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L91_C8", "vector": [14, 3, 0.7323, 0.0079, 3, 0.03, 0.2, 77, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "firstUser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " firstUser = edge[\"from\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L94_C12", "label": "secondUser =", "type": "assigned_variable", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L91_C8", "vector": [14, 3, 0.7402, 0.0079, 3, 0.03, 0.4, 110, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "secondUser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " secondUser = edge[\"to\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L95_C12", "label": "try", "type": "try", "loc": [95, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L91_C8", "vector": [7, 3, 0.7598, 0.0315, 3, 0.03, 0.6, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n firstUserOpinion = self.polarityCounts[firstUser][self.AVERAGE] / float(2)\n except:\n firstUserOpinion = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L96_C16", "label": "firstUserOpinion =", "type": "assigned_variable", "loc": [96, 96], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L95_C12", "vector": [14, 4, 0.7559, 0.0079, 4, 0.47, 0.0, 737, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "firstUserOpinion", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " firstUserOpinion = self.polarityCounts[firstUser][self.AVERAGE] / float(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L98_C16", "label": "firstUserOpinion =", "type": "assigned_variable", "loc": [98, 98], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L95_C12", "vector": [14, 4, 0.7717, 0.0079, 4, 0.47, 0.0, 737, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "firstUserOpinion", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " firstUserOpinion = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L100_C12", "label": "try", "type": "try", "loc": [100, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L91_C8", "vector": [7, 3, 0.7992, 0.0315, 3, 0.03, 0.8, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n secondUserOpinion = self.polarityCounts[secondUser][self.AVERAGE] / float(2)\n except:\n secondUserOpinion = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L101_C16", "label": "secondUserOpinion =", "type": "assigned_variable", "loc": [101, 101], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L100_C12", "vector": [14, 4, 0.7953, 0.0079, 4, 0.72, 0.0, 312, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "secondUserOpinion", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " secondUserOpinion = self.polarityCounts[secondUser][self.AVERAGE] / float(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L103_C16", "label": "secondUserOpinion =", "type": "assigned_variable", "loc": [103, 103], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L100_C12", "vector": [14, 4, 0.811, 0.0079, 4, 0.72, 0.0, 312, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "secondUserOpinion", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " secondUserOpinion = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L105_C12", "label": "increment =", "type": "assigned_variable", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L91_C8", "vector": [14, 3, 0.8268, 0.0079, 3, 0.03, 1.0, 714, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "increment", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " increment = weight * ((firstUserOpinion - secondUserOpinion)**2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L108_C8", "label": "self.NDI =", "type": "assigned_variable", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L87_C4", "vector": [14, 2, 0.8504, 0.0079, 2, 0.77, 1.0, 969, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.NDI", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.NDI = sumNDI"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L110_C4", "label": "computeEdges", "type": "function", "loc": [110, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "vector": [2, 1, 0.878, 0.0315, 1, 0.13, 0.75, 846, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "computeEdges", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def computeEdges(self):\n for reply in self.replies:\n if not self.contains(reply, self.edges):\n self.edges += [reply]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L111_C8", "label": "for reply", "type": "for", "loc": [111, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L110_C4", "vector": [6, 2, 0.8819, 0.0236, 2, 0.99, 0.0, 714, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for reply in self.replies:\n if not self.contains(reply, self.edges):\n self.edges += [reply]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:If_L112_C12", "label": "if", "type": "if", "loc": [112, 113], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L111_C8", "vector": [4, 3, 0.8858, 0.0157, 3, 0.75, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.contains(reply, self.edges):\n self.edges += [reply]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L115_C4", "label": "contains", "type": "function", "loc": [115, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "vector": [2, 1, 0.9213, 0.0394, 1, 0.13, 0.8333, 848, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "contains", "arg_names": ["self", "reply", "edges"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def contains(self, reply, edges):\n for edge in edges:\n if self.isSameMessage(reply, edge):\n return True\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L116_C8", "label": "for edge", "type": "for", "loc": [116, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L115_C4", "vector": [6, 2, 0.9213, 0.0236, 2, 0.86, 0.0, 860, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "edge", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for edge in edges:\n if self.isSameMessage(reply, edge):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:If_L117_C12", "label": "if", "type": "if", "loc": [117, 118], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L116_C8", "vector": [4, 3, 0.9252, 0.0157, 3, 0.08, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.isSameMessage(reply, edge):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Return_L118_C16", "label": "return", "type": "return", "loc": [118, 118], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:If_L117_C12", "vector": [13, 4, 0.9291, 0.0079, 4, 0.87, 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_1074:Return_L119_C8", "label": "return", "type": "return", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L115_C4", "vector": [13, 2, 0.937, 0.0079, 2, 0.86, 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_1074:FunctionDef_L121_C4", "label": "isSameMessage", "type": "function", "loc": [121, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "vector": [2, 1, 0.9567, 0.0157, 1, 0.13, 0.9167, 950, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "isSameMessage", "arg_names": ["self", "reply", "reply2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def isSameMessage(self, reply, reply2):\n return reply[\"from\"] == reply2[\"from\"] and reply[\"to\"] == reply2[\"to\"] or reply[\"from\"] == reply2[\"to\"] and reply[\"to\"] == reply2[\"from\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Return_L122_C8", "label": "return", "type": "return", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L121_C4", "vector": [13, 2, 0.9606, 0.0079, 2, 0.17, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return reply[\"from\"] == reply2[\"from\"] and reply[\"to\"] == reply2[\"to\"] or reply[\"from\"] == reply2[\"to\"] and reply[\"to\"] == reply2[\"from\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L124_C4", "label": "polarityDifferenceRanking", "type": "function", "loc": [124, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "vector": [2, 1, 0.9882, 0.0315, 1, 0.13, 1.0, 615, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "polarityDifferenceRanking", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def polarityDifferenceRanking(self):\n users = {user: userCounts[self.AVERAGE] for user, userCounts in self.polarityCounts.items() if not userCounts[self.AVERAGE] == None}\n ranking = sorted(users.items(), key=lambda x: x[1], reverse=True)\n return ranking"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L125_C8", "label": "users =", "type": "assigned_variable", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L124_C4", "vector": [14, 2, 0.9843, 0.0079, 2, 0.26, 0.0, 395, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "users", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " users = {user: userCounts[self.AVERAGE] for user, userCounts in self.polarityCounts.items() if not userCounts[self.AVERAGE] == None}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L126_C8", "label": "ranking = sorted()", "type": "assigned_variable", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L124_C4", "vector": [14, 2, 0.9921, 0.0079, 2, 0.26, 0.5, 761, 3, 3, 0, 0, 134, 10, 2], "semantic": {"name": "ranking", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " ranking = sorted(users.items(), key=lambda x: x[1], reverse=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1074:Return_L127_C8", "label": "return", "type": "return", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L124_C4", "vector": [13, 2, 1.0, 0.0079, 2, 0.26, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ranking"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Expr_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Expr_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Expr_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Expr_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L27_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L28_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L27_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L29_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L27_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L30_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L27_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L32_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L27_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L34_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L35_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L34_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L37_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L34_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L38_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L27_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L40_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L41_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L40_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L43_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L40_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L44_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L27_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L46_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L49_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L27_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L51_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L54_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L58_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L59_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L58_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L61_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L62_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L62_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L63_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L62_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L65_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L66_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L66_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L67_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L66_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L69_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L70_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L70_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L71_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L70_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L73_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L74_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L75_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L78_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L79_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L82_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L82_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L83_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Expr_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L92_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L93_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L94_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L95_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L95_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L96_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L95_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L98_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L100_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L100_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L101_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:Try_L100_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L103_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L105_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L111_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:If_L112_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:For_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:If_L117_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:If_L117_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Return_L118_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Return_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Return_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Assign_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1074:FunctionDef_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1074:Return_L127_C8"}]
''' Created on 14 juin 2013 @author: Nils Amiet ''' # coding: utf-8 import networkx as nx import sqlite3 class InfrarougeGraphBuilder(): userRepliesCounts = {} graph1 = nx.DiGraph() userParticipations = [] graph2 = nx.Graph() def __init__(self, databasePath): self.infrarougeDatabasePath = databasePath self.countUserReplies() self.createRepliesGraph() self.buildUserParticipations() self.createParticipationGraph() def countUserReplies(self): with sqlite3.connect(self.infrarougeDatabasePath) as connection: cursor = connection.cursor() query = "SELECT * FROM reply" cursor.execute(query) for reply in cursor: self.countReply(reply) cursor.close() def countReply(self, reply): fromUser = reply[0] toUser = reply[1] fromTo = (fromUser, toUser) try: self.userRepliesCounts[fromTo] += 1 except KeyError: self.userRepliesCounts[fromTo] = 1 def createRepliesGraph(self): for fromTo, w in self.userRepliesCounts.items(): try: self.graph1.add_edge(fromTo[0], fromTo[1], weight=w) except: print("Warning: adding edge failed") def buildUserParticipations(self): with sqlite3.connect(self.infrarougeDatabasePath) as connection: cursor = connection.cursor() query = "SELECT * FROM threadmessage" cursor.execute(query) for threadMessage in cursor: forumThread = threadMessage[2] user = threadMessage[3] userThreadTuple = (user, forumThread) self.userParticipations += [userThreadTuple] cursor.close() def createParticipationGraph(self): users = [x[0] for x in self.userParticipations] discussions = [x[1] for x in self.userParticipations] self.graph2.add_nodes_from(users, bipartite=0) self.graph2.add_nodes_from(discussions, bipartite=1) self.graph2.add_edges_from(self.userParticipations)
ajibawa-2023/Python-Code-Large/train/row_1075
47
79
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.038, 0.0633, 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 14 juin 2013\n\n@author: Nils Amiet\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Import_L9_C0", "label": "networkx import nx", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1139, 0.0127, 0, 0.66, 0.3333, 691, 0, 1, 0, 0, 691, 0, 0], "semantic": {"name": "networkx", "arg_names": [], "import_names": ["nx"], "rhs_call_name": "", "annotation": ""}, "snippet": "import networkx as nx"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Import_L10_C0", "label": "sqlite3 import sqlite3", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1266, 0.0127, 0, 0.66, 0.6667, 790, 0, 1, 0, 0, 790, 0, 0], "semantic": {"name": "sqlite3", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:ClassDef_L12_C0", "label": "InfrarougeGraphBuilder", "type": "class", "loc": [12, 78], "level": 0, "parent": null, "vector": [3, 0, 0.5696, 0.8481, 0, 0.66, 1.0, 544, 0, 6, 0, 0, 0, 0, 21], "semantic": {"name": "InfrarougeGraphBuilder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class InfrarougeGraphBuilder():\n \n userRepliesCounts = {}\n graph1 = nx.DiGraph()\n \n userParticipations = []\n graph2 = nx.Graph()\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L14_C4", "label": "userRepliesCounts =", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:ClassDef_L12_C0", "vector": [14, 1, 0.1772, 0.0127, 1, 0.56, 0.0, 161, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "userRepliesCounts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userRepliesCounts = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L15_C4", "label": "graph1 = DiGraph()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:ClassDef_L12_C0", "vector": [14, 1, 0.1899, 0.0127, 1, 0.56, 0.1111, 982, 3, 0, 0, 0, 22, 10, 1], "semantic": {"name": "graph1", "arg_names": [], "import_names": [], "rhs_call_name": "DiGraph", "annotation": ""}, "snippet": " graph1 = nx.DiGraph()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L17_C4", "label": "userParticipations =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:ClassDef_L12_C0", "vector": [14, 1, 0.2152, 0.0127, 1, 0.56, 0.2222, 773, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "userParticipations", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userParticipations = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L18_C4", "label": "graph2 = Graph()", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:ClassDef_L12_C0", "vector": [14, 1, 0.2278, 0.0127, 1, 0.56, 0.3333, 11, 3, 0, 0, 0, 90, 10, 1], "semantic": {"name": "graph2", "arg_names": [], "import_names": [], "rhs_call_name": "Graph", "annotation": ""}, "snippet": " graph2 = nx.Graph()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L20_C4", "label": "__init__", "type": "function", "loc": [20, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:ClassDef_L12_C0", "vector": [2, 1, 0.2911, 0.0886, 1, 0.56, 0.4444, 555, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "databasePath"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, databasePath):\n self.infrarougeDatabasePath = databasePath\n \n self.countUserReplies()\n self.createRepliesGraph()\n self.buildUserParticipations()\n self.createParticipationGraph()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L21_C8", "label": "self.infrarougeDatabasePath =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L20_C4", "vector": [14, 2, 0.2658, 0.0127, 2, 0.42, 0.0, 592, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.infrarougeDatabasePath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.infrarougeDatabasePath = databasePath"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L23_C8", "label": "countUserReplies()", "type": "expression", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L20_C4", "vector": [8, 2, 0.2911, 0.0127, 2, 0.42, 0.25, 442, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "countUserReplies", "arg_names": [], "import_names": [], "rhs_call_name": "countUserReplies", "annotation": ""}, "snippet": " self.countUserReplies()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L24_C8", "label": "createRepliesGraph()", "type": "expression", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L20_C4", "vector": [8, 2, 0.3038, 0.0127, 2, 0.42, 0.5, 793, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "createRepliesGraph", "arg_names": [], "import_names": [], "rhs_call_name": "createRepliesGraph", "annotation": ""}, "snippet": " self.createRepliesGraph()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L25_C8", "label": "buildUserParticipations()", "type": "expression", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L20_C4", "vector": [8, 2, 0.3165, 0.0127, 2, 0.42, 0.75, 953, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "buildUserParticipations", "arg_names": [], "import_names": [], "rhs_call_name": "buildUserParticipations", "annotation": ""}, "snippet": " self.buildUserParticipations()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L26_C8", "label": "createParticipationGraph()", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L20_C4", "vector": [8, 2, 0.3291, 0.0127, 2, 0.42, 1.0, 506, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "createParticipationGraph", "arg_names": [], "import_names": [], "rhs_call_name": "createParticipationGraph", "annotation": ""}, "snippet": " self.createParticipationGraph()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L28_C4", "label": "countUserReplies", "type": "function", "loc": [28, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:ClassDef_L12_C0", "vector": [2, 1, 0.4177, 0.1392, 1, 0.56, 0.5556, 442, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "countUserReplies", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def countUserReplies(self): \n with sqlite3.connect(self.infrarougeDatabasePath) as connection:\n cursor = connection.cursor()\n \n query = \"SELECT * FROM reply\"\n cursor.execute(query)\n \n for reply in cursor:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L30_C12", "label": "cursor = cursor()", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L28_C4", "vector": [14, 2, 0.3797, 0.0127, 2, 0.63, 0.0, 231, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cursor", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cursor = connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L32_C12", "label": "query =", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L28_C4", "vector": [14, 2, 0.4051, 0.0127, 2, 0.63, 0.25, 546, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query = \"SELECT * FROM reply\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L33_C12", "label": "execute()", "type": "expression", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L28_C4", "vector": [8, 2, 0.4177, 0.0127, 2, 0.63, 0.5, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cursor.execute(query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:For_L35_C12", "label": "for reply", "type": "for", "loc": [35, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L28_C4", "vector": [6, 2, 0.4494, 0.0253, 2, 0.63, 0.75, 714, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for reply in cursor:\n self.countReply(reply)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L36_C16", "label": "countReply()", "type": "expression", "loc": [36, 36], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:For_L35_C12", "vector": [8, 3, 0.4557, 0.0127, 3, 0.96, 0.0, 168, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "countReply", "arg_names": [], "import_names": [], "rhs_call_name": "countReply", "annotation": ""}, "snippet": " self.countReply(reply)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L38_C12", "label": "close()", "type": "expression", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L28_C4", "vector": [8, 2, 0.481, 0.0127, 2, 0.63, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cursor.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L40_C4", "label": "countReply", "type": "function", "loc": [40, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:ClassDef_L12_C0", "vector": [2, 1, 0.557, 0.1139, 1, 0.56, 0.6667, 168, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "countReply", "arg_names": ["self", "reply"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def countReply(self, reply):\n fromUser = reply[0]\n toUser = reply[1]\n \n fromTo = (fromUser, toUser)\n try:\n self.userRepliesCounts[fromTo] += 1\n except KeyError:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L41_C8", "label": "fromUser =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L40_C4", "vector": [14, 2, 0.519, 0.0127, 2, 0.46, 0.0, 820, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fromUser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fromUser = reply[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L42_C8", "label": "toUser =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L40_C4", "vector": [14, 2, 0.5316, 0.0127, 2, 0.46, 0.3333, 343, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "toUser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " toUser = reply[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L44_C8", "label": "fromTo =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L40_C4", "vector": [14, 2, 0.557, 0.0127, 2, 0.46, 0.6667, 933, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "fromTo", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fromTo = (fromUser, toUser)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Try_L45_C8", "label": "try", "type": "try", "loc": [45, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L40_C4", "vector": [7, 2, 0.5886, 0.0506, 2, 0.46, 1.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.userRepliesCounts[fromTo] += 1\n except KeyError:\n self.userRepliesCounts[fromTo] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L48_C12", "label": "assign", "type": "assigned_variable", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:Try_L45_C8", "vector": [14, 3, 0.6076, 0.0127, 3, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.userRepliesCounts[fromTo] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L50_C4", "label": "createRepliesGraph", "type": "function", "loc": [50, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:ClassDef_L12_C0", "vector": [2, 1, 0.6646, 0.0759, 1, 0.56, 0.7778, 793, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "createRepliesGraph", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def createRepliesGraph(self): \n for fromTo, w in self.userRepliesCounts.items():\n try:\n self.graph1.add_edge(fromTo[0], fromTo[1], weight=w)\n except:\n print(\"Warning: adding edge failed\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:For_L51_C8", "label": "for fromTo, w", "type": "for", "loc": [51, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L50_C4", "vector": [6, 2, 0.6709, 0.0633, 2, 0.56, 0.0, 777, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "fromTo, w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for fromTo, w in self.userRepliesCounts.items():\n try:\n self.graph1.add_edge(fromTo[0], fromTo[1], weight=w)\n except:\n print(\"Warning: adding edge failed\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Try_L52_C12", "label": "try", "type": "try", "loc": [52, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:For_L51_C8", "vector": [7, 3, 0.6772, 0.0506, 3, 0.58, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.graph1.add_edge(fromTo[0], fromTo[1], weight=w)\n except:\n print(\"Warning: adding edge failed\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L53_C16", "label": "add_edge()", "type": "expression", "loc": [53, 53], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:Try_L52_C12", "vector": [8, 4, 0.6709, 0.0127, 4, 0.37, 0.0, 76, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "add_edge", "arg_names": [], "import_names": [], "rhs_call_name": "add_edge", "annotation": ""}, "snippet": " self.graph1.add_edge(fromTo[0], fromTo[1], weight=w)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L55_C16", "label": "print()", "type": "expression", "loc": [55, 55], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:Try_L52_C12", "vector": [8, 4, 0.6962, 0.0127, 4, 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(\"Warning: adding edge failed\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L57_C4", "label": "buildUserParticipations", "type": "function", "loc": [57, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:ClassDef_L12_C0", "vector": [2, 1, 0.8038, 0.1772, 1, 0.56, 0.8889, 953, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "buildUserParticipations", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def buildUserParticipations(self): \n with sqlite3.connect(self.infrarougeDatabasePath) as connection:\n cursor = connection.cursor()\n \n query = \"SELECT * FROM threadmessage\"\n cursor.execute(query)\n \n for threadMessage in cursor:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L59_C12", "label": "cursor = cursor()", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L57_C4", "vector": [14, 2, 0.7468, 0.0127, 2, 0.91, 0.0, 231, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cursor", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cursor = connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L61_C12", "label": "query =", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L57_C4", "vector": [14, 2, 0.7722, 0.0127, 2, 0.91, 0.25, 546, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query = \"SELECT * FROM threadmessage\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L62_C12", "label": "execute()", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L57_C4", "vector": [8, 2, 0.7848, 0.0127, 2, 0.91, 0.5, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cursor.execute(query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:For_L64_C12", "label": "for threadMessage", "type": "for", "loc": [64, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L57_C4", "vector": [6, 2, 0.8354, 0.0633, 2, 0.91, 0.75, 465, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "threadMessage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for threadMessage in cursor:\n forumThread = threadMessage[2]\n user = threadMessage[3]\n userThreadTuple = (user, forumThread)\n self.userParticipations += [userThreadTuple]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L65_C16", "label": "forumThread =", "type": "assigned_variable", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:For_L64_C12", "vector": [14, 3, 0.8228, 0.0127, 3, 0.61, 0.0, 696, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "forumThread", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " forumThread = threadMessage[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L66_C16", "label": "user =", "type": "assigned_variable", "loc": [66, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:For_L64_C12", "vector": [14, 3, 0.8354, 0.0127, 3, 0.61, 0.5, 503, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user = threadMessage[3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L67_C16", "label": "userThreadTuple =", "type": "assigned_variable", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:For_L64_C12", "vector": [14, 3, 0.8481, 0.0127, 3, 0.61, 1.0, 870, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "userThreadTuple", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userThreadTuple = (user, forumThread)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L70_C12", "label": "close()", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L57_C4", "vector": [8, 2, 0.8861, 0.0127, 2, 0.91, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cursor.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L72_C4", "label": "createParticipationGraph", "type": "function", "loc": [72, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:ClassDef_L12_C0", "vector": [2, 1, 0.9494, 0.0886, 1, 0.56, 1.0, 506, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "createParticipationGraph", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def createParticipationGraph(self):\n users = [x[0] for x in self.userParticipations]\n discussions = [x[1] for x in self.userParticipations]\n \n self.graph2.add_nodes_from(users, bipartite=0)\n self.graph2.add_nodes_from(discussions, bipartite=1)\n self.graph2.add_edges_from(self.userParticipations)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L73_C8", "label": "users =", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L72_C4", "vector": [14, 2, 0.9241, 0.0127, 2, 0.82, 0.0, 395, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "users", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " users = [x[0] for x in self.userParticipations]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L74_C8", "label": "discussions =", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L72_C4", "vector": [14, 2, 0.9367, 0.0127, 2, 0.82, 0.25, 842, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "discussions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " discussions = [x[1] for x in self.userParticipations]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L76_C8", "label": "add_nodes_from()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L72_C4", "vector": [8, 2, 0.962, 0.0127, 2, 0.82, 0.5, 221, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "add_nodes_from", "arg_names": [], "import_names": [], "rhs_call_name": "add_nodes_from", "annotation": ""}, "snippet": " self.graph2.add_nodes_from(users, bipartite=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L77_C8", "label": "add_nodes_from()", "type": "expression", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L72_C4", "vector": [8, 2, 0.9747, 0.0127, 2, 0.82, 0.75, 221, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "add_nodes_from", "arg_names": [], "import_names": [], "rhs_call_name": "add_nodes_from", "annotation": ""}, "snippet": " self.graph2.add_nodes_from(discussions, bipartite=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L78_C8", "label": "add_edges_from()", "type": "expression", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L72_C4", "vector": [8, 2, 0.9873, 0.0127, 2, 0.82, 1.0, 574, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add_edges_from", "arg_names": [], "import_names": [], "rhs_call_name": "add_edges_from", "annotation": ""}, "snippet": " self.graph2.add_edges_from(self.userParticipations)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1075:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L30_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L32_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L33_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:For_L35_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:For_L35_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L36_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Try_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:Try_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:For_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:For_L51_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Try_L52_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:Try_L52_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L53_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:Try_L52_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L55_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L62_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:For_L64_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:For_L64_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L65_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:For_L64_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L66_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:For_L64_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L67_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L70_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Assign_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1075:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1075:Expr_L78_C8"}]
''' Created on 11 juin 2013 @author: Nils Amiet ''' from ITInfluence.polarity import PolarityCounter from ITInfluence.models import Tweet, User, Friendship from ITInfluence.hashtags import getAllHashtags from InfrarougeTwitterInfluence import settings import sqlite3 import math infrarougeDatabasePath = settings.DATABASES["infrarouge"]["NAME"] def getUsers(): getUsers = [] with sqlite3.connect(infrarougeDatabasePath) as connection: cursor = connection.cursor() query = "SELECT * FROM user" cursor.execute(query) for user in cursor: getUsers += [user] cursor.close() return getUsers def getForums(): forums = [] with sqlite3.connect(infrarougeDatabasePath) as connection: cursor = connection.cursor() query = """ SELECT * FROM forum """ cursor.execute(query) for forum in cursor: builtForum = { "id": forum[0], "title": forum[1], "description": forum[2], } forums += [builtForum] return forums def polarityReplies(forum=None): '''Returns a list of replies containing the source, destination, polarity, timestamp and forum id''' replies = [] with sqlite3.connect(infrarougeDatabasePath) as connection: cursor = connection.cursor() query = """ SELECT r.fkfrom, r.fkto, m.polarity, m.timestamp, f.id FROM reply as r INNER JOIN threadmessage as m ON r.fkthreadmessage=m.id INNER JOIN forumthread as t ON m.fkforumthread=t.id INNER JOIN forum as f ON t.fkparentforum=f.id """ if forum is not None: query += "WHERE f.id=" + str(forum) cursor.execute(query) for reply in cursor: builtReply = { "from": reply[0], "to": reply[1], "polarity": reply[2], "timestamp": reply[3], "forum": reply[4] } replies += [builtReply] cursor.close() return replies def polarizationForAllForums(equalTime=True, equalRepliesCount=True): forums = getForums() resultsEqualTime = [] resultsEqualRepliesCount = [] for forum in forums: forumID = forum["id"] title = "Forum " + str(forumID) replies = polarityReplies(forum=forumID) timeSortedReplies = sorted(replies, key=lambda x: x["timestamp"]) sliceCount = 20 # equal time interval if equalTime: res = computePolarizationOverTime(timeSortedReplies, forumID, sliceCount) resultsEqualTime += [(title, res)] # equal replies count interval if equalRepliesCount: res2 = computePolarizationOverTimeSamePostCount(timeSortedReplies, forumID, sliceCount) resultsEqualRepliesCount += [(title, res2)] return resultsEqualTime, resultsEqualRepliesCount def computePolarizationOverTimeSamePostCount(replies, forumID, sliceCount): repliesCount = len(replies) deltaRepliesFloat = repliesCount / float(sliceCount) deltaReplies = int(math.ceil(repliesCount / sliceCount)) if deltaRepliesFloat is not deltaReplies: deltaReplies += 1 ndiVariation = [] replyOffset = 0 while replyOffset < repliesCount: upperOffset = replyOffset + deltaReplies + 1 r = replies[replyOffset:upperOffset] polarityCounter = PolarityCounter(r) edgesCount = len(polarityCounter.edges) ndiVariation += [(int(replyOffset), polarityCounter.NDI, edgesCount)] replyOffset += deltaReplies times = [x[0] for x in ndiVariation] times = [i for i, unused in enumerate(times)] ndis = [x[1] for x in ndiVariation] return times, ndis def computePolarizationOverTime(replies, forumID, sliceCount): first = replies[0]["timestamp"] last = replies[-1]["timestamp"] interval = last - first deltaTimeMillis = interval / sliceCount ndiVariation = [] timeThreshold = first + deltaTimeMillis while timeThreshold <= last: lowerBound = timeThreshold - deltaTimeMillis upperBound = timeThreshold r = repliesInTimeInterval(replies, lowerBound, upperBound) polarityCounter = PolarityCounter(r) ndiVariation += [(int(timeThreshold), polarityCounter.NDI)] timeThreshold += deltaTimeMillis times = [x[0] for x in ndiVariation] times = [i for i, unused in enumerate(times)] ndis = [x[1] for x in ndiVariation] return times, ndis def repliesInTimeInterval(replies, lowerBound, upperBound): return [reply for reply in replies if reply["timestamp"] >= lowerBound and reply["timestamp"] <= upperBound ] '''Twitter''' def getNDIForMostFrequentHashtags(equalTime=True, equalRepliesCount=True): hashtags = mostFrequentHashtags() print("Most frequent hashtags:") print(hashtags) resultsEqualTimeIntervals = [] resultsEqualRepliesCountIntervals = [] sliceCount = 20 # Adjust this value as you wish # Greater value = More accurate results but more computation time maxFollowersCount = 50 for hashtag in hashtags: eqTime, eqReplyCount = getNDIForHashtag(hashtag, sliceCount=sliceCount, maxFollowersCount=maxFollowersCount, equalTime=equalTime, equalRepliesCount=equalRepliesCount) resultsEqualTimeIntervals += eqTime resultsEqualRepliesCountIntervals += eqReplyCount return resultsEqualTimeIntervals, resultsEqualRepliesCountIntervals def getNDIForHashtag(hashtag, sliceCount=20, maxFollowersCount=100, equalTime=True, equalRepliesCount=True): resultsEqualTimeIntervals = [] resultsEqualRepliesCountIntervals = [] print("Computing NDIs for hashtag %s..." % hashtag) ### Uncomment one of the following lines "tweets = ..." # Users with at most x followers, fast computation tweets = Tweet.objects.all().filter(user__followers_count__lte=maxFollowersCount).filter(hashtags__icontains=hashtag) # Complete dataset: Requires a lot of memory and a fast CPU for large networks # tweets = Tweet.objects.all().filter(hashtags__icontains=hashtag) timeSortedTweets = sorted(tweets, key=lambda x: x.created_at) if equalTime: ndis = getNDIValuesForHashtag(hashtag, sliceCount, timeSortedTweets) resultsEqualTimeIntervals += [("#" + hashtag, ndis)] if equalRepliesCount: ndis = getNDIValuesEqualRepliesCountForHashtag(hashtag, sliceCount, timeSortedTweets) resultsEqualRepliesCountIntervals += [("#" + hashtag, ndis)] return resultsEqualTimeIntervals, resultsEqualRepliesCountIntervals def mostFrequentHashtags(): hashtagCount = 6 # n most frequent hashtags = getAllHashtags() hashtags = sorted(hashtags, key=lambda x: x[1], reverse=True) # sort by number of occurences hashtags = [tag.lower() for tag, unused in hashtags] hashtags = convertListToSetKeepingOrder(hashtags) hashtags = hashtags[:hashtagCount] return hashtags def convertListToSetKeepingOrder(xs): # Inspired from http://stackoverflow.com/a/480227 seen = set() addToSet = seen.add return [x for x in xs if x not in seen and not addToSet(x)] def computeReplies(tweets): replies = [] for tweet in tweets: authorId = int(tweet.user.id) polarity = float(tweet.polarity) replyTo = int(tweet.in_reply_to_status_id) if replyTo is not 0: # reply to single person try: user = User.objects.get(id=replyTo) userId = int(user.id) builtReply = { "from": authorId, "to": userId, "polarity": polarity, } replies += [builtReply] except: # reply to all his/her followers replies += getFollowerReplies(authorId, polarity) else: # reply to all his/her followers replies += getFollowerReplies(authorId, polarity) return replies def getFollowerReplies(authorId, polarity): replies = [] friendships = Friendship.objects.all().filter(followed_user__id=authorId) followers = [int(f.user.id) for f in friendships] for follower in followers: builtReply = { "from": authorId, "to": follower, "polarity": polarity, } replies += [builtReply] return replies def getNDIValuesEqualRepliesCountForHashtag(hashtag, sliceCount, timeSortedTweets): ndiVariation = [] if len(timeSortedTweets) >= 2: tweetCount = len(timeSortedTweets) deltaTweetsFloat = tweetCount / float(sliceCount) deltaTweets = int(math.ceil(tweetCount / sliceCount)) if deltaTweetsFloat is not deltaTweets: deltaTweets += 1 tweetOffset = 0 sliceIndex = 1 while tweetOffset < tweetCount: print("Computing slice %s/%s" %(sliceIndex, sliceCount)) upperOffset = tweetOffset + deltaTweets + 1 tweetsSubset = timeSortedTweets[tweetOffset:upperOffset] replies = computeReplies(tweetsSubset) polarityCounter = PolarityCounter(replies) ndiVariation += [(int(tweetOffset), polarityCounter.NDI)] tweetOffset += deltaTweets sliceIndex += 1 times = [x[0] for x in ndiVariation] times = [i for i, unused in enumerate(times)] ndis = [x[1] for x in ndiVariation] return times, ndis def getNDIValuesForHashtag(hashtag, sliceCount, timeSortedTweets): ndiVariation = [] if len(timeSortedTweets) >= 2: first = timeSortedTweets[0].created_at last = timeSortedTweets[-1].created_at interval = last - first deltaTimeMillis = interval / sliceCount sliceIndex = 1 timeUpperBound = first + deltaTimeMillis while timeUpperBound <= last: print("Computing slice %s/%s" %(sliceIndex, sliceCount)) tweetsSubset = tweetsInInterval(timeSortedTweets, timeUpperBound - deltaTimeMillis, timeUpperBound) replies = computeReplies(tweetsSubset) polarityCounter = PolarityCounter(replies) ndiVariation += [(timeUpperBound, polarityCounter.NDI)] timeUpperBound += deltaTimeMillis if timeUpperBound == timeUpperBound + deltaTimeMillis: break sliceIndex += 1 times = [x[0] for x in ndiVariation] times = [i for i, unused in enumerate(times)] ndis = [x[1] for x in ndiVariation] return times, ndis def tweetsInInterval(tweets, timeLowerBound, timeUpperBound): return [tweet for tweet in tweets if tweet.created_at >= timeLowerBound and tweet.created_at <= timeUpperBound]
ajibawa-2023/Python-Code-Large/train/row_1076
178
338
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0089, 0.0148, 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 11 juin 2013\n\n@author: Nils Amiet\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:ImportFrom_L7_C0", "label": "from ITInfluence.polarity import PolarityCounter", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0207, 0.003, 0, 0.66, 0.0417, 330, 0, 1, 0, 0, 330, 0, 0], "semantic": {"name": "ITInfluence.polarity", "arg_names": [], "import_names": ["PolarityCounter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ITInfluence.polarity import PolarityCounter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:ImportFrom_L8_C0", "label": "from ITInfluence.models import Tweet, User, Friendship", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0237, 0.003, 0, 0.66, 0.0833, 316, 0, 3, 0, 0, 316, 0, 0], "semantic": {"name": "ITInfluence.models", "arg_names": [], "import_names": ["Tweet", "User", "Friendship"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ITInfluence.models import Tweet, User, Friendship"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:ImportFrom_L9_C0", "label": "from ITInfluence.hashtags import getAllHashtags", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0266, 0.003, 0, 0.66, 0.125, 154, 0, 1, 0, 0, 154, 0, 0], "semantic": {"name": "ITInfluence.hashtags", "arg_names": [], "import_names": ["getAllHashtags"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ITInfluence.hashtags import getAllHashtags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:ImportFrom_L10_C0", "label": "from InfrarougeTwitterInfluence import settings", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0296, 0.003, 0, 0.66, 0.1667, 542, 0, 1, 0, 0, 542, 0, 0], "semantic": {"name": "InfrarougeTwitterInfluence", "arg_names": [], "import_names": ["settings"], "rhs_call_name": "", "annotation": ""}, "snippet": "from InfrarougeTwitterInfluence import settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Import_L11_C0", "label": "sqlite3 import sqlite3", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0325, 0.003, 0, 0.66, 0.2083, 790, 0, 1, 0, 0, 790, 0, 0], "semantic": {"name": "sqlite3", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Import_L12_C0", "label": "math import math", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0355, 0.003, 0, 0.66, 0.25, 526, 0, 1, 0, 0, 526, 0, 0], "semantic": {"name": "math", "arg_names": [], "import_names": ["math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L14_C0", "label": "infrarougeDatabasePath =", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.0414, 0.003, 0, 0.66, 0.2917, 522, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "infrarougeDatabasePath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "infrarougeDatabasePath = settings.DATABASES[\"infrarouge\"][\"NAME\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L16_C0", "label": "getUsers", "type": "function", "loc": [16, 30], "level": 0, "parent": null, "vector": [2, 0, 0.068, 0.0444, 0, 0.66, 0.3333, 31, 0, 0, 1, 0, 0, 0, 4], "semantic": {"name": "getUsers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getUsers():\n getUsers = []\n \n with sqlite3.connect(infrarougeDatabasePath) as connection:\n cursor = connection.cursor()\n \n query = \"SELECT * FROM user\"\n cursor.execute(query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L17_C4", "label": "getUsers =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L16_C0", "vector": [14, 1, 0.0503, 0.003, 1, 0.63, 0.0, 31, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "getUsers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " getUsers = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L20_C8", "label": "cursor = cursor()", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L16_C0", "vector": [14, 1, 0.0592, 0.003, 1, 0.63, 0.0, 231, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cursor", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cursor = connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L22_C8", "label": "query =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L16_C0", "vector": [14, 1, 0.0651, 0.003, 1, 0.63, 0.25, 546, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query = \"SELECT * FROM user\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L23_C8", "label": "execute()", "type": "expression", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L16_C0", "vector": [8, 1, 0.068, 0.003, 1, 0.63, 0.5, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cursor.execute(query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L25_C8", "label": "for user", "type": "for", "loc": [25, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L16_C0", "vector": [6, 1, 0.0754, 0.0059, 1, 0.63, 0.75, 503, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for user in cursor:\n getUsers += [user]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L28_C8", "label": "close()", "type": "expression", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L16_C0", "vector": [8, 1, 0.0828, 0.003, 1, 0.63, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cursor.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L30_C4", "label": "return", "type": "return", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L16_C0", "vector": [13, 1, 0.0888, 0.003, 1, 0.63, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return getUsers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L32_C0", "label": "getForums", "type": "function", "loc": [32, 52], "level": 0, "parent": null, "vector": [2, 0, 0.1243, 0.0621, 0, 0.66, 0.375, 929, 0, 0, 1, 0, 0, 0, 3], "semantic": {"name": "getForums", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getForums():\n forums = []\n \n with sqlite3.connect(infrarougeDatabasePath) as connection:\n cursor = connection.cursor()\n \n query = \"\"\"\n SELECT *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L33_C4", "label": "forums =", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L32_C0", "vector": [14, 1, 0.0976, 0.003, 1, 0.43, 0.0, 763, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "forums", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " forums = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L36_C8", "label": "cursor = cursor()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L32_C0", "vector": [14, 1, 0.1065, 0.003, 1, 0.43, 0.0, 231, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cursor", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cursor = connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L38_C8", "label": "query =", "type": "assigned_variable", "loc": [38, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L32_C0", "vector": [14, 1, 0.1169, 0.0118, 1, 0.43, 0.3333, 546, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query = \"\"\"\n SELECT *\n FROM forum\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L43_C8", "label": "execute()", "type": "expression", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L32_C0", "vector": [8, 1, 0.1272, 0.003, 1, 0.43, 0.6667, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cursor.execute(query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L44_C8", "label": "for forum", "type": "for", "loc": [44, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L32_C0", "vector": [6, 1, 0.1391, 0.0207, 1, 0.43, 1.0, 659, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "forum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for forum in cursor:\n builtForum = {\n \"id\": forum[0],\n \"title\": forum[1],\n \"description\": forum[2],\n }\n forums += [builtForum]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L45_C12", "label": "builtForum =", "type": "assigned_variable", "loc": [45, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L44_C8", "vector": [14, 2, 0.1391, 0.0148, 2, 0.17, 0.0, 782, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "builtForum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " builtForum = {\n \"id\": forum[0],\n \"title\": forum[1],\n \"description\": forum[2],\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L52_C4", "label": "return", "type": "return", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L32_C0", "vector": [13, 1, 0.1538, 0.003, 1, 0.43, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return forums"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L54_C0", "label": "polarityReplies", "type": "function", "loc": [54, 89], "level": 0, "parent": null, "vector": [2, 0, 0.2115, 0.1065, 0, 0.66, 0.4167, 533, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "polarityReplies", "arg_names": ["forum"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def polarityReplies(forum=None):\n '''Returns a list of replies containing the source, destination, polarity, timestamp and forum id'''\n replies = []\n \n with sqlite3.connect(infrarougeDatabasePath) as connection:\n cursor = connection.cursor()\n \n query = \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L55_C4", "label": "expression", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L54_C0", "vector": [8, 1, 0.1627, 0.003, 1, 0.29, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Returns a list of replies containing the source, destination, polarity, timestamp and forum id'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L56_C4", "label": "replies =", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L54_C0", "vector": [14, 1, 0.1657, 0.003, 1, 0.29, 0.5, 205, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "replies", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " replies = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L59_C8", "label": "cursor = cursor()", "type": "assigned_variable", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L54_C0", "vector": [14, 1, 0.1746, 0.003, 1, 0.29, 0.0, 231, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cursor", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cursor = connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L61_C8", "label": "query =", "type": "assigned_variable", "loc": [61, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L54_C0", "vector": [14, 1, 0.1938, 0.0296, 1, 0.29, 0.2, 546, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query = \"\"\"\n SELECT r.fkfrom, r.fkto, m.polarity, m.timestamp, f.id\n FROM reply as r\n INNER JOIN threadmessage as m\n ON r.fkthreadmessage=m.id\n INNER JOIN forumthread as t\n ON m.fkforumthread=t.id\n INNER JOIN forum as f"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L72_C8", "label": "if", "type": "if", "loc": [72, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L54_C0", "vector": [4, 1, 0.2145, 0.0059, 1, 0.29, 0.4, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if forum is not None:\n query += \"WHERE f.id=\" + str(forum)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L74_C8", "label": "execute()", "type": "expression", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L54_C0", "vector": [8, 1, 0.2189, 0.003, 1, 0.29, 0.6, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cursor.execute(query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L76_C8", "label": "for reply", "type": "for", "loc": [76, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L54_C0", "vector": [6, 1, 0.2382, 0.0296, 1, 0.29, 0.8, 714, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for reply in cursor:\n builtReply = {\n \"from\": reply[0],\n \"to\": reply[1],\n \"polarity\": reply[2],\n \"timestamp\": reply[3],\n \"forum\": reply[4]\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L77_C12", "label": "builtReply =", "type": "assigned_variable", "loc": [77, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L76_C8", "vector": [14, 2, 0.2367, 0.0207, 2, 0.74, 0.0, 248, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "builtReply", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " builtReply = {\n \"from\": reply[0],\n \"to\": reply[1],\n \"polarity\": reply[2],\n \"timestamp\": reply[3],\n \"forum\": reply[4]\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L87_C8", "label": "close()", "type": "expression", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L54_C0", "vector": [8, 1, 0.2574, 0.003, 1, 0.29, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cursor.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L89_C4", "label": "return", "type": "return", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L54_C0", "vector": [13, 1, 0.2633, 0.003, 1, 0.29, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return replies"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L91_C0", "label": "polarizationForAllForums", "type": "function", "loc": [91, 115], "level": 0, "parent": null, "vector": [2, 0, 0.3047, 0.074, 0, 0.66, 0.4583, 209, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "polarizationForAllForums", "arg_names": ["equalTime", "equalRepliesCount"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def polarizationForAllForums(equalTime=True, equalRepliesCount=True):\n forums = getForums()\n \n resultsEqualTime = []\n resultsEqualRepliesCount = []\n \n for forum in forums:\n forumID = forum[\"id\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L92_C4", "label": "forums = getForums()", "type": "assigned_variable", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L91_C0", "vector": [14, 1, 0.2722, 0.003, 1, 0.04, 0.0, 763, 3, 0, 0, 0, 929, 10, 1], "semantic": {"name": "forums", "arg_names": [], "import_names": [], "rhs_call_name": "getForums", "annotation": ""}, "snippet": " forums = getForums()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L94_C4", "label": "resultsEqualTime =", "type": "assigned_variable", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L91_C0", "vector": [14, 1, 0.2781, 0.003, 1, 0.04, 0.25, 568, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "resultsEqualTime", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " resultsEqualTime = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L95_C4", "label": "resultsEqualRepliesCount =", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L91_C0", "vector": [14, 1, 0.2811, 0.003, 1, 0.04, 0.5, 55, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "resultsEqualRepliesCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " resultsEqualRepliesCount = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L97_C4", "label": "for forum", "type": "for", "loc": [97, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L91_C0", "vector": [6, 1, 0.3107, 0.0503, 1, 0.04, 0.75, 659, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "forum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for forum in forums:\n forumID = forum[\"id\"]\n title = \"Forum \" + str(forumID)\n replies = polarityReplies(forum=forumID)\n timeSortedReplies = sorted(replies, key=lambda x: x[\"timestamp\"])\n \n sliceCount = 20\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L98_C8", "label": "forumID =", "type": "assigned_variable", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L97_C4", "vector": [14, 2, 0.2899, 0.003, 2, 0.94, 0.0, 457, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "forumID", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " forumID = forum[\"id\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L99_C8", "label": "title =", "type": "assigned_variable", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L97_C4", "vector": [14, 2, 0.2929, 0.003, 2, 0.94, 0.1667, 48, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " title = \"Forum \" + str(forumID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L100_C8", "label": "replies = polarityReplies()", "type": "assigned_variable", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L97_C4", "vector": [14, 2, 0.2959, 0.003, 2, 0.94, 0.3333, 205, 3, 1, 0, 0, 533, 10, 1], "semantic": {"name": "replies", "arg_names": [], "import_names": [], "rhs_call_name": "polarityReplies", "annotation": ""}, "snippet": " replies = polarityReplies(forum=forumID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L101_C8", "label": "timeSortedReplies = sorted()", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L97_C4", "vector": [14, 2, 0.2988, 0.003, 2, 0.94, 0.5, 639, 3, 2, 0, 0, 134, 10, 1], "semantic": {"name": "timeSortedReplies", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " timeSortedReplies = sorted(replies, key=lambda x: x[\"timestamp\"])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L103_C8", "label": "sliceCount =", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L97_C4", "vector": [14, 2, 0.3047, 0.003, 2, 0.94, 0.6667, 749, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "sliceCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sliceCount = 20"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L106_C8", "label": "if", "type": "if", "loc": [106, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L97_C4", "vector": [4, 2, 0.3166, 0.0089, 2, 0.94, 0.8333, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if equalTime:\n res = computePolarizationOverTime(timeSortedReplies, forumID, sliceCount)\n resultsEqualTime += [(title, res)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L107_C12", "label": "res = computePolarizationOverTime()", "type": "assigned_variable", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L106_C8", "vector": [14, 3, 0.3166, 0.003, 3, 0.9, 0.0, 413, 3, 3, 0, 0, 539, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "computePolarizationOverTime", "annotation": ""}, "snippet": " res = computePolarizationOverTime(timeSortedReplies, forumID, sliceCount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L111_C8", "label": "if", "type": "if", "loc": [111, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L97_C4", "vector": [4, 2, 0.3314, 0.0089, 2, 0.94, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if equalRepliesCount:\n res2 = computePolarizationOverTimeSamePostCount(timeSortedReplies, forumID, sliceCount)\n resultsEqualRepliesCount += [(title, res2)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L112_C12", "label": "res2 = computePolarizationOverTimeSamePostCount()", "type": "assigned_variable", "loc": [112, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L111_C8", "vector": [14, 3, 0.3314, 0.003, 3, 0.37, 0.0, 290, 3, 3, 0, 0, 811, 10, 1], "semantic": {"name": "res2", "arg_names": [], "import_names": [], "rhs_call_name": "computePolarizationOverTimeSamePostCount", "annotation": ""}, "snippet": " res2 = computePolarizationOverTimeSamePostCount(timeSortedReplies, forumID, sliceCount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L115_C4", "label": "return", "type": "return", "loc": [115, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L91_C0", "vector": [13, 1, 0.3402, 0.003, 1, 0.04, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return resultsEqualTime, resultsEqualRepliesCount"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "label": "computePolarizationOverTimeSamePostCount", "type": "function", "loc": [117, 141], "level": 0, "parent": null, "vector": [2, 0, 0.3817, 0.074, 0, 0.66, 0.5, 811, 0, 3, 1, 0, 0, 0, 8], "semantic": {"name": "computePolarizationOverTimeSamePostCount", "arg_names": ["replies", "forumID", "sliceCount"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def computePolarizationOverTimeSamePostCount(replies, forumID, sliceCount):\n repliesCount = len(replies)\n \n deltaRepliesFloat = repliesCount / float(sliceCount)\n deltaReplies = int(math.ceil(repliesCount / sliceCount))\n \n if deltaRepliesFloat is not deltaReplies:\n deltaReplies += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L118_C4", "label": "repliesCount = len()", "type": "assigned_variable", "loc": [118, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "vector": [14, 1, 0.3491, 0.003, 1, 0.3, 0.0, 393, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "repliesCount", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " repliesCount = len(replies)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L120_C4", "label": "deltaRepliesFloat =", "type": "assigned_variable", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "vector": [14, 1, 0.355, 0.003, 1, 0.3, 0.1, 528, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "deltaRepliesFloat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " deltaRepliesFloat = repliesCount / float(sliceCount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L121_C4", "label": "deltaReplies = int()", "type": "assigned_variable", "loc": [121, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "vector": [14, 1, 0.358, 0.003, 1, 0.3, 0.2, 297, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "deltaReplies", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " deltaReplies = int(math.ceil(repliesCount / sliceCount))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L123_C4", "label": "if", "type": "if", "loc": [123, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "vector": [4, 1, 0.3654, 0.0059, 1, 0.3, 0.3, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if deltaRepliesFloat is not deltaReplies:\n deltaReplies += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L126_C4", "label": "ndiVariation =", "type": "assigned_variable", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "vector": [14, 1, 0.3728, 0.003, 1, 0.3, 0.4, 178, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "ndiVariation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ndiVariation = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L127_C4", "label": "replyOffset =", "type": "assigned_variable", "loc": [127, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "vector": [14, 1, 0.3757, 0.003, 1, 0.3, 0.5, 516, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "replyOffset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " replyOffset = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L128_C4", "label": "while", "type": "while", "loc": [128, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "vector": [5, 1, 0.3891, 0.0237, 1, 0.3, 0.6, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while replyOffset < repliesCount:\n upperOffset = replyOffset + deltaReplies + 1\n r = replies[replyOffset:upperOffset]\n polarityCounter = PolarityCounter(r)\n edgesCount = len(polarityCounter.edges)\n ndiVariation += [(int(replyOffset), polarityCounter.NDI, edgesCount)]\n \n replyOffset += deltaReplies"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L129_C8", "label": "upperOffset =", "type": "assigned_variable", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L128_C4", "vector": [14, 2, 0.3817, 0.003, 2, 0.2, 0.0, 660, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "upperOffset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " upperOffset = replyOffset + deltaReplies + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L130_C8", "label": "r =", "type": "assigned_variable", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L128_C4", "vector": [14, 2, 0.3846, 0.003, 2, 0.2, 0.3333, 436, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r = replies[replyOffset:upperOffset]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L131_C8", "label": "polarityCounter = PolarityCounter()", "type": "assigned_variable", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L128_C4", "vector": [14, 2, 0.3876, 0.003, 2, 0.2, 0.6667, 889, 3, 1, 0, 0, 151, 10, 1], "semantic": {"name": "polarityCounter", "arg_names": [], "import_names": [], "rhs_call_name": "PolarityCounter", "annotation": ""}, "snippet": " polarityCounter = PolarityCounter(r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L132_C8", "label": "edgesCount = len()", "type": "assigned_variable", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L128_C4", "vector": [14, 2, 0.3905, 0.003, 2, 0.2, 1.0, 984, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "edgesCount", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " edgesCount = len(polarityCounter.edges)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L137_C4", "label": "times =", "type": "assigned_variable", "loc": [137, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "vector": [14, 1, 0.4053, 0.003, 1, 0.3, 0.7, 342, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "times", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " times = [x[0] for x in ndiVariation]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L138_C4", "label": "times =", "type": "assigned_variable", "loc": [138, 138], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "vector": [14, 1, 0.4083, 0.003, 1, 0.3, 0.8, 342, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "times", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " times = [i for i, unused in enumerate(times)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L139_C4", "label": "ndis =", "type": "assigned_variable", "loc": [139, 139], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "vector": [14, 1, 0.4112, 0.003, 1, 0.3, 0.9, 718, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ndis", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ndis = [x[1] for x in ndiVariation]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L141_C4", "label": "return", "type": "return", "loc": [141, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "vector": [13, 1, 0.4172, 0.003, 1, 0.3, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return times, ndis"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "label": "computePolarizationOverTime", "type": "function", "loc": [143, 164], "level": 0, "parent": null, "vector": [2, 0, 0.4541, 0.0651, 0, 0.66, 0.5417, 539, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "computePolarizationOverTime", "arg_names": ["replies", "forumID", "sliceCount"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def computePolarizationOverTime(replies, forumID, sliceCount):\n first = replies[0][\"timestamp\"]\n last = replies[-1][\"timestamp\"]\n interval = last - first\n deltaTimeMillis = interval / sliceCount\n \n ndiVariation = []\n timeThreshold = first + deltaTimeMillis"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L144_C4", "label": "first =", "type": "assigned_variable", "loc": [144, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "vector": [14, 1, 0.426, 0.003, 1, 0.41, 0.0, 199, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = replies[0][\"timestamp\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L145_C4", "label": "last =", "type": "assigned_variable", "loc": [145, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "vector": [14, 1, 0.429, 0.003, 1, 0.41, 0.1, 95, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "last", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last = replies[-1][\"timestamp\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L146_C4", "label": "interval =", "type": "assigned_variable", "loc": [146, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "vector": [14, 1, 0.432, 0.003, 1, 0.41, 0.2, 628, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "interval", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " interval = last - first"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L147_C4", "label": "deltaTimeMillis =", "type": "assigned_variable", "loc": [147, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "vector": [14, 1, 0.4349, 0.003, 1, 0.41, 0.3, 545, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "deltaTimeMillis", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " deltaTimeMillis = interval / sliceCount"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L149_C4", "label": "ndiVariation =", "type": "assigned_variable", "loc": [149, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "vector": [14, 1, 0.4408, 0.003, 1, 0.41, 0.4, 178, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "ndiVariation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ndiVariation = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L150_C4", "label": "timeThreshold =", "type": "assigned_variable", "loc": [150, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "vector": [14, 1, 0.4438, 0.003, 1, 0.41, 0.5, 816, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "timeThreshold", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " timeThreshold = first + deltaTimeMillis"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L151_C4", "label": "while", "type": "while", "loc": [151, 158], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "vector": [5, 1, 0.4571, 0.0237, 1, 0.41, 0.6, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while timeThreshold <= last:\n lowerBound = timeThreshold - deltaTimeMillis\n upperBound = timeThreshold\n r = repliesInTimeInterval(replies, lowerBound, upperBound)\n polarityCounter = PolarityCounter(r)\n ndiVariation += [(int(timeThreshold), polarityCounter.NDI)]\n \n timeThreshold += deltaTimeMillis"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L152_C8", "label": "lowerBound =", "type": "assigned_variable", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L151_C4", "vector": [14, 2, 0.4497, 0.003, 2, 0.88, 0.0, 158, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lowerBound", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lowerBound = timeThreshold - deltaTimeMillis"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L153_C8", "label": "upperBound =", "type": "assigned_variable", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L151_C4", "vector": [14, 2, 0.4527, 0.003, 2, 0.88, 0.3333, 752, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "upperBound", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " upperBound = timeThreshold"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L154_C8", "label": "r = repliesInTimeInterval()", "type": "assigned_variable", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L151_C4", "vector": [14, 2, 0.4556, 0.003, 2, 0.88, 0.6667, 436, 3, 3, 0, 0, 883, 10, 1], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "repliesInTimeInterval", "annotation": ""}, "snippet": " r = repliesInTimeInterval(replies, lowerBound, upperBound)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L155_C8", "label": "polarityCounter = PolarityCounter()", "type": "assigned_variable", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L151_C4", "vector": [14, 2, 0.4586, 0.003, 2, 0.88, 1.0, 889, 3, 1, 0, 0, 151, 10, 1], "semantic": {"name": "polarityCounter", "arg_names": [], "import_names": [], "rhs_call_name": "PolarityCounter", "annotation": ""}, "snippet": " polarityCounter = PolarityCounter(r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L160_C4", "label": "times =", "type": "assigned_variable", "loc": [160, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "vector": [14, 1, 0.4734, 0.003, 1, 0.41, 0.7, 342, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "times", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " times = [x[0] for x in ndiVariation]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L161_C4", "label": "times =", "type": "assigned_variable", "loc": [161, 161], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "vector": [14, 1, 0.4763, 0.003, 1, 0.41, 0.8, 342, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "times", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " times = [i for i, unused in enumerate(times)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L162_C4", "label": "ndis =", "type": "assigned_variable", "loc": [162, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "vector": [14, 1, 0.4793, 0.003, 1, 0.41, 0.9, 718, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ndis", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ndis = [x[1] for x in ndiVariation]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L164_C4", "label": "return", "type": "return", "loc": [164, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "vector": [13, 1, 0.4852, 0.003, 1, 0.41, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return times, ndis"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L166_C0", "label": "repliesInTimeInterval", "type": "function", "loc": [166, 167], "level": 0, "parent": null, "vector": [2, 0, 0.4926, 0.0059, 0, 0.66, 0.5833, 883, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "repliesInTimeInterval", "arg_names": ["replies", "lowerBound", "upperBound"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def repliesInTimeInterval(replies, lowerBound, upperBound):\n return [reply for reply in replies if reply[\"timestamp\"] >= lowerBound and reply[\"timestamp\"] <= upperBound ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L167_C4", "label": "return", "type": "return", "loc": [167, 167], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L166_C0", "vector": [13, 1, 0.4941, 0.003, 1, 0.81, 0.0, 0, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [reply for reply in replies if reply[\"timestamp\"] >= lowerBound and reply[\"timestamp\"] <= upperBound ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L178_C0", "label": "expression", "type": "expression", "loc": [178, 178], "level": 0, "parent": null, "vector": [8, 0, 0.5266, 0.003, 0, 0.66, 0.625, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''Twitter'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L179_C0", "label": "getNDIForMostFrequentHashtags", "type": "function", "loc": [179, 195], "level": 0, "parent": null, "vector": [2, 0, 0.5533, 0.0503, 0, 0.66, 0.6667, 809, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "getNDIForMostFrequentHashtags", "arg_names": ["equalTime", "equalRepliesCount"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getNDIForMostFrequentHashtags(equalTime=True, equalRepliesCount=True):\n hashtags = mostFrequentHashtags()\n print(\"Most frequent hashtags:\")\n print(hashtags)\n resultsEqualTimeIntervals = []\n resultsEqualRepliesCountIntervals = []\n sliceCount = 20\n # Adjust this value as you wish"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L180_C4", "label": "hashtags = mostFrequentHashtags()", "type": "assigned_variable", "loc": [180, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L179_C0", "vector": [14, 1, 0.5325, 0.003, 1, 0.42, 0.0, 366, 3, 0, 0, 0, 291, 10, 1], "semantic": {"name": "hashtags", "arg_names": [], "import_names": [], "rhs_call_name": "mostFrequentHashtags", "annotation": ""}, "snippet": " hashtags = mostFrequentHashtags()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L181_C4", "label": "print()", "type": "expression", "loc": [181, 181], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L179_C0", "vector": [8, 1, 0.5355, 0.003, 1, 0.42, 0.125, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Most frequent hashtags:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L182_C4", "label": "print()", "type": "expression", "loc": [182, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L179_C0", "vector": [8, 1, 0.5385, 0.003, 1, 0.42, 0.25, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(hashtags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L183_C4", "label": "resultsEqualTimeIntervals =", "type": "assigned_variable", "loc": [183, 183], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L179_C0", "vector": [14, 1, 0.5414, 0.003, 1, 0.42, 0.375, 115, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "resultsEqualTimeIntervals", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " resultsEqualTimeIntervals = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L184_C4", "label": "resultsEqualRepliesCountIntervals =", "type": "assigned_variable", "loc": [184, 184], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L179_C0", "vector": [14, 1, 0.5444, 0.003, 1, 0.42, 0.5, 618, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "resultsEqualRepliesCountIntervals", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " resultsEqualRepliesCountIntervals = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L185_C4", "label": "sliceCount =", "type": "assigned_variable", "loc": [185, 185], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L179_C0", "vector": [14, 1, 0.5473, 0.003, 1, 0.42, 0.625, 749, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "sliceCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sliceCount = 20"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L188_C4", "label": "maxFollowersCount =", "type": "assigned_variable", "loc": [188, 188], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L179_C0", "vector": [14, 1, 0.5562, 0.003, 1, 0.42, 0.75, 14, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "maxFollowersCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " maxFollowersCount = 50"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L190_C4", "label": "for hashtag", "type": "for", "loc": [190, 193], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L179_C0", "vector": [6, 1, 0.5666, 0.0118, 1, 0.42, 0.875, 908, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "hashtag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for hashtag in hashtags:\n eqTime, eqReplyCount = getNDIForHashtag(hashtag, sliceCount=sliceCount, maxFollowersCount=maxFollowersCount, equalTime=equalTime, equalRepliesCount=equalRepliesCount)\n resultsEqualTimeIntervals += eqTime\n resultsEqualRepliesCountIntervals += eqReplyCount"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L191_C8", "label": "eqTime, eqReplyCount = getNDIForHashtag()", "type": "assigned_variable", "loc": [191, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L190_C4", "vector": [14, 2, 0.5651, 0.003, 2, 0.04, 0.0, 46, 3, 5, 0, 0, 886, 10, 1], "semantic": {"name": "eqTime, eqReplyCount", "arg_names": [], "import_names": [], "rhs_call_name": "getNDIForHashtag", "annotation": ""}, "snippet": " eqTime, eqReplyCount = getNDIForHashtag(hashtag, sliceCount=sliceCount, maxFollowersCount=maxFollowersCount, equalTime=equalTime, equalRepliesCount=equalRepliesCount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L195_C4", "label": "return", "type": "return", "loc": [195, 195], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L179_C0", "vector": [13, 1, 0.5769, 0.003, 1, 0.42, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return resultsEqualTimeIntervals, resultsEqualRepliesCountIntervals"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L197_C0", "label": "getNDIForHashtag", "type": "function", "loc": [197, 216], "level": 0, "parent": null, "vector": [2, 0, 0.6109, 0.0592, 0, 0.66, 0.7083, 886, 0, 5, 1, 0, 0, 0, 7], "semantic": {"name": "getNDIForHashtag", "arg_names": ["hashtag", "sliceCount", "maxFollowersCount", "equalTime", "equalRepliesCount"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getNDIForHashtag(hashtag, sliceCount=20, maxFollowersCount=100, equalTime=True, equalRepliesCount=True):\n resultsEqualTimeIntervals = []\n resultsEqualRepliesCountIntervals = []\n \n print(\"Computing NDIs for hashtag %s...\" % hashtag)\n ### Uncomment one of the following lines \"tweets = ...\"\n # Users with at most x followers, fast computation\n tweets = Tweet.objects.all().filter(user__followers_count__lte=maxFollowersCount).filter(hashtags__icontains=hashtag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L198_C4", "label": "resultsEqualTimeIntervals =", "type": "assigned_variable", "loc": [198, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L197_C0", "vector": [14, 1, 0.5858, 0.003, 1, 0.56, 0.0, 115, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "resultsEqualTimeIntervals", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " resultsEqualTimeIntervals = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L199_C4", "label": "resultsEqualRepliesCountIntervals =", "type": "assigned_variable", "loc": [199, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L197_C0", "vector": [14, 1, 0.5888, 0.003, 1, 0.56, 0.1429, 618, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "resultsEqualRepliesCountIntervals", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " resultsEqualRepliesCountIntervals = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L201_C4", "label": "print()", "type": "expression", "loc": [201, 201], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L197_C0", "vector": [8, 1, 0.5947, 0.003, 1, 0.56, 0.2857, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Computing NDIs for hashtag %s...\" % hashtag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L204_C4", "label": "tweets = filter()", "type": "assigned_variable", "loc": [204, 204], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L197_C0", "vector": [14, 1, 0.6036, 0.003, 1, 0.56, 0.4286, 680, 3, 1, 0, 0, 526, 10, 3], "semantic": {"name": "tweets", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " tweets = Tweet.objects.all().filter(user__followers_count__lte=maxFollowersCount).filter(hashtags__icontains=hashtag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L207_C4", "label": "timeSortedTweets = sorted()", "type": "assigned_variable", "loc": [207, 207], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L197_C0", "vector": [14, 1, 0.6124, 0.003, 1, 0.56, 0.5714, 722, 3, 2, 0, 0, 134, 10, 1], "semantic": {"name": "timeSortedTweets", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " timeSortedTweets = sorted(tweets, key=lambda x: x.created_at)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L209_C4", "label": "if", "type": "if", "loc": [209, 211], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L197_C0", "vector": [4, 1, 0.6213, 0.0089, 1, 0.56, 0.7143, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if equalTime:\n ndis = getNDIValuesForHashtag(hashtag, sliceCount, timeSortedTweets)\n resultsEqualTimeIntervals += [(\"#\" + hashtag, ndis)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L210_C8", "label": "ndis = getNDIValuesForHashtag()", "type": "assigned_variable", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L209_C4", "vector": [14, 2, 0.6213, 0.003, 2, 0.99, 0.0, 718, 3, 3, 0, 0, 135, 10, 1], "semantic": {"name": "ndis", "arg_names": [], "import_names": [], "rhs_call_name": "getNDIValuesForHashtag", "annotation": ""}, "snippet": " ndis = getNDIValuesForHashtag(hashtag, sliceCount, timeSortedTweets)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L212_C4", "label": "if", "type": "if", "loc": [212, 214], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L197_C0", "vector": [4, 1, 0.6302, 0.0089, 1, 0.56, 0.8571, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if equalRepliesCount:\n ndis = getNDIValuesEqualRepliesCountForHashtag(hashtag, sliceCount, timeSortedTweets)\n resultsEqualRepliesCountIntervals += [(\"#\" + hashtag, ndis)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L213_C8", "label": "ndis = getNDIValuesEqualRepliesCountForHashtag()", "type": "assigned_variable", "loc": [213, 213], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L212_C4", "vector": [14, 2, 0.6302, 0.003, 2, 0.73, 0.0, 718, 3, 3, 0, 0, 586, 10, 1], "semantic": {"name": "ndis", "arg_names": [], "import_names": [], "rhs_call_name": "getNDIValuesEqualRepliesCountForHashtag", "annotation": ""}, "snippet": " ndis = getNDIValuesEqualRepliesCountForHashtag(hashtag, sliceCount, timeSortedTweets)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L216_C4", "label": "return", "type": "return", "loc": [216, 216], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L197_C0", "vector": [13, 1, 0.6391, 0.003, 1, 0.56, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return resultsEqualTimeIntervals, resultsEqualRepliesCountIntervals"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L218_C0", "label": "mostFrequentHashtags", "type": "function", "loc": [218, 226], "level": 0, "parent": null, "vector": [2, 0, 0.6568, 0.0266, 0, 0.66, 0.75, 291, 0, 0, 1, 0, 0, 0, 4], "semantic": {"name": "mostFrequentHashtags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def mostFrequentHashtags():\n hashtagCount = 6 # n most frequent\n hashtags = getAllHashtags()\n hashtags = sorted(hashtags, key=lambda x: x[1], reverse=True) # sort by number of occurences\n hashtags = [tag.lower() for tag, unused in hashtags]\n hashtags = convertListToSetKeepingOrder(hashtags)\n hashtags = hashtags[:hashtagCount]\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L219_C4", "label": "hashtagCount =", "type": "assigned_variable", "loc": [219, 219], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L218_C0", "vector": [14, 1, 0.6479, 0.003, 1, 0.22, 0.0, 725, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "hashtagCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hashtagCount = 6 # n most frequent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L220_C4", "label": "hashtags = getAllHashtags()", "type": "assigned_variable", "loc": [220, 220], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L218_C0", "vector": [14, 1, 0.6509, 0.003, 1, 0.22, 0.1667, 366, 3, 0, 0, 0, 225, 10, 1], "semantic": {"name": "hashtags", "arg_names": [], "import_names": [], "rhs_call_name": "getAllHashtags", "annotation": ""}, "snippet": " hashtags = getAllHashtags()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L221_C4", "label": "hashtags = sorted()", "type": "assigned_variable", "loc": [221, 221], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L218_C0", "vector": [14, 1, 0.6538, 0.003, 1, 0.22, 0.3333, 366, 3, 3, 0, 0, 134, 10, 1], "semantic": {"name": "hashtags", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " hashtags = sorted(hashtags, key=lambda x: x[1], reverse=True) # sort by number of occurences"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L222_C4", "label": "hashtags =", "type": "assigned_variable", "loc": [222, 222], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L218_C0", "vector": [14, 1, 0.6568, 0.003, 1, 0.22, 0.5, 366, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "hashtags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hashtags = [tag.lower() for tag, unused in hashtags]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L223_C4", "label": "hashtags = convertListToSetKeepingOrder()", "type": "assigned_variable", "loc": [223, 223], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L218_C0", "vector": [14, 1, 0.6598, 0.003, 1, 0.22, 0.6667, 366, 3, 1, 0, 0, 797, 10, 1], "semantic": {"name": "hashtags", "arg_names": [], "import_names": [], "rhs_call_name": "convertListToSetKeepingOrder", "annotation": ""}, "snippet": " hashtags = convertListToSetKeepingOrder(hashtags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L224_C4", "label": "hashtags =", "type": "assigned_variable", "loc": [224, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L218_C0", "vector": [14, 1, 0.6627, 0.003, 1, 0.22, 0.8333, 366, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "hashtags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hashtags = hashtags[:hashtagCount]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L226_C4", "label": "return", "type": "return", "loc": [226, 226], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L218_C0", "vector": [13, 1, 0.6686, 0.003, 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 hashtags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L228_C0", "label": "convertListToSetKeepingOrder", "type": "function", "loc": [228, 232], "level": 0, "parent": null, "vector": [2, 0, 0.6805, 0.0148, 0, 0.66, 0.7917, 797, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "convertListToSetKeepingOrder", "arg_names": ["xs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def convertListToSetKeepingOrder(xs):\n # Inspired from http://stackoverflow.com/a/480227\n seen = set()\n addToSet = seen.add\n return [x for x in xs if x not in seen and not addToSet(x)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L230_C4", "label": "seen = set()", "type": "assigned_variable", "loc": [230, 230], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L228_C0", "vector": [14, 1, 0.6805, 0.003, 1, 0.88, 0.0, 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_1076:Assign_L231_C4", "label": "addToSet =", "type": "assigned_variable", "loc": [231, 231], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L228_C0", "vector": [14, 1, 0.6834, 0.003, 1, 0.88, 0.5, 36, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "addToSet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " addToSet = seen.add"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L232_C4", "label": "return", "type": "return", "loc": [232, 232], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L228_C0", "vector": [13, 1, 0.6864, 0.003, 1, 0.88, 1.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [x for x in xs if x not in seen and not addToSet(x)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L234_C0", "label": "computeReplies", "type": "function", "loc": [234, 260], "level": 0, "parent": null, "vector": [2, 0, 0.7308, 0.0799, 0, 0.66, 0.8333, 407, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "computeReplies", "arg_names": ["tweets"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def computeReplies(tweets):\n replies = []\n \n for tweet in tweets:\n authorId = int(tweet.user.id)\n polarity = float(tweet.polarity)\n replyTo = int(tweet.in_reply_to_status_id)\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L235_C4", "label": "replies =", "type": "assigned_variable", "loc": [235, 235], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L234_C0", "vector": [14, 1, 0.6953, 0.003, 1, 0.73, 0.0, 205, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "replies", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " replies = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L237_C4", "label": "for tweet", "type": "for", "loc": [237, 258], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L234_C0", "vector": [6, 1, 0.7322, 0.0651, 1, 0.73, 0.5, 392, 2, 0, 0, 0, 0, 0, 7], "semantic": {"name": "tweet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for tweet in tweets:\n authorId = int(tweet.user.id)\n polarity = float(tweet.polarity)\n replyTo = int(tweet.in_reply_to_status_id)\n \n if replyTo is not 0: # reply to single person\n try:\n user = User.objects.get(id=replyTo)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L238_C8", "label": "authorId = int()", "type": "assigned_variable", "loc": [238, 238], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L237_C4", "vector": [14, 2, 0.7041, 0.003, 2, 0.86, 0.0, 281, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "authorId", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " authorId = int(tweet.user.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L239_C8", "label": "polarity = float()", "type": "assigned_variable", "loc": [239, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L237_C4", "vector": [14, 2, 0.7071, 0.003, 2, 0.86, 0.3333, 487, 3, 1, 0, 0, 639, 10, 1], "semantic": {"name": "polarity", "arg_names": [], "import_names": [], "rhs_call_name": "float", "annotation": ""}, "snippet": " polarity = float(tweet.polarity)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L240_C8", "label": "replyTo = int()", "type": "assigned_variable", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L237_C4", "vector": [14, 2, 0.7101, 0.003, 2, 0.86, 0.6667, 914, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "replyTo", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " replyTo = int(tweet.in_reply_to_status_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L242_C8", "label": "if", "type": "if", "loc": [242, 258], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L237_C4", "vector": [4, 2, 0.7396, 0.0503, 2, 0.86, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if replyTo is not 0: # reply to single person\n try:\n user = User.objects.get(id=replyTo)\n userId = int(user.id)\n builtReply = {\n \"from\": authorId,\n \"to\": userId,\n \"polarity\": polarity,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Try_L243_C12", "label": "try", "type": "try", "loc": [243, 254], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L242_C8", "vector": [7, 3, 0.7352, 0.0355, 3, 0.28, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n user = User.objects.get(id=replyTo)\n userId = int(user.id)\n builtReply = {\n \"from\": authorId,\n \"to\": userId,\n \"polarity\": polarity,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L244_C16", "label": "user = get()", "type": "assigned_variable", "loc": [244, 244], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:Try_L243_C12", "vector": [14, 4, 0.7219, 0.003, 4, 0.3, 0.0, 503, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " user = User.objects.get(id=replyTo)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L245_C16", "label": "userId = int()", "type": "assigned_variable", "loc": [245, 245], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:Try_L243_C12", "vector": [14, 4, 0.7249, 0.003, 4, 0.3, 0.5, 303, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "userId", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " userId = int(user.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L246_C16", "label": "builtReply =", "type": "assigned_variable", "loc": [246, 250], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:Try_L243_C12", "vector": [14, 4, 0.7337, 0.0148, 4, 0.3, 1.0, 248, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "builtReply", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " builtReply = {\n \"from\": authorId,\n \"to\": userId,\n \"polarity\": polarity,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L260_C4", "label": "return", "type": "return", "loc": [260, 260], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L234_C0", "vector": [13, 1, 0.7692, 0.003, 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 replies"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L262_C0", "label": "getFollowerReplies", "type": "function", "loc": [262, 275], "level": 0, "parent": null, "vector": [2, 0, 0.7944, 0.0414, 0, 0.66, 0.875, 378, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "getFollowerReplies", "arg_names": ["authorId", "polarity"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getFollowerReplies(authorId, polarity):\n replies = []\n friendships = Friendship.objects.all().filter(followed_user__id=authorId)\n followers = [int(f.user.id) for f in friendships]\n \n for follower in followers:\n builtReply = {\n \"from\": authorId,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L263_C4", "label": "replies =", "type": "assigned_variable", "loc": [263, 263], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L262_C0", "vector": [14, 1, 0.7781, 0.003, 1, 0.72, 0.0, 205, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "replies", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " replies = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L264_C4", "label": "friendships = filter()", "type": "assigned_variable", "loc": [264, 264], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L262_C0", "vector": [14, 1, 0.7811, 0.003, 1, 0.72, 0.25, 755, 3, 1, 0, 0, 526, 10, 2], "semantic": {"name": "friendships", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " friendships = Friendship.objects.all().filter(followed_user__id=authorId)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L265_C4", "label": "followers =", "type": "assigned_variable", "loc": [265, 265], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L262_C0", "vector": [14, 1, 0.784, 0.003, 1, 0.72, 0.5, 530, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "followers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " followers = [int(f.user.id) for f in friendships]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L267_C4", "label": "for follower", "type": "for", "loc": [267, 274], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L262_C0", "vector": [6, 1, 0.8003, 0.0237, 1, 0.72, 0.75, 382, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "follower", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for follower in followers:\n builtReply = {\n \"from\": authorId,\n \"to\": follower,\n \"polarity\": polarity,\n }\n \n replies += [builtReply]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L268_C8", "label": "builtReply =", "type": "assigned_variable", "loc": [268, 272], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L267_C4", "vector": [14, 2, 0.7988, 0.0148, 2, 0.12, 0.0, 248, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "builtReply", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " builtReply = {\n \"from\": authorId,\n \"to\": follower,\n \"polarity\": polarity,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L275_C4", "label": "return", "type": "return", "loc": [275, 275], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L262_C0", "vector": [13, 1, 0.8136, 0.003, 1, 0.72, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return replies"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L277_C0", "label": "getNDIValuesEqualRepliesCountForHashtag", "type": "function", "loc": [277, 305], "level": 0, "parent": null, "vector": [2, 0, 0.8609, 0.0858, 0, 0.66, 0.9167, 586, 0, 3, 1, 0, 0, 0, 10], "semantic": {"name": "getNDIValuesEqualRepliesCountForHashtag", "arg_names": ["hashtag", "sliceCount", "timeSortedTweets"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getNDIValuesEqualRepliesCountForHashtag(hashtag, sliceCount, timeSortedTweets):\n ndiVariation = []\n \n if len(timeSortedTweets) >= 2:\n tweetCount = len(timeSortedTweets)\n deltaTweetsFloat = tweetCount / float(sliceCount)\n deltaTweets = int(math.ceil(tweetCount / sliceCount))\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L278_C4", "label": "ndiVariation =", "type": "assigned_variable", "loc": [278, 278], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L277_C0", "vector": [14, 1, 0.8225, 0.003, 1, 0.74, 0.0, 178, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "ndiVariation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ndiVariation = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L280_C4", "label": "if", "type": "if", "loc": [280, 299], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L277_C0", "vector": [4, 1, 0.8565, 0.0592, 1, 0.74, 0.2, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(timeSortedTweets) >= 2:\n tweetCount = len(timeSortedTweets)\n deltaTweetsFloat = tweetCount / float(sliceCount)\n deltaTweets = int(math.ceil(tweetCount / sliceCount))\n \n if deltaTweetsFloat is not deltaTweets:\n deltaTweets += 1\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L281_C8", "label": "tweetCount = len()", "type": "assigned_variable", "loc": [281, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L280_C4", "vector": [14, 2, 0.8314, 0.003, 2, 0.0, 0.0, 318, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "tweetCount", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " tweetCount = len(timeSortedTweets)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L282_C8", "label": "deltaTweetsFloat =", "type": "assigned_variable", "loc": [282, 282], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L280_C4", "vector": [14, 2, 0.8343, 0.003, 2, 0.0, 0.1667, 637, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "deltaTweetsFloat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " deltaTweetsFloat = tweetCount / float(sliceCount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L283_C8", "label": "deltaTweets = int()", "type": "assigned_variable", "loc": [283, 283], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L280_C4", "vector": [14, 2, 0.8373, 0.003, 2, 0.0, 0.3333, 894, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "deltaTweets", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " deltaTweets = int(math.ceil(tweetCount / sliceCount))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L285_C8", "label": "if", "type": "if", "loc": [285, 286], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L280_C4", "vector": [4, 2, 0.8447, 0.0059, 2, 0.0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if deltaTweetsFloat is not deltaTweets:\n deltaTweets += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L288_C8", "label": "tweetOffset =", "type": "assigned_variable", "loc": [288, 288], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L280_C4", "vector": [14, 2, 0.8521, 0.003, 2, 0.0, 0.6667, 161, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "tweetOffset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tweetOffset = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L289_C8", "label": "sliceIndex =", "type": "assigned_variable", "loc": [289, 289], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L280_C4", "vector": [14, 2, 0.855, 0.003, 2, 0.0, 0.8333, 108, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "sliceIndex", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sliceIndex = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L290_C8", "label": "while", "type": "while", "loc": [290, 299], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L280_C4", "vector": [5, 2, 0.8713, 0.0296, 2, 0.0, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while tweetOffset < tweetCount:\n print(\"Computing slice %s/%s\" %(sliceIndex, sliceCount))\n upperOffset = tweetOffset + deltaTweets + 1\n tweetsSubset = timeSortedTweets[tweetOffset:upperOffset]\n replies = computeReplies(tweetsSubset)\n polarityCounter = PolarityCounter(replies)\n ndiVariation += [(int(tweetOffset), polarityCounter.NDI)]\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L291_C12", "label": "print()", "type": "expression", "loc": [291, 291], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L290_C8", "vector": [8, 3, 0.8609, 0.003, 3, 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(\"Computing slice %s/%s\" %(sliceIndex, sliceCount))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L292_C12", "label": "upperOffset =", "type": "assigned_variable", "loc": [292, 292], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L290_C8", "vector": [14, 3, 0.8639, 0.003, 3, 0.4, 0.25, 660, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "upperOffset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " upperOffset = tweetOffset + deltaTweets + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L293_C12", "label": "tweetsSubset =", "type": "assigned_variable", "loc": [293, 293], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L290_C8", "vector": [14, 3, 0.8669, 0.003, 3, 0.4, 0.5, 849, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tweetsSubset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tweetsSubset = timeSortedTweets[tweetOffset:upperOffset]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L294_C12", "label": "replies = computeReplies()", "type": "assigned_variable", "loc": [294, 294], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L290_C8", "vector": [14, 3, 0.8698, 0.003, 3, 0.4, 0.75, 205, 3, 1, 0, 0, 407, 10, 1], "semantic": {"name": "replies", "arg_names": [], "import_names": [], "rhs_call_name": "computeReplies", "annotation": ""}, "snippet": " replies = computeReplies(tweetsSubset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L295_C12", "label": "polarityCounter = PolarityCounter()", "type": "assigned_variable", "loc": [295, 295], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L290_C8", "vector": [14, 3, 0.8728, 0.003, 3, 0.4, 1.0, 889, 3, 1, 0, 0, 151, 10, 1], "semantic": {"name": "polarityCounter", "arg_names": [], "import_names": [], "rhs_call_name": "PolarityCounter", "annotation": ""}, "snippet": " polarityCounter = PolarityCounter(replies)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L301_C4", "label": "times =", "type": "assigned_variable", "loc": [301, 301], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L277_C0", "vector": [14, 1, 0.8905, 0.003, 1, 0.74, 0.4, 342, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "times", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " times = [x[0] for x in ndiVariation]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L302_C4", "label": "times =", "type": "assigned_variable", "loc": [302, 302], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L277_C0", "vector": [14, 1, 0.8935, 0.003, 1, 0.74, 0.6, 342, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "times", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " times = [i for i, unused in enumerate(times)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L303_C4", "label": "ndis =", "type": "assigned_variable", "loc": [303, 303], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L277_C0", "vector": [14, 1, 0.8964, 0.003, 1, 0.74, 0.8, 718, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ndis", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ndis = [x[1] for x in ndiVariation]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L305_C4", "label": "return", "type": "return", "loc": [305, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L277_C0", "vector": [13, 1, 0.9024, 0.003, 1, 0.74, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return times, ndis"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L307_C0", "label": "getNDIValuesForHashtag", "type": "function", "loc": [307, 335], "level": 0, "parent": null, "vector": [2, 0, 0.9497, 0.0858, 0, 0.66, 0.9583, 135, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "getNDIValuesForHashtag", "arg_names": ["hashtag", "sliceCount", "timeSortedTweets"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getNDIValuesForHashtag(hashtag, sliceCount, timeSortedTweets):\n ndiVariation = []\n \n if len(timeSortedTweets) >= 2:\n first = timeSortedTweets[0].created_at\n last = timeSortedTweets[-1].created_at\n interval = last - first\n deltaTimeMillis = interval / sliceCount"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L308_C4", "label": "ndiVariation =", "type": "assigned_variable", "loc": [308, 308], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L307_C0", "vector": [14, 1, 0.9112, 0.003, 1, 0.3, 0.0, 178, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "ndiVariation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ndiVariation = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L310_C4", "label": "if", "type": "if", "loc": [310, 329], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L307_C0", "vector": [4, 1, 0.9453, 0.0592, 1, 0.3, 0.2, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(timeSortedTweets) >= 2:\n first = timeSortedTweets[0].created_at\n last = timeSortedTweets[-1].created_at\n interval = last - first\n deltaTimeMillis = interval / sliceCount\n \n \n sliceIndex = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L311_C8", "label": "first =", "type": "assigned_variable", "loc": [311, 311], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L310_C4", "vector": [14, 2, 0.9201, 0.003, 2, 0.11, 0.0, 199, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = timeSortedTweets[0].created_at"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L312_C8", "label": "last =", "type": "assigned_variable", "loc": [312, 312], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L310_C4", "vector": [14, 2, 0.9231, 0.003, 2, 0.11, 0.1667, 95, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "last", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last = timeSortedTweets[-1].created_at"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L313_C8", "label": "interval =", "type": "assigned_variable", "loc": [313, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L310_C4", "vector": [14, 2, 0.926, 0.003, 2, 0.11, 0.3333, 628, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "interval", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " interval = last - first"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L314_C8", "label": "deltaTimeMillis =", "type": "assigned_variable", "loc": [314, 314], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L310_C4", "vector": [14, 2, 0.929, 0.003, 2, 0.11, 0.5, 545, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "deltaTimeMillis", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " deltaTimeMillis = interval / sliceCount"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L317_C8", "label": "sliceIndex =", "type": "assigned_variable", "loc": [317, 317], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L310_C4", "vector": [14, 2, 0.9379, 0.003, 2, 0.11, 0.6667, 108, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "sliceIndex", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sliceIndex = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L318_C8", "label": "timeUpperBound =", "type": "assigned_variable", "loc": [318, 318], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L310_C4", "vector": [14, 2, 0.9408, 0.003, 2, 0.11, 0.8333, 80, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "timeUpperBound", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " timeUpperBound = first + deltaTimeMillis"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L319_C8", "label": "while", "type": "while", "loc": [319, 329], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L310_C4", "vector": [5, 2, 0.9586, 0.0325, 2, 0.11, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while timeUpperBound <= last:\n print(\"Computing slice %s/%s\" %(sliceIndex, sliceCount))\n tweetsSubset = tweetsInInterval(timeSortedTweets, timeUpperBound - deltaTimeMillis, timeUpperBound)\n replies = computeReplies(tweetsSubset)\n polarityCounter = PolarityCounter(replies)\n ndiVariation += [(timeUpperBound, polarityCounter.NDI)]\n \n timeUpperBound += deltaTimeMillis"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L320_C12", "label": "print()", "type": "expression", "loc": [320, 320], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L319_C8", "vector": [8, 3, 0.9467, 0.003, 3, 0.58, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Computing slice %s/%s\" %(sliceIndex, sliceCount))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L321_C12", "label": "tweetsSubset = tweetsInInterval()", "type": "assigned_variable", "loc": [321, 321], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L319_C8", "vector": [14, 3, 0.9497, 0.003, 3, 0.58, 0.25, 849, 3, 3, 0, 0, 68, 10, 1], "semantic": {"name": "tweetsSubset", "arg_names": [], "import_names": [], "rhs_call_name": "tweetsInInterval", "annotation": ""}, "snippet": " tweetsSubset = tweetsInInterval(timeSortedTweets, timeUpperBound - deltaTimeMillis, timeUpperBound)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L322_C12", "label": "replies = computeReplies()", "type": "assigned_variable", "loc": [322, 322], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L319_C8", "vector": [14, 3, 0.9527, 0.003, 3, 0.58, 0.5, 205, 3, 1, 0, 0, 407, 10, 1], "semantic": {"name": "replies", "arg_names": [], "import_names": [], "rhs_call_name": "computeReplies", "annotation": ""}, "snippet": " replies = computeReplies(tweetsSubset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L323_C12", "label": "polarityCounter = PolarityCounter()", "type": "assigned_variable", "loc": [323, 323], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L319_C8", "vector": [14, 3, 0.9556, 0.003, 3, 0.58, 0.75, 889, 3, 1, 0, 0, 151, 10, 1], "semantic": {"name": "polarityCounter", "arg_names": [], "import_names": [], "rhs_call_name": "PolarityCounter", "annotation": ""}, "snippet": " polarityCounter = PolarityCounter(replies)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L327_C12", "label": "if", "type": "if", "loc": [327, 328], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L319_C8", "vector": [4, 3, 0.9689, 0.0059, 3, 0.58, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if timeUpperBound == timeUpperBound + deltaTimeMillis:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L331_C4", "label": "times =", "type": "assigned_variable", "loc": [331, 331], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L307_C0", "vector": [14, 1, 0.9793, 0.003, 1, 0.3, 0.4, 342, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "times", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " times = [x[0] for x in ndiVariation]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L332_C4", "label": "times =", "type": "assigned_variable", "loc": [332, 332], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L307_C0", "vector": [14, 1, 0.9822, 0.003, 1, 0.3, 0.6, 342, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "times", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " times = [i for i, unused in enumerate(times)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L333_C4", "label": "ndis =", "type": "assigned_variable", "loc": [333, 333], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L307_C0", "vector": [14, 1, 0.9852, 0.003, 1, 0.3, 0.8, 718, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ndis", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ndis = [x[1] for x in ndiVariation]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L335_C4", "label": "return", "type": "return", "loc": [335, 335], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L307_C0", "vector": [13, 1, 0.9911, 0.003, 1, 0.3, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return times, ndis"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L337_C0", "label": "tweetsInInterval", "type": "function", "loc": [337, 338], "level": 0, "parent": null, "vector": [2, 0, 0.9985, 0.0059, 0, 0.66, 1.0, 68, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "tweetsInInterval", "arg_names": ["tweets", "timeLowerBound", "timeUpperBound"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def tweetsInInterval(tweets, timeLowerBound, timeUpperBound):\n return [tweet for tweet in tweets if tweet.created_at >= timeLowerBound and tweet.created_at <= timeUpperBound]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L338_C4", "label": "return", "type": "return", "loc": [338, 338], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L337_C0", "vector": [13, 1, 1.0, 0.003, 1, 0.28, 0.0, 0, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [tweet for tweet in tweets if tweet.created_at >= timeLowerBound and tweet.created_at <= timeUpperBound]"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L44_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L76_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L77_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L106_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L111_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L112_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L117_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L151_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L151_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L151_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L151_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L166_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L167_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L180_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L190_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L190_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L191_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L201_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L204_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L207_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L209_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L209_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L210_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L212_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L213_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L197_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L216_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L218_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L219_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L218_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L220_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L218_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L221_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L218_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L222_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L218_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L223_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L218_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L224_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L218_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L226_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L228_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L230_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L228_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L231_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L228_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L232_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L234_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L235_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L234_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L237_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L237_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L238_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L237_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L239_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L237_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L237_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L242_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L242_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Try_L243_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:Try_L243_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L244_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:Try_L243_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L245_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:Try_L243_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L246_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L234_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L260_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L263_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L264_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L265_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L267_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:For_L267_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L268_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L262_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L275_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L277_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L278_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L277_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L280_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L280_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L281_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L280_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L282_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L280_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L283_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L280_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L285_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L280_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L288_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L280_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L289_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L280_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L290_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L290_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L291_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L290_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L292_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L290_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L293_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L290_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L294_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L290_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L295_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L277_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L301_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L277_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L277_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L303_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L277_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L305_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L308_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L310_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L310_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L311_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L310_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L312_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L310_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L313_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L310_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L314_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L310_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L317_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L310_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L318_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L310_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L319_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L319_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Expr_L320_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L319_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L321_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L319_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L322_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L319_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L323_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:While_L319_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:If_L327_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L331_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L332_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Assign_L333_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L335_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1076:FunctionDef_L337_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1076:Return_L338_C4"}]
''' Created on 7 juin 2013 @author: Nils Amiet ''' import threading import time import math from twython import TwythonStreamer, Twython, TwythonRateLimitError from twython.exceptions import TwythonError from requests.exceptions import ConnectionError from django.db import DatabaseError from ITInfluence.models import Tweet, User from ITInfluence.language import isEnglishTweet from ITInfluence.hashtags import getSimilarHashtags ### # Configuration starts here ### ''' These values are provided for your personal use but since the code is distributed to multiple people, and there can be only one machine using this account at the same time, please use the values from your own Twitter account. Register a regular Twitter account and then register an app at http://dev.twitter.com/apps ''' APP_KEY = "pjoZEliZOQNl9D4tLGljA" APP_SECRET = "1Wp2Jd2eiKVWYH8nJFm3wg6C3bnf10k1D25uzajloU" OAUTH_TOKEN = "1479001058-kJibhcFtcHvUKvbFnKgUO8zPlTpb2MC6HCr1Z1z" OAUTH_TOKEN_SECRET = "KmhIChKm9nENIXt5P5xfotOgxlaI9JfDBy3eZ4ZVKDc" ''' Enables or disables the stream monitor. The stream monitor periodically checks whether the incoming tweet rate is too low. In such a case it restarts the stream with additional similar hashtags. ''' isStreamMonitorEnabled = True ''' Number of seconds between each stream monitor check. ''' monitorCheckInterval = 300 # seconds ''' Minimum number of incoming tweets per minute required. Used by the stream monitor to decide whether it should restart with similar hashtags. ''' incomingTweetRateThreshold = 0.5 # minimum tweets per minute ''' Number of seconds after which the stream is stopped if not a single tweet was received. REMARK: You should not set streamTimeout to a value that is less than monitorCheckInterval because it may cause having two or more streams opened at the same time, which is forbidden by the Twitter API. ''' streamTimeout = 180 # seconds ### # Configuration ends here ### streamingHashtag = "" class TwitterREST(): '''Class to handle operations that require a call to the Twitter REST API''' TIME_INTERVAL_IN_SECONDS = (15 * 60) + 2 # add 2 seconds just to be sure MAX_FOLLOWERS_PER_REQUEST = 5000 MAX_RETRY_COUNT = 30 RETRY_INTERVAL_IN_SECONDS = 30 isCollectingFollowers = False def __init__(self): self.twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET) def stopCollecting(self): self.isCollectingFollowers = False def sleepFor(self, seconds): startTime = time.time() for unused in range(seconds): time.sleep(1) if not self.isCollectingFollowers: return False # make sure we slept for long enough while True: currentTime = time.time() if currentTime - startTime < seconds: time.sleep(1) else: break return True def getFollowers(self, userId, getAll=False, retry=0): self.isCollectingFollowers = True try: totalFollowersCount = int(User.objects.get(id=userId).followers_count) except: totalFollowersCount = 0 requiredCallsCount = int(math.ceil(totalFollowersCount/float(self.MAX_FOLLOWERS_PER_REQUEST))) partCount = 1 # define rate limited operation def doGetFollowers(**kwargs): try: return self.twitter.get_followers_ids(user_id=userId, **kwargs) except ConnectionError as e: print(e) print("ConnectionError! Retrying...") self.sleepFor(10) return doGetFollowers(**kwargs) try: self.displayFollowersCollectionStatus(userId, partCount, requiredCallsCount) returnValue = doGetFollowers() except TwythonRateLimitError: # wait a complete Twitter time interval print("Sleeping until limit is lifted...") if not self.sleepFor(self.TIME_INTERVAL_IN_SECONDS): return # stop collecting # try again print("Retrying...") self.displayFollowersCollectionStatus(userId, partCount, requiredCallsCount) returnValue = doGetFollowers() except TwythonError as e: # User does not exist # User's account was probably deleted after we collected his tweets if "404" in str(e): print("WARNING: User %s does not exist!" % userId) return [] if "401" in str(e): print("WARNING: User %s is probably private! Can't collect his/her followers." % userId) return [] # Twitter is down / API changed / unknown error # wait a few seconds and retry print(e) print("Retrying in %s seconds..." % self.RETRY_INTERVAL_IN_SECONDS) if not self.sleepFor(self.RETRY_INTERVAL_IN_SECONDS): return if retry > self.MAX_RETRY_COUNT: print("Max retry count reached. Aborting...") return print("Retrying... attempt %s/%s" % (retry, self.MAX_RETRY_COUNT)) return self.getFollowers(userId, getAll=getAll, retry=retry + 1) partCount += 1 followers = returnValue["ids"] if getAll: while returnValue["next_cursor"] is not 0: try: self.displayFollowersCollectionStatus(userId, partCount, requiredCallsCount) returnValue = doGetFollowers(cursor=returnValue["next_cursor"]) except TwythonRateLimitError: # wait a complete Twitter time interval print("Sleeping until limit is lifted...") if not self.sleepFor(self.TIME_INTERVAL_IN_SECONDS): return # stop collecting # try again print("Retrying...") self.displayFollowersCollectionStatus(userId, partCount, requiredCallsCount) returnValue = doGetFollowers(cursor=returnValue["next_cursor"]) except TwythonError as e: # Twitter is down / API changed / unknown error # wait a few seconds and retry print(e) print("Retrying in %s seconds..." % self.RETRY_INTERVAL_IN_SECONDS) if not self.sleepFor(self.RETRY_INTERVAL_IN_SECONDS): return if retry > self.MAX_RETRY_COUNT: print("Max retry count reached. Aborting...") return print("Retrying... attempt %s/%s" % (retry, self.MAX_RETRY_COUNT)) return self.getFollowers(userId, getAll=getAll, retry=retry + 1) partCount += 1 followers += returnValue["ids"] elif returnValue["next_cursor"] is not 0: print("Warning: you specified getAll=False but there was more than %s followers. Results are truncated!" % self.MAX_FOLLOWERS_PER_REQUEST) return followers def displayFollowersCollectionStatus(self, userId, partCount, requiredCallsCount): print("Getting followers for user %s (part %s/%s)..." % (userId, partCount, requiredCallsCount)) def getUser(self, userId): # define rate limited operation def doGetUser(): return self.twitter.show_user(user_id=userId) try: print("Getting details for user %s..." % userId) returnValue = doGetUser() except TwythonRateLimitError: # wait a complete Twitter time interval print("Sleeping until limit is lifted...") self.sleepFor(self.TIME_INTERVAL_IN_SECONDS) # try again print("Retrying...") print("Getting details for user %s..." % userId) returnValue = doGetUser() print("done.") screen_name = returnValue["screen_name"] statuses_count = returnValue["statuses_count"] friends_count = returnValue["friends_count"] followers_count = returnValue["followers_count"] lang = returnValue["lang"] followersReady = True # don't collect followers of followers user = User(id=userId, screen_name=screen_name, statuses_count=statuses_count, friends_count=friends_count, followers_count=followers_count, lang=lang, followers_ready=followersReady) return user class TwitterStreaming(TwythonStreamer): '''Class to handle operations that deal with the Twitter Streaming API''' def setParams(self, stopTweetCount, stopTime): self.stopTweetCount = stopTweetCount self.stopTime = stopTime self.receivedTweetsCount = 0 self.startTime = time.time() self.rateTweetCount = 0 self.rateLastTime = time.time() def getRunningTime(self): currentTime = time.time() elapsedTime = currentTime - self.startTime # seconds elapsedTime /= 60.0 # convert to minutes return elapsedTime def getRate(self): '''Received tweets per minute''' receivedTweets = self.rateTweetCount timeInterval = (time.time() - self.rateLastTime) / 60.0 # minutes rate = receivedTweets / timeInterval self.rateLastTime = time.time() self.rateTweetCount = 0 return rate def on_success(self, data): try: text = data["text"] if not isEnglishTweet(text): print("Dropped tweet (considered non-english): " + text) return else: print("ENGLISH: " + text) except: pass try: # User author = data["user"] userId = author["id"] screen_name = author["screen_name"] statuses_count = author["statuses_count"] friends_count = author["friends_count"] followers_count = author["followers_count"] lang = author["lang"] followersReady = False userReady = True user = User(id=userId, screen_name=screen_name, statuses_count=statuses_count, friends_count=friends_count, followers_count=followers_count, lang=lang, followers_ready=followersReady, user_ready=userReady) if not User.objects.filter(id=userId).exists(): try: user.save() except: print("ERROR: failed saving user") # Tweet tweetId = data["id_str"] in_reply_to_status_id = data["in_reply_to_status_id"] if in_reply_to_status_id is None: in_reply_to_status_id = 0 hashtags = "" try: ht = data["entities"]["hashtags"] tags = [x["text"] for x in ht] hashtags = " ".join(tags) except: # this tweet doesn't contain any hashtag pass text = data["text"] created_at = data["created_at"] timestamp = time.strftime('%Y-%m-%d %H:%M:%S+00:00', time.strptime(created_at, '%a %b %d %H:%M:%S +0000 %Y')) polarity = 0 polarityReady = False tweet = Tweet(id=tweetId, user=user, in_reply_to_status_id=in_reply_to_status_id, text=text, created_at=timestamp, polarity=polarity, polarity_ready=polarityReady, hashtags=hashtags) tweet.save() # update received tweets count self.receivedTweetsCount += 1 self.rateTweetCount += 1 # check stop conditions if (self.receivedTweetsCount is not 0 and self.receivedTweetsCount >= self.stopTweetCount) or (self.stopTime is not 0 and self.getRunningTime() >= self.stopTime): self.disconnect() except KeyError: '''Some tweets are badly sent and are missing user or text''' pass except DatabaseError: '''Bad response (invalid JSON)''' pass except Exception as e: print(e) pass def on_error(self, status_code, data): print(status_code, data) '''FUNCTIONS''' def readStream(filterHashtag, stopTweetCount, stopTime, stream): stream.setParams(stopTweetCount, stopTime) try: stream.statuses.filter(track=filterHashtag) print("Stopped streaming") except Exception as e: print(e) stream.disconnect() print("Stopped streaming (timeout)") updateHashtagsUsingSimilar(stream) # retry with similar hashtags def launchStreamMonitor(): global stream t = threading.Thread(target=monitorStream, args=(stream,)) t.daemon = True print("Launched stream monitor...") t.start() def monitorStream(stream): # monitor agent that checks incoming tweet rate # relaunch stream with similar hashtags if rate is too low while True: try: if stream.connected: print("Stream is connected.") tweetsPerMinute = stream.getRate() print("Current rate: %s tweets/min" % tweetsPerMinute) streamStartInterval = time.time() - stream.startTime if tweetsPerMinute < incomingTweetRateThreshold and streamStartInterval >= streamTimeout: print("Not receiving enough tweets matching this set of hashtags.") print("Retrying with additional similar hashtags...") updateHashtagsUsingSimilar(stream) else: print("Stream is disconnected.") except Exception as e: print(e) print("WARNING: stream not instantiated. Stopping monitor...") break # sleep until next check time.sleep(monitorCheckInterval) def updateHashtagsUsingSimilar(stream): currentTags = [tag.replace("#", "") for tag in streamingHashtag.split(",")] similarTags = [] for tag in currentTags: similar = getSimilarHashtags(tag) similar = sorted(similar, key=lambda x: x[1], reverse=True) similarCount = 2 similar = similar[:similarCount] # N most similar tags similar = [tag for tag, unused in similar] similarTags += similar similarTags += currentTags similarTags = set(similarTags) # remove duplicates newFilterTags = ",".join(["#" + tag for tag in similarTags]) # convert to comma seperated string with leading # for each tag print("Current tags: %s" % streamingHashtag) print("New tags: %s" % newFilterTags) # stop stream stream.disconnect() # restart with new tags stopTweetCount = stream.stopTweetCount - stream.receivedTweetsCount stopTime = stream.stopTime del stream startStreaming(newFilterTags, stopTweetCount, stopTime) def startStreaming(filterHashtag="twitter", stopTweetCount=0, stopTime=0): global streamingHashtag streamingHashtag = filterHashtag global stream # start streaming t = threading.Thread(target=readStream, args=(filterHashtag, stopTweetCount, stopTime, stream)) t.daemon = True print("started reading stream...") t.start() def toggleStreaming(): global stream if not stream.connected: startStreaming() else: print("disconnecting stream...") stream.disconnect() # instantiate stream stream = TwitterStreaming(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET, timeout=streamTimeout) # monitor stream if isStreamMonitorEnabled: launchStreamMonitor()
ajibawa-2023/Python-Code-Large/train/row_1077
259
435
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0069, 0.0115, 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 7 juin 2013\n\n@author: Nils Amiet\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Import_L7_C0", "label": "threading import threading", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0161, 0.0023, 0, 0.66, 0.0286, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["threading"], "rhs_call_name": "", "annotation": ""}, "snippet": "import threading"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Import_L8_C0", "label": "time import time", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0184, 0.0023, 0, 0.66, 0.0571, 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_1077:Import_L9_C0", "label": "math import math", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0207, 0.0023, 0, 0.66, 0.0857, 526, 0, 1, 0, 0, 526, 0, 0], "semantic": {"name": "math", "arg_names": [], "import_names": ["math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:ImportFrom_L11_C0", "label": "from twython import TwythonStreamer, Twython, TwythonRateLimitError", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0253, 0.0023, 0, 0.66, 0.1143, 816, 0, 3, 0, 0, 816, 0, 0], "semantic": {"name": "twython", "arg_names": [], "import_names": ["TwythonStreamer", "Twython", "TwythonRateLimitError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from twython import TwythonStreamer, Twython, TwythonRateLimitError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:ImportFrom_L12_C0", "label": "from twython.exceptions import TwythonError", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0276, 0.0023, 0, 0.66, 0.1429, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "twython.exceptions", "arg_names": [], "import_names": ["TwythonError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from twython.exceptions import TwythonError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:ImportFrom_L14_C0", "label": "from requests.exceptions import ConnectionError", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0322, 0.0023, 0, 0.66, 0.1714, 433, 0, 1, 0, 0, 433, 0, 0], "semantic": {"name": "requests.exceptions", "arg_names": [], "import_names": ["ConnectionError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from requests.exceptions import ConnectionError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:ImportFrom_L16_C0", "label": "from django.db import DatabaseError", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0368, 0.0023, 0, 0.66, 0.2, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["DatabaseError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db import DatabaseError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:ImportFrom_L18_C0", "label": "from ITInfluence.models import Tweet, User", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0414, 0.0023, 0, 0.66, 0.2286, 316, 0, 2, 0, 0, 316, 0, 0], "semantic": {"name": "ITInfluence.models", "arg_names": [], "import_names": ["Tweet", "User"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ITInfluence.models import Tweet, User"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:ImportFrom_L19_C0", "label": "from ITInfluence.language import isEnglishTweet", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0437, 0.0023, 0, 0.66, 0.2571, 673, 0, 1, 0, 0, 673, 0, 0], "semantic": {"name": "ITInfluence.language", "arg_names": [], "import_names": ["isEnglishTweet"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ITInfluence.language import isEnglishTweet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:ImportFrom_L20_C0", "label": "from ITInfluence.hashtags import getSimilarHashtags", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.046, 0.0023, 0, 0.66, 0.2857, 154, 0, 1, 0, 0, 154, 0, 0], "semantic": {"name": "ITInfluence.hashtags", "arg_names": [], "import_names": ["getSimilarHashtags"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ITInfluence.hashtags import getSimilarHashtags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L26_C0", "label": "expression", "type": "expression", "loc": [26, 31], "level": 0, "parent": null, "vector": [8, 0, 0.0655, 0.0138, 0, 0.66, 0.3143, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''\nThese values are provided for your personal use but since the code is distributed to multiple people,\nand there can be only one machine using this account at the same time,\nplease use the values from your own Twitter account.\nRegister a regular Twitter account and then register an app at http://dev.twitter.com/apps\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L32_C0", "label": "APP_KEY =", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.0736, 0.0023, 0, 0.66, 0.3429, 912, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "APP_KEY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "APP_KEY = \"pjoZEliZOQNl9D4tLGljA\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L33_C0", "label": "APP_SECRET =", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.0759, 0.0023, 0, 0.66, 0.3714, 675, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "APP_SECRET", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "APP_SECRET = \"1Wp2Jd2eiKVWYH8nJFm3wg6C3bnf10k1D25uzajloU\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L34_C0", "label": "OAUTH_TOKEN =", "type": "assigned_variable", "loc": [34, 34], "level": 0, "parent": null, "vector": [14, 0, 0.0782, 0.0023, 0, 0.66, 0.4, 610, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "OAUTH_TOKEN", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "OAUTH_TOKEN = \"1479001058-kJibhcFtcHvUKvbFnKgUO8zPlTpb2MC6HCr1Z1z\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L35_C0", "label": "OAUTH_TOKEN_SECRET =", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 0.0805, 0.0023, 0, 0.66, 0.4286, 361, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "OAUTH_TOKEN_SECRET", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "OAUTH_TOKEN_SECRET = \"KmhIChKm9nENIXt5P5xfotOgxlaI9JfDBy3eZ4ZVKDc\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L38_C0", "label": "expression", "type": "expression", "loc": [38, 42], "level": 0, "parent": null, "vector": [8, 0, 0.092, 0.0115, 0, 0.66, 0.4571, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''\nEnables or disables the stream monitor.\nThe stream monitor periodically checks whether the incoming tweet rate is too low.\nIn such a case it restarts the stream with additional similar hashtags.\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L43_C0", "label": "isStreamMonitorEnabled =", "type": "assigned_variable", "loc": [43, 43], "level": 0, "parent": null, "vector": [14, 0, 0.0989, 0.0023, 0, 0.66, 0.4857, 172, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "isStreamMonitorEnabled", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "isStreamMonitorEnabled = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L45_C0", "label": "expression", "type": "expression", "loc": [45, 47], "level": 0, "parent": null, "vector": [8, 0, 0.1057, 0.0069, 0, 0.66, 0.5143, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''\nNumber of seconds between each stream monitor check.\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L48_C0", "label": "monitorCheckInterval =", "type": "assigned_variable", "loc": [48, 48], "level": 0, "parent": null, "vector": [14, 0, 0.1103, 0.0023, 0, 0.66, 0.5429, 796, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "monitorCheckInterval", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "monitorCheckInterval = 300 # seconds"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L50_C0", "label": "expression", "type": "expression", "loc": [50, 53], "level": 0, "parent": null, "vector": [8, 0, 0.1184, 0.0092, 0, 0.66, 0.5714, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''\nMinimum number of incoming tweets per minute required.\nUsed by the stream monitor to decide whether it should restart with similar hashtags.\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L54_C0", "label": "incomingTweetRateThreshold =", "type": "assigned_variable", "loc": [54, 54], "level": 0, "parent": null, "vector": [14, 0, 0.1241, 0.0023, 0, 0.66, 0.6, 967, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "incomingTweetRateThreshold", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "incomingTweetRateThreshold = 0.5 # minimum tweets per minute"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L56_C0", "label": "expression", "type": "expression", "loc": [56, 61], "level": 0, "parent": null, "vector": [8, 0, 0.1345, 0.0138, 0, 0.66, 0.6286, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''\nNumber of seconds after which the stream is stopped if not a single tweet was received.\nREMARK: You should not set streamTimeout to a value that is less than monitorCheckInterval because\nit may cause having two or more streams opened at the same time, which is forbidden\nby the Twitter API.\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L62_C0", "label": "streamTimeout =", "type": "assigned_variable", "loc": [62, 62], "level": 0, "parent": null, "vector": [14, 0, 0.1425, 0.0023, 0, 0.66, 0.6571, 655, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "streamTimeout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "streamTimeout = 180 # seconds"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L68_C0", "label": "streamingHashtag =", "type": "assigned_variable", "loc": [68, 68], "level": 0, "parent": null, "vector": [14, 0, 0.1563, 0.0023, 0, 0.66, 0.6857, 461, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "streamingHashtag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "streamingHashtag = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "label": "TwitterREST", "type": "class", "loc": [70, 225], "level": 0, "parent": null, "vector": [3, 0, 0.3391, 0.3586, 0, 0.66, 0.7143, 361, 0, 8, 0, 0, 0, 0, 58], "semantic": {"name": "TwitterREST", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TwitterREST():\n '''Class to handle operations that require a call to the Twitter REST API'''\n \n TIME_INTERVAL_IN_SECONDS = (15 * 60) + 2 # add 2 seconds just to be sure\n MAX_FOLLOWERS_PER_REQUEST = 5000\n MAX_RETRY_COUNT = 30\n RETRY_INTERVAL_IN_SECONDS = 30\n isCollectingFollowers = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L71_C4", "label": "expression", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "vector": [8, 1, 0.1632, 0.0023, 1, 0.35, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Class to handle operations that require a call to the Twitter REST API'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L73_C4", "label": "TIME_INTERVAL_IN_SECONDS =", "type": "assigned_variable", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "vector": [14, 1, 0.1678, 0.0023, 1, 0.35, 0.0909, 322, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "TIME_INTERVAL_IN_SECONDS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " TIME_INTERVAL_IN_SECONDS = (15 * 60) + 2 # add 2 seconds just to be sure"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L74_C4", "label": "MAX_FOLLOWERS_PER_REQUEST =", "type": "assigned_variable", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "vector": [14, 1, 0.1701, 0.0023, 1, 0.35, 0.1818, 590, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "MAX_FOLLOWERS_PER_REQUEST", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " MAX_FOLLOWERS_PER_REQUEST = 5000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L75_C4", "label": "MAX_RETRY_COUNT =", "type": "assigned_variable", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "vector": [14, 1, 0.1724, 0.0023, 1, 0.35, 0.2727, 689, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "MAX_RETRY_COUNT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " MAX_RETRY_COUNT = 30"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L76_C4", "label": "RETRY_INTERVAL_IN_SECONDS =", "type": "assigned_variable", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "vector": [14, 1, 0.1747, 0.0023, 1, 0.35, 0.3636, 351, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "RETRY_INTERVAL_IN_SECONDS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " RETRY_INTERVAL_IN_SECONDS = 30"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L77_C4", "label": "isCollectingFollowers =", "type": "assigned_variable", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "vector": [14, 1, 0.177, 0.0023, 1, 0.35, 0.4545, 695, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "isCollectingFollowers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " isCollectingFollowers = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L79_C4", "label": "__init__", "type": "function", "loc": [79, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "vector": [2, 1, 0.1828, 0.0046, 1, 0.35, 0.5455, 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.twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L80_C8", "label": "self.twitter = Twython()", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L79_C4", "vector": [14, 2, 0.1839, 0.0023, 2, 0.27, 0.0, 224, 3, 4, 0, 0, 500, 10, 1], "semantic": {"name": "self.twitter", "arg_names": [], "import_names": [], "rhs_call_name": "Twython", "annotation": ""}, "snippet": " self.twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L82_C4", "label": "stopCollecting", "type": "function", "loc": [82, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "vector": [2, 1, 0.1897, 0.0046, 1, 0.35, 0.6364, 829, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "stopCollecting", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def stopCollecting(self):\n self.isCollectingFollowers = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L83_C8", "label": "self.isCollectingFollowers =", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L82_C4", "vector": [14, 2, 0.1908, 0.0023, 2, 0.59, 0.0, 909, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.isCollectingFollowers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.isCollectingFollowers = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L85_C4", "label": "sleepFor", "type": "function", "loc": [85, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "vector": [2, 1, 0.2126, 0.0368, 1, 0.35, 0.7273, 684, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "sleepFor", "arg_names": ["self", "seconds"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def sleepFor(self, seconds):\n startTime = time.time()\n for unused in range(seconds):\n time.sleep(1)\n if not self.isCollectingFollowers:\n return False\n \n # make sure we slept for long enough"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L86_C8", "label": "startTime = time()", "type": "assigned_variable", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L85_C4", "vector": [14, 2, 0.1977, 0.0023, 2, 0.73, 0.0, 432, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "startTime", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " startTime = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:For_L87_C8", "label": "for unused", "type": "for", "loc": [87, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L85_C4", "vector": [6, 2, 0.2034, 0.0092, 2, 0.73, 0.3333, 416, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "unused", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for unused in range(seconds):\n time.sleep(1)\n if not self.isCollectingFollowers:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L88_C12", "label": "sleep()", "type": "expression", "loc": [88, 88], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:For_L87_C8", "vector": [8, 3, 0.2023, 0.0023, 3, 0.83, 0.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L89_C12", "label": "if", "type": "if", "loc": [89, 90], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:For_L87_C8", "vector": [4, 3, 0.2057, 0.0046, 3, 0.83, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.isCollectingFollowers:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L90_C16", "label": "return", "type": "return", "loc": [90, 90], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L89_C12", "vector": [13, 4, 0.2069, 0.0023, 4, 0.36, 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_1077:While_L93_C8", "label": "while", "type": "while", "loc": [93, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L85_C4", "vector": [5, 2, 0.2195, 0.0138, 2, 0.73, 0.6667, 0, 1, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n currentTime = time.time()\n if currentTime - startTime < seconds:\n time.sleep(1)\n else:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L94_C12", "label": "currentTime = time()", "type": "assigned_variable", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:While_L93_C8", "vector": [14, 3, 0.2161, 0.0023, 3, 0.45, 0.0, 264, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "currentTime", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " currentTime = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L95_C12", "label": "if", "type": "if", "loc": [95, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:While_L93_C8", "vector": [4, 3, 0.2218, 0.0092, 3, 0.45, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if currentTime - startTime < seconds:\n time.sleep(1)\n else:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L96_C16", "label": "sleep()", "type": "expression", "loc": [96, 96], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L95_C12", "vector": [8, 4, 0.2207, 0.0023, 4, 0.01, 0.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L100_C8", "label": "return", "type": "return", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L85_C4", "vector": [13, 2, 0.2299, 0.0023, 2, 0.73, 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_1077:FunctionDef_L102_C4", "label": "getFollowers", "type": "function", "loc": [102, 193], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "vector": [2, 1, 0.3391, 0.2115, 1, 0.35, 0.8182, 892, 0, 4, 1, 0, 0, 0, 41], "semantic": {"name": "getFollowers", "arg_names": ["self", "userId", "getAll", "retry"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def getFollowers(self, userId, getAll=False, retry=0):\n self.isCollectingFollowers = True\n \n try:\n totalFollowersCount = int(User.objects.get(id=userId).followers_count)\n except:\n totalFollowersCount = 0\n requiredCallsCount = int(math.ceil(totalFollowersCount/float(self.MAX_FOLLOWERS_PER_REQUEST)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L103_C8", "label": "self.isCollectingFollowers =", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L102_C4", "vector": [14, 2, 0.2368, 0.0023, 2, 0.68, 0.0, 909, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.isCollectingFollowers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.isCollectingFollowers = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L105_C8", "label": "try", "type": "try", "loc": [105, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L102_C4", "vector": [7, 2, 0.2448, 0.0092, 2, 0.68, 0.125, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n totalFollowersCount = int(User.objects.get(id=userId).followers_count)\n except:\n totalFollowersCount = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L106_C12", "label": "totalFollowersCount = int()", "type": "assigned_variable", "loc": [106, 106], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L105_C8", "vector": [14, 3, 0.2437, 0.0023, 3, 0.96, 0.0, 837, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "totalFollowersCount", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " totalFollowersCount = int(User.objects.get(id=userId).followers_count)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L108_C12", "label": "totalFollowersCount =", "type": "assigned_variable", "loc": [108, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L105_C8", "vector": [14, 3, 0.2483, 0.0023, 3, 0.96, 0.0, 837, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "totalFollowersCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " totalFollowersCount = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L109_C8", "label": "requiredCallsCount = int()", "type": "assigned_variable", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L102_C4", "vector": [14, 2, 0.2506, 0.0023, 2, 0.68, 0.25, 169, 3, 1, 0, 0, 901, 10, 3], "semantic": {"name": "requiredCallsCount", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " requiredCallsCount = int(math.ceil(totalFollowersCount/float(self.MAX_FOLLOWERS_PER_REQUEST)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L110_C8", "label": "partCount =", "type": "assigned_variable", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L102_C4", "vector": [14, 2, 0.2529, 0.0023, 2, 0.68, 0.375, 32, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "partCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " partCount = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L113_C8", "label": "doGetFollowers", "type": "function", "loc": [113, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L102_C4", "vector": [2, 2, 0.2678, 0.0184, 2, 0.68, 0.5, 241, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "doGetFollowers", "arg_names": ["kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def doGetFollowers(**kwargs):\n try:\n return self.twitter.get_followers_ids(user_id=userId, **kwargs)\n except ConnectionError as e:\n print(e)\n print(\"ConnectionError! Retrying...\")\n self.sleepFor(10)\n return doGetFollowers(**kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L114_C12", "label": "try", "type": "try", "loc": [114, 120], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L113_C8", "vector": [7, 3, 0.269, 0.0161, 3, 0.69, 0.0, 0, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return self.twitter.get_followers_ids(user_id=userId, **kwargs)\n except ConnectionError as e:\n print(e)\n print(\"ConnectionError! Retrying...\")\n self.sleepFor(10)\n return doGetFollowers(**kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L115_C16", "label": "return", "type": "return", "loc": [115, 115], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L114_C12", "vector": [13, 4, 0.2644, 0.0023, 4, 0.77, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.twitter.get_followers_ids(user_id=userId, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L117_C16", "label": "print()", "type": "expression", "loc": [117, 117], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L114_C12", "vector": [8, 4, 0.269, 0.0023, 4, 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(e)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L118_C16", "label": "print()", "type": "expression", "loc": [118, 118], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L114_C12", "vector": [8, 4, 0.2713, 0.0023, 4, 0.77, 0.3333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"ConnectionError! Retrying...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L119_C16", "label": "sleepFor()", "type": "expression", "loc": [119, 119], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L114_C12", "vector": [8, 4, 0.2736, 0.0023, 4, 0.77, 0.6667, 684, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleepFor", "arg_names": [], "import_names": [], "rhs_call_name": "sleepFor", "annotation": ""}, "snippet": " self.sleepFor(10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L120_C16", "label": "return", "type": "return", "loc": [120, 120], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L114_C12", "vector": [13, 4, 0.2759, 0.0023, 4, 0.77, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return doGetFollowers(**kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "label": "try", "type": "try", "loc": [122, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L102_C4", "vector": [7, 2, 0.3184, 0.0782, 2, 0.68, 0.625, 0, 0, 2, 0, 0, 0, 0, 17], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.displayFollowersCollectionStatus(userId, partCount, requiredCallsCount)\n returnValue = doGetFollowers()\n except TwythonRateLimitError:\n # wait a complete Twitter time interval\n print(\"Sleeping until limit is lifted...\")\n if not self.sleepFor(self.TIME_INTERVAL_IN_SECONDS):\n return # stop collecting"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L123_C12", "label": "displayFollowersCollectionStatus()", "type": "expression", "loc": [123, 123], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "vector": [8, 3, 0.2828, 0.0023, 3, 0.19, 0.0, 695, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "displayFollowersCollectionStatus", "arg_names": [], "import_names": [], "rhs_call_name": "displayFollowersCollectionStatus", "annotation": ""}, "snippet": " self.displayFollowersCollectionStatus(userId, partCount, requiredCallsCount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L124_C12", "label": "returnValue = doGetFollowers()", "type": "assigned_variable", "loc": [124, 124], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "vector": [14, 3, 0.2851, 0.0023, 3, 0.19, 1.0, 144, 3, 0, 0, 0, 241, 10, 1], "semantic": {"name": "returnValue", "arg_names": [], "import_names": [], "rhs_call_name": "doGetFollowers", "annotation": ""}, "snippet": " returnValue = doGetFollowers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L127_C12", "label": "print()", "type": "expression", "loc": [127, 127], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "vector": [8, 3, 0.292, 0.0023, 3, 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(\"Sleeping until limit is lifted...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L128_C12", "label": "if", "type": "if", "loc": [128, 129], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "vector": [4, 3, 0.2954, 0.0046, 3, 0.19, 0.25, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.sleepFor(self.TIME_INTERVAL_IN_SECONDS):\n return # stop collecting"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L129_C16", "label": "return", "type": "return", "loc": [129, 129], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L128_C12", "vector": [13, 4, 0.2966, 0.0023, 4, 0.58, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return # stop collecting"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L131_C12", "label": "print()", "type": "expression", "loc": [131, 131], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "vector": [8, 3, 0.3011, 0.0023, 3, 0.19, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Retrying...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L132_C12", "label": "displayFollowersCollectionStatus()", "type": "expression", "loc": [132, 132], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "vector": [8, 3, 0.3034, 0.0023, 3, 0.19, 0.75, 695, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "displayFollowersCollectionStatus", "arg_names": [], "import_names": [], "rhs_call_name": "displayFollowersCollectionStatus", "annotation": ""}, "snippet": " self.displayFollowersCollectionStatus(userId, partCount, requiredCallsCount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L133_C12", "label": "returnValue = doGetFollowers()", "type": "assigned_variable", "loc": [133, 133], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "vector": [14, 3, 0.3057, 0.0023, 3, 0.19, 1.0, 144, 3, 0, 0, 0, 241, 10, 1], "semantic": {"name": "returnValue", "arg_names": [], "import_names": [], "rhs_call_name": "doGetFollowers", "annotation": ""}, "snippet": " returnValue = doGetFollowers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L137_C12", "label": "if", "type": "if", "loc": [137, 139], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "vector": [4, 3, 0.3172, 0.0069, 3, 0.19, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if \"404\" in str(e):\n print(\"WARNING: User %s does not exist!\" % userId)\n return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L138_C16", "label": "print()", "type": "expression", "loc": [138, 138], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L137_C12", "vector": [8, 4, 0.3172, 0.0023, 4, 0.8, 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: User %s does not exist!\" % userId)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L139_C16", "label": "return", "type": "return", "loc": [139, 139], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L137_C12", "vector": [13, 4, 0.3195, 0.0023, 4, 0.8, 1.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_1077:If_L140_C12", "label": "if", "type": "if", "loc": [140, 142], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "vector": [4, 3, 0.3241, 0.0069, 3, 0.19, 0.1429, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if \"401\" in str(e):\n print(\"WARNING: User %s is probably private! Can't collect his/her followers.\" % userId)\n return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L141_C16", "label": "print()", "type": "expression", "loc": [141, 141], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L140_C12", "vector": [8, 4, 0.3241, 0.0023, 4, 0.41, 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: User %s is probably private! Can't collect his/her followers.\" % userId)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L142_C16", "label": "return", "type": "return", "loc": [142, 142], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L140_C12", "vector": [13, 4, 0.3264, 0.0023, 4, 0.41, 1.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_1077:Expr_L147_C12", "label": "print()", "type": "expression", "loc": [147, 147], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "vector": [8, 3, 0.3379, 0.0023, 3, 0.19, 0.2857, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(e)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L148_C12", "label": "print()", "type": "expression", "loc": [148, 148], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "vector": [8, 3, 0.3402, 0.0023, 3, 0.19, 0.4286, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Retrying in %s seconds...\" % self.RETRY_INTERVAL_IN_SECONDS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L149_C12", "label": "if", "type": "if", "loc": [149, 150], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "vector": [4, 3, 0.3437, 0.0046, 3, 0.19, 0.5714, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.sleepFor(self.RETRY_INTERVAL_IN_SECONDS):\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L150_C16", "label": "return", "type": "return", "loc": [150, 150], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L149_C12", "vector": [13, 4, 0.3448, 0.0023, 4, 0.21, 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_1077:If_L151_C12", "label": "if", "type": "if", "loc": [151, 153], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "vector": [4, 3, 0.3494, 0.0069, 3, 0.19, 0.7143, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if retry > self.MAX_RETRY_COUNT:\n print(\"Max retry count reached. Aborting...\")\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L152_C16", "label": "print()", "type": "expression", "loc": [152, 152], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L151_C12", "vector": [8, 4, 0.3494, 0.0023, 4, 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(\"Max retry count reached. Aborting...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L153_C16", "label": "return", "type": "return", "loc": [153, 153], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L151_C12", "vector": [13, 4, 0.3517, 0.0023, 4, 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_1077:Expr_L154_C12", "label": "print()", "type": "expression", "loc": [154, 154], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "vector": [8, 3, 0.354, 0.0023, 3, 0.19, 0.8571, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Retrying... attempt %s/%s\" % (retry, self.MAX_RETRY_COUNT))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L155_C12", "label": "return", "type": "return", "loc": [155, 155], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "vector": [13, 3, 0.3563, 0.0023, 3, 0.19, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.getFollowers(userId, getAll=getAll, retry=retry + 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L158_C8", "label": "followers =", "type": "assigned_variable", "loc": [158, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L102_C4", "vector": [14, 2, 0.3632, 0.0023, 2, 0.68, 0.75, 530, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "followers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " followers = returnValue[\"ids\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L160_C8", "label": "if", "type": "if", "loc": [160, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L102_C4", "vector": [4, 2, 0.4034, 0.0736, 2, 0.68, 0.875, 0, 2, 0, 0, 0, 0, 0, 14], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if getAll:\n \n while returnValue[\"next_cursor\"] is not 0:\n try:\n self.displayFollowersCollectionStatus(userId, partCount, requiredCallsCount)\n returnValue = doGetFollowers(cursor=returnValue[\"next_cursor\"])\n except TwythonRateLimitError:\n # wait a complete Twitter time interval"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:While_L162_C12", "label": "while", "type": "while", "loc": [162, 189], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L160_C8", "vector": [5, 3, 0.4034, 0.0644, 3, 0.59, 0.0, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while returnValue[\"next_cursor\"] is not 0:\n try:\n self.displayFollowersCollectionStatus(userId, partCount, requiredCallsCount)\n returnValue = doGetFollowers(cursor=returnValue[\"next_cursor\"])\n except TwythonRateLimitError:\n # wait a complete Twitter time interval\n print(\"Sleeping until limit is lifted...\")\n if not self.sleepFor(self.TIME_INTERVAL_IN_SECONDS):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "label": "try", "type": "try", "loc": [163, 186], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:While_L162_C12", "vector": [7, 4, 0.4011, 0.0552, 4, 0.06, 0.0, 0, 0, 2, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.displayFollowersCollectionStatus(userId, partCount, requiredCallsCount)\n returnValue = doGetFollowers(cursor=returnValue[\"next_cursor\"])\n except TwythonRateLimitError:\n # wait a complete Twitter time interval\n print(\"Sleeping until limit is lifted...\")\n if not self.sleepFor(self.TIME_INTERVAL_IN_SECONDS):\n return # stop collecting"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L164_C20", "label": "displayFollowersCollectionStatus()", "type": "expression", "loc": [164, 164], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "vector": [8, 5, 0.377, 0.0023, 5, 0.59, 0.0, 695, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "displayFollowersCollectionStatus", "arg_names": [], "import_names": [], "rhs_call_name": "displayFollowersCollectionStatus", "annotation": ""}, "snippet": " self.displayFollowersCollectionStatus(userId, partCount, requiredCallsCount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L165_C20", "label": "returnValue = doGetFollowers()", "type": "assigned_variable", "loc": [165, 165], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "vector": [14, 5, 0.3793, 0.0023, 5, 0.59, 1.0, 144, 3, 1, 0, 0, 241, 10, 1], "semantic": {"name": "returnValue", "arg_names": [], "import_names": [], "rhs_call_name": "doGetFollowers", "annotation": ""}, "snippet": " returnValue = doGetFollowers(cursor=returnValue[\"next_cursor\"])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L168_C20", "label": "print()", "type": "expression", "loc": [168, 168], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "vector": [8, 5, 0.3862, 0.0023, 5, 0.59, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Sleeping until limit is lifted...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L169_C20", "label": "if", "type": "if", "loc": [169, 170], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "vector": [4, 5, 0.3897, 0.0046, 5, 0.59, 0.25, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.sleepFor(self.TIME_INTERVAL_IN_SECONDS):\n return # stop collecting"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L170_C24", "label": "return", "type": "return", "loc": [170, 170], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L169_C20", "vector": [13, 6, 0.3908, 0.0023, 6, 0.33, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return # stop collecting"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L172_C20", "label": "print()", "type": "expression", "loc": [172, 172], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "vector": [8, 5, 0.3954, 0.0023, 5, 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(\"Retrying...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L173_C20", "label": "displayFollowersCollectionStatus()", "type": "expression", "loc": [173, 173], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "vector": [8, 5, 0.3977, 0.0023, 5, 0.59, 0.75, 695, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "displayFollowersCollectionStatus", "arg_names": [], "import_names": [], "rhs_call_name": "displayFollowersCollectionStatus", "annotation": ""}, "snippet": " self.displayFollowersCollectionStatus(userId, partCount, requiredCallsCount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L174_C20", "label": "returnValue = doGetFollowers()", "type": "assigned_variable", "loc": [174, 174], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "vector": [14, 5, 0.4, 0.0023, 5, 0.59, 1.0, 144, 3, 1, 0, 0, 241, 10, 1], "semantic": {"name": "returnValue", "arg_names": [], "import_names": [], "rhs_call_name": "doGetFollowers", "annotation": ""}, "snippet": " returnValue = doGetFollowers(cursor=returnValue[\"next_cursor\"])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L178_C20", "label": "print()", "type": "expression", "loc": [178, 178], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "vector": [8, 5, 0.4092, 0.0023, 5, 0.59, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(e)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L179_C20", "label": "print()", "type": "expression", "loc": [179, 179], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "vector": [8, 5, 0.4115, 0.0023, 5, 0.59, 0.2, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Retrying in %s seconds...\" % self.RETRY_INTERVAL_IN_SECONDS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L180_C20", "label": "if", "type": "if", "loc": [180, 181], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "vector": [4, 5, 0.4149, 0.0046, 5, 0.59, 0.4, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.sleepFor(self.RETRY_INTERVAL_IN_SECONDS):\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L181_C24", "label": "return", "type": "return", "loc": [181, 181], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L180_C20", "vector": [13, 6, 0.4161, 0.0023, 6, 0.48, 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_1077:If_L182_C20", "label": "if", "type": "if", "loc": [182, 184], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "vector": [4, 5, 0.4207, 0.0069, 5, 0.59, 0.6, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if retry > self.MAX_RETRY_COUNT:\n print(\"Max retry count reached. Aborting...\")\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L183_C24", "label": "print()", "type": "expression", "loc": [183, 183], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L182_C20", "vector": [8, 6, 0.4207, 0.0023, 6, 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(\"Max retry count reached. Aborting...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L184_C24", "label": "return", "type": "return", "loc": [184, 184], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L182_C20", "vector": [13, 6, 0.423, 0.0023, 6, 0.49, 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_1077:Expr_L185_C20", "label": "print()", "type": "expression", "loc": [185, 185], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "vector": [8, 5, 0.4253, 0.0023, 5, 0.59, 0.8, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Retrying... attempt %s/%s\" % (retry, self.MAX_RETRY_COUNT))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L186_C20", "label": "return", "type": "return", "loc": [186, 186], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "vector": [13, 5, 0.4276, 0.0023, 5, 0.59, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.getFollowers(userId, getAll=getAll, retry=retry + 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L190_C8", "label": "if", "type": "if", "loc": [190, 191], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L160_C8", "vector": [4, 3, 0.4379, 0.0046, 3, 0.59, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif returnValue[\"next_cursor\"] is not 0:\n print(\"Warning: you specified getAll=False but there was more than %s followers. Results are truncated!\" % self.MAX_FOLLOWERS_PER_REQUEST)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L191_C16", "label": "print()", "type": "expression", "loc": [191, 191], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L190_C8", "vector": [8, 4, 0.4391, 0.0023, 4, 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(\"Warning: you specified getAll=False but there was more than %s followers. Results are truncated!\" % self.MAX_FOLLOWERS_PER_REQUEST)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L193_C8", "label": "return", "type": "return", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L102_C4", "vector": [13, 2, 0.4437, 0.0023, 2, 0.68, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return followers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L195_C4", "label": "displayFollowersCollectionStatus", "type": "function", "loc": [195, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "vector": [2, 1, 0.4494, 0.0046, 1, 0.35, 0.9091, 695, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "displayFollowersCollectionStatus", "arg_names": ["self", "userId", "partCount", "requiredCallsCount"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def displayFollowersCollectionStatus(self, userId, partCount, requiredCallsCount):\n print(\"Getting followers for user %s (part %s/%s)...\" % (userId, partCount, requiredCallsCount))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L196_C8", "label": "print()", "type": "expression", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L195_C4", "vector": [8, 2, 0.4506, 0.0023, 2, 0.59, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Getting followers for user %s (part %s/%s)...\" % (userId, partCount, requiredCallsCount))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "label": "getUser", "type": "function", "loc": [198, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "vector": [2, 1, 0.4862, 0.0644, 1, 0.35, 1.0, 726, 0, 2, 1, 0, 0, 0, 10], "semantic": {"name": "getUser", "arg_names": ["self", "userId"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def getUser(self, userId):\n # define rate limited operation\n def doGetUser():\n return self.twitter.show_user(user_id=userId)\n \n try:\n print(\"Getting details for user %s...\" % userId)\n returnValue = doGetUser() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L200_C8", "label": "doGetUser", "type": "function", "loc": [200, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "vector": [2, 2, 0.4609, 0.0046, 2, 0.54, 0.0, 359, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "doGetUser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def doGetUser():\n return self.twitter.show_user(user_id=userId)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L201_C12", "label": "return", "type": "return", "loc": [201, 201], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L200_C8", "vector": [13, 3, 0.4621, 0.0023, 3, 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.twitter.show_user(user_id=userId)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L203_C8", "label": "try", "type": "try", "loc": [203, 213], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "vector": [7, 2, 0.4782, 0.0253, 2, 0.54, 0.1, 0, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n print(\"Getting details for user %s...\" % userId)\n returnValue = doGetUser() \n except TwythonRateLimitError:\n # wait a complete Twitter time interval\n print(\"Sleeping until limit is lifted...\")\n self.sleepFor(self.TIME_INTERVAL_IN_SECONDS)\n # try again"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L204_C12", "label": "print()", "type": "expression", "loc": [204, 204], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L203_C8", "vector": [8, 3, 0.469, 0.0023, 3, 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": " print(\"Getting details for user %s...\" % userId)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L205_C12", "label": "returnValue = doGetUser()", "type": "assigned_variable", "loc": [205, 205], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L203_C8", "vector": [14, 3, 0.4713, 0.0023, 3, 0.08, 1.0, 144, 3, 0, 0, 0, 359, 10, 1], "semantic": {"name": "returnValue", "arg_names": [], "import_names": [], "rhs_call_name": "doGetUser", "annotation": ""}, "snippet": " returnValue = doGetUser() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L208_C12", "label": "print()", "type": "expression", "loc": [208, 208], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L203_C8", "vector": [8, 3, 0.4782, 0.0023, 3, 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": " print(\"Sleeping until limit is lifted...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L209_C12", "label": "sleepFor()", "type": "expression", "loc": [209, 209], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L203_C8", "vector": [8, 3, 0.4805, 0.0023, 3, 0.08, 0.25, 684, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleepFor", "arg_names": [], "import_names": [], "rhs_call_name": "sleepFor", "annotation": ""}, "snippet": " self.sleepFor(self.TIME_INTERVAL_IN_SECONDS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L211_C12", "label": "print()", "type": "expression", "loc": [211, 211], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L203_C8", "vector": [8, 3, 0.4851, 0.0023, 3, 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": " print(\"Retrying...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L212_C12", "label": "print()", "type": "expression", "loc": [212, 212], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L203_C8", "vector": [8, 3, 0.4874, 0.0023, 3, 0.08, 0.75, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Getting details for user %s...\" % userId)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L213_C12", "label": "returnValue = doGetUser()", "type": "assigned_variable", "loc": [213, 213], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L203_C8", "vector": [14, 3, 0.4897, 0.0023, 3, 0.08, 1.0, 144, 3, 0, 0, 0, 359, 10, 1], "semantic": {"name": "returnValue", "arg_names": [], "import_names": [], "rhs_call_name": "doGetUser", "annotation": ""}, "snippet": " returnValue = doGetUser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L215_C8", "label": "print()", "type": "expression", "loc": [215, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "vector": [8, 2, 0.4943, 0.0023, 2, 0.54, 0.2, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"done.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L217_C8", "label": "screen_name =", "type": "assigned_variable", "loc": [217, 217], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "vector": [14, 2, 0.4989, 0.0023, 2, 0.54, 0.3, 600, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "screen_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " screen_name = returnValue[\"screen_name\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L218_C8", "label": "statuses_count =", "type": "assigned_variable", "loc": [218, 218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "vector": [14, 2, 0.5011, 0.0023, 2, 0.54, 0.4, 812, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "statuses_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " statuses_count = returnValue[\"statuses_count\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L219_C8", "label": "friends_count =", "type": "assigned_variable", "loc": [219, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "vector": [14, 2, 0.5034, 0.0023, 2, 0.54, 0.5, 540, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "friends_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " friends_count = returnValue[\"friends_count\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L220_C8", "label": "followers_count =", "type": "assigned_variable", "loc": [220, 220], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "vector": [14, 2, 0.5057, 0.0023, 2, 0.54, 0.6, 440, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "followers_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " followers_count = returnValue[\"followers_count\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L221_C8", "label": "lang =", "type": "assigned_variable", "loc": [221, 221], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "vector": [14, 2, 0.508, 0.0023, 2, 0.54, 0.7, 312, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lang", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lang = returnValue[\"lang\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L222_C8", "label": "followersReady =", "type": "assigned_variable", "loc": [222, 222], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "vector": [14, 2, 0.5103, 0.0023, 2, 0.54, 0.8, 251, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "followersReady", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " followersReady = True # don't collect followers of followers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L223_C8", "label": "user = User()", "type": "assigned_variable", "loc": [223, 223], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "vector": [14, 2, 0.5126, 0.0023, 2, 0.54, 0.9, 503, 3, 7, 0, 0, 61, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "User", "annotation": ""}, "snippet": " user = User(id=userId, screen_name=screen_name, statuses_count=statuses_count, friends_count=friends_count, followers_count=followers_count, lang=lang, followers_ready=followersReady)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L225_C8", "label": "return", "type": "return", "loc": [225, 225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "vector": [13, 2, 0.5172, 0.0023, 2, 0.54, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L227_C0", "label": "TwitterStreaming", "type": "class", "loc": [227, 327], "level": 0, "parent": null, "vector": [3, 0, 0.6368, 0.2322, 0, 0.66, 0.7429, 683, 0, 5, 0, 0, 637, 0, 22], "semantic": {"name": "TwitterStreaming", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TwitterStreaming(TwythonStreamer):\n '''Class to handle operations that deal with the Twitter Streaming API'''\n \n def setParams(self, stopTweetCount, stopTime):\n self.stopTweetCount = stopTweetCount\n self.stopTime = stopTime\n self.receivedTweetsCount = 0\n self.startTime = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L228_C4", "label": "expression", "type": "expression", "loc": [228, 228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L227_C0", "vector": [8, 1, 0.5241, 0.0023, 1, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Class to handle operations that deal with the Twitter Streaming API'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L230_C4", "label": "setParams", "type": "function", "loc": [230, 237], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L227_C0", "vector": [2, 1, 0.5368, 0.0184, 1, 0.74, 0.2, 689, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "setParams", "arg_names": ["self", "stopTweetCount", "stopTime"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setParams(self, stopTweetCount, stopTime):\n self.stopTweetCount = stopTweetCount\n self.stopTime = stopTime\n self.receivedTweetsCount = 0\n self.startTime = time.time()\n \n self.rateTweetCount = 0\n self.rateLastTime = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L231_C8", "label": "self.stopTweetCount =", "type": "assigned_variable", "loc": [231, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L230_C4", "vector": [14, 2, 0.531, 0.0023, 2, 0.23, 0.0, 574, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.stopTweetCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.stopTweetCount = stopTweetCount"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L232_C8", "label": "self.stopTime =", "type": "assigned_variable", "loc": [232, 232], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L230_C4", "vector": [14, 2, 0.5333, 0.0023, 2, 0.23, 0.2, 693, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.stopTime", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.stopTime = stopTime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L233_C8", "label": "self.receivedTweetsCount =", "type": "assigned_variable", "loc": [233, 233], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L230_C4", "vector": [14, 2, 0.5356, 0.0023, 2, 0.23, 0.4, 510, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.receivedTweetsCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.receivedTweetsCount = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L234_C8", "label": "self.startTime = time()", "type": "assigned_variable", "loc": [234, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L230_C4", "vector": [14, 2, 0.5379, 0.0023, 2, 0.23, 0.6, 226, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "self.startTime", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " self.startTime = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L236_C8", "label": "self.rateTweetCount =", "type": "assigned_variable", "loc": [236, 236], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L230_C4", "vector": [14, 2, 0.5425, 0.0023, 2, 0.23, 0.8, 770, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.rateTweetCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.rateTweetCount = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L237_C8", "label": "self.rateLastTime = time()", "type": "assigned_variable", "loc": [237, 237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L230_C4", "vector": [14, 2, 0.5448, 0.0023, 2, 0.23, 1.0, 666, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "self.rateLastTime", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " self.rateLastTime = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L239_C4", "label": "getRunningTime", "type": "function", "loc": [239, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L227_C0", "vector": [2, 1, 0.554, 0.0115, 1, 0.74, 0.4, 635, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "getRunningTime", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def getRunningTime(self):\n currentTime = time.time()\n elapsedTime = currentTime - self.startTime # seconds\n elapsedTime /= 60.0 # convert to minutes\n return elapsedTime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L240_C8", "label": "currentTime = time()", "type": "assigned_variable", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L239_C4", "vector": [14, 2, 0.5517, 0.0023, 2, 0.65, 0.0, 264, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "currentTime", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " currentTime = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L241_C8", "label": "elapsedTime =", "type": "assigned_variable", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L239_C4", "vector": [14, 2, 0.554, 0.0023, 2, 0.65, 0.5, 701, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "elapsedTime", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elapsedTime = currentTime - self.startTime # seconds"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L243_C8", "label": "return", "type": "return", "loc": [243, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L239_C4", "vector": [13, 2, 0.5586, 0.0023, 2, 0.65, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return elapsedTime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L245_C4", "label": "getRate", "type": "function", "loc": [245, 253], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L227_C0", "vector": [2, 1, 0.5724, 0.0207, 1, 0.74, 0.6, 275, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "getRate", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def getRate(self):\n '''Received tweets per minute'''\n receivedTweets = self.rateTweetCount\n timeInterval = (time.time() - self.rateLastTime) / 60.0 # minutes\n rate = receivedTweets / timeInterval\n \n self.rateLastTime = time.time()\n self.rateTweetCount = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L246_C8", "label": "expression", "type": "expression", "loc": [246, 246], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L245_C4", "vector": [8, 2, 0.5655, 0.0023, 2, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Received tweets per minute'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L247_C8", "label": "receivedTweets =", "type": "assigned_variable", "loc": [247, 247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L245_C4", "vector": [14, 2, 0.5678, 0.0023, 2, 0.84, 0.1667, 77, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "receivedTweets", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " receivedTweets = self.rateTweetCount"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L248_C8", "label": "timeInterval =", "type": "assigned_variable", "loc": [248, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L245_C4", "vector": [14, 2, 0.5701, 0.0023, 2, 0.84, 0.3333, 368, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "timeInterval", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " timeInterval = (time.time() - self.rateLastTime) / 60.0 # minutes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L249_C8", "label": "rate =", "type": "assigned_variable", "loc": [249, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L245_C4", "vector": [14, 2, 0.5724, 0.0023, 2, 0.84, 0.5, 477, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rate", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rate = receivedTweets / timeInterval"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L251_C8", "label": "self.rateLastTime = time()", "type": "assigned_variable", "loc": [251, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L245_C4", "vector": [14, 2, 0.577, 0.0023, 2, 0.84, 0.6667, 666, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "self.rateLastTime", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " self.rateLastTime = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L252_C8", "label": "self.rateTweetCount =", "type": "assigned_variable", "loc": [252, 252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L245_C4", "vector": [14, 2, 0.5793, 0.0023, 2, 0.84, 0.8333, 770, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.rateTweetCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.rateTweetCount = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L253_C8", "label": "return", "type": "return", "loc": [253, 253], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L245_C4", "vector": [13, 2, 0.5816, 0.0023, 2, 0.84, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L255_C4", "label": "on_success", "type": "function", "loc": [255, 324], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L227_C0", "vector": [2, 1, 0.6655, 0.1609, 1, 0.74, 0.8, 305, 0, 2, 0, 0, 0, 0, 16], "semantic": {"name": "on_success", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_success(self, data):\n try: \n text = data[\"text\"]\n if not isEnglishTweet(text):\n print(\"Dropped tweet (considered non-english): \" + text)\n return\n else:\n print(\"ENGLISH: \" + text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L256_C8", "label": "try", "type": "try", "loc": [256, 264], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L255_C4", "vector": [7, 2, 0.5977, 0.0207, 2, 0.71, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try: \n text = data[\"text\"]\n if not isEnglishTweet(text):\n print(\"Dropped tweet (considered non-english): \" + text)\n return\n else:\n print(\"ENGLISH: \" + text)\n except:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L257_C12", "label": "text =", "type": "assigned_variable", "loc": [257, 257], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L256_C8", "vector": [14, 3, 0.5908, 0.0023, 3, 0.01, 0.0, 439, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = data[\"text\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L258_C12", "label": "if", "type": "if", "loc": [258, 262], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L256_C8", "vector": [4, 3, 0.5977, 0.0115, 3, 0.01, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isEnglishTweet(text):\n print(\"Dropped tweet (considered non-english): \" + text)\n return\n else:\n print(\"ENGLISH: \" + text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L259_C16", "label": "print()", "type": "expression", "loc": [259, 259], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L258_C12", "vector": [8, 4, 0.5954, 0.0023, 4, 0.33, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Dropped tweet (considered non-english): \" + text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L260_C16", "label": "return", "type": "return", "loc": [260, 260], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L258_C12", "vector": [13, 4, 0.5977, 0.0023, 4, 0.33, 0.5, 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_1077:Expr_L262_C16", "label": "print()", "type": "expression", "loc": [262, 262], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L258_C12", "vector": [8, 4, 0.6023, 0.0023, 4, 0.33, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"ENGLISH: \" + text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "label": "try", "type": "try", "loc": [266, 324], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L255_C4", "vector": [7, 2, 0.6782, 0.1356, 2, 0.71, 1.0, 0, 0, 3, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # User\n author = data[\"user\"]\n userId = author[\"id\"]\n screen_name = author[\"screen_name\"]\n statuses_count = author[\"statuses_count\"]\n friends_count = author[\"friends_count\"]\n followers_count = author[\"followers_count\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L268_C12", "label": "author =", "type": "assigned_variable", "loc": [268, 268], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [14, 3, 0.6161, 0.0023, 3, 0.18, 0.0, 355, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "author", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " author = data[\"user\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L269_C12", "label": "userId =", "type": "assigned_variable", "loc": [269, 269], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [14, 3, 0.6184, 0.0023, 3, 0.18, 0.0435, 303, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "userId", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userId = author[\"id\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L270_C12", "label": "screen_name =", "type": "assigned_variable", "loc": [270, 270], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [14, 3, 0.6207, 0.0023, 3, 0.18, 0.087, 600, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "screen_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " screen_name = author[\"screen_name\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L271_C12", "label": "statuses_count =", "type": "assigned_variable", "loc": [271, 271], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [14, 3, 0.623, 0.0023, 3, 0.18, 0.1304, 812, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "statuses_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " statuses_count = author[\"statuses_count\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L272_C12", "label": "friends_count =", "type": "assigned_variable", "loc": [272, 272], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [14, 3, 0.6253, 0.0023, 3, 0.18, 0.1739, 540, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "friends_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " friends_count = author[\"friends_count\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L273_C12", "label": "followers_count =", "type": "assigned_variable", "loc": [273, 273], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [14, 3, 0.6276, 0.0023, 3, 0.18, 0.2174, 440, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "followers_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " followers_count = author[\"followers_count\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L274_C12", "label": "lang =", "type": "assigned_variable", "loc": [274, 274], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [14, 3, 0.6299, 0.0023, 3, 0.18, 0.2609, 312, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lang", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lang = author[\"lang\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L275_C12", "label": "followersReady =", "type": "assigned_variable", "loc": [275, 275], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [14, 3, 0.6322, 0.0023, 3, 0.18, 0.3043, 251, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "followersReady", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " followersReady = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L276_C12", "label": "userReady =", "type": "assigned_variable", "loc": [276, 276], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [14, 3, 0.6345, 0.0023, 3, 0.18, 0.3478, 702, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "userReady", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userReady = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L277_C12", "label": "user = User()", "type": "assigned_variable", "loc": [277, 277], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [14, 3, 0.6368, 0.0023, 3, 0.18, 0.3913, 503, 3, 8, 0, 0, 61, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "User", "annotation": ""}, "snippet": " user = User(id=userId, screen_name=screen_name, statuses_count=statuses_count, friends_count=friends_count, followers_count=followers_count, lang=lang, followers_ready=followersReady, user_ready=userReady)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L279_C12", "label": "if", "type": "if", "loc": [279, 283], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [4, 3, 0.646, 0.0115, 3, 0.18, 0.4348, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not User.objects.filter(id=userId).exists():\n try:\n user.save()\n except:\n print(\"ERROR: failed saving user\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L280_C16", "label": "try", "type": "try", "loc": [280, 283], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L279_C12", "vector": [7, 4, 0.6471, 0.0092, 4, 0.39, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n user.save()\n except:\n print(\"ERROR: failed saving user\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L281_C20", "label": "save()", "type": "expression", "loc": [281, 281], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L280_C16", "vector": [8, 5, 0.646, 0.0023, 5, 0.55, 0.0, 928, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " user.save()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L283_C20", "label": "print()", "type": "expression", "loc": [283, 283], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L280_C16", "vector": [8, 5, 0.6506, 0.0023, 5, 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(\"ERROR: failed saving user\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L286_C12", "label": "tweetId =", "type": "assigned_variable", "loc": [286, 286], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [14, 3, 0.6575, 0.0023, 3, 0.18, 0.4783, 18, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tweetId", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tweetId = data[\"id_str\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L287_C12", "label": "in_reply_to_status_id =", "type": "assigned_variable", "loc": [287, 287], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [14, 3, 0.6598, 0.0023, 3, 0.18, 0.5217, 394, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "in_reply_to_status_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " in_reply_to_status_id = data[\"in_reply_to_status_id\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L288_C12", "label": "if", "type": "if", "loc": [288, 289], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [4, 3, 0.6632, 0.0046, 3, 0.18, 0.5652, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if in_reply_to_status_id is None:\n in_reply_to_status_id = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L289_C16", "label": "in_reply_to_status_id =", "type": "assigned_variable", "loc": [289, 289], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L288_C12", "vector": [14, 4, 0.6644, 0.0023, 4, 0.7, 0.0, 394, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "in_reply_to_status_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " in_reply_to_status_id = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L291_C12", "label": "hashtags =", "type": "assigned_variable", "loc": [291, 291], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [14, 3, 0.669, 0.0023, 3, 0.18, 0.6087, 366, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "hashtags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hashtags = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L292_C12", "label": "try", "type": "try", "loc": [292, 298], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [7, 3, 0.6782, 0.0161, 3, 0.18, 0.6522, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n ht = data[\"entities\"][\"hashtags\"]\n tags = [x[\"text\"] for x in ht]\n hashtags = \" \".join(tags)\n except:\n # this tweet doesn't contain any hashtag\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L293_C16", "label": "ht =", "type": "assigned_variable", "loc": [293, 293], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L292_C12", "vector": [14, 4, 0.6736, 0.0023, 4, 0.12, 0.0, 612, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ht", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ht = data[\"entities\"][\"hashtags\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L294_C16", "label": "tags =", "type": "assigned_variable", "loc": [294, 294], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L292_C12", "vector": [14, 4, 0.6759, 0.0023, 4, 0.12, 0.5, 487, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tags = [x[\"text\"] for x in ht]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L295_C16", "label": "hashtags = join()", "type": "assigned_variable", "loc": [295, 295], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L292_C12", "vector": [14, 4, 0.6782, 0.0023, 4, 0.12, 1.0, 366, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "hashtags", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " hashtags = \" \".join(tags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L300_C12", "label": "text =", "type": "assigned_variable", "loc": [300, 300], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [14, 3, 0.6897, 0.0023, 3, 0.18, 0.6957, 439, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = data[\"text\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L301_C12", "label": "created_at =", "type": "assigned_variable", "loc": [301, 301], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [14, 3, 0.692, 0.0023, 3, 0.18, 0.7391, 642, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "created_at", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " created_at = data[\"created_at\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L302_C12", "label": "timestamp = strftime()", "type": "assigned_variable", "loc": [302, 302], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [14, 3, 0.6943, 0.0023, 3, 0.18, 0.7826, 834, 3, 2, 0, 0, 668, 10, 2], "semantic": {"name": "timestamp", "arg_names": [], "import_names": [], "rhs_call_name": "strftime", "annotation": ""}, "snippet": " timestamp = time.strftime('%Y-%m-%d %H:%M:%S+00:00', time.strptime(created_at, '%a %b %d %H:%M:%S +0000 %Y'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L303_C12", "label": "polarity =", "type": "assigned_variable", "loc": [303, 303], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [14, 3, 0.6966, 0.0023, 3, 0.18, 0.8261, 487, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "polarity", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " polarity = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L304_C12", "label": "polarityReady =", "type": "assigned_variable", "loc": [304, 304], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [14, 3, 0.6989, 0.0023, 3, 0.18, 0.8696, 475, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "polarityReady", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " polarityReady = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L306_C12", "label": "tweet = Tweet()", "type": "assigned_variable", "loc": [306, 306], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [14, 3, 0.7034, 0.0023, 3, 0.18, 0.913, 392, 3, 8, 0, 0, 221, 10, 1], "semantic": {"name": "tweet", "arg_names": [], "import_names": [], "rhs_call_name": "Tweet", "annotation": ""}, "snippet": " tweet = Tweet(id=tweetId, user=user, in_reply_to_status_id=in_reply_to_status_id, text=text, created_at=timestamp, polarity=polarity, polarity_ready=polarityReady, hashtags=hashtags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L307_C12", "label": "save()", "type": "expression", "loc": [307, 307], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [8, 3, 0.7057, 0.0023, 3, 0.18, 0.9565, 928, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " tweet.save()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L314_C12", "label": "if", "type": "if", "loc": [314, 315], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [4, 3, 0.723, 0.0046, 3, 0.18, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (self.receivedTweetsCount is not 0 and self.receivedTweetsCount >= self.stopTweetCount) or (self.stopTime is not 0 and self.getRunningTime() >= self.stopTime):\n self.disconnect()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L315_C16", "label": "disconnect()", "type": "expression", "loc": [315, 315], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L314_C12", "vector": [8, 4, 0.7241, 0.0023, 4, 0.3, 0.0, 978, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "disconnect", "arg_names": [], "import_names": [], "rhs_call_name": "disconnect", "annotation": ""}, "snippet": " self.disconnect()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L317_C12", "label": "expression", "type": "expression", "loc": [317, 317], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [8, 3, 0.7287, 0.0023, 3, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Some tweets are badly sent and are missing user or text'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L320_C12", "label": "expression", "type": "expression", "loc": [320, 320], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [8, 3, 0.7356, 0.0023, 3, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Bad response (invalid JSON)'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L323_C12", "label": "print()", "type": "expression", "loc": [323, 323], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "vector": [8, 3, 0.7425, 0.0023, 3, 0.18, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(e)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L326_C4", "label": "on_error", "type": "function", "loc": [326, 327], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L227_C0", "vector": [2, 1, 0.7506, 0.0046, 1, 0.74, 1.0, 756, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "on_error", "arg_names": ["self", "status_code", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_error(self, status_code, data):\n print(status_code, data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L327_C8", "label": "print()", "type": "expression", "loc": [327, 327], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L326_C4", "vector": [8, 2, 0.7517, 0.0023, 2, 0.29, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(status_code, data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L333_C0", "label": "expression", "type": "expression", "loc": [333, 333], "level": 0, "parent": null, "vector": [8, 0, 0.7655, 0.0023, 0, 0.66, 0.7714, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''FUNCTIONS'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L334_C0", "label": "readStream", "type": "function", "loc": [334, 345], "level": 0, "parent": null, "vector": [2, 0, 0.7805, 0.0276, 0, 0.66, 0.8, 257, 0, 4, 0, 0, 0, 0, 7], "semantic": {"name": "readStream", "arg_names": ["filterHashtag", "stopTweetCount", "stopTime", "stream"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def readStream(filterHashtag, stopTweetCount, stopTime, stream):\n stream.setParams(stopTweetCount, stopTime)\n \n try:\n stream.statuses.filter(track=filterHashtag)\n print(\"Stopped streaming\")\n except Exception as e:\n print(e)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L335_C4", "label": "setParams()", "type": "expression", "loc": [335, 335], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L334_C0", "vector": [8, 1, 0.7701, 0.0023, 1, 0.9, 0.0, 689, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setParams", "arg_names": [], "import_names": [], "rhs_call_name": "setParams", "annotation": ""}, "snippet": " stream.setParams(stopTweetCount, stopTime)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L337_C4", "label": "try", "type": "try", "loc": [337, 345], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L334_C0", "vector": [7, 1, 0.7839, 0.0207, 1, 0.9, 1.0, 0, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n stream.statuses.filter(track=filterHashtag)\n print(\"Stopped streaming\")\n except Exception as e:\n print(e)\n stream.disconnect()\n print(\"Stopped streaming (timeout)\")\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L338_C8", "label": "filter()", "type": "expression", "loc": [338, 338], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L337_C4", "vector": [8, 2, 0.777, 0.0023, 2, 0.06, 0.0, 526, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "filter", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " stream.statuses.filter(track=filterHashtag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L339_C8", "label": "print()", "type": "expression", "loc": [339, 339], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L337_C4", "vector": [8, 2, 0.7793, 0.0023, 2, 0.06, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Stopped streaming\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L341_C8", "label": "print()", "type": "expression", "loc": [341, 341], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L337_C4", "vector": [8, 2, 0.7839, 0.0023, 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": " print(e)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L342_C8", "label": "disconnect()", "type": "expression", "loc": [342, 342], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L337_C4", "vector": [8, 2, 0.7862, 0.0023, 2, 0.06, 0.3333, 978, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "disconnect", "arg_names": [], "import_names": [], "rhs_call_name": "disconnect", "annotation": ""}, "snippet": " stream.disconnect()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L343_C8", "label": "print()", "type": "expression", "loc": [343, 343], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L337_C4", "vector": [8, 2, 0.7885, 0.0023, 2, 0.06, 0.6667, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Stopped streaming (timeout)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L345_C8", "label": "updateHashtagsUsingSimilar()", "type": "expression", "loc": [345, 345], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L337_C4", "vector": [8, 2, 0.7931, 0.0023, 2, 0.06, 1.0, 791, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "updateHashtagsUsingSimilar", "arg_names": [], "import_names": [], "rhs_call_name": "updateHashtagsUsingSimilar", "annotation": ""}, "snippet": " updateHashtagsUsingSimilar(stream) # retry with similar hashtags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L347_C0", "label": "launchStreamMonitor", "type": "function", "loc": [347, 352], "level": 0, "parent": null, "vector": [2, 0, 0.8034, 0.0138, 0, 0.66, 0.8286, 362, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "launchStreamMonitor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def launchStreamMonitor():\n global stream\n t = threading.Thread(target=monitorStream, args=(stream,))\n t.daemon = True\n print(\"Launched stream monitor...\")\n t.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L349_C4", "label": "t = Thread()", "type": "assigned_variable", "loc": [349, 349], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L347_C0", "vector": [14, 1, 0.8023, 0.0023, 1, 0.12, 0.0, 15, 3, 2, 0, 0, 134, 10, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "Thread", "annotation": ""}, "snippet": " t = threading.Thread(target=monitorStream, args=(stream,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L350_C4", "label": "t.daemon =", "type": "assigned_variable", "loc": [350, 350], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L347_C0", "vector": [14, 1, 0.8046, 0.0023, 1, 0.12, 0.3333, 827, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "t.daemon", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t.daemon = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L351_C4", "label": "print()", "type": "expression", "loc": [351, 351], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L347_C0", "vector": [8, 1, 0.8069, 0.0023, 1, 0.12, 0.6667, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Launched stream monitor...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L352_C4", "label": "start()", "type": "expression", "loc": [352, 352], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L347_C0", "vector": [8, 1, 0.8092, 0.0023, 1, 0.12, 1.0, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " t.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L354_C0", "label": "monitorStream", "type": "function", "loc": [354, 380], "level": 0, "parent": null, "vector": [2, 0, 0.8437, 0.0621, 0, 0.66, 0.8571, 776, 0, 1, 0, 0, 0, 0, 11], "semantic": {"name": "monitorStream", "arg_names": ["stream"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def monitorStream(stream):\n # monitor agent that checks incoming tweet rate\n # relaunch stream with similar hashtags if rate is too low\n \n while True:\n try:\n if stream.connected:\n print(\"Stream is connected.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:While_L358_C4", "label": "while", "type": "while", "loc": [358, 380], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L354_C0", "vector": [5, 1, 0.8483, 0.0529, 1, 0.39, 0.0, 0, 1, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n try:\n if stream.connected:\n print(\"Stream is connected.\")\n tweetsPerMinute = stream.getRate()\n print(\"Current rate: %s tweets/min\" % tweetsPerMinute)\n \n streamStartInterval = time.time() - stream.startTime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L359_C8", "label": "try", "type": "try", "loc": [359, 377], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:While_L358_C4", "vector": [7, 2, 0.846, 0.0437, 2, 0.71, 0.0, 0, 0, 1, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if stream.connected:\n print(\"Stream is connected.\")\n tweetsPerMinute = stream.getRate()\n print(\"Current rate: %s tweets/min\" % tweetsPerMinute)\n \n streamStartInterval = time.time() - stream.startTime\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L360_C12", "label": "if", "type": "if", "loc": [360, 373], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L359_C8", "vector": [4, 3, 0.8425, 0.0322, 3, 0.19, 0.0, 0, 7, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if stream.connected:\n print(\"Stream is connected.\")\n tweetsPerMinute = stream.getRate()\n print(\"Current rate: %s tweets/min\" % tweetsPerMinute)\n \n streamStartInterval = time.time() - stream.startTime\n \n if tweetsPerMinute < incomingTweetRateThreshold and streamStartInterval >= streamTimeout:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L361_C16", "label": "print()", "type": "expression", "loc": [361, 361], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L360_C12", "vector": [8, 4, 0.8299, 0.0023, 4, 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": " print(\"Stream is connected.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L362_C16", "label": "tweetsPerMinute = getRate()", "type": "assigned_variable", "loc": [362, 362], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L360_C12", "vector": [14, 4, 0.8322, 0.0023, 4, 0.36, 0.2, 566, 3, 0, 0, 0, 275, 10, 1], "semantic": {"name": "tweetsPerMinute", "arg_names": [], "import_names": [], "rhs_call_name": "getRate", "annotation": ""}, "snippet": " tweetsPerMinute = stream.getRate()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L363_C16", "label": "print()", "type": "expression", "loc": [363, 363], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L360_C12", "vector": [8, 4, 0.8345, 0.0023, 4, 0.36, 0.4, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Current rate: %s tweets/min\" % tweetsPerMinute)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L365_C16", "label": "streamStartInterval =", "type": "assigned_variable", "loc": [365, 365], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L360_C12", "vector": [14, 4, 0.8391, 0.0023, 4, 0.36, 0.6, 395, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "streamStartInterval", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " streamStartInterval = time.time() - stream.startTime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L367_C16", "label": "if", "type": "if", "loc": [367, 370], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L360_C12", "vector": [4, 4, 0.8471, 0.0092, 4, 0.36, 0.8, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tweetsPerMinute < incomingTweetRateThreshold and streamStartInterval >= streamTimeout:\n print(\"Not receiving enough tweets matching this set of hashtags.\")\n print(\"Retrying with additional similar hashtags...\")\n updateHashtagsUsingSimilar(stream)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L368_C20", "label": "print()", "type": "expression", "loc": [368, 368], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L367_C16", "vector": [8, 5, 0.846, 0.0023, 5, 0.72, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Not receiving enough tweets matching this set of hashtags.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L369_C20", "label": "print()", "type": "expression", "loc": [369, 369], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L367_C16", "vector": [8, 5, 0.8483, 0.0023, 5, 0.72, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Retrying with additional similar hashtags...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L370_C20", "label": "updateHashtagsUsingSimilar()", "type": "expression", "loc": [370, 370], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L367_C16", "vector": [8, 5, 0.8506, 0.0023, 5, 0.72, 1.0, 791, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "updateHashtagsUsingSimilar", "arg_names": [], "import_names": [], "rhs_call_name": "updateHashtagsUsingSimilar", "annotation": ""}, "snippet": " updateHashtagsUsingSimilar(stream)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L373_C16", "label": "print()", "type": "expression", "loc": [373, 373], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L360_C12", "vector": [8, 4, 0.8575, 0.0023, 4, 0.36, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Stream is disconnected.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L375_C12", "label": "print()", "type": "expression", "loc": [375, 375], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L359_C8", "vector": [8, 3, 0.8621, 0.0023, 3, 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(e)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L376_C12", "label": "print()", "type": "expression", "loc": [376, 376], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L359_C8", "vector": [8, 3, 0.8644, 0.0023, 3, 0.19, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"WARNING: stream not instantiated. Stopping monitor...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L380_C8", "label": "sleep()", "type": "expression", "loc": [380, 380], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:While_L358_C4", "vector": [8, 2, 0.8736, 0.0023, 2, 0.71, 1.0, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep(monitorCheckInterval)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "label": "updateHashtagsUsingSimilar", "type": "function", "loc": [382, 408], "level": 0, "parent": null, "vector": [2, 0, 0.908, 0.0621, 0, 0.66, 0.8857, 791, 0, 1, 0, 0, 0, 0, 10], "semantic": {"name": "updateHashtagsUsingSimilar", "arg_names": ["stream"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def updateHashtagsUsingSimilar(stream):\n currentTags = [tag.replace(\"#\", \"\") for tag in streamingHashtag.split(\",\")]\n similarTags = []\n for tag in currentTags:\n similar = getSimilarHashtags(tag)\n similar = sorted(similar, key=lambda x: x[1], reverse=True)\n similarCount = 2\n similar = similar[:similarCount] # N most similar tags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L383_C4", "label": "currentTags =", "type": "assigned_variable", "loc": [383, 383], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "vector": [14, 1, 0.8805, 0.0023, 1, 0.33, 0.0, 179, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "currentTags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " currentTags = [tag.replace(\"#\", \"\") for tag in streamingHashtag.split(\",\")]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L384_C4", "label": "similarTags =", "type": "assigned_variable", "loc": [384, 384], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "vector": [14, 1, 0.8828, 0.0023, 1, 0.33, 0.1, 490, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "similarTags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " similarTags = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:For_L385_C4", "label": "for tag", "type": "for", "loc": [385, 392], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "vector": [6, 1, 0.8931, 0.0184, 1, 0.33, 0.2, 732, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for tag in currentTags:\n similar = getSimilarHashtags(tag)\n similar = sorted(similar, key=lambda x: x[1], reverse=True)\n similarCount = 2\n similar = similar[:similarCount] # N most similar tags\n similar = [tag for tag, unused in similar]\n \n similarTags += similar"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L386_C8", "label": "similar = getSimilarHashtags()", "type": "assigned_variable", "loc": [386, 386], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:For_L385_C4", "vector": [14, 2, 0.8874, 0.0023, 2, 0.5, 0.0, 367, 3, 1, 0, 0, 383, 10, 1], "semantic": {"name": "similar", "arg_names": [], "import_names": [], "rhs_call_name": "getSimilarHashtags", "annotation": ""}, "snippet": " similar = getSimilarHashtags(tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L387_C8", "label": "similar = sorted()", "type": "assigned_variable", "loc": [387, 387], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:For_L385_C4", "vector": [14, 2, 0.8897, 0.0023, 2, 0.5, 0.25, 367, 3, 3, 0, 0, 134, 10, 1], "semantic": {"name": "similar", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " similar = sorted(similar, key=lambda x: x[1], reverse=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L388_C8", "label": "similarCount =", "type": "assigned_variable", "loc": [388, 388], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:For_L385_C4", "vector": [14, 2, 0.892, 0.0023, 2, 0.5, 0.5, 322, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "similarCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " similarCount = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L389_C8", "label": "similar =", "type": "assigned_variable", "loc": [389, 389], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:For_L385_C4", "vector": [14, 2, 0.8943, 0.0023, 2, 0.5, 0.75, 367, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "similar", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " similar = similar[:similarCount] # N most similar tags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L390_C8", "label": "similar =", "type": "assigned_variable", "loc": [390, 390], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:For_L385_C4", "vector": [14, 2, 0.8966, 0.0023, 2, 0.5, 1.0, 367, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "similar", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " similar = [tag for tag, unused in similar]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L394_C4", "label": "similarTags = set()", "type": "assigned_variable", "loc": [394, 394], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "vector": [14, 1, 0.9057, 0.0023, 1, 0.33, 0.3, 490, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "similarTags", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " similarTags = set(similarTags) # remove duplicates"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L396_C4", "label": "newFilterTags = join()", "type": "assigned_variable", "loc": [396, 396], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "vector": [14, 1, 0.9103, 0.0023, 1, 0.33, 0.4, 970, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "newFilterTags", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " newFilterTags = \",\".join([\"#\" + tag for tag in similarTags]) # convert to comma seperated string with leading # for each tag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L397_C4", "label": "print()", "type": "expression", "loc": [397, 397], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "vector": [8, 1, 0.9126, 0.0023, 1, 0.33, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Current tags: %s\" % streamingHashtag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L398_C4", "label": "print()", "type": "expression", "loc": [398, 398], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "vector": [8, 1, 0.9149, 0.0023, 1, 0.33, 0.6, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"New tags: %s\" % newFilterTags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L401_C4", "label": "disconnect()", "type": "expression", "loc": [401, 401], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "vector": [8, 1, 0.9218, 0.0023, 1, 0.33, 0.7, 978, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "disconnect", "arg_names": [], "import_names": [], "rhs_call_name": "disconnect", "annotation": ""}, "snippet": " stream.disconnect()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L404_C4", "label": "stopTweetCount =", "type": "assigned_variable", "loc": [404, 404], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "vector": [14, 1, 0.9287, 0.0023, 1, 0.33, 0.8, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "stopTweetCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " stopTweetCount = stream.stopTweetCount - stream.receivedTweetsCount"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L405_C4", "label": "stopTime =", "type": "assigned_variable", "loc": [405, 405], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "vector": [14, 1, 0.931, 0.0023, 1, 0.33, 0.9, 386, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "stopTime", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " stopTime = stream.stopTime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L408_C4", "label": "startStreaming()", "type": "expression", "loc": [408, 408], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "vector": [8, 1, 0.9379, 0.0023, 1, 0.33, 1.0, 623, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "startStreaming", "arg_names": [], "import_names": [], "rhs_call_name": "startStreaming", "annotation": ""}, "snippet": " startStreaming(newFilterTags, stopTweetCount, stopTime)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L410_C0", "label": "startStreaming", "type": "function", "loc": [410, 420], "level": 0, "parent": null, "vector": [2, 0, 0.954, 0.0253, 0, 0.66, 0.9143, 623, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "startStreaming", "arg_names": ["filterHashtag", "stopTweetCount", "stopTime"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def startStreaming(filterHashtag=\"twitter\", stopTweetCount=0, stopTime=0):\n global streamingHashtag\n streamingHashtag = filterHashtag\n \n global stream\n \n # start streaming\n t = threading.Thread(target=readStream, args=(filterHashtag, stopTweetCount, stopTime, stream))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L412_C4", "label": "streamingHashtag =", "type": "assigned_variable", "loc": [412, 412], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L410_C0", "vector": [14, 1, 0.9471, 0.0023, 1, 0.66, 0.0, 461, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "streamingHashtag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " streamingHashtag = filterHashtag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L417_C4", "label": "t = Thread()", "type": "assigned_variable", "loc": [417, 417], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L410_C0", "vector": [14, 1, 0.9586, 0.0023, 1, 0.66, 0.25, 15, 3, 2, 0, 0, 134, 10, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "Thread", "annotation": ""}, "snippet": " t = threading.Thread(target=readStream, args=(filterHashtag, stopTweetCount, stopTime, stream))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L418_C4", "label": "t.daemon =", "type": "assigned_variable", "loc": [418, 418], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L410_C0", "vector": [14, 1, 0.9609, 0.0023, 1, 0.66, 0.5, 827, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "t.daemon", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t.daemon = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L419_C4", "label": "print()", "type": "expression", "loc": [419, 419], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L410_C0", "vector": [8, 1, 0.9632, 0.0023, 1, 0.66, 0.75, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"started reading stream...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L420_C4", "label": "start()", "type": "expression", "loc": [420, 420], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L410_C0", "vector": [8, 1, 0.9655, 0.0023, 1, 0.66, 1.0, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " t.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L422_C0", "label": "toggleStreaming", "type": "function", "loc": [422, 429], "level": 0, "parent": null, "vector": [2, 0, 0.9782, 0.0184, 0, 0.66, 0.9429, 446, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "toggleStreaming", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def toggleStreaming():\n global stream\n \n if not stream.connected:\n startStreaming()\n else:\n print(\"disconnecting stream...\")\n stream.disconnect()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L425_C4", "label": "if", "type": "if", "loc": [425, 429], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L422_C0", "vector": [4, 1, 0.9816, 0.0115, 1, 0.63, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not stream.connected:\n startStreaming()\n else:\n print(\"disconnecting stream...\")\n stream.disconnect()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L426_C8", "label": "startStreaming()", "type": "expression", "loc": [426, 426], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L425_C4", "vector": [8, 2, 0.9793, 0.0023, 2, 0.15, 0.0, 623, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "startStreaming", "arg_names": [], "import_names": [], "rhs_call_name": "startStreaming", "annotation": ""}, "snippet": " startStreaming()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L428_C8", "label": "print()", "type": "expression", "loc": [428, 428], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L425_C4", "vector": [8, 2, 0.9839, 0.0023, 2, 0.15, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"disconnecting stream...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L429_C8", "label": "disconnect()", "type": "expression", "loc": [429, 429], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L425_C4", "vector": [8, 2, 0.9862, 0.0023, 2, 0.15, 1.0, 978, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "disconnect", "arg_names": [], "import_names": [], "rhs_call_name": "disconnect", "annotation": ""}, "snippet": " stream.disconnect()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L432_C0", "label": "stream = TwitterStreaming()", "type": "assigned_variable", "loc": [432, 432], "level": 0, "parent": null, "vector": [14, 0, 0.9931, 0.0023, 0, 0.66, 0.9714, 517, 3, 5, 0, 0, 683, 10, 1], "semantic": {"name": "stream", "arg_names": [], "import_names": [], "rhs_call_name": "TwitterStreaming", "annotation": ""}, "snippet": "stream = TwitterStreaming(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET, timeout=streamTimeout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L434_C0", "label": "if", "type": "if", "loc": [434, 435], "level": 0, "parent": null, "vector": [4, 0, 0.9989, 0.0046, 0, 0.66, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if isStreamMonitorEnabled:\n launchStreamMonitor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L435_C4", "label": "launchStreamMonitor()", "type": "expression", "loc": [435, 435], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L434_C0", "vector": [8, 1, 1.0, 0.0023, 1, 0.8, 0.0, 362, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "launchStreamMonitor", "arg_names": [], "import_names": [], "rhs_call_name": "launchStreamMonitor", "annotation": ""}, "snippet": " launchStreamMonitor()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:For_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:For_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L88_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:For_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L89_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L89_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L90_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:While_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:While_L93_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L94_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:While_L93_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L95_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L95_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L96_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L106_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L108_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L113_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L114_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L114_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L115_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L114_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L117_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L114_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L118_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L114_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L119_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L114_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L120_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L123_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L124_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L127_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L128_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L128_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L129_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L131_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L132_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L133_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L137_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L137_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L138_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L137_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L139_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L140_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L140_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L141_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L140_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L142_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L147_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L148_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L149_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L149_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L150_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L151_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L151_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L152_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L151_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L153_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L154_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L155_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L160_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:While_L162_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:While_L162_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L164_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L165_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L168_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L169_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L169_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L170_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L172_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L173_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L174_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L178_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L179_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L180_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L180_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L181_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L182_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L182_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L183_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L182_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L184_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L185_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L163_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L186_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L160_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L190_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L191_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L196_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L201_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L203_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L203_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L204_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L203_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L205_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L203_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L208_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L203_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L209_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L203_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L211_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L203_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L212_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L203_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L213_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L215_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L217_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L219_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L220_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L221_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L222_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L223_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L225_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L227_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L228_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L227_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L230_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L230_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L231_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L230_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L232_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L230_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L233_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L230_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L234_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L230_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L236_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L230_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L237_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L227_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L239_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L239_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L239_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L241_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L239_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L243_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L227_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L245_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L246_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L247_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L248_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L252_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L245_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L253_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L227_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L255_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L255_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L256_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L256_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L257_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L256_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L258_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L258_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L259_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L258_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Return_L260_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L258_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L262_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L255_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L268_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L269_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L270_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L271_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L272_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L273_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L274_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L275_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L276_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L277_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L279_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L279_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L280_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L280_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L281_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L280_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L283_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L286_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L287_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L288_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L288_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L289_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L291_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L292_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L292_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L293_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L292_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L294_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L292_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L295_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L300_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L301_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L302_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L303_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L304_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L306_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L307_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L314_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L314_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L315_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L317_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L320_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L323_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:ClassDef_L227_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L326_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L327_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L334_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L335_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L334_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L337_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L337_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L338_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L337_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L339_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L337_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L341_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L337_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L342_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L337_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L343_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L337_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L345_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L347_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L349_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L347_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L350_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L347_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L351_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L347_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L352_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L354_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:While_L358_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:While_L358_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L359_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L359_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L360_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L360_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L361_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L360_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L362_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L360_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L363_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L360_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L365_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L360_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L367_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L367_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L368_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L367_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L369_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L367_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L370_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L360_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L373_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L359_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L375_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:Try_L359_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L376_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:While_L358_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L380_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L383_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L384_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:For_L385_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:For_L385_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L386_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:For_L385_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L387_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:For_L385_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L388_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:For_L385_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L389_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:For_L385_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L390_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L394_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L396_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L397_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L398_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L401_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L404_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L405_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L382_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L408_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L410_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L412_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L410_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L417_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L410_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Assign_L418_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L410_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L419_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L410_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L420_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:FunctionDef_L422_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L425_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L425_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L426_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L425_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L428_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L425_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L429_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1077:If_L434_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1077:Expr_L435_C4"}]
# Create your views here. import math import networkx as nx from django.shortcuts import render_to_response, redirect from django.template import RequestContext from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.db import connection from ITInfluence.models import Tweet, User from ITInfluence.models import InfrarougeUser, InfrarougeForum, InfrarougeForumThread, InfrarougeThreadMessage from ITInfluence import twitter, followers, NDI from ITInfluence.plot import GraphPlotter, TwoDimensionalValuesPlotter from ITInfluence.hashtags import getAllHashtags, getSimilarHashtags from ITInfluence.infrarouge import InfrarougeGraphBuilder from ITInfluence.TwitterGraphBuilder import TwitterGraphBuilder, TwitterFollowersGraphBuilder from Tools.Timer import timer from SentiStrength import sentistrength from InfrarougeTwitterInfluence.settings import DATABASES '''VIEWS''' def index(request): return redirect("/infrarouge/") def twitterStats(request): NDIPath = "/twitter/images/ndi/" NDITimePath = "/twitter/images/ndi-time/" NDIRepliesCountPath = "/twitter/images/ndi-replies-count/" repliesGraphVisualizationPath = "/twitter/images/replies-graph/" followersGraphVisualizationPath = "/twitter/images/followers-graph/" tweetCount = Tweet.objects.count() ### Use one of the two methods (slow but exact count or fast estimation) ## METHOD 1 # Uncomment for exact count (WARNING: slow for large tables) # userCount = User.objects.count() # friendshipCount = Friendship.objects.count() ## METHOD 2 # Uncomment for fast count using approximation databaseName = DATABASES["default"]["NAME"] userTableName = "ITInfluence_user" friendshipTableName = "ITInfluence_friendship" query = """ SELECT table_name, table_rows FROM information_schema.tables WHERE table_schema = %s """ cursor = connection.cursor() cursor.execute(query, [databaseName]) response = cursor.fetchall() userCount = 0 friendshipCount = 0 for row in response: if row[0].lower() == userTableName.lower(): userCount = row[1] if row[0].lower() == friendshipTableName.lower(): friendshipCount = row[1] cursor.close() ### END context = { "tweetCount": tweetCount, "userCount": userCount, "friendshipCount": friendshipCount, 'NDIPath': NDIPath, 'NDITimePath': NDITimePath, 'NDIRepliesCountPath': NDIRepliesCountPath, "repliesGraphVisualizationPath": repliesGraphVisualizationPath, "followersGraphVisualizationPath": followersGraphVisualizationPath, } return render_to_response("ITInfluence/twitter.html", context, context_instance=RequestContext(request)) def twitterBrowseHashtags(request): hashtags = getAllHashtags() minimumOccurences = 10 hashtags = [(tag, occurences, fontSize(occurences)) for (tag, occurences) in hashtags if occurences >= minimumOccurences] context = { "hashtags": hashtags, "minimumOccurences": minimumOccurences, } return render_to_response("ITInfluence/twitter-browse-hashtags.html", context, context_instance=RequestContext(request)) def twitterHashtag(request, hashtag=""): similarHashtags = getSimilarHashtags(hashtag) similarHashtags = [(tag, occurences, fontSize(occurences)) for (tag, occurences) in similarHashtags] context = { "hashtag": hashtag, "similarHashtags": similarHashtags, } return render_to_response("ITInfluence/hashtag.html", context, context_instance=RequestContext(request)) def twitterBrowseTweets(request): classifyTweets() # using sentistrength try: tweetsPerPage = int(request.GET.get("tpp")) if tweetsPerPage <= 0: raise Exception("Tweets per page can't be negative") except: tweetsPerPage = 20 tweets = Tweet.objects.all().order_by("-created_at") paginator = Paginator(tweets, tweetsPerPage) tweetCount = Tweet.objects.count() page = request.GET.get("page") try: tweets = paginator.page(page) except PageNotAnInteger: tweets = paginator.page(1) except EmptyPage: tweets = paginator.page(paginator.num_pages) context = { "tweets": tweets, "tweetCount": tweetCount, "tweetsPerPage": tweetsPerPage, } return render_to_response("ITInfluence/twitter-browse-tweets.html", context, context_instance=RequestContext(request)) def twitterFollowersCountRanking(request): users = User.objects.all().filter(user_ready=1).order_by("-followers_count") rankingLength = 30 # top n users users = users[:rankingLength] context = { "users": users, } return render_to_response("ITInfluence/twitter-followers-ranking.html", context, context_instance=RequestContext(request)) def twitterStartCollectingStream(request, hashtag): context = { } return render_to_response("ITInfluence/twitter-collect-stream.html", context, context_instance=RequestContext(request)) def twitterShowCollectForm(request): totalTimeToCollectFolowers = followers.getTotalTimeToCollectFollowers() remainingTimeToCollectFolowers = followers.getRemainingTimeToCollectFollowers() twoDecimalFormat = "{0:.2f}" followersTimeDays = twoDecimalFormat.format(totalTimeToCollectFolowers[0]) followersTimeHours = twoDecimalFormat.format(totalTimeToCollectFolowers[1]) followersTimeMinutes = twoDecimalFormat.format(totalTimeToCollectFolowers[2]) followersRemainingTimeDays = twoDecimalFormat.format(remainingTimeToCollectFolowers[0]) followersRemainingTimeHours = twoDecimalFormat.format(remainingTimeToCollectFolowers[1]) followersRemainingTimeMinutes = twoDecimalFormat.format(remainingTimeToCollectFolowers[2]) try: followersProgressPercentage = 100 - 100 * (remainingTimeToCollectFolowers[2] / totalTimeToCollectFolowers[2]) except: followersProgressPercentage = 100 followersProgressPercentage = twoDecimalFormat.format(followersProgressPercentage) context = { "isCollectingFollowers": followers.rest.isCollectingFollowers, "followersTimeDays": followersTimeDays, "followersTimeHours": followersTimeHours, "followersTimeMinutes": followersTimeMinutes, "followersRemainingTimeDays": followersRemainingTimeDays, "followersRemainingTimeHours": followersRemainingTimeHours, "followersRemainingTimeMinutes": followersRemainingTimeMinutes, "followersProgressPercentage": followersProgressPercentage, } try: hashtagSeparator = "," # add a leading # to all tags seperated by commas hashtags = ["#" + tag.strip() for tag in request.POST["hashtag"].split(hashtagSeparator)] filterTag = hashtagSeparator.join(hashtags) stopTweetCount = int(request.POST["stopTweetCount"]) stopTime = int(request.POST["stopTime"]) # start collecting tweets twitter.startStreaming(filterHashtag=filterTag, stopTweetCount=stopTweetCount, stopTime=stopTime) except: pass context["isStreaming"] = twitter.stream.connected context["streamingHashtag"] = twitter.streamingHashtag return render_to_response("ITInfluence/twitter-collect-form.html", context, context_instance=RequestContext(request)) def twitterToggleCollectingFollowers(request): followers.toggleFollowersCollection() return redirect("/twitter/collect/") def infrarougeStats(request): userCount = InfrarougeUser.objects.count() forumCount = InfrarougeForum.objects.count() forumThreadCount = InfrarougeForumThread.objects.count() threadMessageCount = InfrarougeThreadMessage.objects.count() NDIPath = "/infrarouge/images/ndi/" NDITimePath = "/infrarouge/images/ndi-time/" NDIRepliesCountPath = "/infrarouge/images/ndi-replies-count/" repliesGraphVisualizationPath = "/infrarouge/images/replies-graph/" userDiscussionsGraphVisualizationPath = "/infrarouge/images/user-discussion-graph/" context = { 'forumCount': forumCount, 'forumThreadCount': forumThreadCount, 'threadMessageCount': threadMessageCount, 'userCount': userCount, 'NDIPath': NDIPath, 'NDITimePath': NDITimePath, 'NDIRepliesCountPath': NDIRepliesCountPath, 'repliesGraphVisualizationPath': repliesGraphVisualizationPath, 'userDiscussionsGraphVisualizationPath': userDiscussionsGraphVisualizationPath, } return render_to_response("ITInfluence/infrarouge.html", context, context_instance=RequestContext(request)) def getInfrarougeForums(request): forums = InfrarougeForum.objects.all() context = { "forums": forums, } return render_to_response("ITInfluence/infrarouge-forums.html", context, context_instance=RequestContext(request)) def twitterStopStreaming(request): twitter.toggleStreaming() return redirect("/twitter/collect/") '''Image views''' def showImage(request, path): '''Wrapper view that displays the image at given path on a html page''' context ={ "path": path, } return render_to_response("ITInfluence/show-image.html", context, context_instance=RequestContext(request)) # These views do NOT return HTML. They return PNG images. def getInfrarougeNDI(request): with timer(): resultsEqualTime, resultsEqualRepliesCount = NDI.polarizationForAllForums() plotter = TwoDimensionalValuesPlotter() xlabel = "Interval" ylabel = "NDI" response = plotter.memoryPlotMultipleDatasetsMultidimensional([resultsEqualTime, resultsEqualRepliesCount], xlabel, ylabel) return response def getInfrarougeNDITimeFigure(request): with timer(): resultsEqualTime, unused = NDI.polarizationForAllForums(equalRepliesCount=False) plotter = TwoDimensionalValuesPlotter() xlabel = "Interval (equal time)" ylabel = "NDI" response = plotter.memoryPlotMultipleDatasets(resultsEqualTime, xlabel, ylabel) return response def getInfrarougeNDIReplyCountFigure(request): with timer(): unused, resultsEqualRepliesCount = NDI.polarizationForAllForums(equalTime=False) plotter = TwoDimensionalValuesPlotter() xlabel = "Interval (equal reply count)" ylabel = "NDI" response = plotter.memoryPlotMultipleDatasets(resultsEqualRepliesCount, xlabel, ylabel) return response def getInfrarougeRepliesGraph(request): with timer(): infrarougeGraphBuilder = InfrarougeGraphBuilder(NDI.infrarougeDatabasePath) graphPlotter = GraphPlotter() graph = infrarougeGraphBuilder.graph1 nodeLabel="User" edgeLabel="Reply" response = graphPlotter.memoryPlot(graph, nodeLabel=nodeLabel, edgeLabel=edgeLabel) return response def getInfrarougeUserDiscussionGraph(request): with timer(): infrarougeGraphBuilder = InfrarougeGraphBuilder(NDI.infrarougeDatabasePath) graphPlotter = GraphPlotter() graph = infrarougeGraphBuilder.graph2 # compute bipartite positions for nodes pos = graphPlotter.bipartiteNodePositions(graph) nodeLabel="User" nodeLabel2="Discussion" edgeLabel="Participation" response = graphPlotter.memoryPlot(graph, bipartite=True, pos=pos, nodeLabel=nodeLabel, nodeLabel2=nodeLabel2, edgeLabel=edgeLabel) return response def getTwitterNDI(request): with timer(): # measure execution time resultsEqualTime, resultsEqualRepliesCount = NDI.getNDIForMostFrequentHashtags() plotter = TwoDimensionalValuesPlotter() xlabel = "Interval" ylabel = "NDI" response = plotter.memoryPlotMultipleDatasetsMultidimensional([resultsEqualTime, resultsEqualRepliesCount], xlabel, ylabel) return response def getTwitterNDISingleHashtag(request, hashtag): with timer(): resultsEqualTime, resultsEqualRepliesCount = NDI.getNDIForHashtag(hashtag) plotter = TwoDimensionalValuesPlotter(width=800, height=600) xlabel = "Interval" ylabel = "NDI" response = plotter.memoryPlotMultipleDatasetsMultidimensional([resultsEqualTime, resultsEqualRepliesCount], xlabel, ylabel) return response def getTwitterNDITimeFigure(request): with timer(): resultsEqualTime, unused = NDI.getNDIForMostFrequentHashtags(equalRepliesCount=False) plotter = TwoDimensionalValuesPlotter() xlabel = "Interval (equal time)" ylabel = "NDI" response = plotter.memoryPlotMultipleDatasets(resultsEqualTime, xlabel, ylabel) return response def getTwitterNDIReplyCountFigure(request): with timer(): unused, resultsEqualRepliesCount = NDI.getNDIForMostFrequentHashtags(equalTime=False) plotter = TwoDimensionalValuesPlotter() xlabel = "Interval (equal time)" ylabel = "NDI" response = plotter.memoryPlotMultipleDatasets(resultsEqualRepliesCount, xlabel, ylabel) return response def getTwitterRepliesGraph(request): with timer(): twitterGraphBuilder = TwitterGraphBuilder() graph = twitterGraphBuilder.graph # save graph to gml file # filename = "replies_graph.gml" # saveGraph(graph, filename) graphPlotter = GraphPlotter() print("Plotting graph...") response = graphPlotter.memoryPlot(graph) print("...done!") return response def getTwitterFollowersGraph(request): with timer(): twitterGraphBuilder = TwitterFollowersGraphBuilder() graph = twitterGraphBuilder.graph # save graph to gml file # filename = "followers_graph.gml" # saveGraph(graph, filename) graphPlotter = GraphPlotter() nodeLabel="User" edgeLabel="Friendship" print("Plotting graph...") response = graphPlotter.memoryPlot(graph, nodeSizes=twitterGraphBuilder.nodeSizes, nodeColor=twitterGraphBuilder.nodeSizes, nodeLabel=nodeLabel, edgeLabel=edgeLabel) print("...done!") return response '''HELPER FUNCTIONS''' def saveGraph(graph, filename): nx.gml.write_gml(graph, filename) def fontSize(occurences): return 1 + math.log(occurences) def classifyTweets(): # only classify tweets that are not classified yet tweets = Tweet.objects.all().filter(polarity_ready=False) if len(tweets) > 0: s = sentistrength.SentiStrength() # concatenate all texts to annotate at once text = "" for tweet in tweets: text += tweet.text.replace("\n", " ") + "\n" polarities = s.classifiy(text) # update tweets with their polarity for tweet, polarity in zip(tweets, polarities): tweet.polarity = polarity tweet.polarity_ready = True tweet.save()
ajibawa-2023/Python-Code-Large/train/row_1078
232
412
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Import_L2_C0", "label": "math import math", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0049, 0.0024, 0, 0.66, 0.0, 526, 0, 1, 0, 0, 526, 0, 0], "semantic": {"name": "math", "arg_names": [], "import_names": ["math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Import_L3_C0", "label": "networkx import nx", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0073, 0.0024, 0, 0.66, 0.0222, 691, 0, 1, 0, 0, 691, 0, 0], "semantic": {"name": "networkx", "arg_names": [], "import_names": ["nx"], "rhs_call_name": "", "annotation": ""}, "snippet": "import networkx as nx"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:ImportFrom_L5_C0", "label": "from django.shortcuts import render_to_response, redirect", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0121, 0.0024, 0, 0.66, 0.0444, 852, 0, 2, 0, 0, 852, 0, 0], "semantic": {"name": "django.shortcuts", "arg_names": [], "import_names": ["render_to_response", "redirect"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.shortcuts import render_to_response, redirect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:ImportFrom_L6_C0", "label": "from django.template import RequestContext", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0146, 0.0024, 0, 0.66, 0.0667, 213, 0, 1, 0, 0, 213, 0, 0], "semantic": {"name": "django.template", "arg_names": [], "import_names": ["RequestContext"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.template import RequestContext"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:ImportFrom_L7_C0", "label": "from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.017, 0.0024, 0, 0.66, 0.0889, 831, 0, 3, 0, 0, 831, 0, 0], "semantic": {"name": "django.core.paginator", "arg_names": [], "import_names": ["Paginator", "EmptyPage", "PageNotAnInteger"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:ImportFrom_L8_C0", "label": "from django.db import connection", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0194, 0.0024, 0, 0.66, 0.1111, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["connection"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.db import connection"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:ImportFrom_L10_C0", "label": "from ITInfluence.models import Tweet, User", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0243, 0.0024, 0, 0.66, 0.1333, 316, 0, 2, 0, 0, 316, 0, 0], "semantic": {"name": "ITInfluence.models", "arg_names": [], "import_names": ["Tweet", "User"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ITInfluence.models import Tweet, User"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:ImportFrom_L11_C0", "label": "from ITInfluence.models import InfrarougeUser, InfrarougeForum, InfrarougeForumThread\u2026", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0267, 0.0024, 0, 0.66, 0.1556, 316, 0, 4, 0, 0, 316, 0, 0], "semantic": {"name": "ITInfluence.models", "arg_names": [], "import_names": ["InfrarougeUser", "InfrarougeForum", "InfrarougeForumThread", "InfrarougeThreadMessage"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ITInfluence.models import InfrarougeUser, InfrarougeForum, InfrarougeForumThread, InfrarougeThreadMessage"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:ImportFrom_L13_C0", "label": "from ITInfluence import twitter, followers, NDI", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0316, 0.0024, 0, 0.66, 0.1778, 607, 0, 3, 0, 0, 607, 0, 0], "semantic": {"name": "ITInfluence", "arg_names": [], "import_names": ["twitter", "followers", "NDI"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ITInfluence import twitter, followers, NDI"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:ImportFrom_L14_C0", "label": "from ITInfluence.plot import GraphPlotter, TwoDimensionalValuesPlotter", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.034, 0.0024, 0, 0.66, 0.2, 139, 0, 2, 0, 0, 139, 0, 0], "semantic": {"name": "ITInfluence.plot", "arg_names": [], "import_names": ["GraphPlotter", "TwoDimensionalValuesPlotter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ITInfluence.plot import GraphPlotter, TwoDimensionalValuesPlotter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:ImportFrom_L15_C0", "label": "from ITInfluence.hashtags import getAllHashtags, getSimilarHashtags", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0364, 0.0024, 0, 0.66, 0.2222, 154, 0, 2, 0, 0, 154, 0, 0], "semantic": {"name": "ITInfluence.hashtags", "arg_names": [], "import_names": ["getAllHashtags", "getSimilarHashtags"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ITInfluence.hashtags import getAllHashtags, getSimilarHashtags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:ImportFrom_L16_C0", "label": "from ITInfluence.infrarouge import InfrarougeGraphBuilder", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0388, 0.0024, 0, 0.66, 0.2444, 532, 0, 1, 0, 0, 532, 0, 0], "semantic": {"name": "ITInfluence.infrarouge", "arg_names": [], "import_names": ["InfrarougeGraphBuilder"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ITInfluence.infrarouge import InfrarougeGraphBuilder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:ImportFrom_L17_C0", "label": "from ITInfluence.TwitterGraphBuilder import TwitterGraphBuilder, TwitterFollowersGraphBuilder", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0413, 0.0024, 0, 0.66, 0.2667, 481, 0, 2, 0, 0, 481, 0, 0], "semantic": {"name": "ITInfluence.TwitterGraphBuilder", "arg_names": [], "import_names": ["TwitterGraphBuilder", "TwitterFollowersGraphBuilder"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ITInfluence.TwitterGraphBuilder import TwitterGraphBuilder, TwitterFollowersGraphBuilder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:ImportFrom_L19_C0", "label": "from Tools.Timer import timer", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0461, 0.0024, 0, 0.66, 0.2889, 642, 0, 1, 0, 0, 642, 0, 0], "semantic": {"name": "Tools.Timer", "arg_names": [], "import_names": ["timer"], "rhs_call_name": "", "annotation": ""}, "snippet": "from Tools.Timer import timer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:ImportFrom_L21_C0", "label": "from SentiStrength import sentistrength", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.051, 0.0024, 0, 0.66, 0.3111, 895, 0, 1, 0, 0, 895, 0, 0], "semantic": {"name": "SentiStrength", "arg_names": [], "import_names": ["sentistrength"], "rhs_call_name": "", "annotation": ""}, "snippet": "from SentiStrength import sentistrength"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:ImportFrom_L22_C0", "label": "from InfrarougeTwitterInfluence.settings import DATABASES", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.0534, 0.0024, 0, 0.66, 0.3333, 610, 0, 1, 0, 0, 610, 0, 0], "semantic": {"name": "InfrarougeTwitterInfluence.settings", "arg_names": [], "import_names": ["DATABASES"], "rhs_call_name": "", "annotation": ""}, "snippet": "from InfrarougeTwitterInfluence.settings import DATABASES"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L25_C0", "label": "expression", "type": "expression", "loc": [25, 25], "level": 0, "parent": null, "vector": [8, 0, 0.0607, 0.0024, 0, 0.66, 0.3556, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''VIEWS'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L26_C0", "label": "index", "type": "function", "loc": [26, 27], "level": 0, "parent": null, "vector": [2, 0, 0.0643, 0.0049, 0, 0.66, 0.3778, 780, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "index", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def index(request):\n return redirect(\"/infrarouge/\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L27_C4", "label": "return", "type": "return", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L26_C0", "vector": [13, 1, 0.0655, 0.0024, 1, 0.83, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return redirect(\"/infrarouge/\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "label": "twitterStats", "type": "function", "loc": [29, 81], "level": 0, "parent": null, "vector": [2, 0, 0.1335, 0.1286, 0, 0.66, 0.4, 984, 0, 1, 1, 0, 0, 0, 11], "semantic": {"name": "twitterStats", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def twitterStats(request):\n NDIPath = \"/twitter/images/ndi/\"\n NDITimePath = \"/twitter/images/ndi-time/\"\n NDIRepliesCountPath = \"/twitter/images/ndi-replies-count/\"\n repliesGraphVisualizationPath = \"/twitter/images/replies-graph/\"\n followersGraphVisualizationPath = \"/twitter/images/followers-graph/\"\n \n tweetCount = Tweet.objects.count()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L30_C4", "label": "NDIPath =", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "vector": [14, 1, 0.0728, 0.0024, 1, 0.77, 0.0, 688, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "NDIPath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " NDIPath = \"/twitter/images/ndi/\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L31_C4", "label": "NDITimePath =", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "vector": [14, 1, 0.0752, 0.0024, 1, 0.77, 0.0556, 839, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "NDITimePath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " NDITimePath = \"/twitter/images/ndi-time/\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L32_C4", "label": "NDIRepliesCountPath =", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "vector": [14, 1, 0.0777, 0.0024, 1, 0.77, 0.1111, 46, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "NDIRepliesCountPath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " NDIRepliesCountPath = \"/twitter/images/ndi-replies-count/\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L33_C4", "label": "repliesGraphVisualizationPath =", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "vector": [14, 1, 0.0801, 0.0024, 1, 0.77, 0.1667, 698, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "repliesGraphVisualizationPath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " repliesGraphVisualizationPath = \"/twitter/images/replies-graph/\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L34_C4", "label": "followersGraphVisualizationPath =", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "vector": [14, 1, 0.0825, 0.0024, 1, 0.77, 0.2222, 316, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "followersGraphVisualizationPath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " followersGraphVisualizationPath = \"/twitter/images/followers-graph/\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L36_C4", "label": "tweetCount = count()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "vector": [14, 1, 0.0874, 0.0024, 1, 0.77, 0.2778, 318, 3, 0, 0, 0, 778, 10, 1], "semantic": {"name": "tweetCount", "arg_names": [], "import_names": [], "rhs_call_name": "count", "annotation": ""}, "snippet": " tweetCount = Tweet.objects.count()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L46_C4", "label": "databaseName =", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "vector": [14, 1, 0.1117, 0.0024, 1, 0.77, 0.3333, 509, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "databaseName", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " databaseName = DATABASES[\"default\"][\"NAME\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L47_C4", "label": "userTableName =", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "vector": [14, 1, 0.1141, 0.0024, 1, 0.77, 0.3889, 491, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "userTableName", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userTableName = \"ITInfluence_user\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L48_C4", "label": "friendshipTableName =", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "vector": [14, 1, 0.1165, 0.0024, 1, 0.77, 0.4444, 312, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "friendshipTableName", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " friendshipTableName = \"ITInfluence_friendship\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L49_C4", "label": "query =", "type": "assigned_variable", "loc": [49, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "vector": [14, 1, 0.1238, 0.0121, 1, 0.77, 0.5, 546, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query = \"\"\"\nSELECT table_name, table_rows\nFROM information_schema.tables\nWHERE table_schema = %s\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L55_C4", "label": "cursor = cursor()", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "vector": [14, 1, 0.1335, 0.0024, 1, 0.77, 0.5556, 231, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cursor", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cursor = connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L56_C4", "label": "execute()", "type": "expression", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "vector": [8, 1, 0.1359, 0.0024, 1, 0.77, 0.6111, 569, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cursor.execute(query, [databaseName])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L57_C4", "label": "response = fetchall()", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "vector": [14, 1, 0.1383, 0.0024, 1, 0.77, 0.6667, 511, 3, 0, 0, 0, 133, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "fetchall", "annotation": ""}, "snippet": " response = cursor.fetchall()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L59_C4", "label": "userCount =", "type": "assigned_variable", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "vector": [14, 1, 0.1432, 0.0024, 1, 0.77, 0.7222, 177, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "userCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userCount = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L60_C4", "label": "friendshipCount =", "type": "assigned_variable", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "vector": [14, 1, 0.1456, 0.0024, 1, 0.77, 0.7778, 286, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "friendshipCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " friendshipCount = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:For_L62_C4", "label": "for row", "type": "for", "loc": [62, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "vector": [6, 1, 0.1553, 0.0121, 1, 0.77, 0.8333, 767, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for row in response:\n if row[0].lower() == userTableName.lower():\n userCount = row[1]\n if row[0].lower() == friendshipTableName.lower():\n friendshipCount = row[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:If_L63_C8", "label": "if", "type": "if", "loc": [63, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:For_L62_C4", "vector": [4, 2, 0.1541, 0.0049, 2, 0.89, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if row[0].lower() == userTableName.lower():\n userCount = row[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L64_C12", "label": "userCount =", "type": "assigned_variable", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:If_L63_C8", "vector": [14, 3, 0.1553, 0.0024, 3, 0.5, 0.0, 177, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "userCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userCount = row[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:If_L65_C8", "label": "if", "type": "if", "loc": [65, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:For_L62_C4", "vector": [4, 2, 0.159, 0.0049, 2, 0.89, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if row[0].lower() == friendshipTableName.lower():\n friendshipCount = row[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L66_C12", "label": "friendshipCount =", "type": "assigned_variable", "loc": [66, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:If_L65_C8", "vector": [14, 3, 0.1602, 0.0024, 3, 0.77, 0.0, 286, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "friendshipCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " friendshipCount = row[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L68_C4", "label": "close()", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "vector": [8, 1, 0.165, 0.0024, 1, 0.77, 0.8889, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cursor.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L71_C4", "label": "context =", "type": "assigned_variable", "loc": [71, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "vector": [14, 1, 0.1833, 0.0243, 1, 0.77, 0.9444, 954, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " context = {\n \"tweetCount\": tweetCount,\n \"userCount\": userCount,\n \"friendshipCount\": friendshipCount,\n 'NDIPath': NDIPath,\n 'NDITimePath': NDITimePath,\n 'NDIRepliesCountPath': NDIRepliesCountPath,\n \"repliesGraphVisualizationPath\": repliesGraphVisualizationPath,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L81_C4", "label": "return", "type": "return", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "vector": [13, 1, 0.1966, 0.0024, 1, 0.77, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render_to_response(\"ITInfluence/twitter.html\", context, context_instance=RequestContext(request))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L83_C0", "label": "twitterBrowseHashtags", "type": "function", "loc": [83, 92], "level": 0, "parent": null, "vector": [2, 0, 0.2124, 0.0243, 0, 0.66, 0.4222, 900, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "twitterBrowseHashtags", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def twitterBrowseHashtags(request):\n hashtags = getAllHashtags()\n minimumOccurences = 10\n hashtags = [(tag, occurences, fontSize(occurences)) for (tag, occurences) in hashtags if occurences >= minimumOccurences]\n \n context = {\n \"hashtags\": hashtags,\n \"minimumOccurences\": minimumOccurences,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L84_C4", "label": "hashtags = getAllHashtags()", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L83_C0", "vector": [14, 1, 0.2039, 0.0024, 1, 0.13, 0.0, 366, 3, 0, 0, 0, 225, 10, 1], "semantic": {"name": "hashtags", "arg_names": [], "import_names": [], "rhs_call_name": "getAllHashtags", "annotation": ""}, "snippet": " hashtags = getAllHashtags()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L85_C4", "label": "minimumOccurences =", "type": "assigned_variable", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L83_C0", "vector": [14, 1, 0.2063, 0.0024, 1, 0.13, 0.25, 462, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "minimumOccurences", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " minimumOccurences = 10"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L86_C4", "label": "hashtags =", "type": "assigned_variable", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L83_C0", "vector": [14, 1, 0.2087, 0.0024, 1, 0.13, 0.5, 366, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "hashtags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hashtags = [(tag, occurences, fontSize(occurences)) for (tag, occurences) in hashtags if occurences >= minimumOccurences]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L88_C4", "label": "context =", "type": "assigned_variable", "loc": [88, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L83_C0", "vector": [14, 1, 0.2172, 0.0097, 1, 0.13, 0.75, 954, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " context = {\n \"hashtags\": hashtags,\n \"minimumOccurences\": minimumOccurences,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L92_C4", "label": "return", "type": "return", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L83_C0", "vector": [13, 1, 0.2233, 0.0024, 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 render_to_response(\"ITInfluence/twitter-browse-hashtags.html\", context, context_instance=RequestContext(request))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L94_C0", "label": "twitterHashtag", "type": "function", "loc": [94, 102], "level": 0, "parent": null, "vector": [2, 0, 0.2379, 0.0218, 0, 0.66, 0.4444, 271, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "twitterHashtag", "arg_names": ["request", "hashtag"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def twitterHashtag(request, hashtag=\"\"):\n similarHashtags = getSimilarHashtags(hashtag)\n similarHashtags = [(tag, occurences, fontSize(occurences)) for (tag, occurences) in similarHashtags]\n \n context = {\n \"hashtag\": hashtag,\n \"similarHashtags\": similarHashtags,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L95_C4", "label": "similarHashtags = getSimilarHashtags()", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L94_C0", "vector": [14, 1, 0.2306, 0.0024, 1, 0.14, 0.0, 843, 3, 1, 0, 0, 383, 10, 1], "semantic": {"name": "similarHashtags", "arg_names": [], "import_names": [], "rhs_call_name": "getSimilarHashtags", "annotation": ""}, "snippet": " similarHashtags = getSimilarHashtags(hashtag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L96_C4", "label": "similarHashtags =", "type": "assigned_variable", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L94_C0", "vector": [14, 1, 0.233, 0.0024, 1, 0.14, 0.3333, 843, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "similarHashtags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " similarHashtags = [(tag, occurences, fontSize(occurences)) for (tag, occurences) in similarHashtags]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L98_C4", "label": "context =", "type": "assigned_variable", "loc": [98, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L94_C0", "vector": [14, 1, 0.2415, 0.0097, 1, 0.14, 0.6667, 954, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " context = {\n \"hashtag\": hashtag,\n \"similarHashtags\": similarHashtags,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L102_C4", "label": "return", "type": "return", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L94_C0", "vector": [13, 1, 0.2476, 0.0024, 1, 0.14, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render_to_response(\"ITInfluence/hashtag.html\", context, context_instance=RequestContext(request))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L104_C0", "label": "twitterBrowseTweets", "type": "function", "loc": [104, 132], "level": 0, "parent": null, "vector": [2, 0, 0.2864, 0.0704, 0, 0.66, 0.4667, 55, 0, 1, 1, 0, 0, 0, 14], "semantic": {"name": "twitterBrowseTweets", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def twitterBrowseTweets(request):\n classifyTweets() # using sentistrength\n \n try:\n tweetsPerPage = int(request.GET.get(\"tpp\"))\n if tweetsPerPage <= 0:\n raise Exception(\"Tweets per page can't be negative\")\n except:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L105_C4", "label": "classifyTweets()", "type": "expression", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L104_C0", "vector": [8, 1, 0.2549, 0.0024, 1, 0.1, 0.0, 31, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "classifyTweets", "arg_names": [], "import_names": [], "rhs_call_name": "classifyTweets", "annotation": ""}, "snippet": " classifyTweets() # using sentistrength"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L107_C4", "label": "try", "type": "try", "loc": [107, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L104_C0", "vector": [7, 1, 0.2658, 0.0146, 1, 0.1, 0.125, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n tweetsPerPage = int(request.GET.get(\"tpp\"))\n if tweetsPerPage <= 0:\n raise Exception(\"Tweets per page can't be negative\")\n except:\n tweetsPerPage = 20"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L108_C8", "label": "tweetsPerPage = int()", "type": "assigned_variable", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L107_C4", "vector": [14, 2, 0.2621, 0.0024, 2, 0.97, 0.0, 537, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "tweetsPerPage", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " tweetsPerPage = int(request.GET.get(\"tpp\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:If_L109_C8", "label": "if", "type": "if", "loc": [109, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L107_C4", "vector": [4, 2, 0.2658, 0.0049, 2, 0.97, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tweetsPerPage <= 0:\n raise Exception(\"Tweets per page can't be negative\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L112_C8", "label": "tweetsPerPage =", "type": "assigned_variable", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L107_C4", "vector": [14, 2, 0.2718, 0.0024, 2, 0.97, 0.0, 537, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "tweetsPerPage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tweetsPerPage = 20"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L114_C4", "label": "tweets = order_by()", "type": "assigned_variable", "loc": [114, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L104_C0", "vector": [14, 1, 0.2767, 0.0024, 1, 0.1, 0.25, 680, 3, 1, 0, 0, 23, 10, 2], "semantic": {"name": "tweets", "arg_names": [], "import_names": [], "rhs_call_name": "order_by", "annotation": ""}, "snippet": " tweets = Tweet.objects.all().order_by(\"-created_at\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L115_C4", "label": "paginator = Paginator()", "type": "assigned_variable", "loc": [115, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L104_C0", "vector": [14, 1, 0.2791, 0.0024, 1, 0.1, 0.375, 711, 3, 2, 0, 0, 148, 10, 1], "semantic": {"name": "paginator", "arg_names": [], "import_names": [], "rhs_call_name": "Paginator", "annotation": ""}, "snippet": " paginator = Paginator(tweets, tweetsPerPage)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L117_C4", "label": "tweetCount = count()", "type": "assigned_variable", "loc": [117, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L104_C0", "vector": [14, 1, 0.284, 0.0024, 1, 0.1, 0.5, 318, 3, 0, 0, 0, 778, 10, 1], "semantic": {"name": "tweetCount", "arg_names": [], "import_names": [], "rhs_call_name": "count", "annotation": ""}, "snippet": " tweetCount = Tweet.objects.count()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L119_C4", "label": "page = get()", "type": "assigned_variable", "loc": [119, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L104_C0", "vector": [14, 1, 0.2888, 0.0024, 1, 0.1, 0.625, 623, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "page", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " page = request.GET.get(\"page\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L120_C4", "label": "try", "type": "try", "loc": [120, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L104_C0", "vector": [7, 1, 0.2973, 0.0146, 1, 0.1, 0.75, 0, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n tweets = paginator.page(page)\n except PageNotAnInteger:\n tweets = paginator.page(1)\n except EmptyPage:\n tweets = paginator.page(paginator.num_pages)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L121_C8", "label": "tweets = page()", "type": "assigned_variable", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L120_C4", "vector": [14, 2, 0.2937, 0.0024, 2, 0.16, 0.0, 680, 3, 1, 0, 0, 623, 10, 1], "semantic": {"name": "tweets", "arg_names": [], "import_names": [], "rhs_call_name": "page", "annotation": ""}, "snippet": " tweets = paginator.page(page)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L123_C8", "label": "tweets = page()", "type": "assigned_variable", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L120_C4", "vector": [14, 2, 0.2985, 0.0024, 2, 0.16, 0.0, 680, 3, 1, 0, 0, 623, 10, 1], "semantic": {"name": "tweets", "arg_names": [], "import_names": [], "rhs_call_name": "page", "annotation": ""}, "snippet": " tweets = paginator.page(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L125_C8", "label": "tweets = page()", "type": "assigned_variable", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L120_C4", "vector": [14, 2, 0.3034, 0.0024, 2, 0.16, 0.0, 680, 3, 1, 0, 0, 623, 10, 1], "semantic": {"name": "tweets", "arg_names": [], "import_names": [], "rhs_call_name": "page", "annotation": ""}, "snippet": " tweets = paginator.page(paginator.num_pages)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L127_C4", "label": "context =", "type": "assigned_variable", "loc": [127, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L104_C0", "vector": [14, 1, 0.3131, 0.0121, 1, 0.1, 0.875, 954, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " context = {\n \"tweets\": tweets,\n \"tweetCount\": tweetCount,\n \"tweetsPerPage\": tweetsPerPage,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L132_C4", "label": "return", "type": "return", "loc": [132, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L104_C0", "vector": [13, 1, 0.3204, 0.0024, 1, 0.1, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render_to_response(\"ITInfluence/twitter-browse-tweets.html\", context, context_instance=RequestContext(request))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L134_C0", "label": "twitterFollowersCountRanking", "type": "function", "loc": [134, 144], "level": 0, "parent": null, "vector": [2, 0, 0.3374, 0.0267, 0, 0.66, 0.4889, 893, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "twitterFollowersCountRanking", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def twitterFollowersCountRanking(request):\n users = User.objects.all().filter(user_ready=1).order_by(\"-followers_count\")\n \n rankingLength = 30 # top n users\n users = users[:rankingLength]\n \n context = {\n \"users\": users,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L135_C4", "label": "users = order_by()", "type": "assigned_variable", "loc": [135, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L134_C0", "vector": [14, 1, 0.3277, 0.0024, 1, 0.1, 0.0, 395, 3, 1, 0, 0, 23, 10, 3], "semantic": {"name": "users", "arg_names": [], "import_names": [], "rhs_call_name": "order_by", "annotation": ""}, "snippet": " users = User.objects.all().filter(user_ready=1).order_by(\"-followers_count\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L137_C4", "label": "rankingLength =", "type": "assigned_variable", "loc": [137, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L134_C0", "vector": [14, 1, 0.3325, 0.0024, 1, 0.1, 0.25, 799, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "rankingLength", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rankingLength = 30 # top n users"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L138_C4", "label": "users =", "type": "assigned_variable", "loc": [138, 138], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L134_C0", "vector": [14, 1, 0.335, 0.0024, 1, 0.1, 0.5, 395, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "users", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " users = users[:rankingLength]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L140_C4", "label": "context =", "type": "assigned_variable", "loc": [140, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L134_C0", "vector": [14, 1, 0.3422, 0.0073, 1, 0.1, 0.75, 954, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " context = {\n \"users\": users,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L144_C4", "label": "return", "type": "return", "loc": [144, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L134_C0", "vector": [13, 1, 0.3495, 0.0024, 1, 0.1, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render_to_response(\"ITInfluence/twitter-followers-ranking.html\", context, context_instance=RequestContext(request))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L146_C0", "label": "twitterStartCollectingStream", "type": "function", "loc": [146, 150], "level": 0, "parent": null, "vector": [2, 0, 0.3592, 0.0121, 0, 0.66, 0.5111, 719, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "twitterStartCollectingStream", "arg_names": ["request", "hashtag"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def twitterStartCollectingStream(request, hashtag):\n context = {\n \n }\n return render_to_response(\"ITInfluence/twitter-collect-stream.html\", context, context_instance=RequestContext(request))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L147_C4", "label": "context =", "type": "assigned_variable", "loc": [147, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L146_C0", "vector": [14, 1, 0.3592, 0.0073, 1, 0.28, 0.0, 954, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " context = {\n \n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L150_C4", "label": "return", "type": "return", "loc": [150, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L146_C0", "vector": [13, 1, 0.3641, 0.0024, 1, 0.28, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render_to_response(\"ITInfluence/twitter-collect-stream.html\", context, context_instance=RequestContext(request))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "label": "twitterShowCollectForm", "type": "function", "loc": [152, 199], "level": 0, "parent": null, "vector": [2, 0, 0.426, 0.1165, 0, 0.66, 0.5333, 400, 0, 1, 1, 0, 0, 0, 17], "semantic": {"name": "twitterShowCollectForm", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def twitterShowCollectForm(request):\n totalTimeToCollectFolowers = followers.getTotalTimeToCollectFollowers()\n remainingTimeToCollectFolowers = followers.getRemainingTimeToCollectFollowers()\n \n twoDecimalFormat = \"{0:.2f}\"\n \n followersTimeDays = twoDecimalFormat.format(totalTimeToCollectFolowers[0])\n followersTimeHours = twoDecimalFormat.format(totalTimeToCollectFolowers[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L153_C4", "label": "totalTimeToCollectFolowers = getTotalTimeToCollectFollowers()", "type": "assigned_variable", "loc": [153, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "vector": [14, 1, 0.3714, 0.0024, 1, 0.23, 0.0, 229, 3, 0, 0, 0, 821, 10, 1], "semantic": {"name": "totalTimeToCollectFolowers", "arg_names": [], "import_names": [], "rhs_call_name": "getTotalTimeToCollectFollowers", "annotation": ""}, "snippet": " totalTimeToCollectFolowers = followers.getTotalTimeToCollectFollowers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L154_C4", "label": "remainingTimeToCollectFolowers = getRemainingTimeToCollectFollowers()", "type": "assigned_variable", "loc": [154, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "vector": [14, 1, 0.3738, 0.0024, 1, 0.23, 0.0667, 928, 3, 0, 0, 0, 24, 10, 1], "semantic": {"name": "remainingTimeToCollectFolowers", "arg_names": [], "import_names": [], "rhs_call_name": "getRemainingTimeToCollectFollowers", "annotation": ""}, "snippet": " remainingTimeToCollectFolowers = followers.getRemainingTimeToCollectFollowers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L156_C4", "label": "twoDecimalFormat =", "type": "assigned_variable", "loc": [156, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "vector": [14, 1, 0.3786, 0.0024, 1, 0.23, 0.1333, 199, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "twoDecimalFormat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " twoDecimalFormat = \"{0:.2f}\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L158_C4", "label": "followersTimeDays = format()", "type": "assigned_variable", "loc": [158, 158], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "vector": [14, 1, 0.3835, 0.0024, 1, 0.23, 0.2, 269, 3, 1, 0, 0, 293, 10, 1], "semantic": {"name": "followersTimeDays", "arg_names": [], "import_names": [], "rhs_call_name": "format", "annotation": ""}, "snippet": " followersTimeDays = twoDecimalFormat.format(totalTimeToCollectFolowers[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L159_C4", "label": "followersTimeHours = format()", "type": "assigned_variable", "loc": [159, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "vector": [14, 1, 0.3859, 0.0024, 1, 0.23, 0.2667, 389, 3, 1, 0, 0, 293, 10, 1], "semantic": {"name": "followersTimeHours", "arg_names": [], "import_names": [], "rhs_call_name": "format", "annotation": ""}, "snippet": " followersTimeHours = twoDecimalFormat.format(totalTimeToCollectFolowers[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L160_C4", "label": "followersTimeMinutes = format()", "type": "assigned_variable", "loc": [160, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "vector": [14, 1, 0.3883, 0.0024, 1, 0.23, 0.3333, 396, 3, 1, 0, 0, 293, 10, 1], "semantic": {"name": "followersTimeMinutes", "arg_names": [], "import_names": [], "rhs_call_name": "format", "annotation": ""}, "snippet": " followersTimeMinutes = twoDecimalFormat.format(totalTimeToCollectFolowers[2])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L161_C4", "label": "followersRemainingTimeDays = format()", "type": "assigned_variable", "loc": [161, 161], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "vector": [14, 1, 0.3908, 0.0024, 1, 0.23, 0.4, 747, 3, 1, 0, 0, 293, 10, 1], "semantic": {"name": "followersRemainingTimeDays", "arg_names": [], "import_names": [], "rhs_call_name": "format", "annotation": ""}, "snippet": " followersRemainingTimeDays = twoDecimalFormat.format(remainingTimeToCollectFolowers[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L162_C4", "label": "followersRemainingTimeHours = format()", "type": "assigned_variable", "loc": [162, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "vector": [14, 1, 0.3932, 0.0024, 1, 0.23, 0.4667, 767, 3, 1, 0, 0, 293, 10, 1], "semantic": {"name": "followersRemainingTimeHours", "arg_names": [], "import_names": [], "rhs_call_name": "format", "annotation": ""}, "snippet": " followersRemainingTimeHours = twoDecimalFormat.format(remainingTimeToCollectFolowers[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L163_C4", "label": "followersRemainingTimeMinutes = format()", "type": "assigned_variable", "loc": [163, 163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "vector": [14, 1, 0.3956, 0.0024, 1, 0.23, 0.5333, 698, 3, 1, 0, 0, 293, 10, 1], "semantic": {"name": "followersRemainingTimeMinutes", "arg_names": [], "import_names": [], "rhs_call_name": "format", "annotation": ""}, "snippet": " followersRemainingTimeMinutes = twoDecimalFormat.format(remainingTimeToCollectFolowers[2])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L165_C4", "label": "try", "type": "try", "loc": [165, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "vector": [7, 1, 0.4041, 0.0097, 1, 0.23, 0.6, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n followersProgressPercentage = 100 - 100 * (remainingTimeToCollectFolowers[2] / totalTimeToCollectFolowers[2])\n except:\n followersProgressPercentage = 100"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L166_C8", "label": "followersProgressPercentage =", "type": "assigned_variable", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L165_C4", "vector": [14, 2, 0.4029, 0.0024, 2, 0.95, 0.0, 392, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "followersProgressPercentage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " followersProgressPercentage = 100 - 100 * (remainingTimeToCollectFolowers[2] / totalTimeToCollectFolowers[2])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L168_C8", "label": "followersProgressPercentage =", "type": "assigned_variable", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L165_C4", "vector": [14, 2, 0.4078, 0.0024, 2, 0.95, 0.0, 392, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "followersProgressPercentage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " followersProgressPercentage = 100"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L169_C4", "label": "followersProgressPercentage = format()", "type": "assigned_variable", "loc": [169, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "vector": [14, 1, 0.4102, 0.0024, 1, 0.23, 0.6667, 392, 3, 1, 0, 0, 293, 10, 1], "semantic": {"name": "followersProgressPercentage", "arg_names": [], "import_names": [], "rhs_call_name": "format", "annotation": ""}, "snippet": " followersProgressPercentage = twoDecimalFormat.format(followersProgressPercentage)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L171_C4", "label": "context =", "type": "assigned_variable", "loc": [171, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "vector": [14, 1, 0.426, 0.0243, 1, 0.23, 0.7333, 954, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " context = {\n \"isCollectingFollowers\": followers.rest.isCollectingFollowers,\n \"followersTimeDays\": followersTimeDays,\n \"followersTimeHours\": followersTimeHours,\n \"followersTimeMinutes\": followersTimeMinutes,\n \"followersRemainingTimeDays\": followersRemainingTimeDays,\n \"followersRemainingTimeHours\": followersRemainingTimeHours,\n \"followersRemainingTimeMinutes\": followersRemainingTimeMinutes,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L182_C4", "label": "try", "type": "try", "loc": [182, 195], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "vector": [7, 1, 0.4575, 0.034, 1, 0.23, 0.8, 0, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n hashtagSeparator = \",\"\n # add a leading # to all tags seperated by commas\n hashtags = [\"#\" + tag.strip() for tag in request.POST[\"hashtag\"].split(hashtagSeparator)]\n\n filterTag = hashtagSeparator.join(hashtags)\n \n stopTweetCount = int(request.POST[\"stopTweetCount\"])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L183_C8", "label": "hashtagSeparator =", "type": "assigned_variable", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L182_C4", "vector": [14, 2, 0.4442, 0.0024, 2, 0.25, 0.0, 8, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "hashtagSeparator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hashtagSeparator = \",\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L185_C8", "label": "hashtags =", "type": "assigned_variable", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L182_C4", "vector": [14, 2, 0.449, 0.0024, 2, 0.25, 0.2, 366, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "hashtags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hashtags = [\"#\" + tag.strip() for tag in request.POST[\"hashtag\"].split(hashtagSeparator)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L187_C8", "label": "filterTag = join()", "type": "assigned_variable", "loc": [187, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L182_C4", "vector": [14, 2, 0.4539, 0.0024, 2, 0.25, 0.4, 896, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "filterTag", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " filterTag = hashtagSeparator.join(hashtags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L189_C8", "label": "stopTweetCount = int()", "type": "assigned_variable", "loc": [189, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L182_C4", "vector": [14, 2, 0.4587, 0.0024, 2, 0.25, 0.6, 0, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "stopTweetCount", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " stopTweetCount = int(request.POST[\"stopTweetCount\"])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L190_C8", "label": "stopTime = int()", "type": "assigned_variable", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L182_C4", "vector": [14, 2, 0.4612, 0.0024, 2, 0.25, 0.8, 386, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "stopTime", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " stopTime = int(request.POST[\"stopTime\"])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L193_C8", "label": "startStreaming()", "type": "expression", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L182_C4", "vector": [8, 2, 0.4684, 0.0024, 2, 0.25, 1.0, 623, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "startStreaming", "arg_names": [], "import_names": [], "rhs_call_name": "startStreaming", "annotation": ""}, "snippet": " twitter.startStreaming(filterHashtag=filterTag, stopTweetCount=stopTweetCount, stopTime=stopTime)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L197_C4", "label": "assign", "type": "assigned_variable", "loc": [197, 197], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "vector": [14, 1, 0.4782, 0.0024, 1, 0.23, 0.8667, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " context[\"isStreaming\"] = twitter.stream.connected"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L198_C4", "label": "assign", "type": "assigned_variable", "loc": [198, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "vector": [14, 1, 0.4806, 0.0024, 1, 0.23, 0.9333, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " context[\"streamingHashtag\"] = twitter.streamingHashtag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L199_C4", "label": "return", "type": "return", "loc": [199, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "vector": [13, 1, 0.483, 0.0024, 1, 0.23, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render_to_response(\"ITInfluence/twitter-collect-form.html\", context, context_instance=RequestContext(request))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L201_C0", "label": "twitterToggleCollectingFollowers", "type": "function", "loc": [201, 204], "level": 0, "parent": null, "vector": [2, 0, 0.4915, 0.0097, 0, 0.66, 0.5556, 575, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "twitterToggleCollectingFollowers", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def twitterToggleCollectingFollowers(request):\n followers.toggleFollowersCollection()\n \n return redirect(\"/twitter/collect/\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L202_C4", "label": "toggleFollowersCollection()", "type": "expression", "loc": [202, 202], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L201_C0", "vector": [8, 1, 0.4903, 0.0024, 1, 0.55, 0.0, 901, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "toggleFollowersCollection", "arg_names": [], "import_names": [], "rhs_call_name": "toggleFollowersCollection", "annotation": ""}, "snippet": " followers.toggleFollowersCollection()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L204_C4", "label": "return", "type": "return", "loc": [204, 204], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L201_C0", "vector": [13, 1, 0.4951, 0.0024, 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 redirect(\"/twitter/collect/\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "label": "infrarougeStats", "type": "function", "loc": [206, 230], "level": 0, "parent": null, "vector": [2, 0, 0.5291, 0.0607, 0, 0.66, 0.5778, 431, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "infrarougeStats", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def infrarougeStats(request): \n userCount = InfrarougeUser.objects.count()\n forumCount = InfrarougeForum.objects.count()\n forumThreadCount = InfrarougeForumThread.objects.count()\n threadMessageCount = InfrarougeThreadMessage.objects.count()\n \n NDIPath = \"/infrarouge/images/ndi/\"\n NDITimePath = \"/infrarouge/images/ndi-time/\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L207_C4", "label": "userCount = count()", "type": "assigned_variable", "loc": [207, 207], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "vector": [14, 1, 0.5024, 0.0024, 1, 0.07, 0.0, 177, 3, 0, 0, 0, 778, 10, 1], "semantic": {"name": "userCount", "arg_names": [], "import_names": [], "rhs_call_name": "count", "annotation": ""}, "snippet": " userCount = InfrarougeUser.objects.count()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L208_C4", "label": "forumCount = count()", "type": "assigned_variable", "loc": [208, 208], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "vector": [14, 1, 0.5049, 0.0024, 1, 0.07, 0.1, 554, 3, 0, 0, 0, 778, 10, 1], "semantic": {"name": "forumCount", "arg_names": [], "import_names": [], "rhs_call_name": "count", "annotation": ""}, "snippet": " forumCount = InfrarougeForum.objects.count()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L209_C4", "label": "forumThreadCount = count()", "type": "assigned_variable", "loc": [209, 209], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "vector": [14, 1, 0.5073, 0.0024, 1, 0.07, 0.2, 65, 3, 0, 0, 0, 778, 10, 1], "semantic": {"name": "forumThreadCount", "arg_names": [], "import_names": [], "rhs_call_name": "count", "annotation": ""}, "snippet": " forumThreadCount = InfrarougeForumThread.objects.count()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L210_C4", "label": "threadMessageCount = count()", "type": "assigned_variable", "loc": [210, 210], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "vector": [14, 1, 0.5097, 0.0024, 1, 0.07, 0.3, 483, 3, 0, 0, 0, 778, 10, 1], "semantic": {"name": "threadMessageCount", "arg_names": [], "import_names": [], "rhs_call_name": "count", "annotation": ""}, "snippet": " threadMessageCount = InfrarougeThreadMessage.objects.count()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L212_C4", "label": "NDIPath =", "type": "assigned_variable", "loc": [212, 212], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "vector": [14, 1, 0.5146, 0.0024, 1, 0.07, 0.4, 688, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "NDIPath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " NDIPath = \"/infrarouge/images/ndi/\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L213_C4", "label": "NDITimePath =", "type": "assigned_variable", "loc": [213, 213], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "vector": [14, 1, 0.517, 0.0024, 1, 0.07, 0.5, 839, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "NDITimePath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " NDITimePath = \"/infrarouge/images/ndi-time/\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L214_C4", "label": "NDIRepliesCountPath =", "type": "assigned_variable", "loc": [214, 214], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "vector": [14, 1, 0.5194, 0.0024, 1, 0.07, 0.6, 46, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "NDIRepliesCountPath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " NDIRepliesCountPath = \"/infrarouge/images/ndi-replies-count/\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L216_C4", "label": "repliesGraphVisualizationPath =", "type": "assigned_variable", "loc": [216, 216], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "vector": [14, 1, 0.5243, 0.0024, 1, 0.07, 0.7, 698, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "repliesGraphVisualizationPath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " repliesGraphVisualizationPath = \"/infrarouge/images/replies-graph/\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L217_C4", "label": "userDiscussionsGraphVisualizationPath =", "type": "assigned_variable", "loc": [217, 217], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "vector": [14, 1, 0.5267, 0.0024, 1, 0.07, 0.8, 608, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "userDiscussionsGraphVisualizationPath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userDiscussionsGraphVisualizationPath = \"/infrarouge/images/user-discussion-graph/\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L219_C4", "label": "context =", "type": "assigned_variable", "loc": [219, 229], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "vector": [14, 1, 0.5437, 0.0267, 1, 0.07, 0.9, 954, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " context = {\n 'forumCount': forumCount,\n 'forumThreadCount': forumThreadCount,\n 'threadMessageCount': threadMessageCount,\n 'userCount': userCount,\n 'NDIPath': NDIPath,\n 'NDITimePath': NDITimePath,\n 'NDIRepliesCountPath': NDIRepliesCountPath,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L230_C4", "label": "return", "type": "return", "loc": [230, 230], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "vector": [13, 1, 0.5583, 0.0024, 1, 0.07, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render_to_response(\"ITInfluence/infrarouge.html\", context, context_instance=RequestContext(request))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L232_C0", "label": "getInfrarougeForums", "type": "function", "loc": [232, 238], "level": 0, "parent": null, "vector": [2, 0, 0.5704, 0.017, 0, 0.66, 0.6, 480, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "getInfrarougeForums", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getInfrarougeForums(request):\n forums = InfrarougeForum.objects.all()\n \n context = {\n \"forums\": forums,\n }\n return render_to_response(\"ITInfluence/infrarouge-forums.html\", context, context_instance=RequestContext(request))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L233_C4", "label": "forums = all()", "type": "assigned_variable", "loc": [233, 233], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L232_C0", "vector": [14, 1, 0.5655, 0.0024, 1, 0.62, 0.0, 763, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "forums", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " forums = InfrarougeForum.objects.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L235_C4", "label": "context =", "type": "assigned_variable", "loc": [235, 237], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L232_C0", "vector": [14, 1, 0.5728, 0.0073, 1, 0.62, 0.5, 954, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " context = {\n \"forums\": forums,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L238_C4", "label": "return", "type": "return", "loc": [238, 238], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L232_C0", "vector": [13, 1, 0.5777, 0.0024, 1, 0.62, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render_to_response(\"ITInfluence/infrarouge-forums.html\", context, context_instance=RequestContext(request))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L240_C0", "label": "twitterStopStreaming", "type": "function", "loc": [240, 242], "level": 0, "parent": null, "vector": [2, 0, 0.585, 0.0073, 0, 0.66, 0.6222, 784, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "twitterStopStreaming", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def twitterStopStreaming(request):\n twitter.toggleStreaming()\n return redirect(\"/twitter/collect/\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L241_C4", "label": "toggleStreaming()", "type": "expression", "loc": [241, 241], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L240_C0", "vector": [8, 1, 0.585, 0.0024, 1, 0.27, 0.0, 446, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "toggleStreaming", "arg_names": [], "import_names": [], "rhs_call_name": "toggleStreaming", "annotation": ""}, "snippet": " twitter.toggleStreaming()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L242_C4", "label": "return", "type": "return", "loc": [242, 242], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L240_C0", "vector": [13, 1, 0.5874, 0.0024, 1, 0.27, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return redirect(\"/twitter/collect/\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L244_C0", "label": "expression", "type": "expression", "loc": [244, 244], "level": 0, "parent": null, "vector": [8, 0, 0.5922, 0.0024, 0, 0.66, 0.6444, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''Image views'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L245_C0", "label": "showImage", "type": "function", "loc": [245, 250], "level": 0, "parent": null, "vector": [2, 0, 0.6007, 0.0146, 0, 0.66, 0.6667, 370, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "showImage", "arg_names": ["request", "path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def showImage(request, path):\n '''Wrapper view that displays the image at given path on a html page'''\n context ={\n \"path\": path,\n }\n return render_to_response(\"ITInfluence/show-image.html\", context, context_instance=RequestContext(request))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L246_C4", "label": "expression", "type": "expression", "loc": [246, 246], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L245_C0", "vector": [8, 1, 0.5971, 0.0024, 1, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Wrapper view that displays the image at given path on a html page'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L247_C4", "label": "context =", "type": "assigned_variable", "loc": [247, 249], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L245_C0", "vector": [14, 1, 0.6019, 0.0073, 1, 0.67, 0.5, 954, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " context ={\n \"path\": path,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L250_C4", "label": "return", "type": "return", "loc": [250, 250], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L245_C0", "vector": [13, 1, 0.6068, 0.0024, 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 render_to_response(\"ITInfluence/show-image.html\", context, context_instance=RequestContext(request))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L253_C0", "label": "getInfrarougeNDI", "type": "function", "loc": [253, 262], "level": 0, "parent": null, "vector": [2, 0, 0.625, 0.0243, 0, 0.66, 0.6889, 136, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "getInfrarougeNDI", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getInfrarougeNDI(request):\n with timer():\n resultsEqualTime, resultsEqualRepliesCount = NDI.polarizationForAllForums()\n \n plotter = TwoDimensionalValuesPlotter()\n xlabel = \"Interval\"\n ylabel = \"NDI\"\n response = plotter.memoryPlotMultipleDatasetsMultidimensional([resultsEqualTime, resultsEqualRepliesCount], xlabel, ylabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L255_C8", "label": "resultsEqualTime, resultsEqualRepliesCount = polarizationForAllForums()", "type": "assigned_variable", "loc": [255, 255], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L253_C0", "vector": [14, 1, 0.6189, 0.0024, 1, 0.07, 0.0, 962, 3, 0, 0, 0, 209, 10, 1], "semantic": {"name": "resultsEqualTime, resultsEqualRepliesCount", "arg_names": [], "import_names": [], "rhs_call_name": "polarizationForAllForums", "annotation": ""}, "snippet": " resultsEqualTime, resultsEqualRepliesCount = NDI.polarizationForAllForums()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L257_C8", "label": "plotter = TwoDimensionalValuesPlotter()", "type": "assigned_variable", "loc": [257, 257], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L253_C0", "vector": [14, 1, 0.6238, 0.0024, 1, 0.07, 0.25, 802, 3, 0, 0, 0, 195, 10, 1], "semantic": {"name": "plotter", "arg_names": [], "import_names": [], "rhs_call_name": "TwoDimensionalValuesPlotter", "annotation": ""}, "snippet": " plotter = TwoDimensionalValuesPlotter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L258_C8", "label": "xlabel =", "type": "assigned_variable", "loc": [258, 258], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L253_C0", "vector": [14, 1, 0.6262, 0.0024, 1, 0.07, 0.5, 676, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xlabel = \"Interval\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L259_C8", "label": "ylabel =", "type": "assigned_variable", "loc": [259, 259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L253_C0", "vector": [14, 1, 0.6286, 0.0024, 1, 0.07, 0.75, 584, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ylabel = \"NDI\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L260_C8", "label": "response = memoryPlotMultipleDatasetsMultidimensional()", "type": "assigned_variable", "loc": [260, 260], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L253_C0", "vector": [14, 1, 0.6311, 0.0024, 1, 0.07, 1.0, 511, 3, 3, 0, 0, 702, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "memoryPlotMultipleDatasetsMultidimensional", "annotation": ""}, "snippet": " response = plotter.memoryPlotMultipleDatasetsMultidimensional([resultsEqualTime, resultsEqualRepliesCount], xlabel, ylabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L262_C4", "label": "return", "type": "return", "loc": [262, 262], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L253_C0", "vector": [13, 1, 0.6359, 0.0024, 1, 0.07, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L264_C0", "label": "getInfrarougeNDITimeFigure", "type": "function", "loc": [264, 273], "level": 0, "parent": null, "vector": [2, 0, 0.6517, 0.0243, 0, 0.66, 0.7111, 556, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "getInfrarougeNDITimeFigure", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getInfrarougeNDITimeFigure(request):\n with timer():\n resultsEqualTime, unused = NDI.polarizationForAllForums(equalRepliesCount=False)\n \n plotter = TwoDimensionalValuesPlotter()\n xlabel = \"Interval (equal time)\"\n ylabel = \"NDI\"\n response = plotter.memoryPlotMultipleDatasets(resultsEqualTime, xlabel, ylabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L266_C8", "label": "resultsEqualTime, unused = polarizationForAllForums()", "type": "assigned_variable", "loc": [266, 266], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L264_C0", "vector": [14, 1, 0.6456, 0.0024, 1, 0.12, 0.0, 446, 3, 1, 0, 0, 209, 10, 1], "semantic": {"name": "resultsEqualTime, unused", "arg_names": [], "import_names": [], "rhs_call_name": "polarizationForAllForums", "annotation": ""}, "snippet": " resultsEqualTime, unused = NDI.polarizationForAllForums(equalRepliesCount=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L268_C8", "label": "plotter = TwoDimensionalValuesPlotter()", "type": "assigned_variable", "loc": [268, 268], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L264_C0", "vector": [14, 1, 0.6505, 0.0024, 1, 0.12, 0.25, 802, 3, 0, 0, 0, 195, 10, 1], "semantic": {"name": "plotter", "arg_names": [], "import_names": [], "rhs_call_name": "TwoDimensionalValuesPlotter", "annotation": ""}, "snippet": " plotter = TwoDimensionalValuesPlotter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L269_C8", "label": "xlabel =", "type": "assigned_variable", "loc": [269, 269], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L264_C0", "vector": [14, 1, 0.6529, 0.0024, 1, 0.12, 0.5, 676, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xlabel = \"Interval (equal time)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L270_C8", "label": "ylabel =", "type": "assigned_variable", "loc": [270, 270], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L264_C0", "vector": [14, 1, 0.6553, 0.0024, 1, 0.12, 0.75, 584, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ylabel = \"NDI\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L271_C8", "label": "response = memoryPlotMultipleDatasets()", "type": "assigned_variable", "loc": [271, 271], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L264_C0", "vector": [14, 1, 0.6578, 0.0024, 1, 0.12, 1.0, 511, 3, 3, 0, 0, 412, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "memoryPlotMultipleDatasets", "annotation": ""}, "snippet": " response = plotter.memoryPlotMultipleDatasets(resultsEqualTime, xlabel, ylabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L273_C4", "label": "return", "type": "return", "loc": [273, 273], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L264_C0", "vector": [13, 1, 0.6626, 0.0024, 1, 0.12, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L275_C0", "label": "getInfrarougeNDIReplyCountFigure", "type": "function", "loc": [275, 284], "level": 0, "parent": null, "vector": [2, 0, 0.6784, 0.0243, 0, 0.66, 0.7333, 136, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "getInfrarougeNDIReplyCountFigure", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getInfrarougeNDIReplyCountFigure(request):\n with timer():\n unused, resultsEqualRepliesCount = NDI.polarizationForAllForums(equalTime=False)\n \n plotter = TwoDimensionalValuesPlotter()\n xlabel = \"Interval (equal reply count)\"\n ylabel = \"NDI\"\n response = plotter.memoryPlotMultipleDatasets(resultsEqualRepliesCount, xlabel, ylabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L277_C8", "label": "unused, resultsEqualRepliesCount = polarizationForAllForums()", "type": "assigned_variable", "loc": [277, 277], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L275_C0", "vector": [14, 1, 0.6723, 0.0024, 1, 0.67, 0.0, 920, 3, 1, 0, 0, 209, 10, 1], "semantic": {"name": "unused, resultsEqualRepliesCount", "arg_names": [], "import_names": [], "rhs_call_name": "polarizationForAllForums", "annotation": ""}, "snippet": " unused, resultsEqualRepliesCount = NDI.polarizationForAllForums(equalTime=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L279_C8", "label": "plotter = TwoDimensionalValuesPlotter()", "type": "assigned_variable", "loc": [279, 279], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L275_C0", "vector": [14, 1, 0.6772, 0.0024, 1, 0.67, 0.25, 802, 3, 0, 0, 0, 195, 10, 1], "semantic": {"name": "plotter", "arg_names": [], "import_names": [], "rhs_call_name": "TwoDimensionalValuesPlotter", "annotation": ""}, "snippet": " plotter = TwoDimensionalValuesPlotter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L280_C8", "label": "xlabel =", "type": "assigned_variable", "loc": [280, 280], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L275_C0", "vector": [14, 1, 0.6796, 0.0024, 1, 0.67, 0.5, 676, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xlabel = \"Interval (equal reply count)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L281_C8", "label": "ylabel =", "type": "assigned_variable", "loc": [281, 281], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L275_C0", "vector": [14, 1, 0.682, 0.0024, 1, 0.67, 0.75, 584, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ylabel = \"NDI\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L282_C8", "label": "response = memoryPlotMultipleDatasets()", "type": "assigned_variable", "loc": [282, 282], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L275_C0", "vector": [14, 1, 0.6845, 0.0024, 1, 0.67, 1.0, 511, 3, 3, 0, 0, 412, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "memoryPlotMultipleDatasets", "annotation": ""}, "snippet": " response = plotter.memoryPlotMultipleDatasets(resultsEqualRepliesCount, xlabel, ylabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L284_C4", "label": "return", "type": "return", "loc": [284, 284], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L275_C0", "vector": [13, 1, 0.6893, 0.0024, 1, 0.67, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L286_C0", "label": "getInfrarougeRepliesGraph", "type": "function", "loc": [286, 295], "level": 0, "parent": null, "vector": [2, 0, 0.7051, 0.0243, 0, 0.66, 0.7556, 143, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "getInfrarougeRepliesGraph", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getInfrarougeRepliesGraph(request):\n with timer():\n infrarougeGraphBuilder = InfrarougeGraphBuilder(NDI.infrarougeDatabasePath)\n graphPlotter = GraphPlotter()\n graph = infrarougeGraphBuilder.graph1\n nodeLabel=\"User\"\n edgeLabel=\"Reply\"\n response = graphPlotter.memoryPlot(graph, nodeLabel=nodeLabel, edgeLabel=edgeLabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L288_C8", "label": "infrarougeGraphBuilder = InfrarougeGraphBuilder()", "type": "assigned_variable", "loc": [288, 288], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L286_C0", "vector": [14, 1, 0.699, 0.0024, 1, 0.44, 0.0, 212, 3, 1, 0, 0, 544, 10, 1], "semantic": {"name": "infrarougeGraphBuilder", "arg_names": [], "import_names": [], "rhs_call_name": "InfrarougeGraphBuilder", "annotation": ""}, "snippet": " infrarougeGraphBuilder = InfrarougeGraphBuilder(NDI.infrarougeDatabasePath)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L289_C8", "label": "graphPlotter = GraphPlotter()", "type": "assigned_variable", "loc": [289, 289], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L286_C0", "vector": [14, 1, 0.7015, 0.0024, 1, 0.44, 0.2, 268, 3, 0, 0, 0, 214, 10, 1], "semantic": {"name": "graphPlotter", "arg_names": [], "import_names": [], "rhs_call_name": "GraphPlotter", "annotation": ""}, "snippet": " graphPlotter = GraphPlotter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L290_C8", "label": "graph =", "type": "assigned_variable", "loc": [290, 290], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L286_C0", "vector": [14, 1, 0.7039, 0.0024, 1, 0.44, 0.4, 170, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "graph", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " graph = infrarougeGraphBuilder.graph1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L291_C8", "label": "nodeLabel =", "type": "assigned_variable", "loc": [291, 291], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L286_C0", "vector": [14, 1, 0.7063, 0.0024, 1, 0.44, 0.6, 819, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "nodeLabel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nodeLabel=\"User\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L292_C8", "label": "edgeLabel =", "type": "assigned_variable", "loc": [292, 292], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L286_C0", "vector": [14, 1, 0.7087, 0.0024, 1, 0.44, 0.8, 740, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "edgeLabel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " edgeLabel=\"Reply\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L293_C8", "label": "response = memoryPlot()", "type": "assigned_variable", "loc": [293, 293], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L286_C0", "vector": [14, 1, 0.7112, 0.0024, 1, 0.44, 1.0, 511, 3, 3, 0, 0, 314, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "memoryPlot", "annotation": ""}, "snippet": " response = graphPlotter.memoryPlot(graph, nodeLabel=nodeLabel, edgeLabel=edgeLabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L295_C4", "label": "return", "type": "return", "loc": [295, 295], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L286_C0", "vector": [13, 1, 0.716, 0.0024, 1, 0.44, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L297_C0", "label": "getInfrarougeUserDiscussionGraph", "type": "function", "loc": [297, 309], "level": 0, "parent": null, "vector": [2, 0, 0.7354, 0.0316, 0, 0.66, 0.7778, 692, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "getInfrarougeUserDiscussionGraph", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getInfrarougeUserDiscussionGraph(request):\n with timer():\n infrarougeGraphBuilder = InfrarougeGraphBuilder(NDI.infrarougeDatabasePath)\n graphPlotter = GraphPlotter()\n graph = infrarougeGraphBuilder.graph2\n # compute bipartite positions for nodes\n pos = graphPlotter.bipartiteNodePositions(graph)\n nodeLabel=\"User\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L299_C8", "label": "infrarougeGraphBuilder = InfrarougeGraphBuilder()", "type": "assigned_variable", "loc": [299, 299], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L297_C0", "vector": [14, 1, 0.7257, 0.0024, 1, 0.78, 0.0, 212, 3, 1, 0, 0, 544, 10, 1], "semantic": {"name": "infrarougeGraphBuilder", "arg_names": [], "import_names": [], "rhs_call_name": "InfrarougeGraphBuilder", "annotation": ""}, "snippet": " infrarougeGraphBuilder = InfrarougeGraphBuilder(NDI.infrarougeDatabasePath)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L300_C8", "label": "graphPlotter = GraphPlotter()", "type": "assigned_variable", "loc": [300, 300], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L297_C0", "vector": [14, 1, 0.7282, 0.0024, 1, 0.78, 0.1429, 268, 3, 0, 0, 0, 214, 10, 1], "semantic": {"name": "graphPlotter", "arg_names": [], "import_names": [], "rhs_call_name": "GraphPlotter", "annotation": ""}, "snippet": " graphPlotter = GraphPlotter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L301_C8", "label": "graph =", "type": "assigned_variable", "loc": [301, 301], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L297_C0", "vector": [14, 1, 0.7306, 0.0024, 1, 0.78, 0.2857, 170, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "graph", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " graph = infrarougeGraphBuilder.graph2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L303_C8", "label": "pos = bipartiteNodePositions()", "type": "assigned_variable", "loc": [303, 303], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L297_C0", "vector": [14, 1, 0.7354, 0.0024, 1, 0.78, 0.4286, 627, 3, 1, 0, 0, 445, 10, 1], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "bipartiteNodePositions", "annotation": ""}, "snippet": " pos = graphPlotter.bipartiteNodePositions(graph)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L304_C8", "label": "nodeLabel =", "type": "assigned_variable", "loc": [304, 304], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L297_C0", "vector": [14, 1, 0.7379, 0.0024, 1, 0.78, 0.5714, 819, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "nodeLabel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nodeLabel=\"User\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L305_C8", "label": "nodeLabel2 =", "type": "assigned_variable", "loc": [305, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L297_C0", "vector": [14, 1, 0.7403, 0.0024, 1, 0.78, 0.7143, 387, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "nodeLabel2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nodeLabel2=\"Discussion\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L306_C8", "label": "edgeLabel =", "type": "assigned_variable", "loc": [306, 306], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L297_C0", "vector": [14, 1, 0.7427, 0.0024, 1, 0.78, 0.8571, 740, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "edgeLabel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " edgeLabel=\"Participation\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L307_C8", "label": "response = memoryPlot()", "type": "assigned_variable", "loc": [307, 307], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L297_C0", "vector": [14, 1, 0.7451, 0.0024, 1, 0.78, 1.0, 511, 3, 6, 0, 0, 314, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "memoryPlot", "annotation": ""}, "snippet": " response = graphPlotter.memoryPlot(graph, bipartite=True, pos=pos, nodeLabel=nodeLabel, nodeLabel2=nodeLabel2, edgeLabel=edgeLabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L309_C4", "label": "return", "type": "return", "loc": [309, 309], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L297_C0", "vector": [13, 1, 0.75, 0.0024, 1, 0.78, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L311_C0", "label": "getTwitterNDI", "type": "function", "loc": [311, 320], "level": 0, "parent": null, "vector": [2, 0, 0.7658, 0.0243, 0, 0.66, 0.8, 345, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "getTwitterNDI", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getTwitterNDI(request):\n with timer(): # measure execution time\n resultsEqualTime, resultsEqualRepliesCount = NDI.getNDIForMostFrequentHashtags()\n \n plotter = TwoDimensionalValuesPlotter()\n xlabel = \"Interval\"\n ylabel = \"NDI\"\n response = plotter.memoryPlotMultipleDatasetsMultidimensional([resultsEqualTime, resultsEqualRepliesCount], xlabel, ylabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L313_C8", "label": "resultsEqualTime, resultsEqualRepliesCount = getNDIForMostFrequentHashtags()", "type": "assigned_variable", "loc": [313, 313], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L311_C0", "vector": [14, 1, 0.7597, 0.0024, 1, 0.3, 0.0, 962, 3, 0, 0, 0, 809, 10, 1], "semantic": {"name": "resultsEqualTime, resultsEqualRepliesCount", "arg_names": [], "import_names": [], "rhs_call_name": "getNDIForMostFrequentHashtags", "annotation": ""}, "snippet": " resultsEqualTime, resultsEqualRepliesCount = NDI.getNDIForMostFrequentHashtags()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L315_C8", "label": "plotter = TwoDimensionalValuesPlotter()", "type": "assigned_variable", "loc": [315, 315], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L311_C0", "vector": [14, 1, 0.7646, 0.0024, 1, 0.3, 0.25, 802, 3, 0, 0, 0, 195, 10, 1], "semantic": {"name": "plotter", "arg_names": [], "import_names": [], "rhs_call_name": "TwoDimensionalValuesPlotter", "annotation": ""}, "snippet": " plotter = TwoDimensionalValuesPlotter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L316_C8", "label": "xlabel =", "type": "assigned_variable", "loc": [316, 316], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L311_C0", "vector": [14, 1, 0.767, 0.0024, 1, 0.3, 0.5, 676, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xlabel = \"Interval\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L317_C8", "label": "ylabel =", "type": "assigned_variable", "loc": [317, 317], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L311_C0", "vector": [14, 1, 0.7694, 0.0024, 1, 0.3, 0.75, 584, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ylabel = \"NDI\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L318_C8", "label": "response = memoryPlotMultipleDatasetsMultidimensional()", "type": "assigned_variable", "loc": [318, 318], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L311_C0", "vector": [14, 1, 0.7718, 0.0024, 1, 0.3, 1.0, 511, 3, 3, 0, 0, 702, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "memoryPlotMultipleDatasetsMultidimensional", "annotation": ""}, "snippet": " response = plotter.memoryPlotMultipleDatasetsMultidimensional([resultsEqualTime, resultsEqualRepliesCount], xlabel, ylabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L320_C4", "label": "return", "type": "return", "loc": [320, 320], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L311_C0", "vector": [13, 1, 0.7767, 0.0024, 1, 0.3, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L322_C0", "label": "getTwitterNDISingleHashtag", "type": "function", "loc": [322, 331], "level": 0, "parent": null, "vector": [2, 0, 0.7925, 0.0243, 0, 0.66, 0.8222, 467, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "getTwitterNDISingleHashtag", "arg_names": ["request", "hashtag"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getTwitterNDISingleHashtag(request, hashtag):\n with timer():\n resultsEqualTime, resultsEqualRepliesCount = NDI.getNDIForHashtag(hashtag)\n \n plotter = TwoDimensionalValuesPlotter(width=800, height=600)\n xlabel = \"Interval\"\n ylabel = \"NDI\"\n response = plotter.memoryPlotMultipleDatasetsMultidimensional([resultsEqualTime, resultsEqualRepliesCount], xlabel, ylabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L324_C8", "label": "resultsEqualTime, resultsEqualRepliesCount = getNDIForHashtag()", "type": "assigned_variable", "loc": [324, 324], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L322_C0", "vector": [14, 1, 0.7864, 0.0024, 1, 0.16, 0.0, 962, 3, 1, 0, 0, 886, 10, 1], "semantic": {"name": "resultsEqualTime, resultsEqualRepliesCount", "arg_names": [], "import_names": [], "rhs_call_name": "getNDIForHashtag", "annotation": ""}, "snippet": " resultsEqualTime, resultsEqualRepliesCount = NDI.getNDIForHashtag(hashtag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L326_C8", "label": "plotter = TwoDimensionalValuesPlotter()", "type": "assigned_variable", "loc": [326, 326], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L322_C0", "vector": [14, 1, 0.7913, 0.0024, 1, 0.16, 0.25, 802, 3, 2, 0, 0, 195, 10, 1], "semantic": {"name": "plotter", "arg_names": [], "import_names": [], "rhs_call_name": "TwoDimensionalValuesPlotter", "annotation": ""}, "snippet": " plotter = TwoDimensionalValuesPlotter(width=800, height=600)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L327_C8", "label": "xlabel =", "type": "assigned_variable", "loc": [327, 327], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L322_C0", "vector": [14, 1, 0.7937, 0.0024, 1, 0.16, 0.5, 676, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xlabel = \"Interval\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L328_C8", "label": "ylabel =", "type": "assigned_variable", "loc": [328, 328], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L322_C0", "vector": [14, 1, 0.7961, 0.0024, 1, 0.16, 0.75, 584, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ylabel = \"NDI\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L329_C8", "label": "response = memoryPlotMultipleDatasetsMultidimensional()", "type": "assigned_variable", "loc": [329, 329], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L322_C0", "vector": [14, 1, 0.7985, 0.0024, 1, 0.16, 1.0, 511, 3, 3, 0, 0, 702, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "memoryPlotMultipleDatasetsMultidimensional", "annotation": ""}, "snippet": " response = plotter.memoryPlotMultipleDatasetsMultidimensional([resultsEqualTime, resultsEqualRepliesCount], xlabel, ylabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L331_C4", "label": "return", "type": "return", "loc": [331, 331], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L322_C0", "vector": [13, 1, 0.8034, 0.0024, 1, 0.16, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L333_C0", "label": "getTwitterNDITimeFigure", "type": "function", "loc": [333, 342], "level": 0, "parent": null, "vector": [2, 0, 0.8192, 0.0243, 0, 0.66, 0.8444, 727, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "getTwitterNDITimeFigure", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getTwitterNDITimeFigure(request):\n with timer():\n resultsEqualTime, unused = NDI.getNDIForMostFrequentHashtags(equalRepliesCount=False)\n \n plotter = TwoDimensionalValuesPlotter()\n xlabel = \"Interval (equal time)\"\n ylabel = \"NDI\"\n response = plotter.memoryPlotMultipleDatasets(resultsEqualTime, xlabel, ylabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L335_C8", "label": "resultsEqualTime, unused = getNDIForMostFrequentHashtags()", "type": "assigned_variable", "loc": [335, 335], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L333_C0", "vector": [14, 1, 0.8131, 0.0024, 1, 0.92, 0.0, 446, 3, 1, 0, 0, 809, 10, 1], "semantic": {"name": "resultsEqualTime, unused", "arg_names": [], "import_names": [], "rhs_call_name": "getNDIForMostFrequentHashtags", "annotation": ""}, "snippet": " resultsEqualTime, unused = NDI.getNDIForMostFrequentHashtags(equalRepliesCount=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L337_C8", "label": "plotter = TwoDimensionalValuesPlotter()", "type": "assigned_variable", "loc": [337, 337], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L333_C0", "vector": [14, 1, 0.818, 0.0024, 1, 0.92, 0.25, 802, 3, 0, 0, 0, 195, 10, 1], "semantic": {"name": "plotter", "arg_names": [], "import_names": [], "rhs_call_name": "TwoDimensionalValuesPlotter", "annotation": ""}, "snippet": " plotter = TwoDimensionalValuesPlotter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L338_C8", "label": "xlabel =", "type": "assigned_variable", "loc": [338, 338], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L333_C0", "vector": [14, 1, 0.8204, 0.0024, 1, 0.92, 0.5, 676, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xlabel = \"Interval (equal time)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L339_C8", "label": "ylabel =", "type": "assigned_variable", "loc": [339, 339], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L333_C0", "vector": [14, 1, 0.8228, 0.0024, 1, 0.92, 0.75, 584, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ylabel = \"NDI\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L340_C8", "label": "response = memoryPlotMultipleDatasets()", "type": "assigned_variable", "loc": [340, 340], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L333_C0", "vector": [14, 1, 0.8252, 0.0024, 1, 0.92, 1.0, 511, 3, 3, 0, 0, 412, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "memoryPlotMultipleDatasets", "annotation": ""}, "snippet": " response = plotter.memoryPlotMultipleDatasets(resultsEqualTime, xlabel, ylabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L342_C4", "label": "return", "type": "return", "loc": [342, 342], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L333_C0", "vector": [13, 1, 0.8301, 0.0024, 1, 0.92, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L344_C0", "label": "getTwitterNDIReplyCountFigure", "type": "function", "loc": [344, 353], "level": 0, "parent": null, "vector": [2, 0, 0.8459, 0.0243, 0, 0.66, 0.8667, 257, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "getTwitterNDIReplyCountFigure", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getTwitterNDIReplyCountFigure(request):\n with timer():\n unused, resultsEqualRepliesCount = NDI.getNDIForMostFrequentHashtags(equalTime=False)\n \n plotter = TwoDimensionalValuesPlotter()\n xlabel = \"Interval (equal time)\"\n ylabel = \"NDI\"\n response = plotter.memoryPlotMultipleDatasets(resultsEqualRepliesCount, xlabel, ylabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L346_C8", "label": "unused, resultsEqualRepliesCount = getNDIForMostFrequentHashtags()", "type": "assigned_variable", "loc": [346, 346], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L344_C0", "vector": [14, 1, 0.8398, 0.0024, 1, 0.37, 0.0, 920, 3, 1, 0, 0, 809, 10, 1], "semantic": {"name": "unused, resultsEqualRepliesCount", "arg_names": [], "import_names": [], "rhs_call_name": "getNDIForMostFrequentHashtags", "annotation": ""}, "snippet": " unused, resultsEqualRepliesCount = NDI.getNDIForMostFrequentHashtags(equalTime=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L348_C8", "label": "plotter = TwoDimensionalValuesPlotter()", "type": "assigned_variable", "loc": [348, 348], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L344_C0", "vector": [14, 1, 0.8447, 0.0024, 1, 0.37, 0.25, 802, 3, 0, 0, 0, 195, 10, 1], "semantic": {"name": "plotter", "arg_names": [], "import_names": [], "rhs_call_name": "TwoDimensionalValuesPlotter", "annotation": ""}, "snippet": " plotter = TwoDimensionalValuesPlotter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L349_C8", "label": "xlabel =", "type": "assigned_variable", "loc": [349, 349], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L344_C0", "vector": [14, 1, 0.8471, 0.0024, 1, 0.37, 0.5, 676, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "xlabel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xlabel = \"Interval (equal time)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L350_C8", "label": "ylabel =", "type": "assigned_variable", "loc": [350, 350], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L344_C0", "vector": [14, 1, 0.8495, 0.0024, 1, 0.37, 0.75, 584, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ylabel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ylabel = \"NDI\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L351_C8", "label": "response = memoryPlotMultipleDatasets()", "type": "assigned_variable", "loc": [351, 351], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L344_C0", "vector": [14, 1, 0.8519, 0.0024, 1, 0.37, 1.0, 511, 3, 3, 0, 0, 412, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "memoryPlotMultipleDatasets", "annotation": ""}, "snippet": " response = plotter.memoryPlotMultipleDatasets(resultsEqualRepliesCount, xlabel, ylabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L353_C4", "label": "return", "type": "return", "loc": [353, 353], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L344_C0", "vector": [13, 1, 0.8568, 0.0024, 1, 0.37, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L355_C0", "label": "getTwitterRepliesGraph", "type": "function", "loc": [355, 369], "level": 0, "parent": null, "vector": [2, 0, 0.8786, 0.0364, 0, 0.66, 0.8889, 752, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "getTwitterRepliesGraph", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getTwitterRepliesGraph(request):\n with timer():\n twitterGraphBuilder = TwitterGraphBuilder()\n graph = twitterGraphBuilder.graph\n \n # save graph to gml file\n# filename = \"replies_graph.gml\"\n# saveGraph(graph, filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L357_C8", "label": "twitterGraphBuilder = TwitterGraphBuilder()", "type": "assigned_variable", "loc": [357, 357], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L355_C0", "vector": [14, 1, 0.8665, 0.0024, 1, 0.36, 0.0, 43, 3, 0, 0, 0, 235, 10, 1], "semantic": {"name": "twitterGraphBuilder", "arg_names": [], "import_names": [], "rhs_call_name": "TwitterGraphBuilder", "annotation": ""}, "snippet": " twitterGraphBuilder = TwitterGraphBuilder()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L358_C8", "label": "graph =", "type": "assigned_variable", "loc": [358, 358], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L355_C0", "vector": [14, 1, 0.8689, 0.0024, 1, 0.36, 0.2, 170, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "graph", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " graph = twitterGraphBuilder.graph"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L364_C8", "label": "graphPlotter = GraphPlotter()", "type": "assigned_variable", "loc": [364, 364], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L355_C0", "vector": [14, 1, 0.8835, 0.0024, 1, 0.36, 0.4, 268, 3, 0, 0, 0, 214, 10, 1], "semantic": {"name": "graphPlotter", "arg_names": [], "import_names": [], "rhs_call_name": "GraphPlotter", "annotation": ""}, "snippet": " graphPlotter = GraphPlotter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L365_C8", "label": "print()", "type": "expression", "loc": [365, 365], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L355_C0", "vector": [8, 1, 0.8859, 0.0024, 1, 0.36, 0.6, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Plotting graph...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L366_C8", "label": "response = memoryPlot()", "type": "assigned_variable", "loc": [366, 366], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L355_C0", "vector": [14, 1, 0.8883, 0.0024, 1, 0.36, 0.8, 511, 3, 1, 0, 0, 314, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "memoryPlot", "annotation": ""}, "snippet": " response = graphPlotter.memoryPlot(graph)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L367_C8", "label": "print()", "type": "expression", "loc": [367, 367], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L355_C0", "vector": [8, 1, 0.8908, 0.0024, 1, 0.36, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"...done!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L369_C4", "label": "return", "type": "return", "loc": [369, 369], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L355_C0", "vector": [13, 1, 0.8956, 0.0024, 1, 0.36, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L371_C0", "label": "getTwitterFollowersGraph", "type": "function", "loc": [371, 387], "level": 0, "parent": null, "vector": [2, 0, 0.9199, 0.0413, 0, 0.66, 0.9111, 554, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "getTwitterFollowersGraph", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getTwitterFollowersGraph(request):\n with timer():\n twitterGraphBuilder = TwitterFollowersGraphBuilder()\n graph = twitterGraphBuilder.graph\n \n # save graph to gml file\n# filename = \"followers_graph.gml\"\n# saveGraph(graph, filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L373_C8", "label": "twitterGraphBuilder = TwitterFollowersGraphBuilder()", "type": "assigned_variable", "loc": [373, 373], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L371_C0", "vector": [14, 1, 0.9053, 0.0024, 1, 0.02, 0.0, 43, 3, 0, 0, 0, 918, 10, 1], "semantic": {"name": "twitterGraphBuilder", "arg_names": [], "import_names": [], "rhs_call_name": "TwitterFollowersGraphBuilder", "annotation": ""}, "snippet": " twitterGraphBuilder = TwitterFollowersGraphBuilder()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L374_C8", "label": "graph =", "type": "assigned_variable", "loc": [374, 374], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L371_C0", "vector": [14, 1, 0.9078, 0.0024, 1, 0.02, 0.1429, 170, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "graph", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " graph = twitterGraphBuilder.graph"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L380_C8", "label": "graphPlotter = GraphPlotter()", "type": "assigned_variable", "loc": [380, 380], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L371_C0", "vector": [14, 1, 0.9223, 0.0024, 1, 0.02, 0.2857, 268, 3, 0, 0, 0, 214, 10, 1], "semantic": {"name": "graphPlotter", "arg_names": [], "import_names": [], "rhs_call_name": "GraphPlotter", "annotation": ""}, "snippet": " graphPlotter = GraphPlotter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L381_C8", "label": "nodeLabel =", "type": "assigned_variable", "loc": [381, 381], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L371_C0", "vector": [14, 1, 0.9248, 0.0024, 1, 0.02, 0.4286, 819, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "nodeLabel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nodeLabel=\"User\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L382_C8", "label": "edgeLabel =", "type": "assigned_variable", "loc": [382, 382], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L371_C0", "vector": [14, 1, 0.9272, 0.0024, 1, 0.02, 0.5714, 740, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "edgeLabel", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " edgeLabel=\"Friendship\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L383_C8", "label": "print()", "type": "expression", "loc": [383, 383], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L371_C0", "vector": [8, 1, 0.9296, 0.0024, 1, 0.02, 0.7143, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Plotting graph...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L384_C8", "label": "response = memoryPlot()", "type": "assigned_variable", "loc": [384, 384], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L371_C0", "vector": [14, 1, 0.932, 0.0024, 1, 0.02, 0.8571, 511, 3, 5, 0, 0, 314, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "memoryPlot", "annotation": ""}, "snippet": " response = graphPlotter.memoryPlot(graph, nodeSizes=twitterGraphBuilder.nodeSizes, nodeColor=twitterGraphBuilder.nodeSizes, nodeLabel=nodeLabel, edgeLabel=edgeLabel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L385_C8", "label": "print()", "type": "expression", "loc": [385, 385], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L371_C0", "vector": [8, 1, 0.9345, 0.0024, 1, 0.02, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"...done!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L387_C4", "label": "return", "type": "return", "loc": [387, 387], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L371_C0", "vector": [13, 1, 0.9393, 0.0024, 1, 0.02, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L389_C0", "label": "expression", "type": "expression", "loc": [389, 389], "level": 0, "parent": null, "vector": [8, 0, 0.9442, 0.0024, 0, 0.66, 0.9333, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''HELPER FUNCTIONS'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L390_C0", "label": "saveGraph", "type": "function", "loc": [390, 391], "level": 0, "parent": null, "vector": [2, 0, 0.9478, 0.0049, 0, 0.66, 0.9556, 400, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "saveGraph", "arg_names": ["graph", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def saveGraph(graph, filename):\n nx.gml.write_gml(graph, filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L391_C4", "label": "write_gml()", "type": "expression", "loc": [391, 391], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L390_C0", "vector": [8, 1, 0.949, 0.0024, 1, 0.33, 0.0, 446, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "write_gml", "arg_names": [], "import_names": [], "rhs_call_name": "write_gml", "annotation": ""}, "snippet": " nx.gml.write_gml(graph, filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L393_C0", "label": "fontSize", "type": "function", "loc": [393, 394], "level": 0, "parent": null, "vector": [2, 0, 0.9551, 0.0049, 0, 0.66, 0.9778, 422, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "fontSize", "arg_names": ["occurences"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def fontSize(occurences):\n return 1 + math.log(occurences)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L394_C4", "label": "return", "type": "return", "loc": [394, 394], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L393_C0", "vector": [13, 1, 0.9563, 0.0024, 1, 0.66, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 1 + math.log(occurences)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L396_C0", "label": "classifyTweets", "type": "function", "loc": [396, 412], "level": 0, "parent": null, "vector": [2, 0, 0.9806, 0.0413, 0, 0.66, 1.0, 31, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "classifyTweets", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def classifyTweets():\n # only classify tweets that are not classified yet\n tweets = Tweet.objects.all().filter(polarity_ready=False)\n \n if len(tweets) > 0:\n s = sentistrength.SentiStrength()\n # concatenate all texts to annotate at once\n text = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L398_C4", "label": "tweets = filter()", "type": "assigned_variable", "loc": [398, 398], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L396_C0", "vector": [14, 1, 0.966, 0.0024, 1, 0.14, 0.0, 680, 3, 1, 0, 0, 526, 10, 2], "semantic": {"name": "tweets", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " tweets = Tweet.objects.all().filter(polarity_ready=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:If_L400_C4", "label": "if", "type": "if", "loc": [400, 412], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L396_C0", "vector": [4, 1, 0.9854, 0.0316, 1, 0.14, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(tweets) > 0:\n s = sentistrength.SentiStrength()\n # concatenate all texts to annotate at once\n text = \"\"\n for tweet in tweets:\n text += tweet.text.replace(\"\\n\", \" \") + \"\\n\"\n \n polarities = s.classifiy(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L401_C8", "label": "s = SentiStrength()", "type": "assigned_variable", "loc": [401, 401], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:If_L400_C4", "vector": [14, 2, 0.9733, 0.0024, 2, 0.08, 0.0, 553, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "SentiStrength", "annotation": ""}, "snippet": " s = sentistrength.SentiStrength()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L403_C8", "label": "text =", "type": "assigned_variable", "loc": [403, 403], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:If_L400_C4", "vector": [14, 2, 0.9782, 0.0024, 2, 0.08, 0.25, 439, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:For_L404_C8", "label": "for tweet", "type": "for", "loc": [404, 405], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:If_L400_C4", "vector": [6, 2, 0.9818, 0.0049, 2, 0.08, 0.5, 392, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "tweet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for tweet in tweets:\n text += tweet.text.replace(\"\\n\", \" \") + \"\\n\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L407_C8", "label": "polarities = classifiy()", "type": "assigned_variable", "loc": [407, 407], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:If_L400_C4", "vector": [14, 2, 0.9879, 0.0024, 2, 0.08, 0.75, 207, 3, 1, 0, 0, 202, 10, 1], "semantic": {"name": "polarities", "arg_names": [], "import_names": [], "rhs_call_name": "classifiy", "annotation": ""}, "snippet": " polarities = s.classifiy(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:For_L409_C8", "label": "for tweet, polarity", "type": "for", "loc": [409, 412], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:If_L400_C4", "vector": [6, 2, 0.9964, 0.0097, 2, 0.08, 1.0, 433, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "tweet, polarity", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for tweet, polarity in zip(tweets, polarities):\n tweet.polarity = polarity\n tweet.polarity_ready = True\n tweet.save()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L410_C12", "label": "tweet.polarity =", "type": "assigned_variable", "loc": [410, 410], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:For_L409_C8", "vector": [14, 3, 0.9951, 0.0024, 3, 0.22, 0.0, 104, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tweet.polarity", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tweet.polarity = polarity"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L411_C12", "label": "tweet.polarity_ready =", "type": "assigned_variable", "loc": [411, 411], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:For_L409_C8", "vector": [14, 3, 0.9976, 0.0024, 3, 0.22, 0.5, 45, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "tweet.polarity_ready", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tweet.polarity_ready = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L412_C12", "label": "save()", "type": "expression", "loc": [412, 412], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1078:For_L409_C8", "vector": [8, 3, 1.0, 0.0024, 3, 0.22, 1.0, 928, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " tweet.save()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:For_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:For_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:If_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:If_L63_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L64_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:For_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:If_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:If_L65_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L66_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L107_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L107_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:If_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L107_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L120_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L120_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L120_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L134_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L134_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L134_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L134_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L134_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L158_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L165_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L165_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L165_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L171_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L185_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L187_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:Try_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L201_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L204_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L207_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L208_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L209_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L210_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L212_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L213_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L214_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L216_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L219_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L206_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L230_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L232_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L233_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L232_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L235_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L232_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L238_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L240_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L241_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L240_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L242_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L245_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L246_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L245_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L247_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L245_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L250_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L253_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L255_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L253_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L257_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L253_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L258_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L253_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L259_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L253_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L260_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L253_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L262_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L266_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L268_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L269_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L270_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L271_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L273_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L279_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L280_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L281_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L282_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L284_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L286_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L288_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L286_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L289_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L286_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L290_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L286_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L291_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L286_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L292_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L286_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L293_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L286_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L295_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L297_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L299_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L297_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L300_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L297_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L301_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L297_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L303_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L297_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L304_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L297_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L305_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L297_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L306_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L297_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L307_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L297_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L309_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L311_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L313_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L311_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L315_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L311_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L316_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L311_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L317_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L311_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L318_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L311_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L320_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L322_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L324_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L322_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L326_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L322_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L327_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L322_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L328_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L322_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L329_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L322_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L331_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L333_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L335_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L333_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L337_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L333_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L338_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L333_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L339_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L333_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L340_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L333_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L342_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L344_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L346_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L344_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L348_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L344_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L349_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L344_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L350_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L344_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L351_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L344_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L353_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L355_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L357_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L355_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L358_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L355_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L364_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L355_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L365_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L355_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L366_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L355_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L367_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L355_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L369_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L371_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L373_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L371_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L374_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L371_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L380_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L371_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L381_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L371_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L382_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L371_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L383_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L371_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L384_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L371_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L385_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L371_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L387_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L390_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L391_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L393_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Return_L394_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L396_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L398_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:FunctionDef_L396_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:If_L400_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:If_L400_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L401_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:If_L400_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L403_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:If_L400_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:For_L404_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:If_L400_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L407_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:If_L400_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:For_L409_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:For_L409_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L410_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:For_L409_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Assign_L411_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1078:For_L409_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1078:Expr_L412_C12"}]
''' Created on 12 juin 2013 @author: Nils Amiet ''' # Database routers are used to know which model should be used with which database. # This is useful in our case because we have multiple databases. class TwitterRouter(): def db_for_read(self, model, **hints): if hasattr(model._meta, "isTwitterModel"): return "default" else: return "infrarouge" def db_for_write(self, model, **hints): if hasattr(model._meta, "isTwitterModel"): return "default" else: return "infrarouge" def allow_syncdb(self, db, model): isTwitterModel = hasattr(model._meta, "isTwitterModel") if isTwitterModel: return db == "default" else: return not db == "default"
ajibawa-2023/Python-Code-Large/train/row_1079
15
28
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1079:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.1071, 0.1786, 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 12 juin 2013\n\n@author: Nils Amiet\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1079:ClassDef_L10_C0", "label": "TwitterRouter", "type": "class", "loc": [10, 28], "level": 0, "parent": null, "vector": [3, 0, 0.6786, 0.6786, 0, 0.66, 1.0, 87, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "TwitterRouter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TwitterRouter():\n def db_for_read(self, model, **hints):\n if hasattr(model._meta, \"isTwitterModel\"):\n return \"default\"\n else:\n return \"infrarouge\"\n\n def db_for_write(self, model, **hints):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1079:FunctionDef_L11_C4", "label": "db_for_read", "type": "function", "loc": [11, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1079:ClassDef_L10_C0", "vector": [2, 1, 0.4643, 0.1786, 1, 0.35, 0.0, 968, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "db_for_read", "arg_names": ["self", "model", "hints"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def db_for_read(self, model, **hints):\n if hasattr(model._meta, \"isTwitterModel\"):\n return \"default\"\n else:\n return \"infrarouge\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1079:If_L12_C8", "label": "if", "type": "if", "loc": [12, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1079:FunctionDef_L11_C4", "vector": [4, 2, 0.4821, 0.1429, 2, 0.36, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(model._meta, \"isTwitterModel\"):\n return \"default\"\n else:\n return \"infrarouge\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1079:Return_L13_C12", "label": "return", "type": "return", "loc": [13, 13], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1079:If_L12_C8", "vector": [13, 3, 0.4643, 0.0357, 3, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"default\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1079:Return_L15_C12", "label": "return", "type": "return", "loc": [15, 15], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1079:If_L12_C8", "vector": [13, 3, 0.5357, 0.0357, 3, 0.85, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"infrarouge\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1079:FunctionDef_L17_C4", "label": "db_for_write", "type": "function", "loc": [17, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1079:ClassDef_L10_C0", "vector": [2, 1, 0.6786, 0.1786, 1, 0.35, 0.5, 395, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "db_for_write", "arg_names": ["self", "model", "hints"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def db_for_write(self, model, **hints):\n if hasattr(model._meta, \"isTwitterModel\"):\n return \"default\"\n else:\n return \"infrarouge\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1079:If_L18_C8", "label": "if", "type": "if", "loc": [18, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1079:FunctionDef_L17_C4", "vector": [4, 2, 0.6964, 0.1429, 2, 0.48, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(model._meta, \"isTwitterModel\"):\n return \"default\"\n else:\n return \"infrarouge\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1079:Return_L19_C12", "label": "return", "type": "return", "loc": [19, 19], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1079:If_L18_C8", "vector": [13, 3, 0.6786, 0.0357, 3, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"default\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1079:Return_L21_C12", "label": "return", "type": "return", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1079:If_L18_C8", "vector": [13, 3, 0.75, 0.0357, 3, 0.03, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"infrarouge\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1079:FunctionDef_L22_C4", "label": "allow_syncdb", "type": "function", "loc": [22, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1079:ClassDef_L10_C0", "vector": [2, 1, 0.8929, 0.25, 1, 0.35, 1.0, 459, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "allow_syncdb", "arg_names": ["self", "db", "model"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def allow_syncdb(self, db, model):\n isTwitterModel = hasattr(model._meta, \"isTwitterModel\")\n \n if isTwitterModel:\n return db == \"default\"\n else:\n return not db == \"default\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1079:Assign_L23_C8", "label": "isTwitterModel = hasattr()", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1079:FunctionDef_L22_C4", "vector": [14, 2, 0.8214, 0.0357, 2, 0.54, 0.0, 376, 3, 2, 0, 0, 720, 10, 1], "semantic": {"name": "isTwitterModel", "arg_names": [], "import_names": [], "rhs_call_name": "hasattr", "annotation": ""}, "snippet": " isTwitterModel = hasattr(model._meta, \"isTwitterModel\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1079:If_L25_C8", "label": "if", "type": "if", "loc": [25, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1079:FunctionDef_L22_C4", "vector": [4, 2, 0.9464, 0.1429, 2, 0.54, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isTwitterModel:\n return db == \"default\"\n else:\n return not db == \"default\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1079:Return_L26_C12", "label": "return", "type": "return", "loc": [26, 26], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1079:If_L25_C8", "vector": [13, 3, 0.9286, 0.0357, 3, 0.9, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return db == \"default\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1079:Return_L28_C12", "label": "return", "type": "return", "loc": [28, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1079:If_L25_C8", "vector": [13, 3, 1.0, 0.0357, 3, 0.9, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return not db == \"default\""}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1079:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1079:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1079:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1079:If_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1079:If_L12_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1079:Return_L13_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1079:If_L12_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1079:Return_L15_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1079:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1079:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1079:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1079:If_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1079:If_L18_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1079:Return_L19_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1079:If_L18_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1079:Return_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1079:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1079:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1079:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1079:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1079:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1079:If_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1079:If_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1079:Return_L26_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1079:If_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1079:Return_L28_C12"}]
''' Created on 23 mars 2013 @author: Nils Amiet ''' # coding: utf-8 ''' Graph 1: Replies graph Weighted directed graph Weight of edge from A to B = number of replies from user A to user B Graph 2: User-Discussion graph Bipartite graph Edge from User A to discussion D => user A participates in discussion D ''' import networkx as nx import networkx.readwrite.gml as gml import sqlite3 import random import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt '''Config''' databasePath = "../../../../../InfrarougeGrabber/infrarouge.db" graph1Path = "graph1.gml" graph2Path = "graph2.gml" userRepliesCounts = {} graph1 = nx.DiGraph() userParticipations = [] graph2 = nx.Graph() def users(): users = [] with sqlite3.connect(databasePath) as connection: cursor = connection.cursor() query = "SELECT * FROM user" cursor.execute(query) for user in cursor: users += [user] cursor.close() return users def getForums(): forums = [] with sqlite3.connect(databasePath) as connection: cursor = connection.cursor() query = """ SELECT * FROM forum """ cursor.execute(query) for forum in cursor: builtForum = { "id": forum[0], "title": forum[1], "description": forum[2], } forums += [builtForum] return forums def polarityReplies(forum=None): '''Returns a list of replies containing the source, destination, polarity, timestamp and forum id''' replies = [] with sqlite3.connect(databasePath) as connection: cursor = connection.cursor() query = """ SELECT r.fkfrom, r.fkto, m.polarity, m.timestamp, f.id FROM reply as r INNER JOIN threadmessage as m ON r.fkthreadmessage=m.id INNER JOIN forumthread as t ON m.fkforumthread=t.id INNER JOIN forum as f ON t.fkparentforum=f.id """ if forum is not None: query += "WHERE f.id=" + str(forum) cursor.execute(query) for reply in cursor: builtReply = { "from": reply[0], "to": reply[1], "polarity": reply[2], "timestamp": reply[3], "forum": reply[4] } replies += [builtReply] cursor.close() return replies def countUserReplies(): with sqlite3.connect(databasePath) as connection: cursor = connection.cursor() query = "SELECT * FROM reply" cursor.execute(query) for reply in cursor: countReply(reply) cursor.close() def countReply(reply): global userRepliesCounts fromUser = reply[0] toUser = reply[1] # discussion = reply[2] fromTo = (fromUser, toUser) try: userRepliesCounts[fromTo] += 1 except KeyError: userRepliesCounts[fromTo] = 1 def createRepliesGraph(): global graph1 for fromTo, w in userRepliesCounts.items(): graph1.add_edge(fromTo[0], fromTo[1], weight=w) def buildUserParticipations(): global userParticipations with sqlite3.connect(databasePath) as connection: cursor = connection.cursor() query = "SELECT * FROM threadmessage" cursor.execute(query) for threadMessage in cursor: forumThread = threadMessage[2] user = threadMessage[3] userThreadTuple = (user, forumThread) userParticipations += [userThreadTuple] cursor.close() def createParticipationGraph(): global graph2 users = [x[0] for x in userParticipations] discussions = [x[1] for x in userParticipations] graph2.add_nodes_from(users, bipartite=0) graph2.add_nodes_from(discussions, bipartite=1) graph2.add_edges_from(userParticipations) def saveGraphs(): gml.write_gml(graph1, graph1Path) gml.write_gml(graph2, graph2Path) def drawGraph(graph, filename, dpi): pos=nx.spring_layout(graph) # pos = nx.shell_layout(graph) # pos = nx.graphviz_layout(graph) nx.draw(graph, pos=pos) plt.savefig(filename, dpi=dpi) # save as png if __name__ == "__main__": countUserReplies() createRepliesGraph() buildUserParticipations() createParticipationGraph() saveGraphs() print(len(graph1.nodes())) print(len(graph2.nodes())) print(polarityReplies(forum=1)) print(getForums()) drawGraph(graph1, "g1.png", 180)
ajibawa-2023/Python-Code-Large/train/row_1080
93
200
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.015, 0.025, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''\nCreated on 23 mars 2013\n\n@author: Nils Amiet\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 19], "level": 0, "parent": null, "vector": [8, 0, 0.07, 0.055, 0, 0.66, 0.037, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''\nGraph 1:\nReplies graph\nWeighted directed graph\nWeight of edge from A to B = number of replies from user A to user B\n\nGraph 2:\nUser-Discussion graph"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Import_L21_C0", "label": "networkx import nx", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.105, 0.005, 0, 0.66, 0.0741, 691, 0, 1, 0, 0, 691, 0, 0], "semantic": {"name": "networkx", "arg_names": [], "import_names": ["nx"], "rhs_call_name": "", "annotation": ""}, "snippet": "import networkx as nx"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Import_L22_C0", "label": "networkx.readwrite.gml import gml", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.11, 0.005, 0, 0.66, 0.1111, 599, 0, 1, 0, 0, 599, 0, 0], "semantic": {"name": "networkx.readwrite.gml", "arg_names": [], "import_names": ["gml"], "rhs_call_name": "", "annotation": ""}, "snippet": "import networkx.readwrite.gml as gml"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Import_L23_C0", "label": "sqlite3 import sqlite3", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.115, 0.005, 0, 0.66, 0.1481, 790, 0, 1, 0, 0, 790, 0, 0], "semantic": {"name": "sqlite3", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Import_L24_C0", "label": "random import random", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.12, 0.005, 0, 0.66, 0.1852, 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_1080:Import_L25_C0", "label": "matplotlib import matplotlib", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.005, 0, 0.66, 0.2222, 75, 0, 1, 0, 0, 75, 0, 0], "semantic": {"name": "matplotlib", "arg_names": [], "import_names": ["matplotlib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import matplotlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L26_C0", "label": "use()", "type": "expression", "loc": [26, 26], "level": 0, "parent": null, "vector": [8, 0, 0.13, 0.005, 0, 0.66, 0.2593, 906, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "use", "arg_names": [], "import_names": [], "rhs_call_name": "use", "annotation": ""}, "snippet": "matplotlib.use(\"Agg\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Import_L27_C0", "label": "matplotlib.pyplot import plt", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.135, 0.005, 0, 0.66, 0.2963, 596, 0, 1, 0, 0, 596, 0, 0], "semantic": {"name": "matplotlib.pyplot", "arg_names": [], "import_names": ["plt"], "rhs_call_name": "", "annotation": ""}, "snippet": "import matplotlib.pyplot as plt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L29_C0", "label": "expression", "type": "expression", "loc": [29, 29], "level": 0, "parent": null, "vector": [8, 0, 0.145, 0.005, 0, 0.66, 0.3333, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''Config'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L30_C0", "label": "databasePath =", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.15, 0.005, 0, 0.66, 0.3704, 313, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "databasePath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "databasePath = \"../../../../../InfrarougeGrabber/infrarouge.db\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L31_C0", "label": "graph1Path =", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.155, 0.005, 0, 0.66, 0.4074, 913, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "graph1Path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "graph1Path = \"graph1.gml\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L32_C0", "label": "graph2Path =", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.16, 0.005, 0, 0.66, 0.4444, 421, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "graph2Path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "graph2Path = \"graph2.gml\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L35_C0", "label": "userRepliesCounts =", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 0.175, 0.005, 0, 0.66, 0.4815, 161, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "userRepliesCounts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "userRepliesCounts = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L36_C0", "label": "graph1 = DiGraph()", "type": "assigned_variable", "loc": [36, 36], "level": 0, "parent": null, "vector": [14, 0, 0.18, 0.005, 0, 0.66, 0.5185, 982, 3, 0, 0, 0, 22, 10, 1], "semantic": {"name": "graph1", "arg_names": [], "import_names": [], "rhs_call_name": "DiGraph", "annotation": ""}, "snippet": "graph1 = nx.DiGraph()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L38_C0", "label": "userParticipations =", "type": "assigned_variable", "loc": [38, 38], "level": 0, "parent": null, "vector": [14, 0, 0.19, 0.005, 0, 0.66, 0.5556, 773, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "userParticipations", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "userParticipations = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L39_C0", "label": "graph2 = Graph()", "type": "assigned_variable", "loc": [39, 39], "level": 0, "parent": null, "vector": [14, 0, 0.195, 0.005, 0, 0.66, 0.5926, 11, 3, 0, 0, 0, 90, 10, 1], "semantic": {"name": "graph2", "arg_names": [], "import_names": [], "rhs_call_name": "Graph", "annotation": ""}, "snippet": "graph2 = nx.Graph()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L41_C0", "label": "users", "type": "function", "loc": [41, 55], "level": 0, "parent": null, "vector": [2, 0, 0.24, 0.075, 0, 0.66, 0.6296, 395, 0, 0, 1, 0, 0, 0, 4], "semantic": {"name": "users", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def users():\n users = []\n \n with sqlite3.connect(databasePath) as connection:\n cursor = connection.cursor()\n \n query = \"SELECT * FROM user\"\n cursor.execute(query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L42_C4", "label": "users =", "type": "assigned_variable", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L41_C0", "vector": [14, 1, 0.21, 0.005, 1, 0.15, 0.0, 395, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "users", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " users = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L45_C8", "label": "cursor = cursor()", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L41_C0", "vector": [14, 1, 0.225, 0.005, 1, 0.15, 0.0, 231, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cursor", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cursor = connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L47_C8", "label": "query =", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L41_C0", "vector": [14, 1, 0.235, 0.005, 1, 0.15, 0.25, 546, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query = \"SELECT * FROM user\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L48_C8", "label": "execute()", "type": "expression", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L41_C0", "vector": [8, 1, 0.24, 0.005, 1, 0.15, 0.5, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cursor.execute(query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L50_C8", "label": "for user", "type": "for", "loc": [50, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L41_C0", "vector": [6, 1, 0.2525, 0.01, 1, 0.15, 0.75, 503, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for user in cursor:\n users += [user]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L53_C8", "label": "close()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L41_C0", "vector": [8, 1, 0.265, 0.005, 1, 0.15, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cursor.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Return_L55_C4", "label": "return", "type": "return", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L41_C0", "vector": [13, 1, 0.275, 0.005, 1, 0.15, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return users"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L57_C0", "label": "getForums", "type": "function", "loc": [57, 77], "level": 0, "parent": null, "vector": [2, 0, 0.335, 0.105, 0, 0.66, 0.6667, 929, 0, 0, 1, 0, 0, 0, 3], "semantic": {"name": "getForums", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getForums():\n forums = []\n \n with sqlite3.connect(databasePath) as connection:\n cursor = connection.cursor()\n \n query = \"\"\"\n SELECT *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L58_C4", "label": "forums =", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L57_C0", "vector": [14, 1, 0.29, 0.005, 1, 0.71, 0.0, 763, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "forums", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " forums = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L61_C8", "label": "cursor = cursor()", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L57_C0", "vector": [14, 1, 0.305, 0.005, 1, 0.71, 0.0, 231, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cursor", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cursor = connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L63_C8", "label": "query =", "type": "assigned_variable", "loc": [63, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L57_C0", "vector": [14, 1, 0.3225, 0.02, 1, 0.71, 0.3333, 546, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query = \"\"\"\n SELECT *\n FROM forum\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L68_C8", "label": "execute()", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L57_C0", "vector": [8, 1, 0.34, 0.005, 1, 0.71, 0.6667, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cursor.execute(query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L69_C8", "label": "for forum", "type": "for", "loc": [69, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L57_C0", "vector": [6, 1, 0.36, 0.035, 1, 0.71, 1.0, 659, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "forum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for forum in cursor:\n builtForum = {\n \"id\": forum[0],\n \"title\": forum[1],\n \"description\": forum[2],\n }\n forums += [builtForum]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L70_C12", "label": "builtForum =", "type": "assigned_variable", "loc": [70, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L69_C8", "vector": [14, 2, 0.36, 0.025, 2, 0.76, 0.0, 782, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "builtForum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " builtForum = {\n \"id\": forum[0],\n \"title\": forum[1],\n \"description\": forum[2],\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Return_L77_C4", "label": "return", "type": "return", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L57_C0", "vector": [13, 1, 0.385, 0.005, 1, 0.71, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return forums"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L79_C0", "label": "polarityReplies", "type": "function", "loc": [79, 114], "level": 0, "parent": null, "vector": [2, 0, 0.4825, 0.18, 0, 0.66, 0.7037, 533, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "polarityReplies", "arg_names": ["forum"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def polarityReplies(forum=None):\n '''Returns a list of replies containing the source, destination, polarity, timestamp and forum id'''\n replies = []\n \n with sqlite3.connect(databasePath) as connection:\n cursor = connection.cursor()\n \n query = \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L80_C4", "label": "expression", "type": "expression", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L79_C0", "vector": [8, 1, 0.4, 0.005, 1, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Returns a list of replies containing the source, destination, polarity, timestamp and forum id'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L81_C4", "label": "replies =", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L79_C0", "vector": [14, 1, 0.405, 0.005, 1, 0.98, 0.5, 205, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "replies", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " replies = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L84_C8", "label": "cursor = cursor()", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L79_C0", "vector": [14, 1, 0.42, 0.005, 1, 0.98, 0.0, 231, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cursor", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cursor = connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L86_C8", "label": "query =", "type": "assigned_variable", "loc": [86, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L79_C0", "vector": [14, 1, 0.4525, 0.05, 1, 0.98, 0.2, 546, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query = \"\"\"\n SELECT r.fkfrom, r.fkto, m.polarity, m.timestamp, f.id\n FROM reply as r\n INNER JOIN threadmessage as m\n ON r.fkthreadmessage=m.id\n INNER JOIN forumthread as t\n ON m.fkforumthread=t.id\n INNER JOIN forum as f"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L97_C8", "label": "if", "type": "if", "loc": [97, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L79_C0", "vector": [4, 1, 0.4875, 0.01, 1, 0.98, 0.4, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if forum is not None:\n query += \"WHERE f.id=\" + str(forum)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L99_C8", "label": "execute()", "type": "expression", "loc": [99, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L79_C0", "vector": [8, 1, 0.495, 0.005, 1, 0.98, 0.6, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cursor.execute(query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L101_C8", "label": "for reply", "type": "for", "loc": [101, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L79_C0", "vector": [6, 1, 0.5275, 0.05, 1, 0.98, 0.8, 714, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for reply in cursor:\n builtReply = {\n \"from\": reply[0],\n \"to\": reply[1],\n \"polarity\": reply[2],\n \"timestamp\": reply[3],\n \"forum\": reply[4]\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L102_C12", "label": "builtReply =", "type": "assigned_variable", "loc": [102, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L101_C8", "vector": [14, 2, 0.525, 0.035, 2, 0.67, 0.0, 248, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "builtReply", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " builtReply = {\n \"from\": reply[0],\n \"to\": reply[1],\n \"polarity\": reply[2],\n \"timestamp\": reply[3],\n \"forum\": reply[4]\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L112_C8", "label": "close()", "type": "expression", "loc": [112, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L79_C0", "vector": [8, 1, 0.56, 0.005, 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": " cursor.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Return_L114_C4", "label": "return", "type": "return", "loc": [114, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L79_C0", "vector": [13, 1, 0.57, 0.005, 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 replies"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L116_C0", "label": "countUserReplies", "type": "function", "loc": [116, 126], "level": 0, "parent": null, "vector": [2, 0, 0.605, 0.055, 0, 0.66, 0.7407, 442, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "countUserReplies", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def countUserReplies(): \n with sqlite3.connect(databasePath) as connection:\n cursor = connection.cursor()\n \n query = \"SELECT * FROM reply\"\n cursor.execute(query)\n \n for reply in cursor:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L118_C8", "label": "cursor = cursor()", "type": "assigned_variable", "loc": [118, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L116_C0", "vector": [14, 1, 0.59, 0.005, 1, 0.54, 0.0, 231, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cursor", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cursor = connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L120_C8", "label": "query =", "type": "assigned_variable", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L116_C0", "vector": [14, 1, 0.6, 0.005, 1, 0.54, 0.25, 546, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query = \"SELECT * FROM reply\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L121_C8", "label": "execute()", "type": "expression", "loc": [121, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L116_C0", "vector": [8, 1, 0.605, 0.005, 1, 0.54, 0.5, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cursor.execute(query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L123_C8", "label": "for reply", "type": "for", "loc": [123, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L116_C0", "vector": [6, 1, 0.6175, 0.01, 1, 0.54, 0.75, 714, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for reply in cursor:\n countReply(reply)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L124_C12", "label": "countReply()", "type": "expression", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L123_C8", "vector": [8, 2, 0.62, 0.005, 2, 0.4, 0.0, 168, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "countReply", "arg_names": [], "import_names": [], "rhs_call_name": "countReply", "annotation": ""}, "snippet": " countReply(reply)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L126_C8", "label": "close()", "type": "expression", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L116_C0", "vector": [8, 1, 0.63, 0.005, 1, 0.54, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cursor.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L128_C0", "label": "countReply", "type": "function", "loc": [128, 139], "level": 0, "parent": null, "vector": [2, 0, 0.6675, 0.06, 0, 0.66, 0.7778, 168, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "countReply", "arg_names": ["reply"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def countReply(reply):\n global userRepliesCounts\n \n fromUser = reply[0]\n toUser = reply[1]\n# discussion = reply[2]\n \n fromTo = (fromUser, toUser)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L131_C4", "label": "fromUser =", "type": "assigned_variable", "loc": [131, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L128_C0", "vector": [14, 1, 0.655, 0.005, 1, 0.59, 0.0, 820, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fromUser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fromUser = reply[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L132_C4", "label": "toUser =", "type": "assigned_variable", "loc": [132, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L128_C0", "vector": [14, 1, 0.66, 0.005, 1, 0.59, 0.3333, 343, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "toUser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " toUser = reply[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L135_C4", "label": "fromTo =", "type": "assigned_variable", "loc": [135, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L128_C0", "vector": [14, 1, 0.675, 0.005, 1, 0.59, 0.6667, 933, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "fromTo", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fromTo = (fromUser, toUser)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Try_L136_C4", "label": "try", "type": "try", "loc": [136, 139], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L128_C0", "vector": [7, 1, 0.6875, 0.02, 1, 0.59, 1.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n userRepliesCounts[fromTo] += 1\n except KeyError:\n userRepliesCounts[fromTo] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L139_C8", "label": "assign", "type": "assigned_variable", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:Try_L136_C4", "vector": [14, 2, 0.695, 0.005, 2, 0.87, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userRepliesCounts[fromTo] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L141_C0", "label": "createRepliesGraph", "type": "function", "loc": [141, 145], "level": 0, "parent": null, "vector": [2, 0, 0.715, 0.025, 0, 0.66, 0.8148, 793, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "createRepliesGraph", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def createRepliesGraph():\n global graph1\n \n for fromTo, w in userRepliesCounts.items():\n graph1.add_edge(fromTo[0], fromTo[1], weight=w)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L144_C4", "label": "for fromTo, w", "type": "for", "loc": [144, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L141_C0", "vector": [6, 1, 0.7225, 0.01, 1, 0.01, 0.0, 777, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "fromTo, w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for fromTo, w in userRepliesCounts.items():\n graph1.add_edge(fromTo[0], fromTo[1], weight=w)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L145_C8", "label": "add_edge()", "type": "expression", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L144_C4", "vector": [8, 2, 0.725, 0.005, 2, 0.69, 0.0, 76, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "add_edge", "arg_names": [], "import_names": [], "rhs_call_name": "add_edge", "annotation": ""}, "snippet": " graph1.add_edge(fromTo[0], fromTo[1], weight=w)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L147_C0", "label": "buildUserParticipations", "type": "function", "loc": [147, 162], "level": 0, "parent": null, "vector": [2, 0, 0.7725, 0.08, 0, 0.66, 0.8519, 953, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "buildUserParticipations", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def buildUserParticipations():\n global userParticipations\n \n with sqlite3.connect(databasePath) as connection:\n cursor = connection.cursor()\n \n query = \"SELECT * FROM threadmessage\"\n cursor.execute(query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L151_C8", "label": "cursor = cursor()", "type": "assigned_variable", "loc": [151, 151], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L147_C0", "vector": [14, 1, 0.755, 0.005, 1, 0.58, 0.0, 231, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cursor", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cursor = connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L153_C8", "label": "query =", "type": "assigned_variable", "loc": [153, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L147_C0", "vector": [14, 1, 0.765, 0.005, 1, 0.58, 0.25, 546, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query = \"SELECT * FROM threadmessage\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L154_C8", "label": "execute()", "type": "expression", "loc": [154, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L147_C0", "vector": [8, 1, 0.77, 0.005, 1, 0.58, 0.5, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cursor.execute(query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L156_C8", "label": "for threadMessage", "type": "for", "loc": [156, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L147_C0", "vector": [6, 1, 0.79, 0.025, 1, 0.58, 0.75, 465, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "threadMessage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for threadMessage in cursor:\n forumThread = threadMessage[2]\n user = threadMessage[3]\n userThreadTuple = (user, forumThread)\n userParticipations += [userThreadTuple]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L157_C12", "label": "forumThread =", "type": "assigned_variable", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L156_C8", "vector": [14, 2, 0.785, 0.005, 2, 0.66, 0.0, 696, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "forumThread", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " forumThread = threadMessage[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L158_C12", "label": "user =", "type": "assigned_variable", "loc": [158, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L156_C8", "vector": [14, 2, 0.79, 0.005, 2, 0.66, 0.5, 503, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user = threadMessage[3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L159_C12", "label": "userThreadTuple =", "type": "assigned_variable", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L156_C8", "vector": [14, 2, 0.795, 0.005, 2, 0.66, 1.0, 870, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "userThreadTuple", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userThreadTuple = (user, forumThread)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L162_C8", "label": "close()", "type": "expression", "loc": [162, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L147_C0", "vector": [8, 1, 0.81, 0.005, 1, 0.58, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cursor.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L164_C0", "label": "createParticipationGraph", "type": "function", "loc": [164, 172], "level": 0, "parent": null, "vector": [2, 0, 0.84, 0.045, 0, 0.66, 0.8889, 506, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "createParticipationGraph", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def createParticipationGraph():\n global graph2\n \n users = [x[0] for x in userParticipations]\n discussions = [x[1] for x in userParticipations]\n\n graph2.add_nodes_from(users, bipartite=0)\n graph2.add_nodes_from(discussions, bipartite=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L167_C4", "label": "users =", "type": "assigned_variable", "loc": [167, 167], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L164_C0", "vector": [14, 1, 0.835, 0.005, 1, 0.95, 0.0, 395, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "users", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " users = [x[0] for x in userParticipations]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L168_C4", "label": "discussions =", "type": "assigned_variable", "loc": [168, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L164_C0", "vector": [14, 1, 0.84, 0.005, 1, 0.95, 0.25, 842, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "discussions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " discussions = [x[1] for x in userParticipations]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L170_C4", "label": "add_nodes_from()", "type": "expression", "loc": [170, 170], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L164_C0", "vector": [8, 1, 0.85, 0.005, 1, 0.95, 0.5, 221, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "add_nodes_from", "arg_names": [], "import_names": [], "rhs_call_name": "add_nodes_from", "annotation": ""}, "snippet": " graph2.add_nodes_from(users, bipartite=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L171_C4", "label": "add_nodes_from()", "type": "expression", "loc": [171, 171], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L164_C0", "vector": [8, 1, 0.855, 0.005, 1, 0.95, 0.75, 221, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "add_nodes_from", "arg_names": [], "import_names": [], "rhs_call_name": "add_nodes_from", "annotation": ""}, "snippet": " graph2.add_nodes_from(discussions, bipartite=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L172_C4", "label": "add_edges_from()", "type": "expression", "loc": [172, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L164_C0", "vector": [8, 1, 0.86, 0.005, 1, 0.95, 1.0, 574, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add_edges_from", "arg_names": [], "import_names": [], "rhs_call_name": "add_edges_from", "annotation": ""}, "snippet": " graph2.add_edges_from(userParticipations)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L174_C0", "label": "saveGraphs", "type": "function", "loc": [174, 176], "level": 0, "parent": null, "vector": [2, 0, 0.875, 0.015, 0, 0.66, 0.9259, 343, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "saveGraphs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def saveGraphs():\n gml.write_gml(graph1, graph1Path)\n gml.write_gml(graph2, graph2Path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L175_C4", "label": "write_gml()", "type": "expression", "loc": [175, 175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L174_C0", "vector": [8, 1, 0.875, 0.005, 1, 0.86, 0.0, 446, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "write_gml", "arg_names": [], "import_names": [], "rhs_call_name": "write_gml", "annotation": ""}, "snippet": " gml.write_gml(graph1, graph1Path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L176_C4", "label": "write_gml()", "type": "expression", "loc": [176, 176], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L174_C0", "vector": [8, 1, 0.88, 0.005, 1, 0.86, 1.0, 446, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "write_gml", "arg_names": [], "import_names": [], "rhs_call_name": "write_gml", "annotation": ""}, "snippet": " gml.write_gml(graph2, graph2Path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L178_C0", "label": "drawGraph", "type": "function", "loc": [178, 183], "level": 0, "parent": null, "vector": [2, 0, 0.9025, 0.03, 0, 0.66, 0.963, 370, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "drawGraph", "arg_names": ["graph", "filename", "dpi"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def drawGraph(graph, filename, dpi):\n pos=nx.spring_layout(graph)\n# pos = nx.shell_layout(graph)\n# pos = nx.graphviz_layout(graph)\n nx.draw(graph, pos=pos)\n plt.savefig(filename, dpi=dpi) # save as png"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L179_C4", "label": "pos = spring_layout()", "type": "assigned_variable", "loc": [179, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L178_C0", "vector": [14, 1, 0.895, 0.005, 1, 0.93, 0.0, 627, 3, 1, 0, 0, 891, 10, 1], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "spring_layout", "annotation": ""}, "snippet": " pos=nx.spring_layout(graph)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L182_C4", "label": "draw()", "type": "expression", "loc": [182, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L178_C0", "vector": [8, 1, 0.91, 0.005, 1, 0.93, 0.5, 920, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "draw", "arg_names": [], "import_names": [], "rhs_call_name": "draw", "annotation": ""}, "snippet": " nx.draw(graph, pos=pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L183_C4", "label": "savefig()", "type": "expression", "loc": [183, 183], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L178_C0", "vector": [8, 1, 0.915, 0.005, 1, 0.93, 1.0, 677, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "savefig", "arg_names": [], "import_names": [], "rhs_call_name": "savefig", "annotation": ""}, "snippet": " plt.savefig(filename, dpi=dpi) # save as png"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L185_C0", "label": "if", "type": "if", "loc": [185, 200], "level": 0, "parent": null, "vector": [4, 0, 0.9625, 0.08, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 16], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n countUserReplies()\n createRepliesGraph()\n \n buildUserParticipations()\n createParticipationGraph()\n\n saveGraphs()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L186_C4", "label": "countUserReplies()", "type": "expression", "loc": [186, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L185_C0", "vector": [8, 1, 0.93, 0.005, 1, 0.29, 0.0, 442, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "countUserReplies", "arg_names": [], "import_names": [], "rhs_call_name": "countUserReplies", "annotation": ""}, "snippet": " countUserReplies()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L187_C4", "label": "createRepliesGraph()", "type": "expression", "loc": [187, 187], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L185_C0", "vector": [8, 1, 0.935, 0.005, 1, 0.29, 0.1111, 793, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "createRepliesGraph", "arg_names": [], "import_names": [], "rhs_call_name": "createRepliesGraph", "annotation": ""}, "snippet": " createRepliesGraph()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L189_C4", "label": "buildUserParticipations()", "type": "expression", "loc": [189, 189], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L185_C0", "vector": [8, 1, 0.945, 0.005, 1, 0.29, 0.2222, 953, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "buildUserParticipations", "arg_names": [], "import_names": [], "rhs_call_name": "buildUserParticipations", "annotation": ""}, "snippet": " buildUserParticipations()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L190_C4", "label": "createParticipationGraph()", "type": "expression", "loc": [190, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L185_C0", "vector": [8, 1, 0.95, 0.005, 1, 0.29, 0.3333, 506, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "createParticipationGraph", "arg_names": [], "import_names": [], "rhs_call_name": "createParticipationGraph", "annotation": ""}, "snippet": " createParticipationGraph()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L192_C4", "label": "saveGraphs()", "type": "expression", "loc": [192, 192], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L185_C0", "vector": [8, 1, 0.96, 0.005, 1, 0.29, 0.4444, 343, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "saveGraphs", "arg_names": [], "import_names": [], "rhs_call_name": "saveGraphs", "annotation": ""}, "snippet": " saveGraphs()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L194_C4", "label": "print()", "type": "expression", "loc": [194, 194], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L185_C0", "vector": [8, 1, 0.97, 0.005, 1, 0.29, 0.5556, 535, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(len(graph1.nodes()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L195_C4", "label": "print()", "type": "expression", "loc": [195, 195], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L185_C0", "vector": [8, 1, 0.975, 0.005, 1, 0.29, 0.6667, 535, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(len(graph2.nodes()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L197_C4", "label": "print()", "type": "expression", "loc": [197, 197], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L185_C0", "vector": [8, 1, 0.985, 0.005, 1, 0.29, 0.7778, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(polarityReplies(forum=1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L198_C4", "label": "print()", "type": "expression", "loc": [198, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L185_C0", "vector": [8, 1, 0.99, 0.005, 1, 0.29, 0.8889, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(getForums())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L200_C4", "label": "drawGraph()", "type": "expression", "loc": [200, 200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L185_C0", "vector": [8, 1, 1.0, 0.005, 1, 0.29, 1.0, 370, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "drawGraph", "arg_names": [], "import_names": [], "rhs_call_name": "drawGraph", "annotation": ""}, "snippet": " drawGraph(graph1, \"g1.png\", 180)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Return_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L69_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L70_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Return_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L102_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Return_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L124_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Try_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:Try_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L141_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L156_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L157_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L156_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L158_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:For_L156_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L159_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L164_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L167_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L164_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L164_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L164_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L171_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L164_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L174_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L174_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L178_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Assign_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L178_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:FunctionDef_L178_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L187_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L190_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L194_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1080:If_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1080:Expr_L200_C4"}]
''' Created on 23 mai 2013 @author: Nils Amiet ''' # coding: utf-8 class PolarityCounter: polarityCounts = {} RECEIVED = "recv" SENT = "sent" AVERAGE = "avg" NDI = -1 # network disagreement index def __init__(self, replies): ''' Replies: a list of replies with the attributes "from", "to" and "polarity" ''' self.replies = replies self.edges = [] self.countPolarities() self.computeAveragePolarities() self.computeNDI() def countPolarities(self): for reply in self.replies: fromUser = reply["from"] toUser = reply["to"] polarity = reply["polarity"] polarity = 0 if polarity <= 0 else 1 try: fromUserCounts = self.polarityCounts[fromUser][self.SENT] except KeyError: self.polarityCounts[fromUser] = {self.RECEIVED : {}, self.SENT: {}, self.AVERAGE: None} fromUserCounts = self.polarityCounts[fromUser][self.SENT] try: toUserCounts = self.polarityCounts[toUser][self.RECEIVED] except KeyError: self.polarityCounts[toUser] = {self.RECEIVED : {}, self.SENT: {}, self.AVERAGE: None} toUserCounts = self.polarityCounts[toUser][self.RECEIVED] try: fromUserCounts[polarity] += 1 except: fromUserCounts[polarity] = 1 try: toUserCounts[polarity] += 1 except: toUserCounts[polarity] = 1 def computeAveragePolarities(self): for user, userCounts in self.polarityCounts.items(): try: receivedPositive = userCounts[self.RECEIVED][1] except: receivedPositive = 0 try: receivedNegative = userCounts[self.RECEIVED][0] except: receivedNegative = 0 try: sentPositive = userCounts[self.SENT][1] except: sentPositive = 0 try: sentNegative = userCounts[self.SENT][0] except: sentNegative = 0 try: recv = (receivedPositive - receivedNegative) / float(receivedPositive + receivedNegative) except: pass # user never received a message try: sent = (sentPositive - sentNegative) / float(sentPositive + sentNegative) except: pass # user never sent a message try: userCounts[self.AVERAGE] = abs(recv - sent) except: pass # user never received or sent a message def computeNDI(self): self.computeEdges() sumNDI = 0 for edge in self.edges: weight = 1 firstUser = edge["from"] secondUser = edge["to"] try: firstUserOpinion = self.polarityCounts[firstUser][self.AVERAGE] / float(2) except: firstUserOpinion = 0 try: secondUserOpinion = self.polarityCounts[secondUser][self.AVERAGE] / float(2) except: secondUserOpinion = 0 # print (firstUserOpinion, secondUserOpinion) increment = weight * ((firstUserOpinion - secondUserOpinion)**2) sumNDI += increment # print("NDI=" + str(sumNDI) + " (+ " + str(increment) + ")") self.NDI = sumNDI def computeEdges(self): for reply in self.replies: fromUser = reply["from"] toUser = reply["to"] if not self.contains(reply, self.edges): self.edges += [reply] def contains(self, reply, edges): for edge in edges: if self.isSameMessage(reply, edge): return True return False def isSameMessage(self, reply, reply2): return reply["from"] == reply2["from"] and reply["to"] == reply2["to"] or reply["from"] == reply2["to"] and reply["to"] == reply2["from"] def polarityDifferenceRanking(self): users = {user: userCounts[self.AVERAGE] for user, userCounts in self.polarityCounts.items() if not userCounts[self.AVERAGE] == None} print(users) ranking = sorted(users.items(), key=lambda x: x[1], reverse=True) print(ranking) return ranking if __name__ == "__main__": r1 = {"from": 4, "to": 5, "polarity": 1} r2 = {"from": 5, "to": 4, "polarity": 1} r3 = {"from": 4, "to": 2, "polarity": 0} replies = [r1, r2, r3] polarityCounter = PolarityCounter(replies) print(polarityCounter.polarityCounts) polarityCounter.polarityDifferenceRanking()
ajibawa-2023/Python-Code-Large/train/row_1081
93
146
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0205, 0.0342, 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 23 mai 2013\n\n@author: Nils Amiet\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "label": "PolarityCounter", "type": "class", "loc": [9, 136], "level": 0, "parent": null, "vector": [3, 0, 0.4966, 0.8767, 0, 0.66, 0.5, 151, 0, 8, 0, 0, 0, 0, 17], "semantic": {"name": "PolarityCounter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PolarityCounter:\n \n polarityCounts = {}\n RECEIVED = \"recv\"\n SENT = \"sent\"\n AVERAGE = \"avg\"\n NDI = -1 # network disagreement index\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L11_C4", "label": "polarityCounts =", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "vector": [14, 1, 0.0753, 0.0068, 1, 0.22, 0.0, 540, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "polarityCounts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " polarityCounts = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L12_C4", "label": "RECEIVED =", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "vector": [14, 1, 0.0822, 0.0068, 1, 0.22, 0.0833, 640, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "RECEIVED", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " RECEIVED = \"recv\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L13_C4", "label": "SENT =", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "vector": [14, 1, 0.089, 0.0068, 1, 0.22, 0.1667, 217, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SENT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " SENT = \"sent\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L14_C4", "label": "AVERAGE =", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "vector": [14, 1, 0.0959, 0.0068, 1, 0.22, 0.25, 795, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "AVERAGE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " AVERAGE = \"avg\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L15_C4", "label": "NDI =", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "vector": [14, 1, 0.1027, 0.0068, 1, 0.22, 0.3333, 225, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "NDI", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " NDI = -1 # network disagreement index"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L17_C4", "label": "__init__", "type": "function", "loc": [17, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "vector": [2, 1, 0.1438, 0.0616, 1, 0.22, 0.4167, 555, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "replies"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, replies):\n '''\n Replies: a list of replies with the attributes \"from\", \"to\" and \"polarity\"\n '''\n self.replies = replies\n self.edges = []\n self.countPolarities()\n self.computeAveragePolarities()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Expr_L18_C8", "label": "expression", "type": "expression", "loc": [18, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L17_C4", "vector": [8, 2, 0.1301, 0.0205, 2, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Replies: a list of replies with the attributes \"from\", \"to\" and \"polarity\"\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L21_C8", "label": "self.replies =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L17_C4", "vector": [14, 2, 0.1438, 0.0068, 2, 0.59, 0.2, 50, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.replies", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.replies = replies"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L22_C8", "label": "self.edges =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L17_C4", "vector": [14, 2, 0.1507, 0.0068, 2, 0.59, 0.4, 911, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.edges", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.edges = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Expr_L23_C8", "label": "countPolarities()", "type": "expression", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L17_C4", "vector": [8, 2, 0.1575, 0.0068, 2, 0.59, 0.6, 6, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "countPolarities", "arg_names": [], "import_names": [], "rhs_call_name": "countPolarities", "annotation": ""}, "snippet": " self.countPolarities()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Expr_L24_C8", "label": "computeAveragePolarities()", "type": "expression", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L17_C4", "vector": [8, 2, 0.1644, 0.0068, 2, 0.59, 0.8, 836, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "computeAveragePolarities", "arg_names": [], "import_names": [], "rhs_call_name": "computeAveragePolarities", "annotation": ""}, "snippet": " self.computeAveragePolarities()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Expr_L25_C8", "label": "computeNDI()", "type": "expression", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L17_C4", "vector": [8, 2, 0.1712, 0.0068, 2, 0.59, 1.0, 850, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "computeNDI", "arg_names": [], "import_names": [], "rhs_call_name": "computeNDI", "annotation": ""}, "snippet": " self.computeNDI()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L27_C4", "label": "countPolarities", "type": "function", "loc": [27, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "vector": [2, 1, 0.2774, 0.1918, 1, 0.22, 0.5, 6, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "countPolarities", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def countPolarities(self):\n for reply in self.replies:\n fromUser = reply[\"from\"]\n toUser = reply[\"to\"]\n polarity = reply[\"polarity\"]\n polarity = 0 if polarity <= 0 else 1\n \n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L28_C8", "label": "for reply", "type": "for", "loc": [28, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L27_C4", "vector": [6, 2, 0.2808, 0.1849, 2, 0.67, 0.0, 714, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for reply in self.replies:\n fromUser = reply[\"from\"]\n toUser = reply[\"to\"]\n polarity = reply[\"polarity\"]\n polarity = 0 if polarity <= 0 else 1\n \n try:\n fromUserCounts = self.polarityCounts[fromUser][self.SENT]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L29_C12", "label": "fromUser =", "type": "assigned_variable", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L28_C8", "vector": [14, 3, 0.1986, 0.0068, 3, 0.62, 0.0, 820, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fromUser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fromUser = reply[\"from\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L30_C12", "label": "toUser =", "type": "assigned_variable", "loc": [30, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L28_C8", "vector": [14, 3, 0.2055, 0.0068, 3, 0.62, 0.1429, 343, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "toUser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " toUser = reply[\"to\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L31_C12", "label": "polarity =", "type": "assigned_variable", "loc": [31, 31], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L28_C8", "vector": [14, 3, 0.2123, 0.0068, 3, 0.62, 0.2857, 487, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "polarity", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " polarity = reply[\"polarity\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L32_C12", "label": "polarity =", "type": "assigned_variable", "loc": [32, 32], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L28_C8", "vector": [14, 3, 0.2192, 0.0068, 3, 0.62, 0.4286, 487, 8, 0, 0, 0, 0, 0, 0], "semantic": {"name": "polarity", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " polarity = 0 if polarity <= 0 else 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L34_C12", "label": "try", "type": "try", "loc": [34, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L28_C8", "vector": [7, 3, 0.2466, 0.0342, 3, 0.62, 0.5714, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n fromUserCounts = self.polarityCounts[fromUser][self.SENT]\n except KeyError:\n self.polarityCounts[fromUser] = {self.RECEIVED : {}, self.SENT: {}, self.AVERAGE: None}\n fromUserCounts = self.polarityCounts[fromUser][self.SENT]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L35_C16", "label": "fromUserCounts =", "type": "assigned_variable", "loc": [35, 35], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L34_C12", "vector": [14, 4, 0.2397, 0.0068, 4, 0.4, 0.0, 498, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fromUserCounts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fromUserCounts = self.polarityCounts[fromUser][self.SENT]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L37_C16", "label": "assign", "type": "assigned_variable", "loc": [37, 37], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L34_C12", "vector": [14, 4, 0.2534, 0.0068, 4, 0.4, 0.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.polarityCounts[fromUser] = {self.RECEIVED : {}, self.SENT: {}, self.AVERAGE: None}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L38_C16", "label": "fromUserCounts =", "type": "assigned_variable", "loc": [38, 38], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L34_C12", "vector": [14, 4, 0.2603, 0.0068, 4, 0.4, 1.0, 498, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fromUserCounts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fromUserCounts = self.polarityCounts[fromUser][self.SENT]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L40_C12", "label": "try", "type": "try", "loc": [40, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L28_C8", "vector": [7, 3, 0.2877, 0.0342, 3, 0.62, 0.7143, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n toUserCounts = self.polarityCounts[toUser][self.RECEIVED]\n except KeyError:\n self.polarityCounts[toUser] = {self.RECEIVED : {}, self.SENT: {}, self.AVERAGE: None}\n toUserCounts = self.polarityCounts[toUser][self.RECEIVED]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L41_C16", "label": "toUserCounts =", "type": "assigned_variable", "loc": [41, 41], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L40_C12", "vector": [14, 4, 0.2808, 0.0068, 4, 0.24, 0.0, 513, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "toUserCounts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " toUserCounts = self.polarityCounts[toUser][self.RECEIVED]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L43_C16", "label": "assign", "type": "assigned_variable", "loc": [43, 43], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L40_C12", "vector": [14, 4, 0.2945, 0.0068, 4, 0.24, 0.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.polarityCounts[toUser] = {self.RECEIVED : {}, self.SENT: {}, self.AVERAGE: None}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L44_C16", "label": "toUserCounts =", "type": "assigned_variable", "loc": [44, 44], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L40_C12", "vector": [14, 4, 0.3014, 0.0068, 4, 0.24, 1.0, 513, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "toUserCounts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " toUserCounts = self.polarityCounts[toUser][self.RECEIVED]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L46_C12", "label": "try", "type": "try", "loc": [46, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L28_C8", "vector": [7, 3, 0.3253, 0.0274, 3, 0.62, 0.8571, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n fromUserCounts[polarity] += 1\n except:\n fromUserCounts[polarity] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L49_C16", "label": "assign", "type": "assigned_variable", "loc": [49, 49], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L46_C12", "vector": [14, 4, 0.3356, 0.0068, 4, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fromUserCounts[polarity] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L51_C12", "label": "try", "type": "try", "loc": [51, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L28_C8", "vector": [7, 3, 0.3596, 0.0274, 3, 0.62, 1.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n toUserCounts[polarity] += 1\n except:\n toUserCounts[polarity] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L54_C16", "label": "assign", "type": "assigned_variable", "loc": [54, 54], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L51_C12", "vector": [14, 4, 0.3699, 0.0068, 4, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " toUserCounts[polarity] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L56_C4", "label": "computeAveragePolarities", "type": "function", "loc": [56, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "vector": [2, 1, 0.4829, 0.2055, 1, 0.22, 0.5833, 836, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "computeAveragePolarities", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def computeAveragePolarities(self): \n for user, userCounts in self.polarityCounts.items():\n try:\n receivedPositive = userCounts[self.RECEIVED][1]\n except:\n receivedPositive = 0\n try:\n receivedNegative = userCounts[self.RECEIVED][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L57_C8", "label": "for user, userCounts", "type": "for", "loc": [57, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L56_C4", "vector": [6, 2, 0.4863, 0.1986, 2, 0.88, 0.0, 452, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "user, userCounts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for user, userCounts in self.polarityCounts.items():\n try:\n receivedPositive = userCounts[self.RECEIVED][1]\n except:\n receivedPositive = 0\n try:\n receivedNegative = userCounts[self.RECEIVED][0]\n except:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L58_C12", "label": "try", "type": "try", "loc": [58, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L57_C8", "vector": [7, 3, 0.4075, 0.0274, 3, 0.26, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n receivedPositive = userCounts[self.RECEIVED][1]\n except:\n receivedPositive = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L59_C16", "label": "receivedPositive =", "type": "assigned_variable", "loc": [59, 59], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L58_C12", "vector": [14, 4, 0.4041, 0.0068, 4, 0.88, 0.0, 748, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "receivedPositive", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " receivedPositive = userCounts[self.RECEIVED][1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L61_C16", "label": "receivedPositive =", "type": "assigned_variable", "loc": [61, 61], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L58_C12", "vector": [14, 4, 0.4178, 0.0068, 4, 0.88, 0.0, 748, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "receivedPositive", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " receivedPositive = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L62_C12", "label": "try", "type": "try", "loc": [62, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L57_C8", "vector": [7, 3, 0.4349, 0.0274, 3, 0.26, 0.1667, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n receivedNegative = userCounts[self.RECEIVED][0]\n except:\n receivedNegative = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L63_C16", "label": "receivedNegative =", "type": "assigned_variable", "loc": [63, 63], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L62_C12", "vector": [14, 4, 0.4315, 0.0068, 4, 0.41, 0.0, 54, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "receivedNegative", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " receivedNegative = userCounts[self.RECEIVED][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L65_C16", "label": "receivedNegative =", "type": "assigned_variable", "loc": [65, 65], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L62_C12", "vector": [14, 4, 0.4452, 0.0068, 4, 0.41, 0.0, 54, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "receivedNegative", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " receivedNegative = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L66_C12", "label": "try", "type": "try", "loc": [66, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L57_C8", "vector": [7, 3, 0.4623, 0.0274, 3, 0.26, 0.3333, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n sentPositive = userCounts[self.SENT][1]\n except:\n sentPositive = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L67_C16", "label": "sentPositive =", "type": "assigned_variable", "loc": [67, 67], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L66_C12", "vector": [14, 4, 0.4589, 0.0068, 4, 0.05, 0.0, 158, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sentPositive", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sentPositive = userCounts[self.SENT][1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L69_C16", "label": "sentPositive =", "type": "assigned_variable", "loc": [69, 69], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L66_C12", "vector": [14, 4, 0.4726, 0.0068, 4, 0.05, 0.0, 158, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "sentPositive", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sentPositive = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L70_C12", "label": "try", "type": "try", "loc": [70, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L57_C8", "vector": [7, 3, 0.4897, 0.0274, 3, 0.26, 0.5, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n sentNegative = userCounts[self.SENT][0]\n except:\n sentNegative = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L71_C16", "label": "sentNegative =", "type": "assigned_variable", "loc": [71, 71], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L70_C12", "vector": [14, 4, 0.4863, 0.0068, 4, 0.91, 0.0, 381, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sentNegative", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sentNegative = userCounts[self.SENT][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L73_C16", "label": "sentNegative =", "type": "assigned_variable", "loc": [73, 73], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L70_C12", "vector": [14, 4, 0.5, 0.0068, 4, 0.91, 0.0, 381, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "sentNegative", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sentNegative = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L74_C12", "label": "try", "type": "try", "loc": [74, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L57_C8", "vector": [7, 3, 0.5171, 0.0274, 3, 0.26, 0.6667, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n recv = (receivedPositive - receivedNegative) / float(receivedPositive + receivedNegative)\n except:\n pass # user never received a message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L75_C16", "label": "recv =", "type": "assigned_variable", "loc": [75, 75], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L74_C12", "vector": [14, 4, 0.5137, 0.0068, 4, 0.99, 0.0, 178, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "recv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " recv = (receivedPositive - receivedNegative) / float(receivedPositive + receivedNegative)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L78_C12", "label": "try", "type": "try", "loc": [78, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L57_C8", "vector": [7, 3, 0.5445, 0.0274, 3, 0.26, 0.8333, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n sent = (sentPositive - sentNegative) / float(sentPositive + sentNegative)\n except:\n pass # user never sent a message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L79_C16", "label": "sent =", "type": "assigned_variable", "loc": [79, 79], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L78_C12", "vector": [14, 4, 0.5411, 0.0068, 4, 0.12, 0.0, 928, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sent = (sentPositive - sentNegative) / float(sentPositive + sentNegative)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L82_C12", "label": "try", "type": "try", "loc": [82, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L57_C8", "vector": [7, 3, 0.5719, 0.0274, 3, 0.26, 1.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n userCounts[self.AVERAGE] = abs(recv - sent)\n except:\n pass # user never received or sent a message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L83_C16", "label": " = abs()", "type": "assigned_variable", "loc": [83, 83], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L82_C12", "vector": [14, 4, 0.5685, 0.0068, 4, 0.78, 0.0, 0, 3, 1, 0, 0, 799, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "abs", "annotation": ""}, "snippet": " userCounts[self.AVERAGE] = abs(recv - sent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L87_C4", "label": "computeNDI", "type": "function", "loc": [87, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "vector": [2, 1, 0.6815, 0.1781, 1, 0.22, 0.6667, 850, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "computeNDI", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def computeNDI(self):\n self.computeEdges()\n \n sumNDI = 0\n for edge in self.edges:\n weight = 1\n firstUser = edge[\"from\"]\n secondUser = edge[\"to\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Expr_L88_C8", "label": "computeEdges()", "type": "expression", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L87_C4", "vector": [8, 2, 0.6027, 0.0068, 2, 0.62, 0.0, 846, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "computeEdges", "arg_names": [], "import_names": [], "rhs_call_name": "computeEdges", "annotation": ""}, "snippet": " self.computeEdges()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L90_C8", "label": "sumNDI =", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L87_C4", "vector": [14, 2, 0.6164, 0.0068, 2, 0.62, 0.3333, 251, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "sumNDI", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sumNDI = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L91_C8", "label": "for edge", "type": "for", "loc": [91, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L87_C4", "vector": [6, 2, 0.6815, 0.1233, 2, 0.62, 0.6667, 860, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "edge", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for edge in self.edges:\n weight = 1\n firstUser = edge[\"from\"]\n secondUser = edge[\"to\"]\n try:\n firstUserOpinion = self.polarityCounts[firstUser][self.AVERAGE] / float(2)\n except:\n firstUserOpinion = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L92_C12", "label": "weight =", "type": "assigned_variable", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L91_C8", "vector": [14, 3, 0.6301, 0.0068, 3, 0.61, 0.0, 205, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "weight", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " weight = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L93_C12", "label": "firstUser =", "type": "assigned_variable", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L91_C8", "vector": [14, 3, 0.637, 0.0068, 3, 0.61, 0.2, 77, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "firstUser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " firstUser = edge[\"from\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L94_C12", "label": "secondUser =", "type": "assigned_variable", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L91_C8", "vector": [14, 3, 0.6438, 0.0068, 3, 0.61, 0.4, 110, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "secondUser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " secondUser = edge[\"to\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L95_C12", "label": "try", "type": "try", "loc": [95, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L91_C8", "vector": [7, 3, 0.661, 0.0274, 3, 0.61, 0.6, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n firstUserOpinion = self.polarityCounts[firstUser][self.AVERAGE] / float(2)\n except:\n firstUserOpinion = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L96_C16", "label": "firstUserOpinion =", "type": "assigned_variable", "loc": [96, 96], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L95_C12", "vector": [14, 4, 0.6575, 0.0068, 4, 0.04, 0.0, 737, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "firstUserOpinion", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " firstUserOpinion = self.polarityCounts[firstUser][self.AVERAGE] / float(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L98_C16", "label": "firstUserOpinion =", "type": "assigned_variable", "loc": [98, 98], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L95_C12", "vector": [14, 4, 0.6712, 0.0068, 4, 0.04, 0.0, 737, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "firstUserOpinion", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " firstUserOpinion = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L100_C12", "label": "try", "type": "try", "loc": [100, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L91_C8", "vector": [7, 3, 0.6952, 0.0274, 3, 0.61, 0.8, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n secondUserOpinion = self.polarityCounts[secondUser][self.AVERAGE] / float(2)\n except:\n secondUserOpinion = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L101_C16", "label": "secondUserOpinion =", "type": "assigned_variable", "loc": [101, 101], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L100_C12", "vector": [14, 4, 0.6918, 0.0068, 4, 0.24, 0.0, 312, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "secondUserOpinion", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " secondUserOpinion = self.polarityCounts[secondUser][self.AVERAGE] / float(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L103_C16", "label": "secondUserOpinion =", "type": "assigned_variable", "loc": [103, 103], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L100_C12", "vector": [14, 4, 0.7055, 0.0068, 4, 0.24, 0.0, 312, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "secondUserOpinion", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " secondUserOpinion = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L107_C12", "label": "increment =", "type": "assigned_variable", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L91_C8", "vector": [14, 3, 0.7329, 0.0068, 3, 0.61, 1.0, 714, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "increment", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " increment = weight * ((firstUserOpinion - secondUserOpinion)**2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L112_C8", "label": "self.NDI =", "type": "assigned_variable", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L87_C4", "vector": [14, 2, 0.7671, 0.0068, 2, 0.62, 1.0, 969, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.NDI", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.NDI = sumNDI"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L114_C4", "label": "computeEdges", "type": "function", "loc": [114, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "vector": [2, 1, 0.8014, 0.0479, 1, 0.22, 0.75, 846, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "computeEdges", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def computeEdges(self):\n for reply in self.replies:\n fromUser = reply[\"from\"]\n toUser = reply[\"to\"]\n \n if not self.contains(reply, self.edges):\n self.edges += [reply]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L115_C8", "label": "for reply", "type": "for", "loc": [115, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L114_C4", "vector": [6, 2, 0.8048, 0.0411, 2, 0.82, 0.0, 714, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for reply in self.replies:\n fromUser = reply[\"from\"]\n toUser = reply[\"to\"]\n \n if not self.contains(reply, self.edges):\n self.edges += [reply]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L116_C12", "label": "fromUser =", "type": "assigned_variable", "loc": [116, 116], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L115_C8", "vector": [14, 3, 0.7945, 0.0068, 3, 0.21, 0.0, 820, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fromUser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fromUser = reply[\"from\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L117_C12", "label": "toUser =", "type": "assigned_variable", "loc": [117, 117], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L115_C8", "vector": [14, 3, 0.8014, 0.0068, 3, 0.21, 0.5, 343, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "toUser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " toUser = reply[\"to\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:If_L119_C12", "label": "if", "type": "if", "loc": [119, 120], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L115_C8", "vector": [4, 3, 0.8185, 0.0137, 3, 0.21, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.contains(reply, self.edges):\n self.edges += [reply]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L122_C4", "label": "contains", "type": "function", "loc": [122, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "vector": [2, 1, 0.8493, 0.0342, 1, 0.22, 0.8333, 848, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "contains", "arg_names": ["self", "reply", "edges"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def contains(self, reply, edges):\n for edge in edges:\n if self.isSameMessage(reply, edge):\n return True\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L123_C8", "label": "for edge", "type": "for", "loc": [123, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L122_C4", "vector": [6, 2, 0.8493, 0.0205, 2, 0.6, 0.0, 860, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "edge", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for edge in edges:\n if self.isSameMessage(reply, edge):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:If_L124_C12", "label": "if", "type": "if", "loc": [124, 125], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L123_C8", "vector": [4, 3, 0.8527, 0.0137, 3, 0.42, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.isSameMessage(reply, edge):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Return_L125_C16", "label": "return", "type": "return", "loc": [125, 125], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:If_L124_C12", "vector": [13, 4, 0.8562, 0.0068, 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 True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Return_L126_C8", "label": "return", "type": "return", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L122_C4", "vector": [13, 2, 0.863, 0.0068, 2, 0.6, 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_1081:FunctionDef_L128_C4", "label": "isSameMessage", "type": "function", "loc": [128, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "vector": [2, 1, 0.8801, 0.0137, 1, 0.22, 0.9167, 950, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "isSameMessage", "arg_names": ["self", "reply", "reply2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def isSameMessage(self, reply, reply2):\n return reply[\"from\"] == reply2[\"from\"] and reply[\"to\"] == reply2[\"to\"] or reply[\"from\"] == reply2[\"to\"] and reply[\"to\"] == reply2[\"from\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Return_L129_C8", "label": "return", "type": "return", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L128_C4", "vector": [13, 2, 0.8836, 0.0068, 2, 0.64, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return reply[\"from\"] == reply2[\"from\"] and reply[\"to\"] == reply2[\"to\"] or reply[\"from\"] == reply2[\"to\"] and reply[\"to\"] == reply2[\"from\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L131_C4", "label": "polarityDifferenceRanking", "type": "function", "loc": [131, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "vector": [2, 1, 0.9144, 0.0411, 1, 0.22, 1.0, 615, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "polarityDifferenceRanking", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def polarityDifferenceRanking(self):\n users = {user: userCounts[self.AVERAGE] for user, userCounts in self.polarityCounts.items() if not userCounts[self.AVERAGE] == None}\n print(users)\n ranking = sorted(users.items(), key=lambda x: x[1], reverse=True)\n print(ranking)\n return ranking"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L132_C8", "label": "users =", "type": "assigned_variable", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L131_C4", "vector": [14, 2, 0.9041, 0.0068, 2, 0.1, 0.0, 395, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "users", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " users = {user: userCounts[self.AVERAGE] for user, userCounts in self.polarityCounts.items() if not userCounts[self.AVERAGE] == None}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Expr_L133_C8", "label": "print()", "type": "expression", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L131_C4", "vector": [8, 2, 0.911, 0.0068, 2, 0.1, 0.25, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(users)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L134_C8", "label": "ranking = sorted()", "type": "assigned_variable", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L131_C4", "vector": [14, 2, 0.9178, 0.0068, 2, 0.1, 0.5, 761, 3, 3, 0, 0, 134, 10, 2], "semantic": {"name": "ranking", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " ranking = sorted(users.items(), key=lambda x: x[1], reverse=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Expr_L135_C8", "label": "print()", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L131_C4", "vector": [8, 2, 0.9247, 0.0068, 2, 0.1, 0.75, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(ranking)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Return_L136_C8", "label": "return", "type": "return", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L131_C4", "vector": [13, 2, 0.9315, 0.0068, 2, 0.1, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ranking"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:If_L138_C0", "label": "if", "type": "if", "loc": [138, 146], "level": 0, "parent": null, "vector": [4, 0, 0.9726, 0.0616, 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 r1 = {\"from\": 4, \"to\": 5, \"polarity\": 1}\n r2 = {\"from\": 5, \"to\": 4, \"polarity\": 1}\n r3 = {\"from\": 4, \"to\": 2, \"polarity\": 0}\n replies = [r1, r2, r3]\n \n polarityCounter = PolarityCounter(replies)\n print(polarityCounter.polarityCounts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L139_C4", "label": "r1 =", "type": "assigned_variable", "loc": [139, 139], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:If_L138_C0", "vector": [14, 1, 0.9521, 0.0068, 1, 0.6, 0.0, 648, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "r1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r1 = {\"from\": 4, \"to\": 5, \"polarity\": 1}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L140_C4", "label": "r2 =", "type": "assigned_variable", "loc": [140, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:If_L138_C0", "vector": [14, 1, 0.9589, 0.0068, 1, 0.6, 0.1667, 959, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "r2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r2 = {\"from\": 5, \"to\": 4, \"polarity\": 1}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L141_C4", "label": "r3 =", "type": "assigned_variable", "loc": [141, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:If_L138_C0", "vector": [14, 1, 0.9658, 0.0068, 1, 0.6, 0.3333, 837, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "r3", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r3 = {\"from\": 4, \"to\": 2, \"polarity\": 0}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L142_C4", "label": "replies =", "type": "assigned_variable", "loc": [142, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:If_L138_C0", "vector": [14, 1, 0.9726, 0.0068, 1, 0.6, 0.5, 205, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "replies", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " replies = [r1, r2, r3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L144_C4", "label": "polarityCounter = PolarityCounter()", "type": "assigned_variable", "loc": [144, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:If_L138_C0", "vector": [14, 1, 0.9863, 0.0068, 1, 0.6, 0.6667, 889, 3, 1, 0, 0, 151, 10, 1], "semantic": {"name": "polarityCounter", "arg_names": [], "import_names": [], "rhs_call_name": "PolarityCounter", "annotation": ""}, "snippet": " polarityCounter = PolarityCounter(replies)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Expr_L145_C4", "label": "print()", "type": "expression", "loc": [145, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:If_L138_C0", "vector": [8, 1, 0.9932, 0.0068, 1, 0.6, 0.8333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(polarityCounter.polarityCounts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1081:Expr_L146_C4", "label": "polarityDifferenceRanking()", "type": "expression", "loc": [146, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1081:If_L138_C0", "vector": [8, 1, 1.0, 0.0068, 1, 0.6, 1.0, 615, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "polarityDifferenceRanking", "arg_names": [], "import_names": [], "rhs_call_name": "polarityDifferenceRanking", "annotation": ""}, "snippet": " polarityCounter.polarityDifferenceRanking()"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Expr_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Expr_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Expr_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Expr_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L29_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L30_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L31_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L32_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L34_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L35_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L34_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L37_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L34_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L38_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L40_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L41_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L40_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L43_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L40_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L44_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L46_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L49_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L51_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L54_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L58_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L59_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L58_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L61_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L62_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L62_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L63_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L62_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L65_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L66_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L66_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L67_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L66_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L69_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L70_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L70_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L71_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L70_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L73_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L74_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L75_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L78_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L79_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L82_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L82_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L83_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Expr_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L92_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L93_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L94_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L95_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L95_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L96_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L95_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L98_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L100_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L100_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L101_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:Try_L100_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L103_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L115_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L116_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L115_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L117_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L115_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:If_L119_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L122_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L122_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:For_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:If_L124_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:If_L124_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Return_L125_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L122_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Return_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Return_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Expr_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Expr_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:FunctionDef_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Return_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:If_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:If_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:If_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:If_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:If_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Assign_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:If_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Expr_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1081:If_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1081:Expr_L146_C4"}]
''' Created on 4 avr. 2013 @author: Nils Amiet ''' # coding: utf-8 graph1Path = "graph1.gml" graph2Path = "graph2.gml" rankingsFile = "rankings.html" import networkx as nx import networkx.readwrite.gml as gml import operator import math import copy import os import sys import sqlite3 ''' Required for running the script from anywhere outside eclipse''' os.chdir(os.path.dirname(os.path.realpath(__file__))) sys.path.append('../../../../../InfrarougeGraphBuilder') from ch.hearc.infrarouge.graphbuilder.HTMLTableGenerator import HTMLTableGenerator from ch.hearc.infrarouge.graphbuilder.main import users, polarityReplies, getForums, databasePath from ch.hearc.infrarouge.graphbuilder.polarity import PolarityCounter sqlUsers = users() averageRankings = [] def readGraphs(): g1 = gml.read_gml(graph1Path, relabel=True) g2 = gml.read_gml(graph2Path, relabel=True) return (g1, g2) def getSortedTop(centrality): return sorted(centrality.items(), key=operator.itemgetter(1), reverse=True) def writeHTML(filename, headings, rows, readWriteMode='w'): html = HTMLTableGenerator(th=headings, rows=rows, users=sqlUsers) with open(filename, readWriteMode) as file: file.write(str(html)) def writeRawHTML(filename, headings, rows, readWriteMode='w'): htmlGenerator = HTMLTableGenerator(th=headings, rows=rows, users=sqlUsers) html = htmlGenerator.raw() with open(filename, readWriteMode) as file: file.write(str(html)) def writeHeader(filename): html = HTMLTableGenerator(title="Infrarouge Centrality rankings") with open(filename, 'w') as file: file.write(str(html.header())) def writeFooter(filename): html = HTMLTableGenerator() with open(filename, 'a') as file: file.write(str(html.footer())) def writeH1(filename, text): html = HTMLTableGenerator() with open(filename, 'a') as file: file.write(html.h1(text)) def createRanking(graph, ev=True, directed=False): # general graph information headings = ["#nodes", "#edges", "directed", "weighted", "bipartite"] rows = [] if directed: weighted = True bipartite = False else: weighted = False bipartite = True rows += [(str(len(graph.nodes())), str(len(graph.edges())), str(directed), str(weighted), str(bipartite))] writeRawHTML(rankingsFile, headings, rows, readWriteMode='a') # centrality rankings degreeCentrality = nx.degree_centrality(graph) if directed: inDegreeCentrality = nx.in_degree_centrality(graph) outDegreeCentrality = nx.out_degree_centrality(graph) closenessCentrality = nx.closeness_centrality(graph) betweennessCentrality = nx.betweenness_centrality(graph) nbNodes = len(graph.nodes()) topLength = 15 degreeRanking = getSortedTop(degreeCentrality) if directed: inDegreeRanking = getSortedTop(inDegreeCentrality) outDegreeRanking = getSortedTop(outDegreeCentrality) closenessRanking = getSortedTop(closenessCentrality) betweennessRanking = getSortedTop(betweennessCentrality) headings = ["user id", "username", "degree centrality"] writeHTML(rankingsFile, headings, degreeRanking[:topLength], readWriteMode='a') if directed: headings = ["user id", "username", "in-degree centrality"] writeHTML(rankingsFile, headings, inDegreeRanking[:topLength], readWriteMode='a') headings = ["user id", "username", "out-degree centrality"] writeHTML(rankingsFile, headings, outDegreeRanking[:topLength], readWriteMode='a') headings = ["user id", "username", "closeness centrality"] writeHTML(rankingsFile, headings, closenessRanking[:topLength], readWriteMode='a') headings = ["user id", "username", "betweenness centrality"] writeHTML(rankingsFile, headings, betweennessRanking[:topLength], readWriteMode='a') if ev: evCentrality = nx.eigenvector_centrality(graph, max_iter=500) evRanking = getSortedTop(evCentrality) headings = ["user id", "username", "eigenvector centrality"] writeHTML(rankingsFile, headings, evRanking[:topLength], readWriteMode='a') clusteringCoefficientRanking = computeClusteringCoefficient(graph, directed) # clustering coefficient headings = ["user id", "username", "clustering coefficient"] writeHTML(rankingsFile, headings, clusteringCoefficientRanking[:topLength], readWriteMode='a') # fraction of common users commonNodesStatsDCBE = [] commonNodesStatsDE = [] commonNodesStatsCE = [] commonNodesStatsBE = [] commonNodesStatsDC = [] commonNodesStatsDB = [] commonNodesStatsBC = [] commonNodesStatsDCB = [] fraction = 1 while fraction <= 20: # from 1% to 20% if ev: commonNodesFractionDCBE = computeFractionOfCommonUsers(fraction/100.0, degreeRanking, closenessRanking, betweennessRanking, evRanking) commonNodesFractionDE = computeFractionOfCommonUsers(fraction/100.0, degreeRanking, evRanking) commonNodesFractionCE = computeFractionOfCommonUsers(fraction/100.0, closenessRanking, evRanking) commonNodesFractionBE = computeFractionOfCommonUsers(fraction/100.0, betweennessRanking, evRanking) commonNodesStatsDCBE += [(str(fraction) + "%", str(100*commonNodesFractionDCBE) + "%")] commonNodesStatsDE += [(str(fraction) + "%", str(100*commonNodesFractionDE) + "%")] commonNodesStatsCE += [(str(fraction) + "%", str(100*commonNodesFractionCE) + "%")] commonNodesStatsBE += [(str(fraction) + "%", str(100*commonNodesFractionBE) + "%")] commonNodesFractionDCB = computeFractionOfCommonUsers(fraction/100.0, degreeRanking, closenessRanking, betweennessRanking) commonNodesFractionDC = computeFractionOfCommonUsers(fraction/100.0, degreeRanking, closenessRanking) commonNodesFractionDB = computeFractionOfCommonUsers(fraction/100.0, degreeRanking, betweennessRanking) commonNodesFractionBC = computeFractionOfCommonUsers(fraction/100.0, betweennessRanking, closenessRanking) commonNodesStatsDC += [(str(fraction) + "%", str(100*commonNodesFractionDC) + "%")] commonNodesStatsDB += [(str(fraction) + "%", str(100*commonNodesFractionDB) + "%")] commonNodesStatsBC += [(str(fraction) + "%", str(100*commonNodesFractionBC) + "%")] commonNodesStatsDCB += [(str(fraction) + "%", str(100*commonNodesFractionDCB) + "%")] fraction += 1 if ev: headings = ["top proportion", "fraction of common users [DC, CC, BC, EC]"] writeRawHTML(rankingsFile, headings, commonNodesStatsDCBE, readWriteMode='a') headings = ["top proportion", "fraction of common users [DC, CC, BC]"] writeRawHTML(rankingsFile, headings, commonNodesStatsDCB, readWriteMode='a') topNumber = "top proportion" if ev: headingsDE = [topNumber, "fraction of common users [DC, EC]"] headingsCE = [topNumber, "fraction of common users [CC, EC]"] headingsBE = [topNumber, "fraction of common users [BC, EC]"] writeRawHTML(rankingsFile, headingsDE, commonNodesStatsDE, readWriteMode='a') writeRawHTML(rankingsFile, headingsCE, commonNodesStatsCE, readWriteMode='a') writeRawHTML(rankingsFile, headingsBE, commonNodesStatsBE, readWriteMode='a') headingsDC = [topNumber, "fraction of common users [DC, CC]"] headingsDB = [topNumber, "fraction of common users [DC, BC]"] headingsBC = [topNumber, "fraction of common users [BC, CC]"] writeRawHTML(rankingsFile, headingsDC, commonNodesStatsDC, readWriteMode='a') writeRawHTML(rankingsFile, headingsDB, commonNodesStatsDB, readWriteMode='a') writeRawHTML(rankingsFile, headingsBC, commonNodesStatsBC, readWriteMode='a') # top 15 common nodes topn = 15 if ev: fraction = topn / float(nbNodes) commonNodesTop15Fraction = computeFractionOfCommonUsers(fraction, degreeRanking, closenessRanking, betweennessRanking, evRanking) commonNodesTop15Stats = [("Top " + str(topn), str(int(commonNodesTop15Fraction*topn)) + " (" + str(100*commonNodesTop15Fraction) + "%)")] topNumber = "top number" headings = [topNumber, "Common users [DC, CC, BC, EC] in top " + str(topn)] writeRawHTML(rankingsFile, headings, commonNodesTop15Stats, readWriteMode='a') # average rank topNodes = [] if ev: # compute average of all 4 rankings = [degreeRanking, closenessRanking, betweennessRanking, evRanking] else: # compute average of all 3 rankings = [degreeRanking, closenessRanking, betweennessRanking] for ranking in rankings: topNodes += [x[0] for x in ranking] topNodes = set(topNodes) averageRankStats = [] for node in topNodes: averageRank = 0 for ranking in rankings: try: rank = [x[0] for x in ranking].index(node) except: print("Warning: Node not in ranking!") averageRank += rank averageRank /= float(len(rankings)) averageRank += 1 averageRankStats += [(node, averageRank)] averageRankStats = sorted(averageRankStats, key=operator.itemgetter(1), reverse=False) global averageRankings averageRankings += [averageRankStats] headings = ["node id", "username", "average rank"] writeHTML(rankingsFile, headings, averageRankStats[:topn], readWriteMode='a') # top n% subgraph limit = 7 for topPercent in range(10, 100, 15): topNumber = int(nbNodes * topPercent / float(100)) topNodes = [x[0] for x in averageRankStats][:topNumber] topNodesAndNeighbors = copy.deepcopy(topNodes) for node in topNodes: topNodesAndNeighbors += graph.neighbors(node) subGraph = nx.subgraph(graph, topNodes) subGraphWithNeighbors = nx.subgraph(graph, topNodesAndNeighbors) filename = "graph" + ("1" if directed else "2") + "top" + str(topPercent) + "percent.gml" saveGraph(subGraph, filename) clusteringCoefficientRanking = computeClusteringCoefficient(subGraph, directed) clusteringCoefficientNeighborsRanking = computeClusteringCoefficient(subGraphWithNeighbors, directed) clusteringCoefficientNeighborsRanking = [x for x in clusteringCoefficientNeighborsRanking if x[0] in topNodes] headings = ["user id", "username", "clustering coefficient for top" + str(topPercent) + "% subgraph"] writeHTML(rankingsFile, headings, clusteringCoefficientRanking[:limit], readWriteMode='a') headings = ["user id", "username", "clustering coefficient (with neighbors) for top" + str(topPercent) + "% subgraph"] writeHTML(rankingsFile, headings, clusteringCoefficientNeighborsRanking[:limit], readWriteMode='a') def computeClusteringCoefficient(graph, directed): if not directed: clusteringCoefficient = nx.clustering(graph) else: g = nx.Graph() g.add_nodes_from(graph.nodes()) g.add_edges_from(graph.edges()) clusteringCoefficient = nx.clustering(g) clusteringCoefficientRanking = getSortedTop(clusteringCoefficient) return clusteringCoefficientRanking def saveGraph(graph, filename): gml.write_gml(graph, filename) def computeFractionOfCommonUsers(fraction, *rankings): if len(rankings) > 1: nbNodes = len(rankings[0]) portionSize = math.ceil(fraction * nbNodes) commonNodes = set([x[0] for x in rankings[0]][:portionSize]) for ranking in rankings: rankingPortion = [x[0] for x in ranking][:portionSize] commonNodes = [x for x in commonNodes if x in rankingPortion] commonNodesFraction = len(commonNodes) / float(portionSize) return commonNodesFraction raise Exception("expected at least 2 rankings") def createGeneralRanking(): generalRanking = {} generalRankingNodeOccurences = {} for ranking in averageRankings: for nodeRankTuple in ranking: node = nodeRankTuple[0] rank = nodeRankTuple[1] try: generalRanking[node] += rank except: generalRanking[node] = rank try: generalRankingNodeOccurences[node] += 1 except: generalRankingNodeOccurences[node] = 1 finalRanking = [] for node, rank in generalRanking.items(): averageRank = rank / float(generalRankingNodeOccurences[node]) finalRanking += [(node, averageRank)] finalRanking = sorted(finalRanking, key=operator.itemgetter(1), reverse=False) headings = ["node id", "username", "average rank over both graphs"] writeHTML(rankingsFile, headings, finalRanking, readWriteMode='a') def createPolarityRanking(): limit = 7 # polarity ranking replies = polarityReplies() polarityCounter = PolarityCounter(replies) polarityRanking = polarityCounter.polarityDifferenceRanking() headings = ["user id", "username", "Greatest polarity difference"] writeHTML(rankingsFile, headings, polarityRanking[:limit], readWriteMode='a') polarityRanking.reverse() headings = ["user id", "username", "Lowest polarity difference"] writeHTML(rankingsFile, headings, polarityRanking[:limit], readWriteMode='a') print("users: %s, ranking length: %s" % (len(sqlUsers), len(polarityRanking))) print(len(polarityCounter.replies)) print(len(polarityCounter.edges)) print("NDI=" + str(polarityCounter.NDI)) def printTime(interval): seconds = interval / 1000 minutes = seconds / 60 hours = minutes / 60 days = hours / 24 print(days, hours, minutes, seconds) def polarizationForAllForums(): forums = getForums() for forum in forums: forumID = forum["id"] replies = polarityReplies(forum=forumID) computePolarizationOverTime(replies, forumID) def computePolarizationOverTime(replies, forumID): timeSortedReplies = sorted(replies, key=lambda x: x["timestamp"]) first = timeSortedReplies[0]["timestamp"] last = timeSortedReplies[-1]["timestamp"] interval = last - first timeSliceCount = 20 deltaTimeMillis = interval / timeSliceCount ndiVariation = [] timeThreshold = first + deltaTimeMillis while timeThreshold <= last: r = repliesBeforeTime(timeSortedReplies, timeThreshold) polarityCounter = PolarityCounter(r) edgesCount = len(polarityCounter.edges) ndiVariation += [(timeThreshold, polarityCounter.NDI, edgesCount)] timeThreshold += deltaTimeMillis times = [x[0] for x in ndiVariation] ndis = [x[1] for x in ndiVariation] edgesCounts = [x[2] for x in ndiVariation] # print(times) # print(ndis) # print(edgesCounts) filename = "topic" + str(forumID) + ".m" writeListsToFile(times, ndis, edgesCounts, filename) def writeListsToFile(times, ndis, edgesCounts, filename): with open(filename, 'w+') as file: file.write("times = " + str(times) + ";\n") file.write("ndis = " + str(ndis) + ";\n") file.write("edges = " + str(edgesCounts) + ";\n") plotCode = """ figure plot(times, ndis) xlabel('Time (timestamp)') ylabel('Network Disagreement Index (NDI)') """ file.write(plotCode) def repliesBeforeTime(replies, time): return [reply for reply in replies if reply["timestamp"] <= time] def usersWhoSentMultipleMessages(forum=1): query = """ SELECT m.fkauthor, f.id, COUNT(*) as count FROM threadmessage as m INNER JOIN forumthread as t ON m.fkforumthread=t.id INNER JOIN forum as f ON t.fkparentforum=f.id WHERE f.id=%s GROUP BY m.fkauthor HAVING count>1 """ % forum users = [] with sqlite3.connect(databasePath) as connection: cursor = connection.cursor() cursor.execute(query) for user in cursor: users += [user] cursor.close() return users def usersWhoParticipateInForum(forum=1): query = """ SELECT m.fkauthor, f.id, COUNT(*) as count FROM threadmessage as m INNER JOIN forumthread as t ON m.fkforumthread=t.id INNER JOIN forum as f ON t.fkparentforum=f.id WHERE f.id=%s GROUP BY m.fkauthor """ % forum users = [] with sqlite3.connect(databasePath) as connection: cursor = connection.cursor() cursor.execute(query) for user in cursor: users += [user] cursor.close() return users def getUserCount(): query = "SELECT COUNT(*) as count FROM user" with sqlite3.connect(databasePath) as connection: cursor = connection.cursor() cursor.execute(query) for row in cursor: count = row[0] cursor.close() return count def forumContributionRanking(): forums = getForums() ranking = [] for forum in forums: forumID = forum["id"] usersWhoSentMoreThanOneMessage = usersWhoSentMultipleMessages(forum=forumID) users = usersWhoParticipateInForum(forum=forumID) gtOne = len(usersWhoSentMoreThanOneMessage) total = len(users) ratio = gtOne/float(total)*100 line = (forumID, gtOne, total, str(ratio) + "%") ranking += [line] ranking = sorted(ranking, key=lambda x: x[1]/float(x[2]), reverse=True) headings = ["forum id", "users with sent messages count > 1", "users who sent at least 1 message count", "ratio"] writeRawHTML(rankingsFile, headings, ranking, readWriteMode='a') if __name__ == "__main__": (g1, g2) = readGraphs() print(len(g1.nodes())) print(len(g2.nodes())) writeHeader(rankingsFile) print("-----") print("Centrality Rankings for graph 1") print("-----") writeH1(rankingsFile, "Replies graph centrality measures (directed weighted)") createRanking(g1, directed=True) print() print("-----") print("Centrality Rankings for graph 2") print("-----") writeH1(rankingsFile, "User-Discussion graph centrality measures (bipartite)") createRanking(g2, ev=False) # do not compute Eigenvector centrality print() print("-----") print("Conclusion") print("-----") writeH1(rankingsFile, "Conclusion") createGeneralRanking() createPolarityRanking() polarizationForAllForums() forumContributionRanking() writeFooter(rankingsFile) print() print("Successfully generated HTML report.")
ajibawa-2023/Python-Code-Large/train/row_1082
319
522
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0057, 0.0096, 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 4 avr. 2013\n\n@author: Nils Amiet\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L9_C0", "label": "graph1Path =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.0172, 0.0019, 0, 0.66, 0.0238, 913, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "graph1Path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "graph1Path = \"graph1.gml\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L10_C0", "label": "graph2Path =", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.0192, 0.0019, 0, 0.66, 0.0476, 421, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "graph2Path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "graph2Path = \"graph2.gml\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L12_C0", "label": "rankingsFile =", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.023, 0.0019, 0, 0.66, 0.0714, 780, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "rankingsFile", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "rankingsFile = \"rankings.html\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Import_L14_C0", "label": "networkx import nx", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0268, 0.0019, 0, 0.66, 0.0952, 691, 0, 1, 0, 0, 691, 0, 0], "semantic": {"name": "networkx", "arg_names": [], "import_names": ["nx"], "rhs_call_name": "", "annotation": ""}, "snippet": "import networkx as nx"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Import_L15_C0", "label": "networkx.readwrite.gml import gml", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0287, 0.0019, 0, 0.66, 0.119, 599, 0, 1, 0, 0, 599, 0, 0], "semantic": {"name": "networkx.readwrite.gml", "arg_names": [], "import_names": ["gml"], "rhs_call_name": "", "annotation": ""}, "snippet": "import networkx.readwrite.gml as gml"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Import_L16_C0", "label": "operator import operator", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0307, 0.0019, 0, 0.66, 0.1429, 616, 0, 1, 0, 0, 616, 0, 0], "semantic": {"name": "operator", "arg_names": [], "import_names": ["operator"], "rhs_call_name": "", "annotation": ""}, "snippet": "import operator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Import_L17_C0", "label": "math import math", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0326, 0.0019, 0, 0.66, 0.1667, 526, 0, 1, 0, 0, 526, 0, 0], "semantic": {"name": "math", "arg_names": [], "import_names": ["math"], "rhs_call_name": "", "annotation": ""}, "snippet": "import math"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Import_L18_C0", "label": "copy import copy", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0345, 0.0019, 0, 0.66, 0.1905, 739, 0, 1, 0, 0, 739, 0, 0], "semantic": {"name": "copy", "arg_names": [], "import_names": ["copy"], "rhs_call_name": "", "annotation": ""}, "snippet": "import copy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Import_L19_C0", "label": "os import os", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0364, 0.0019, 0, 0.66, 0.2143, 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_1082:Import_L20_C0", "label": "sys import sys", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.0383, 0.0019, 0, 0.66, 0.2381, 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_1082:Import_L21_C0", "label": "sqlite3 import sqlite3", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.0402, 0.0019, 0, 0.66, 0.2619, 790, 0, 1, 0, 0, 790, 0, 0], "semantic": {"name": "sqlite3", "arg_names": [], "import_names": ["sqlite3"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sqlite3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L23_C0", "label": "expression", "type": "expression", "loc": [23, 23], "level": 0, "parent": null, "vector": [8, 0, 0.0441, 0.0019, 0, 0.66, 0.2857, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "''' Required for running the script from anywhere outside eclipse'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L24_C0", "label": "chdir()", "type": "expression", "loc": [24, 24], "level": 0, "parent": null, "vector": [8, 0, 0.046, 0.0019, 0, 0.66, 0.3095, 122, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "chdir", "arg_names": [], "import_names": [], "rhs_call_name": "chdir", "annotation": ""}, "snippet": "os.chdir(os.path.dirname(os.path.realpath(__file__)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L25_C0", "label": "append()", "type": "expression", "loc": [25, 25], "level": 0, "parent": null, "vector": [8, 0, 0.0479, 0.0019, 0, 0.66, 0.3333, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "sys.path.append('../../../../../InfrarougeGraphBuilder')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:ImportFrom_L27_C0", "label": "from ch.hearc.infrarouge.graphbuilder.HTMLTableGenerator import HTMLTableGenerator", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.0517, 0.0019, 0, 0.66, 0.3571, 823, 0, 1, 0, 0, 823, 0, 0], "semantic": {"name": "ch.hearc.infrarouge.graphbuilder.HTMLTableGenerator", "arg_names": [], "import_names": ["HTMLTableGenerator"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ch.hearc.infrarouge.graphbuilder.HTMLTableGenerator import HTMLTableGenerator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:ImportFrom_L28_C0", "label": "from ch.hearc.infrarouge.graphbuilder.main import users, polarityReplies, getForums\u2026", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.0536, 0.0019, 0, 0.66, 0.381, 115, 0, 4, 0, 0, 115, 0, 0], "semantic": {"name": "ch.hearc.infrarouge.graphbuilder.main", "arg_names": [], "import_names": ["users", "polarityReplies", "getForums", "databasePath"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ch.hearc.infrarouge.graphbuilder.main import users, polarityReplies, getForums, databasePath"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:ImportFrom_L29_C0", "label": "from ch.hearc.infrarouge.graphbuilder.polarity import PolarityCounter", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0019, 0, 0.66, 0.4048, 72, 0, 1, 0, 0, 72, 0, 0], "semantic": {"name": "ch.hearc.infrarouge.graphbuilder.polarity", "arg_names": [], "import_names": ["PolarityCounter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ch.hearc.infrarouge.graphbuilder.polarity import PolarityCounter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L31_C0", "label": "sqlUsers = users()", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.0594, 0.0019, 0, 0.66, 0.4286, 915, 3, 0, 0, 0, 395, 10, 1], "semantic": {"name": "sqlUsers", "arg_names": [], "import_names": [], "rhs_call_name": "users", "annotation": ""}, "snippet": "sqlUsers = users()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L32_C0", "label": "averageRankings =", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.0613, 0.0019, 0, 0.66, 0.4524, 433, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "averageRankings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "averageRankings = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L34_C0", "label": "readGraphs", "type": "function", "loc": [34, 37], "level": 0, "parent": null, "vector": [2, 0, 0.068, 0.0077, 0, 0.66, 0.4762, 595, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "readGraphs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def readGraphs():\n g1 = gml.read_gml(graph1Path, relabel=True)\n g2 = gml.read_gml(graph2Path, relabel=True)\n return (g1, g2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L35_C4", "label": "g1 = read_gml()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L34_C0", "vector": [14, 1, 0.067, 0.0019, 1, 0.62, 0.0, 926, 3, 2, 0, 0, 720, 10, 1], "semantic": {"name": "g1", "arg_names": [], "import_names": [], "rhs_call_name": "read_gml", "annotation": ""}, "snippet": " g1 = gml.read_gml(graph1Path, relabel=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L36_C4", "label": "g2 = read_gml()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L34_C0", "vector": [14, 1, 0.069, 0.0019, 1, 0.62, 0.5, 985, 3, 2, 0, 0, 720, 10, 1], "semantic": {"name": "g2", "arg_names": [], "import_names": [], "rhs_call_name": "read_gml", "annotation": ""}, "snippet": " g2 = gml.read_gml(graph2Path, relabel=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Return_L37_C4", "label": "return", "type": "return", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L34_C0", "vector": [13, 1, 0.0709, 0.0019, 1, 0.62, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (g1, g2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L39_C0", "label": "getSortedTop", "type": "function", "loc": [39, 40], "level": 0, "parent": null, "vector": [2, 0, 0.0757, 0.0038, 0, 0.66, 0.5, 894, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "getSortedTop", "arg_names": ["centrality"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getSortedTop(centrality):\n return sorted(centrality.items(), key=operator.itemgetter(1), reverse=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Return_L40_C4", "label": "return", "type": "return", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L39_C0", "vector": [13, 1, 0.0766, 0.0019, 1, 0.27, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sorted(centrality.items(), key=operator.itemgetter(1), reverse=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L42_C0", "label": "writeHTML", "type": "function", "loc": [42, 45], "level": 0, "parent": null, "vector": [2, 0, 0.0833, 0.0077, 0, 0.66, 0.5238, 665, 0, 4, 0, 0, 0, 0, 4], "semantic": {"name": "writeHTML", "arg_names": ["filename", "headings", "rows", "readWriteMode"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def writeHTML(filename, headings, rows, readWriteMode='w'):\n html = HTMLTableGenerator(th=headings, rows=rows, users=sqlUsers)\n with open(filename, readWriteMode) as file:\n file.write(str(html))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L43_C4", "label": "html = HTMLTableGenerator()", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L42_C0", "vector": [14, 1, 0.0824, 0.0019, 1, 0.02, 0.0, 271, 3, 3, 0, 0, 408, 10, 1], "semantic": {"name": "html", "arg_names": [], "import_names": [], "rhs_call_name": "HTMLTableGenerator", "annotation": ""}, "snippet": " html = HTMLTableGenerator(th=headings, rows=rows, users=sqlUsers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L45_C8", "label": "write()", "type": "expression", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L42_C0", "vector": [8, 1, 0.0862, 0.0019, 1, 0.02, 0.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " file.write(str(html))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L47_C0", "label": "writeRawHTML", "type": "function", "loc": [47, 51], "level": 0, "parent": null, "vector": [2, 0, 0.0939, 0.0096, 0, 0.66, 0.5476, 256, 0, 4, 0, 0, 0, 0, 5], "semantic": {"name": "writeRawHTML", "arg_names": ["filename", "headings", "rows", "readWriteMode"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def writeRawHTML(filename, headings, rows, readWriteMode='w'):\n htmlGenerator = HTMLTableGenerator(th=headings, rows=rows, users=sqlUsers)\n html = htmlGenerator.raw()\n with open(filename, readWriteMode) as file:\n file.write(str(html))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L48_C4", "label": "htmlGenerator = HTMLTableGenerator()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L47_C0", "vector": [14, 1, 0.092, 0.0019, 1, 0.72, 0.0, 255, 3, 3, 0, 0, 408, 10, 1], "semantic": {"name": "htmlGenerator", "arg_names": [], "import_names": [], "rhs_call_name": "HTMLTableGenerator", "annotation": ""}, "snippet": " htmlGenerator = HTMLTableGenerator(th=headings, rows=rows, users=sqlUsers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L49_C4", "label": "html = raw()", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L47_C0", "vector": [14, 1, 0.0939, 0.0019, 1, 0.72, 1.0, 271, 3, 0, 0, 0, 23, 10, 1], "semantic": {"name": "html", "arg_names": [], "import_names": [], "rhs_call_name": "raw", "annotation": ""}, "snippet": " html = htmlGenerator.raw()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L51_C8", "label": "write()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L47_C0", "vector": [8, 1, 0.0977, 0.0019, 1, 0.72, 0.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " file.write(str(html))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L53_C0", "label": "writeHeader", "type": "function", "loc": [53, 56], "level": 0, "parent": null, "vector": [2, 0, 0.1044, 0.0077, 0, 0.66, 0.5714, 746, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "writeHeader", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def writeHeader(filename):\n html = HTMLTableGenerator(title=\"Infrarouge Centrality rankings\")\n with open(filename, 'w') as file:\n file.write(str(html.header()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L54_C4", "label": "html = HTMLTableGenerator()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L53_C0", "vector": [14, 1, 0.1034, 0.0019, 1, 0.79, 0.0, 271, 3, 1, 0, 0, 408, 10, 1], "semantic": {"name": "html", "arg_names": [], "import_names": [], "rhs_call_name": "HTMLTableGenerator", "annotation": ""}, "snippet": " html = HTMLTableGenerator(title=\"Infrarouge Centrality rankings\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L56_C8", "label": "write()", "type": "expression", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L53_C0", "vector": [8, 1, 0.1073, 0.0019, 1, 0.79, 0.0, 837, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " file.write(str(html.header()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L58_C0", "label": "writeFooter", "type": "function", "loc": [58, 61], "level": 0, "parent": null, "vector": [2, 0, 0.114, 0.0077, 0, 0.66, 0.5952, 820, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "writeFooter", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def writeFooter(filename):\n html = HTMLTableGenerator()\n with open(filename, 'a') as file:\n file.write(str(html.footer()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L59_C4", "label": "html = HTMLTableGenerator()", "type": "assigned_variable", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L58_C0", "vector": [14, 1, 0.113, 0.0019, 1, 0.22, 0.0, 271, 3, 0, 0, 0, 408, 10, 1], "semantic": {"name": "html", "arg_names": [], "import_names": [], "rhs_call_name": "HTMLTableGenerator", "annotation": ""}, "snippet": " html = HTMLTableGenerator()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L61_C8", "label": "write()", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L58_C0", "vector": [8, 1, 0.1169, 0.0019, 1, 0.22, 0.0, 837, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " file.write(str(html.footer()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L63_C0", "label": "writeH1", "type": "function", "loc": [63, 66], "level": 0, "parent": null, "vector": [2, 0, 0.1236, 0.0077, 0, 0.66, 0.619, 600, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "writeH1", "arg_names": ["filename", "text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def writeH1(filename, text):\n html = HTMLTableGenerator()\n with open(filename, 'a') as file:\n file.write(html.h1(text))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L64_C4", "label": "html = HTMLTableGenerator()", "type": "assigned_variable", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L63_C0", "vector": [14, 1, 0.1226, 0.0019, 1, 0.36, 0.0, 271, 3, 0, 0, 0, 408, 10, 1], "semantic": {"name": "html", "arg_names": [], "import_names": [], "rhs_call_name": "HTMLTableGenerator", "annotation": ""}, "snippet": " html = HTMLTableGenerator()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L66_C8", "label": "write()", "type": "expression", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L63_C0", "vector": [8, 1, 0.1264, 0.0019, 1, 0.36, 0.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " file.write(html.h1(text))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "label": "createRanking", "type": "function", "loc": [68, 263], "level": 0, "parent": null, "vector": [2, 0, 0.317, 0.3755, 0, 0.66, 0.6429, 45, 0, 3, 0, 0, 0, 0, 95], "semantic": {"name": "createRanking", "arg_names": ["graph", "ev", "directed"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def createRanking(graph, ev=True, directed=False):\n # general graph information\n headings = [\"#nodes\", \"#edges\", \"directed\", \"weighted\", \"bipartite\"]\n rows = []\n if directed:\n weighted = True\n bipartite = False\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L70_C4", "label": "headings =", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.1341, 0.0019, 1, 0.01, 0.0, 469, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "headings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headings = [\"#nodes\", \"#edges\", \"directed\", \"weighted\", \"bipartite\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L71_C4", "label": "rows =", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.136, 0.0019, 1, 0.01, 0.0175, 275, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "rows", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rows = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L72_C4", "label": "if", "type": "if", "loc": [72, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [4, 1, 0.1427, 0.0115, 1, 0.01, 0.0351, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if directed:\n weighted = True\n bipartite = False\n else:\n weighted = False\n bipartite = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L73_C8", "label": "weighted =", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L72_C4", "vector": [14, 2, 0.1398, 0.0019, 2, 0.35, 0.0, 200, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "weighted", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " weighted = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L74_C8", "label": "bipartite =", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L72_C4", "vector": [14, 2, 0.1418, 0.0019, 2, 0.35, 0.3333, 897, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "bipartite", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bipartite = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L76_C8", "label": "weighted =", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L72_C4", "vector": [14, 2, 0.1456, 0.0019, 2, 0.35, 0.6667, 200, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "weighted", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " weighted = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L77_C8", "label": "bipartite =", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L72_C4", "vector": [14, 2, 0.1475, 0.0019, 2, 0.35, 1.0, 897, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "bipartite", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bipartite = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L79_C4", "label": "writeRawHTML()", "type": "expression", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [8, 1, 0.1513, 0.0019, 1, 0.01, 0.0526, 256, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeRawHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeRawHTML", "annotation": ""}, "snippet": " writeRawHTML(rankingsFile, headings, rows, readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L82_C4", "label": "degreeCentrality = degree_centrality()", "type": "assigned_variable", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.1571, 0.0019, 1, 0.01, 0.0702, 250, 3, 1, 0, 0, 877, 10, 1], "semantic": {"name": "degreeCentrality", "arg_names": [], "import_names": [], "rhs_call_name": "degree_centrality", "annotation": ""}, "snippet": " degreeCentrality = nx.degree_centrality(graph)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L83_C4", "label": "if", "type": "if", "loc": [83, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [4, 1, 0.1609, 0.0057, 1, 0.01, 0.0877, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if directed:\n inDegreeCentrality = nx.in_degree_centrality(graph)\n outDegreeCentrality = nx.out_degree_centrality(graph)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L84_C8", "label": "inDegreeCentrality = in_degree_centrality()", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L83_C4", "vector": [14, 2, 0.1609, 0.0019, 2, 0.97, 0.0, 972, 3, 1, 0, 0, 363, 10, 1], "semantic": {"name": "inDegreeCentrality", "arg_names": [], "import_names": [], "rhs_call_name": "in_degree_centrality", "annotation": ""}, "snippet": " inDegreeCentrality = nx.in_degree_centrality(graph)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L85_C8", "label": "outDegreeCentrality = out_degree_centrality()", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L83_C4", "vector": [14, 2, 0.1628, 0.0019, 2, 0.97, 1.0, 949, 3, 1, 0, 0, 924, 10, 1], "semantic": {"name": "outDegreeCentrality", "arg_names": [], "import_names": [], "rhs_call_name": "out_degree_centrality", "annotation": ""}, "snippet": " outDegreeCentrality = nx.out_degree_centrality(graph)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L86_C4", "label": "closenessCentrality = closeness_centrality()", "type": "assigned_variable", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.1648, 0.0019, 1, 0.01, 0.1053, 584, 3, 1, 0, 0, 186, 10, 1], "semantic": {"name": "closenessCentrality", "arg_names": [], "import_names": [], "rhs_call_name": "closeness_centrality", "annotation": ""}, "snippet": " closenessCentrality = nx.closeness_centrality(graph)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L87_C4", "label": "betweennessCentrality = betweenness_centrality()", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.1667, 0.0019, 1, 0.01, 0.1228, 239, 3, 1, 0, 0, 970, 10, 1], "semantic": {"name": "betweennessCentrality", "arg_names": [], "import_names": [], "rhs_call_name": "betweenness_centrality", "annotation": ""}, "snippet": " betweennessCentrality = nx.betweenness_centrality(graph)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L89_C4", "label": "nbNodes = len()", "type": "assigned_variable", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.1705, 0.0019, 1, 0.01, 0.1404, 973, 3, 1, 0, 0, 890, 10, 2], "semantic": {"name": "nbNodes", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " nbNodes = len(graph.nodes())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L90_C4", "label": "topLength =", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.1724, 0.0019, 1, 0.01, 0.1579, 894, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "topLength", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " topLength = 15"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L91_C4", "label": "degreeRanking = getSortedTop()", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.1743, 0.0019, 1, 0.01, 0.1754, 5, 3, 1, 0, 0, 894, 10, 1], "semantic": {"name": "degreeRanking", "arg_names": [], "import_names": [], "rhs_call_name": "getSortedTop", "annotation": ""}, "snippet": " degreeRanking = getSortedTop(degreeCentrality)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L92_C4", "label": "if", "type": "if", "loc": [92, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [4, 1, 0.1782, 0.0057, 1, 0.01, 0.193, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if directed:\n inDegreeRanking = getSortedTop(inDegreeCentrality)\n outDegreeRanking = getSortedTop(outDegreeCentrality)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L93_C8", "label": "inDegreeRanking = getSortedTop()", "type": "assigned_variable", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L92_C4", "vector": [14, 2, 0.1782, 0.0019, 2, 0.27, 0.0, 129, 3, 1, 0, 0, 894, 10, 1], "semantic": {"name": "inDegreeRanking", "arg_names": [], "import_names": [], "rhs_call_name": "getSortedTop", "annotation": ""}, "snippet": " inDegreeRanking = getSortedTop(inDegreeCentrality)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L94_C8", "label": "outDegreeRanking = getSortedTop()", "type": "assigned_variable", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L92_C4", "vector": [14, 2, 0.1801, 0.0019, 2, 0.27, 1.0, 246, 3, 1, 0, 0, 894, 10, 1], "semantic": {"name": "outDegreeRanking", "arg_names": [], "import_names": [], "rhs_call_name": "getSortedTop", "annotation": ""}, "snippet": " outDegreeRanking = getSortedTop(outDegreeCentrality)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L96_C4", "label": "closenessRanking = getSortedTop()", "type": "assigned_variable", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.1839, 0.0019, 1, 0.01, 0.2105, 774, 3, 1, 0, 0, 894, 10, 1], "semantic": {"name": "closenessRanking", "arg_names": [], "import_names": [], "rhs_call_name": "getSortedTop", "annotation": ""}, "snippet": " closenessRanking = getSortedTop(closenessCentrality)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L97_C4", "label": "betweennessRanking = getSortedTop()", "type": "assigned_variable", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.1858, 0.0019, 1, 0.01, 0.2281, 793, 3, 1, 0, 0, 894, 10, 1], "semantic": {"name": "betweennessRanking", "arg_names": [], "import_names": [], "rhs_call_name": "getSortedTop", "annotation": ""}, "snippet": " betweennessRanking = getSortedTop(betweennessCentrality)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L100_C4", "label": "headings =", "type": "assigned_variable", "loc": [100, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.1916, 0.0019, 1, 0.01, 0.2456, 469, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "headings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headings = [\"user id\", \"username\", \"degree centrality\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L101_C4", "label": "writeHTML()", "type": "expression", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [8, 1, 0.1935, 0.0019, 1, 0.01, 0.2632, 665, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeHTML", "annotation": ""}, "snippet": " writeHTML(rankingsFile, headings, degreeRanking[:topLength], readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L103_C4", "label": "if", "type": "if", "loc": [103, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [4, 1, 0.2021, 0.0115, 1, 0.01, 0.2807, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if directed:\n headings = [\"user id\", \"username\", \"in-degree centrality\"]\n writeHTML(rankingsFile, headings, inDegreeRanking[:topLength], readWriteMode='a')\n \n headings = [\"user id\", \"username\", \"out-degree centrality\"]\n writeHTML(rankingsFile, headings, outDegreeRanking[:topLength], readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L104_C8", "label": "headings =", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L103_C4", "vector": [14, 2, 0.1992, 0.0019, 2, 0.26, 0.0, 469, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "headings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headings = [\"user id\", \"username\", \"in-degree centrality\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L105_C8", "label": "writeHTML()", "type": "expression", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L103_C4", "vector": [8, 2, 0.2011, 0.0019, 2, 0.26, 0.3333, 665, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeHTML", "annotation": ""}, "snippet": " writeHTML(rankingsFile, headings, inDegreeRanking[:topLength], readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L107_C8", "label": "headings =", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L103_C4", "vector": [14, 2, 0.205, 0.0019, 2, 0.26, 0.6667, 469, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "headings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headings = [\"user id\", \"username\", \"out-degree centrality\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L108_C8", "label": "writeHTML()", "type": "expression", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L103_C4", "vector": [8, 2, 0.2069, 0.0019, 2, 0.26, 1.0, 665, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeHTML", "annotation": ""}, "snippet": " writeHTML(rankingsFile, headings, outDegreeRanking[:topLength], readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L110_C4", "label": "headings =", "type": "assigned_variable", "loc": [110, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.2107, 0.0019, 1, 0.01, 0.2982, 469, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "headings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headings = [\"user id\", \"username\", \"closeness centrality\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L111_C4", "label": "writeHTML()", "type": "expression", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [8, 1, 0.2126, 0.0019, 1, 0.01, 0.3158, 665, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeHTML", "annotation": ""}, "snippet": " writeHTML(rankingsFile, headings, closenessRanking[:topLength], readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L113_C4", "label": "headings =", "type": "assigned_variable", "loc": [113, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.2165, 0.0019, 1, 0.01, 0.3333, 469, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "headings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headings = [\"user id\", \"username\", \"betweenness centrality\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L114_C4", "label": "writeHTML()", "type": "expression", "loc": [114, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [8, 1, 0.2184, 0.0019, 1, 0.01, 0.3509, 665, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeHTML", "annotation": ""}, "snippet": " writeHTML(rankingsFile, headings, betweennessRanking[:topLength], readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L116_C4", "label": "if", "type": "if", "loc": [116, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [4, 1, 0.227, 0.0115, 1, 0.01, 0.3684, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ev:\n evCentrality = nx.eigenvector_centrality(graph, max_iter=500)\n evRanking = getSortedTop(evCentrality)\n \n headings = [\"user id\", \"username\", \"eigenvector centrality\"]\n writeHTML(rankingsFile, headings, evRanking[:topLength], readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L117_C8", "label": "evCentrality = eigenvector_centrality()", "type": "assigned_variable", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L116_C4", "vector": [14, 2, 0.2241, 0.0019, 2, 0.13, 0.0, 349, 3, 2, 0, 0, 573, 10, 1], "semantic": {"name": "evCentrality", "arg_names": [], "import_names": [], "rhs_call_name": "eigenvector_centrality", "annotation": ""}, "snippet": " evCentrality = nx.eigenvector_centrality(graph, max_iter=500)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L118_C8", "label": "evRanking = getSortedTop()", "type": "assigned_variable", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L116_C4", "vector": [14, 2, 0.2261, 0.0019, 2, 0.13, 0.3333, 324, 3, 1, 0, 0, 894, 10, 1], "semantic": {"name": "evRanking", "arg_names": [], "import_names": [], "rhs_call_name": "getSortedTop", "annotation": ""}, "snippet": " evRanking = getSortedTop(evCentrality)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L120_C8", "label": "headings =", "type": "assigned_variable", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L116_C4", "vector": [14, 2, 0.2299, 0.0019, 2, 0.13, 0.6667, 469, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "headings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headings = [\"user id\", \"username\", \"eigenvector centrality\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L121_C8", "label": "writeHTML()", "type": "expression", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L116_C4", "vector": [8, 2, 0.2318, 0.0019, 2, 0.13, 1.0, 665, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeHTML", "annotation": ""}, "snippet": " writeHTML(rankingsFile, headings, evRanking[:topLength], readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L123_C4", "label": "clusteringCoefficientRanking = computeClusteringCoefficient()", "type": "assigned_variable", "loc": [123, 123], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.2356, 0.0019, 1, 0.01, 0.386, 163, 3, 2, 0, 0, 271, 10, 1], "semantic": {"name": "clusteringCoefficientRanking", "arg_names": [], "import_names": [], "rhs_call_name": "computeClusteringCoefficient", "annotation": ""}, "snippet": " clusteringCoefficientRanking = computeClusteringCoefficient(graph, directed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L126_C4", "label": "headings =", "type": "assigned_variable", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.2414, 0.0019, 1, 0.01, 0.4035, 469, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "headings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headings = [\"user id\", \"username\", \"clustering coefficient\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L127_C4", "label": "writeHTML()", "type": "expression", "loc": [127, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [8, 1, 0.2433, 0.0019, 1, 0.01, 0.4211, 665, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeHTML", "annotation": ""}, "snippet": " writeHTML(rankingsFile, headings, clusteringCoefficientRanking[:topLength], readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L130_C4", "label": "commonNodesStatsDCBE =", "type": "assigned_variable", "loc": [130, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.249, 0.0019, 1, 0.01, 0.4386, 962, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "commonNodesStatsDCBE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " commonNodesStatsDCBE = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L131_C4", "label": "commonNodesStatsDE =", "type": "assigned_variable", "loc": [131, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.251, 0.0019, 1, 0.01, 0.4561, 464, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "commonNodesStatsDE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " commonNodesStatsDE = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L132_C4", "label": "commonNodesStatsCE =", "type": "assigned_variable", "loc": [132, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.2529, 0.0019, 1, 0.01, 0.4737, 59, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "commonNodesStatsCE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " commonNodesStatsCE = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L133_C4", "label": "commonNodesStatsBE =", "type": "assigned_variable", "loc": [133, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.2548, 0.0019, 1, 0.01, 0.4912, 278, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "commonNodesStatsBE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " commonNodesStatsBE = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L134_C4", "label": "commonNodesStatsDC =", "type": "assigned_variable", "loc": [134, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.2567, 0.0019, 1, 0.01, 0.5088, 638, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "commonNodesStatsDC", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " commonNodesStatsDC = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L135_C4", "label": "commonNodesStatsDB =", "type": "assigned_variable", "loc": [135, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.2586, 0.0019, 1, 0.01, 0.5263, 204, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "commonNodesStatsDB", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " commonNodesStatsDB = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L136_C4", "label": "commonNodesStatsBC =", "type": "assigned_variable", "loc": [136, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.2605, 0.0019, 1, 0.01, 0.5439, 570, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "commonNodesStatsBC", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " commonNodesStatsBC = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L137_C4", "label": "commonNodesStatsDCB =", "type": "assigned_variable", "loc": [137, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.2625, 0.0019, 1, 0.01, 0.5614, 839, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "commonNodesStatsDCB", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " commonNodesStatsDCB = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L139_C4", "label": "fraction =", "type": "assigned_variable", "loc": [139, 139], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.2663, 0.0019, 1, 0.01, 0.5789, 696, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "fraction", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fraction = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:While_L141_C4", "label": "while", "type": "while", "loc": [141, 165], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [5, 1, 0.2931, 0.0479, 1, 0.01, 0.5965, 0, 0, 0, 0, 0, 0, 0, 24], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while fraction <= 20: # from 1% to 20%\n if ev:\n commonNodesFractionDCBE = computeFractionOfCommonUsers(fraction/100.0, degreeRanking, closenessRanking, betweennessRanking, evRanking)\n commonNodesFractionDE = computeFractionOfCommonUsers(fraction/100.0, degreeRanking, evRanking)\n commonNodesFractionCE = computeFractionOfCommonUsers(fraction/100.0, closenessRanking, evRanking)\n commonNodesFractionBE = computeFractionOfCommonUsers(fraction/100.0, betweennessRanking, evRanking)\n \n commonNodesStatsDCBE += [(str(fraction) + \"%\", str(100*commonNodesFractionDCBE) + \"%\")]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L142_C8", "label": "if", "type": "if", "loc": [142, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:While_L141_C4", "vector": [4, 2, 0.2807, 0.0192, 2, 0.74, 0.0, 0, 2, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ev:\n commonNodesFractionDCBE = computeFractionOfCommonUsers(fraction/100.0, degreeRanking, closenessRanking, betweennessRanking, evRanking)\n commonNodesFractionDE = computeFractionOfCommonUsers(fraction/100.0, degreeRanking, evRanking)\n commonNodesFractionCE = computeFractionOfCommonUsers(fraction/100.0, closenessRanking, evRanking)\n commonNodesFractionBE = computeFractionOfCommonUsers(fraction/100.0, betweennessRanking, evRanking)\n \n commonNodesStatsDCBE += [(str(fraction) + \"%\", str(100*commonNodesFractionDCBE) + \"%\")]\n commonNodesStatsDE += [(str(fraction) + \"%\", str(100*commonNodesFractionDE) + \"%\")]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L143_C12", "label": "commonNodesFractionDCBE = computeFractionOfCommonUsers()", "type": "assigned_variable", "loc": [143, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L142_C8", "vector": [14, 3, 0.2739, 0.0019, 3, 0.28, 0.0, 967, 3, 5, 0, 0, 277, 10, 1], "semantic": {"name": "commonNodesFractionDCBE", "arg_names": [], "import_names": [], "rhs_call_name": "computeFractionOfCommonUsers", "annotation": ""}, "snippet": " commonNodesFractionDCBE = computeFractionOfCommonUsers(fraction/100.0, degreeRanking, closenessRanking, betweennessRanking, evRanking)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L144_C12", "label": "commonNodesFractionDE = computeFractionOfCommonUsers()", "type": "assigned_variable", "loc": [144, 144], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L142_C8", "vector": [14, 3, 0.2759, 0.0019, 3, 0.28, 0.3333, 553, 3, 3, 0, 0, 277, 10, 1], "semantic": {"name": "commonNodesFractionDE", "arg_names": [], "import_names": [], "rhs_call_name": "computeFractionOfCommonUsers", "annotation": ""}, "snippet": " commonNodesFractionDE = computeFractionOfCommonUsers(fraction/100.0, degreeRanking, evRanking)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L145_C12", "label": "commonNodesFractionCE = computeFractionOfCommonUsers()", "type": "assigned_variable", "loc": [145, 145], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L142_C8", "vector": [14, 3, 0.2778, 0.0019, 3, 0.28, 0.6667, 918, 3, 3, 0, 0, 277, 10, 1], "semantic": {"name": "commonNodesFractionCE", "arg_names": [], "import_names": [], "rhs_call_name": "computeFractionOfCommonUsers", "annotation": ""}, "snippet": " commonNodesFractionCE = computeFractionOfCommonUsers(fraction/100.0, closenessRanking, evRanking)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L146_C12", "label": "commonNodesFractionBE = computeFractionOfCommonUsers()", "type": "assigned_variable", "loc": [146, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L142_C8", "vector": [14, 3, 0.2797, 0.0019, 3, 0.28, 1.0, 966, 3, 3, 0, 0, 277, 10, 1], "semantic": {"name": "commonNodesFractionBE", "arg_names": [], "import_names": [], "rhs_call_name": "computeFractionOfCommonUsers", "annotation": ""}, "snippet": " commonNodesFractionBE = computeFractionOfCommonUsers(fraction/100.0, betweennessRanking, evRanking)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L153_C8", "label": "commonNodesFractionDCB = computeFractionOfCommonUsers()", "type": "assigned_variable", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:While_L141_C4", "vector": [14, 2, 0.2931, 0.0019, 2, 0.74, 0.25, 435, 3, 4, 0, 0, 277, 10, 1], "semantic": {"name": "commonNodesFractionDCB", "arg_names": [], "import_names": [], "rhs_call_name": "computeFractionOfCommonUsers", "annotation": ""}, "snippet": " commonNodesFractionDCB = computeFractionOfCommonUsers(fraction/100.0, degreeRanking, closenessRanking, betweennessRanking)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L155_C8", "label": "commonNodesFractionDC = computeFractionOfCommonUsers()", "type": "assigned_variable", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:While_L141_C4", "vector": [14, 2, 0.2969, 0.0019, 2, 0.74, 0.5, 556, 3, 3, 0, 0, 277, 10, 1], "semantic": {"name": "commonNodesFractionDC", "arg_names": [], "import_names": [], "rhs_call_name": "computeFractionOfCommonUsers", "annotation": ""}, "snippet": " commonNodesFractionDC = computeFractionOfCommonUsers(fraction/100.0, degreeRanking, closenessRanking)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L156_C8", "label": "commonNodesFractionDB = computeFractionOfCommonUsers()", "type": "assigned_variable", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:While_L141_C4", "vector": [14, 2, 0.2989, 0.0019, 2, 0.74, 0.75, 987, 3, 3, 0, 0, 277, 10, 1], "semantic": {"name": "commonNodesFractionDB", "arg_names": [], "import_names": [], "rhs_call_name": "computeFractionOfCommonUsers", "annotation": ""}, "snippet": " commonNodesFractionDB = computeFractionOfCommonUsers(fraction/100.0, degreeRanking, betweennessRanking)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L157_C8", "label": "commonNodesFractionBC = computeFractionOfCommonUsers()", "type": "assigned_variable", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:While_L141_C4", "vector": [14, 2, 0.3008, 0.0019, 2, 0.74, 1.0, 51, 3, 3, 0, 0, 277, 10, 1], "semantic": {"name": "commonNodesFractionBC", "arg_names": [], "import_names": [], "rhs_call_name": "computeFractionOfCommonUsers", "annotation": ""}, "snippet": " commonNodesFractionBC = computeFractionOfCommonUsers(fraction/100.0, betweennessRanking, closenessRanking)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L168_C4", "label": "if", "type": "if", "loc": [168, 170], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [4, 1, 0.3238, 0.0057, 1, 0.01, 0.614, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ev:\n headings = [\"top proportion\", \"fraction of common users [DC, CC, BC, EC]\"]\n writeRawHTML(rankingsFile, headings, commonNodesStatsDCBE, readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L169_C8", "label": "headings =", "type": "assigned_variable", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L168_C4", "vector": [14, 2, 0.3238, 0.0019, 2, 0.79, 0.0, 469, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "headings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headings = [\"top proportion\", \"fraction of common users [DC, CC, BC, EC]\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L170_C8", "label": "writeRawHTML()", "type": "expression", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L168_C4", "vector": [8, 2, 0.3257, 0.0019, 2, 0.79, 1.0, 256, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeRawHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeRawHTML", "annotation": ""}, "snippet": " writeRawHTML(rankingsFile, headings, commonNodesStatsDCBE, readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L172_C4", "label": "headings =", "type": "assigned_variable", "loc": [172, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.3295, 0.0019, 1, 0.01, 0.6316, 469, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "headings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headings = [\"top proportion\", \"fraction of common users [DC, CC, BC]\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L173_C4", "label": "writeRawHTML()", "type": "expression", "loc": [173, 173], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [8, 1, 0.3314, 0.0019, 1, 0.01, 0.6491, 256, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeRawHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeRawHTML", "annotation": ""}, "snippet": " writeRawHTML(rankingsFile, headings, commonNodesStatsDCB, readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L175_C4", "label": "topNumber =", "type": "assigned_variable", "loc": [175, 175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.3352, 0.0019, 1, 0.01, 0.6667, 882, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "topNumber", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " topNumber = \"top proportion\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L176_C4", "label": "if", "type": "if", "loc": [176, 183], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [4, 1, 0.3439, 0.0153, 1, 0.01, 0.6842, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ev:\n headingsDE = [topNumber, \"fraction of common users [DC, EC]\"]\n headingsCE = [topNumber, \"fraction of common users [CC, EC]\"]\n headingsBE = [topNumber, \"fraction of common users [BC, EC]\"]\n \n writeRawHTML(rankingsFile, headingsDE, commonNodesStatsDE, readWriteMode='a')\n writeRawHTML(rankingsFile, headingsCE, commonNodesStatsCE, readWriteMode='a')\n writeRawHTML(rankingsFile, headingsBE, commonNodesStatsBE, readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L177_C8", "label": "headingsDE =", "type": "assigned_variable", "loc": [177, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L176_C4", "vector": [14, 2, 0.3391, 0.0019, 2, 0.02, 0.0, 780, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "headingsDE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headingsDE = [topNumber, \"fraction of common users [DC, EC]\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L178_C8", "label": "headingsCE =", "type": "assigned_variable", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L176_C4", "vector": [14, 2, 0.341, 0.0019, 2, 0.02, 0.2, 285, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "headingsCE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headingsCE = [topNumber, \"fraction of common users [CC, EC]\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L179_C8", "label": "headingsBE =", "type": "assigned_variable", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L176_C4", "vector": [14, 2, 0.3429, 0.0019, 2, 0.02, 0.4, 363, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "headingsBE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headingsBE = [topNumber, \"fraction of common users [BC, EC]\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L181_C8", "label": "writeRawHTML()", "type": "expression", "loc": [181, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L176_C4", "vector": [8, 2, 0.3467, 0.0019, 2, 0.02, 0.6, 256, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeRawHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeRawHTML", "annotation": ""}, "snippet": " writeRawHTML(rankingsFile, headingsDE, commonNodesStatsDE, readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L182_C8", "label": "writeRawHTML()", "type": "expression", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L176_C4", "vector": [8, 2, 0.3487, 0.0019, 2, 0.02, 0.8, 256, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeRawHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeRawHTML", "annotation": ""}, "snippet": " writeRawHTML(rankingsFile, headingsCE, commonNodesStatsCE, readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L183_C8", "label": "writeRawHTML()", "type": "expression", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L176_C4", "vector": [8, 2, 0.3506, 0.0019, 2, 0.02, 1.0, 256, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeRawHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeRawHTML", "annotation": ""}, "snippet": " writeRawHTML(rankingsFile, headingsBE, commonNodesStatsBE, readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L185_C4", "label": "headingsDC =", "type": "assigned_variable", "loc": [185, 185], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.3544, 0.0019, 1, 0.01, 0.7018, 362, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "headingsDC", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headingsDC = [topNumber, \"fraction of common users [DC, CC]\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L186_C4", "label": "headingsDB =", "type": "assigned_variable", "loc": [186, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.3563, 0.0019, 1, 0.01, 0.7193, 634, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "headingsDB", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headingsDB = [topNumber, \"fraction of common users [DC, BC]\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L187_C4", "label": "headingsBC =", "type": "assigned_variable", "loc": [187, 187], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.3582, 0.0019, 1, 0.01, 0.7368, 362, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "headingsBC", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headingsBC = [topNumber, \"fraction of common users [BC, CC]\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L189_C4", "label": "writeRawHTML()", "type": "expression", "loc": [189, 189], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [8, 1, 0.3621, 0.0019, 1, 0.01, 0.7544, 256, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeRawHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeRawHTML", "annotation": ""}, "snippet": " writeRawHTML(rankingsFile, headingsDC, commonNodesStatsDC, readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L190_C4", "label": "writeRawHTML()", "type": "expression", "loc": [190, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [8, 1, 0.364, 0.0019, 1, 0.01, 0.7719, 256, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeRawHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeRawHTML", "annotation": ""}, "snippet": " writeRawHTML(rankingsFile, headingsDB, commonNodesStatsDB, readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L191_C4", "label": "writeRawHTML()", "type": "expression", "loc": [191, 191], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [8, 1, 0.3659, 0.0019, 1, 0.01, 0.7895, 256, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeRawHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeRawHTML", "annotation": ""}, "snippet": " writeRawHTML(rankingsFile, headingsBC, commonNodesStatsBC, readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L194_C4", "label": "topn =", "type": "assigned_variable", "loc": [194, 194], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.3716, 0.0019, 1, 0.01, 0.807, 958, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "topn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " topn = 15"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L195_C4", "label": "if", "type": "if", "loc": [195, 202], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [4, 1, 0.3803, 0.0153, 1, 0.01, 0.8246, 0, 2, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ev:\n fraction = topn / float(nbNodes)\n commonNodesTop15Fraction = computeFractionOfCommonUsers(fraction, degreeRanking, closenessRanking, betweennessRanking, evRanking)\n commonNodesTop15Stats = [(\"Top \" + str(topn), str(int(commonNodesTop15Fraction*topn)) + \" (\" + str(100*commonNodesTop15Fraction) + \"%)\")]\n \n topNumber = \"top number\"\n headings = [topNumber, \"Common users [DC, CC, BC, EC] in top \" + str(topn)]\n writeRawHTML(rankingsFile, headings, commonNodesTop15Stats, readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L196_C8", "label": "fraction =", "type": "assigned_variable", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L195_C4", "vector": [14, 2, 0.3755, 0.0019, 2, 0.61, 0.0, 696, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "fraction", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fraction = topn / float(nbNodes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L197_C8", "label": "commonNodesTop15Fraction = computeFractionOfCommonUsers()", "type": "assigned_variable", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L195_C4", "vector": [14, 2, 0.3774, 0.0019, 2, 0.61, 0.2, 812, 3, 5, 0, 0, 277, 10, 1], "semantic": {"name": "commonNodesTop15Fraction", "arg_names": [], "import_names": [], "rhs_call_name": "computeFractionOfCommonUsers", "annotation": ""}, "snippet": " commonNodesTop15Fraction = computeFractionOfCommonUsers(fraction, degreeRanking, closenessRanking, betweennessRanking, evRanking)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L198_C8", "label": "commonNodesTop15Stats =", "type": "assigned_variable", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L195_C4", "vector": [14, 2, 0.3793, 0.0019, 2, 0.61, 0.4, 915, 0, 0, 0, 0, 0, 5, 4], "semantic": {"name": "commonNodesTop15Stats", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " commonNodesTop15Stats = [(\"Top \" + str(topn), str(int(commonNodesTop15Fraction*topn)) + \" (\" + str(100*commonNodesTop15Fraction) + \"%)\")]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L200_C8", "label": "topNumber =", "type": "assigned_variable", "loc": [200, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L195_C4", "vector": [14, 2, 0.3831, 0.0019, 2, 0.61, 0.6, 882, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "topNumber", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " topNumber = \"top number\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L201_C8", "label": "headings =", "type": "assigned_variable", "loc": [201, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L195_C4", "vector": [14, 2, 0.3851, 0.0019, 2, 0.61, 0.8, 469, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "headings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headings = [topNumber, \"Common users [DC, CC, BC, EC] in top \" + str(topn)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L202_C8", "label": "writeRawHTML()", "type": "expression", "loc": [202, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L195_C4", "vector": [8, 2, 0.387, 0.0019, 2, 0.61, 1.0, 256, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeRawHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeRawHTML", "annotation": ""}, "snippet": " writeRawHTML(rankingsFile, headings, commonNodesTop15Stats, readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L205_C4", "label": "topNodes =", "type": "assigned_variable", "loc": [205, 205], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.3927, 0.0019, 1, 0.01, 0.8421, 830, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "topNodes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " topNodes = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L206_C4", "label": "if", "type": "if", "loc": [206, 211], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [4, 1, 0.3994, 0.0115, 1, 0.01, 0.8596, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ev:\n # compute average of all 4\n rankings = [degreeRanking, closenessRanking, betweennessRanking, evRanking]\n else:\n # compute average of all 3\n rankings = [degreeRanking, closenessRanking, betweennessRanking]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L208_C8", "label": "rankings =", "type": "assigned_variable", "loc": [208, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L206_C4", "vector": [14, 2, 0.3985, 0.0019, 2, 0.94, 0.0, 194, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "rankings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rankings = [degreeRanking, closenessRanking, betweennessRanking, evRanking]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L211_C8", "label": "rankings =", "type": "assigned_variable", "loc": [211, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L206_C4", "vector": [14, 2, 0.4042, 0.0019, 2, 0.94, 1.0, 194, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "rankings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rankings = [degreeRanking, closenessRanking, betweennessRanking]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L213_C4", "label": "for ranking", "type": "for", "loc": [213, 214], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [6, 1, 0.409, 0.0038, 1, 0.01, 0.8772, 761, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ranking", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for ranking in rankings:\n topNodes += [x[0] for x in ranking]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L215_C4", "label": "topNodes = set()", "type": "assigned_variable", "loc": [215, 215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.4119, 0.0019, 1, 0.01, 0.8947, 830, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "topNodes", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " topNodes = set(topNodes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L217_C4", "label": "averageRankStats =", "type": "assigned_variable", "loc": [217, 217], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.4157, 0.0019, 1, 0.01, 0.9123, 835, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "averageRankStats", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " averageRankStats = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L218_C4", "label": "for node", "type": "for", "loc": [218, 230], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [6, 1, 0.4291, 0.0249, 1, 0.01, 0.9298, 772, 2, 0, 0, 0, 0, 0, 6], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for node in topNodes:\n averageRank = 0\n for ranking in rankings:\n try:\n rank = [x[0] for x in ranking].index(node)\n except:\n print(\"Warning: Node not in ranking!\")\n averageRank += rank"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L219_C8", "label": "averageRank =", "type": "assigned_variable", "loc": [219, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L218_C4", "vector": [14, 2, 0.4195, 0.0019, 2, 0.7, 0.0, 958, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "averageRank", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " averageRank = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L220_C8", "label": "for ranking", "type": "for", "loc": [220, 225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L218_C4", "vector": [6, 2, 0.4262, 0.0115, 2, 0.7, 0.5, 761, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "ranking", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for ranking in rankings:\n try:\n rank = [x[0] for x in ranking].index(node)\n except:\n print(\"Warning: Node not in ranking!\")\n averageRank += rank"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Try_L221_C12", "label": "try", "type": "try", "loc": [221, 224], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L220_C8", "vector": [7, 3, 0.4262, 0.0077, 3, 0.03, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n rank = [x[0] for x in ranking].index(node)\n except:\n print(\"Warning: Node not in ranking!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L222_C16", "label": "rank = index()", "type": "assigned_variable", "loc": [222, 222], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:Try_L221_C12", "vector": [14, 4, 0.4253, 0.0019, 4, 0.34, 0.0, 186, 3, 1, 0, 0, 780, 10, 1], "semantic": {"name": "rank", "arg_names": [], "import_names": [], "rhs_call_name": "index", "annotation": ""}, "snippet": " rank = [x[0] for x in ranking].index(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L224_C16", "label": "print()", "type": "expression", "loc": [224, 224], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:Try_L221_C12", "vector": [8, 4, 0.4291, 0.0019, 4, 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(\"Warning: Node not in ranking!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L230_C8", "label": "averageRankStats = sorted()", "type": "assigned_variable", "loc": [230, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L218_C4", "vector": [14, 2, 0.4406, 0.0019, 2, 0.7, 1.0, 835, 3, 3, 0, 0, 134, 10, 2], "semantic": {"name": "averageRankStats", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " averageRankStats = sorted(averageRankStats, key=operator.itemgetter(1), reverse=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L235_C4", "label": "headings =", "type": "assigned_variable", "loc": [235, 235], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.4502, 0.0019, 1, 0.01, 0.9474, 469, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "headings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headings = [\"node id\", \"username\", \"average rank\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L236_C4", "label": "writeHTML()", "type": "expression", "loc": [236, 236], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [8, 1, 0.4521, 0.0019, 1, 0.01, 0.9649, 665, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeHTML", "annotation": ""}, "snippet": " writeHTML(rankingsFile, headings, averageRankStats[:topn], readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L239_C4", "label": "limit =", "type": "assigned_variable", "loc": [239, 239], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [14, 1, 0.4579, 0.0019, 1, 0.01, 0.9825, 429, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "limit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " limit = 7"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "label": "for topPercent", "type": "for", "loc": [240, 263], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "vector": [6, 1, 0.4818, 0.046, 1, 0.01, 1.0, 640, 3, 0, 0, 0, 0, 0, 15], "semantic": {"name": "topPercent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for topPercent in range(10, 100, 15):\n topNumber = int(nbNodes * topPercent / float(100))\n topNodes = [x[0] for x in averageRankStats][:topNumber]\n \n topNodesAndNeighbors = copy.deepcopy(topNodes)\n for node in topNodes:\n topNodesAndNeighbors += graph.neighbors(node)\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L241_C8", "label": "topNumber = int()", "type": "assigned_variable", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "vector": [14, 2, 0.4617, 0.0019, 2, 0.97, 0.0, 882, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "topNumber", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " topNumber = int(nbNodes * topPercent / float(100))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L242_C8", "label": "topNodes =", "type": "assigned_variable", "loc": [242, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "vector": [14, 2, 0.4636, 0.0019, 2, 0.97, 0.0714, 830, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "topNodes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " topNodes = [x[0] for x in averageRankStats][:topNumber]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L244_C8", "label": "topNodesAndNeighbors = deepcopy()", "type": "assigned_variable", "loc": [244, 244], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "vector": [14, 2, 0.4674, 0.0019, 2, 0.97, 0.1429, 971, 3, 1, 0, 0, 44, 10, 1], "semantic": {"name": "topNodesAndNeighbors", "arg_names": [], "import_names": [], "rhs_call_name": "deepcopy", "annotation": ""}, "snippet": " topNodesAndNeighbors = copy.deepcopy(topNodes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L245_C8", "label": "for node", "type": "for", "loc": [245, 246], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "vector": [6, 2, 0.4703, 0.0038, 2, 0.97, 0.2143, 772, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for node in topNodes:\n topNodesAndNeighbors += graph.neighbors(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L248_C8", "label": "subGraph = subgraph()", "type": "assigned_variable", "loc": [248, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "vector": [14, 2, 0.4751, 0.0019, 2, 0.97, 0.2857, 916, 3, 2, 0, 0, 880, 10, 1], "semantic": {"name": "subGraph", "arg_names": [], "import_names": [], "rhs_call_name": "subgraph", "annotation": ""}, "snippet": " subGraph = nx.subgraph(graph, topNodes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L249_C8", "label": "subGraphWithNeighbors = subgraph()", "type": "assigned_variable", "loc": [249, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "vector": [14, 2, 0.477, 0.0019, 2, 0.97, 0.3571, 195, 3, 2, 0, 0, 880, 10, 1], "semantic": {"name": "subGraphWithNeighbors", "arg_names": [], "import_names": [], "rhs_call_name": "subgraph", "annotation": ""}, "snippet": " subGraphWithNeighbors = nx.subgraph(graph, topNodesAndNeighbors)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L251_C8", "label": "filename =", "type": "assigned_variable", "loc": [251, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "vector": [14, 2, 0.4808, 0.0019, 2, 0.97, 0.4286, 275, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename = \"graph\" + (\"1\" if directed else \"2\") + \"top\" + str(topPercent) + \"percent.gml\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L252_C8", "label": "saveGraph()", "type": "expression", "loc": [252, 252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "vector": [8, 2, 0.4828, 0.0019, 2, 0.97, 0.5, 400, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "saveGraph", "arg_names": [], "import_names": [], "rhs_call_name": "saveGraph", "annotation": ""}, "snippet": " saveGraph(subGraph, filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L254_C8", "label": "clusteringCoefficientRanking = computeClusteringCoefficient()", "type": "assigned_variable", "loc": [254, 254], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "vector": [14, 2, 0.4866, 0.0019, 2, 0.97, 0.5714, 163, 3, 2, 0, 0, 271, 10, 1], "semantic": {"name": "clusteringCoefficientRanking", "arg_names": [], "import_names": [], "rhs_call_name": "computeClusteringCoefficient", "annotation": ""}, "snippet": " clusteringCoefficientRanking = computeClusteringCoefficient(subGraph, directed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L256_C8", "label": "clusteringCoefficientNeighborsRanking = computeClusteringCoefficient()", "type": "assigned_variable", "loc": [256, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "vector": [14, 2, 0.4904, 0.0019, 2, 0.97, 0.6429, 412, 3, 2, 0, 0, 271, 10, 1], "semantic": {"name": "clusteringCoefficientNeighborsRanking", "arg_names": [], "import_names": [], "rhs_call_name": "computeClusteringCoefficient", "annotation": ""}, "snippet": " clusteringCoefficientNeighborsRanking = computeClusteringCoefficient(subGraphWithNeighbors, directed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L257_C8", "label": "clusteringCoefficientNeighborsRanking =", "type": "assigned_variable", "loc": [257, 257], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "vector": [14, 2, 0.4923, 0.0019, 2, 0.97, 0.7143, 412, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "clusteringCoefficientNeighborsRanking", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " clusteringCoefficientNeighborsRanking = [x for x in clusteringCoefficientNeighborsRanking if x[0] in topNodes]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L259_C8", "label": "headings =", "type": "assigned_variable", "loc": [259, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "vector": [14, 2, 0.4962, 0.0019, 2, 0.97, 0.7857, 469, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "headings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headings = [\"user id\", \"username\", \"clustering coefficient for top\" + str(topPercent) + \"% subgraph\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L260_C8", "label": "writeHTML()", "type": "expression", "loc": [260, 260], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "vector": [8, 2, 0.4981, 0.0019, 2, 0.97, 0.8571, 665, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeHTML", "annotation": ""}, "snippet": " writeHTML(rankingsFile, headings, clusteringCoefficientRanking[:limit], readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L262_C8", "label": "headings =", "type": "assigned_variable", "loc": [262, 262], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "vector": [14, 2, 0.5019, 0.0019, 2, 0.97, 0.9286, 469, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "headings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headings = [\"user id\", \"username\", \"clustering coefficient (with neighbors) for top\" + str(topPercent) + \"% subgraph\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L263_C8", "label": "writeHTML()", "type": "expression", "loc": [263, 263], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "vector": [8, 2, 0.5038, 0.0019, 2, 0.97, 1.0, 665, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeHTML", "annotation": ""}, "snippet": " writeHTML(rankingsFile, headings, clusteringCoefficientNeighborsRanking[:limit], readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L265_C0", "label": "computeClusteringCoefficient", "type": "function", "loc": [265, 276], "level": 0, "parent": null, "vector": [2, 0, 0.5182, 0.023, 0, 0.66, 0.6667, 271, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "computeClusteringCoefficient", "arg_names": ["graph", "directed"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def computeClusteringCoefficient(graph, directed):\n if not directed:\n clusteringCoefficient = nx.clustering(graph)\n else:\n g = nx.Graph()\n g.add_nodes_from(graph.nodes())\n g.add_edges_from(graph.edges())\n clusteringCoefficient = nx.clustering(g)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L266_C4", "label": "if", "type": "if", "loc": [266, 272], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L265_C0", "vector": [4, 1, 0.5153, 0.0134, 1, 0.15, 0.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not directed:\n clusteringCoefficient = nx.clustering(graph)\n else:\n g = nx.Graph()\n g.add_nodes_from(graph.nodes())\n g.add_edges_from(graph.edges())\n clusteringCoefficient = nx.clustering(g)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L267_C8", "label": "clusteringCoefficient = clustering()", "type": "assigned_variable", "loc": [267, 267], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L266_C4", "vector": [14, 2, 0.5115, 0.0019, 2, 0.43, 0.0, 200, 3, 1, 0, 0, 426, 10, 1], "semantic": {"name": "clusteringCoefficient", "arg_names": [], "import_names": [], "rhs_call_name": "clustering", "annotation": ""}, "snippet": " clusteringCoefficient = nx.clustering(graph)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L269_C8", "label": "g = Graph()", "type": "assigned_variable", "loc": [269, 269], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L266_C4", "vector": [14, 2, 0.5153, 0.0019, 2, 0.43, 0.25, 384, 3, 0, 0, 0, 90, 10, 1], "semantic": {"name": "g", "arg_names": [], "import_names": [], "rhs_call_name": "Graph", "annotation": ""}, "snippet": " g = nx.Graph()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L270_C8", "label": "add_nodes_from()", "type": "expression", "loc": [270, 270], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L266_C4", "vector": [8, 2, 0.5172, 0.0019, 2, 0.43, 0.5, 221, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "add_nodes_from", "arg_names": [], "import_names": [], "rhs_call_name": "add_nodes_from", "annotation": ""}, "snippet": " g.add_nodes_from(graph.nodes())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L271_C8", "label": "add_edges_from()", "type": "expression", "loc": [271, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L266_C4", "vector": [8, 2, 0.5192, 0.0019, 2, 0.43, 0.75, 574, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "add_edges_from", "arg_names": [], "import_names": [], "rhs_call_name": "add_edges_from", "annotation": ""}, "snippet": " g.add_edges_from(graph.edges())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L272_C8", "label": "clusteringCoefficient = clustering()", "type": "assigned_variable", "loc": [272, 272], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L266_C4", "vector": [14, 2, 0.5211, 0.0019, 2, 0.43, 1.0, 200, 3, 1, 0, 0, 426, 10, 1], "semantic": {"name": "clusteringCoefficient", "arg_names": [], "import_names": [], "rhs_call_name": "clustering", "annotation": ""}, "snippet": " clusteringCoefficient = nx.clustering(g)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L274_C4", "label": "clusteringCoefficientRanking = getSortedTop()", "type": "assigned_variable", "loc": [274, 274], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L265_C0", "vector": [14, 1, 0.5249, 0.0019, 1, 0.15, 0.5, 163, 3, 1, 0, 0, 894, 10, 1], "semantic": {"name": "clusteringCoefficientRanking", "arg_names": [], "import_names": [], "rhs_call_name": "getSortedTop", "annotation": ""}, "snippet": " clusteringCoefficientRanking = getSortedTop(clusteringCoefficient)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Return_L276_C4", "label": "return", "type": "return", "loc": [276, 276], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L265_C0", "vector": [13, 1, 0.5287, 0.0019, 1, 0.15, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return clusteringCoefficientRanking"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L278_C0", "label": "saveGraph", "type": "function", "loc": [278, 279], "level": 0, "parent": null, "vector": [2, 0, 0.5335, 0.0038, 0, 0.66, 0.6905, 400, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "saveGraph", "arg_names": ["graph", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def saveGraph(graph, filename):\n gml.write_gml(graph, filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L279_C4", "label": "write_gml()", "type": "expression", "loc": [279, 279], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L278_C0", "vector": [8, 1, 0.5345, 0.0019, 1, 0.5, 0.0, 446, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "write_gml", "arg_names": [], "import_names": [], "rhs_call_name": "write_gml", "annotation": ""}, "snippet": " gml.write_gml(graph, filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L281_C0", "label": "computeFractionOfCommonUsers", "type": "function", "loc": [281, 293], "level": 0, "parent": null, "vector": [2, 0, 0.5498, 0.0249, 0, 0.66, 0.7143, 277, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "computeFractionOfCommonUsers", "arg_names": ["fraction", "rankings"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def computeFractionOfCommonUsers(fraction, *rankings):\n if len(rankings) > 1:\n nbNodes = len(rankings[0])\n portionSize = math.ceil(fraction * nbNodes)\n commonNodes = set([x[0] for x in rankings[0]][:portionSize])\n \n for ranking in rankings:\n rankingPortion = [x[0] for x in ranking][:portionSize]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L282_C4", "label": "if", "type": "if", "loc": [282, 292], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L281_C0", "vector": [4, 1, 0.5498, 0.0211, 1, 0.63, 0.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(rankings) > 1:\n nbNodes = len(rankings[0])\n portionSize = math.ceil(fraction * nbNodes)\n commonNodes = set([x[0] for x in rankings[0]][:portionSize])\n \n for ranking in rankings:\n rankingPortion = [x[0] for x in ranking][:portionSize]\n commonNodes = [x for x in commonNodes if x in rankingPortion]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L283_C8", "label": "nbNodes = len()", "type": "assigned_variable", "loc": [283, 283], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L282_C4", "vector": [14, 2, 0.5421, 0.0019, 2, 0.98, 0.0, 973, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "nbNodes", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " nbNodes = len(rankings[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L284_C8", "label": "portionSize = ceil()", "type": "assigned_variable", "loc": [284, 284], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L282_C4", "vector": [14, 2, 0.5441, 0.0019, 2, 0.98, 0.2, 342, 3, 1, 0, 0, 211, 10, 1], "semantic": {"name": "portionSize", "arg_names": [], "import_names": [], "rhs_call_name": "ceil", "annotation": ""}, "snippet": " portionSize = math.ceil(fraction * nbNodes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L285_C8", "label": "commonNodes = set()", "type": "assigned_variable", "loc": [285, 285], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L282_C4", "vector": [14, 2, 0.546, 0.0019, 2, 0.98, 0.4, 280, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "commonNodes", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " commonNodes = set([x[0] for x in rankings[0]][:portionSize])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L287_C8", "label": "for ranking", "type": "for", "loc": [287, 289], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L282_C4", "vector": [6, 2, 0.5517, 0.0057, 2, 0.98, 0.6, 761, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ranking", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for ranking in rankings:\n rankingPortion = [x[0] for x in ranking][:portionSize]\n commonNodes = [x for x in commonNodes if x in rankingPortion]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L288_C12", "label": "rankingPortion =", "type": "assigned_variable", "loc": [288, 288], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L287_C8", "vector": [14, 3, 0.5517, 0.0019, 3, 0.62, 0.0, 693, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rankingPortion", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rankingPortion = [x[0] for x in ranking][:portionSize]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L289_C12", "label": "commonNodes =", "type": "assigned_variable", "loc": [289, 289], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L287_C8", "vector": [14, 3, 0.5536, 0.0019, 3, 0.62, 1.0, 280, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "commonNodes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " commonNodes = [x for x in commonNodes if x in rankingPortion]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L291_C8", "label": "commonNodesFraction =", "type": "assigned_variable", "loc": [291, 291], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L282_C4", "vector": [14, 2, 0.5575, 0.0019, 2, 0.98, 0.8, 368, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "commonNodesFraction", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " commonNodesFraction = len(commonNodes) / float(portionSize)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Return_L292_C8", "label": "return", "type": "return", "loc": [292, 292], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L282_C4", "vector": [13, 2, 0.5594, 0.0019, 2, 0.98, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return commonNodesFraction"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L295_C0", "label": "createGeneralRanking", "type": "function", "loc": [295, 320], "level": 0, "parent": null, "vector": [2, 0, 0.5891, 0.0498, 0, 0.66, 0.7381, 714, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "createGeneralRanking", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def createGeneralRanking():\n generalRanking = {}\n generalRankingNodeOccurences = {}\n for ranking in averageRankings:\n for nodeRankTuple in ranking:\n node = nodeRankTuple[0]\n rank = nodeRankTuple[1]\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L296_C4", "label": "generalRanking =", "type": "assigned_variable", "loc": [296, 296], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L295_C0", "vector": [14, 1, 0.567, 0.0019, 1, 0.89, 0.0, 293, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "generalRanking", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " generalRanking = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L297_C4", "label": "generalRankingNodeOccurences =", "type": "assigned_variable", "loc": [297, 297], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L295_C0", "vector": [14, 1, 0.569, 0.0019, 1, 0.89, 0.1429, 748, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "generalRankingNodeOccurences", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " generalRankingNodeOccurences = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L298_C4", "label": "for ranking", "type": "for", "loc": [298, 310], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L295_C0", "vector": [6, 1, 0.5824, 0.0249, 1, 0.89, 0.2857, 761, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ranking", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for ranking in averageRankings:\n for nodeRankTuple in ranking:\n node = nodeRankTuple[0]\n rank = nodeRankTuple[1]\n try:\n generalRanking[node] += rank\n except:\n generalRanking[node] = rank"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L299_C8", "label": "for nodeRankTuple", "type": "for", "loc": [299, 310], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L298_C4", "vector": [6, 2, 0.5833, 0.023, 2, 0.4, 0.0, 876, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "nodeRankTuple", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for nodeRankTuple in ranking:\n node = nodeRankTuple[0]\n rank = nodeRankTuple[1]\n try:\n generalRanking[node] += rank\n except:\n generalRanking[node] = rank\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L300_C12", "label": "node =", "type": "assigned_variable", "loc": [300, 300], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L299_C8", "vector": [14, 3, 0.5747, 0.0019, 3, 0.18, 0.0, 772, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " node = nodeRankTuple[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L301_C12", "label": "rank =", "type": "assigned_variable", "loc": [301, 301], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L299_C8", "vector": [14, 3, 0.5766, 0.0019, 3, 0.18, 0.3333, 186, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rank", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rank = nodeRankTuple[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Try_L302_C12", "label": "try", "type": "try", "loc": [302, 305], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L299_C8", "vector": [7, 3, 0.5814, 0.0077, 3, 0.18, 0.6667, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n generalRanking[node] += rank\n except:\n generalRanking[node] = rank"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L305_C16", "label": "assign", "type": "assigned_variable", "loc": [305, 305], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:Try_L302_C12", "vector": [14, 4, 0.5843, 0.0019, 4, 0.71, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " generalRanking[node] = rank"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Try_L307_C12", "label": "try", "type": "try", "loc": [307, 310], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L299_C8", "vector": [7, 3, 0.591, 0.0077, 3, 0.18, 1.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n generalRankingNodeOccurences[node] += 1\n except:\n generalRankingNodeOccurences[node] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L310_C16", "label": "assign", "type": "assigned_variable", "loc": [310, 310], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:Try_L307_C12", "vector": [14, 4, 0.5939, 0.0019, 4, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " generalRankingNodeOccurences[node] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L312_C4", "label": "finalRanking =", "type": "assigned_variable", "loc": [312, 312], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L295_C0", "vector": [14, 1, 0.5977, 0.0019, 1, 0.89, 0.4286, 238, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "finalRanking", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " finalRanking = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L313_C4", "label": "for node, rank", "type": "for", "loc": [313, 315], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L295_C0", "vector": [6, 1, 0.6015, 0.0057, 1, 0.89, 0.5714, 188, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "node, rank", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for node, rank in generalRanking.items():\n averageRank = rank / float(generalRankingNodeOccurences[node])\n finalRanking += [(node, averageRank)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L314_C8", "label": "averageRank =", "type": "assigned_variable", "loc": [314, 314], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L313_C4", "vector": [14, 2, 0.6015, 0.0019, 2, 0.79, 0.0, 958, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "averageRank", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " averageRank = rank / float(generalRankingNodeOccurences[node])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L317_C4", "label": "finalRanking = sorted()", "type": "assigned_variable", "loc": [317, 317], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L295_C0", "vector": [14, 1, 0.6073, 0.0019, 1, 0.89, 0.7143, 238, 3, 3, 0, 0, 134, 10, 2], "semantic": {"name": "finalRanking", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " finalRanking = sorted(finalRanking, key=operator.itemgetter(1), reverse=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L319_C4", "label": "headings =", "type": "assigned_variable", "loc": [319, 319], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L295_C0", "vector": [14, 1, 0.6111, 0.0019, 1, 0.89, 0.8571, 469, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "headings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headings = [\"node id\", \"username\", \"average rank over both graphs\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L320_C4", "label": "writeHTML()", "type": "expression", "loc": [320, 320], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L295_C0", "vector": [8, 1, 0.613, 0.0019, 1, 0.89, 1.0, 665, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeHTML", "annotation": ""}, "snippet": " writeHTML(rankingsFile, headings, finalRanking, readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "label": "createPolarityRanking", "type": "function", "loc": [322, 339], "level": 0, "parent": null, "vector": [2, 0, 0.6331, 0.0345, 0, 0.66, 0.7619, 308, 0, 0, 0, 0, 0, 0, 15], "semantic": {"name": "createPolarityRanking", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def createPolarityRanking():\n limit = 7\n # polarity ranking\n replies = polarityReplies()\n polarityCounter = PolarityCounter(replies)\n polarityRanking = polarityCounter.polarityDifferenceRanking()\n \n headings = [\"user id\", \"username\", \"Greatest polarity difference\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L323_C4", "label": "limit =", "type": "assigned_variable", "loc": [323, 323], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "vector": [14, 1, 0.6188, 0.0019, 1, 0.63, 0.0, 429, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "limit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " limit = 7"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L325_C4", "label": "replies = polarityReplies()", "type": "assigned_variable", "loc": [325, 325], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "vector": [14, 1, 0.6226, 0.0019, 1, 0.63, 0.0833, 205, 3, 0, 0, 0, 533, 10, 1], "semantic": {"name": "replies", "arg_names": [], "import_names": [], "rhs_call_name": "polarityReplies", "annotation": ""}, "snippet": " replies = polarityReplies()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L326_C4", "label": "polarityCounter = PolarityCounter()", "type": "assigned_variable", "loc": [326, 326], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "vector": [14, 1, 0.6245, 0.0019, 1, 0.63, 0.1667, 889, 3, 1, 0, 0, 151, 10, 1], "semantic": {"name": "polarityCounter", "arg_names": [], "import_names": [], "rhs_call_name": "PolarityCounter", "annotation": ""}, "snippet": " polarityCounter = PolarityCounter(replies)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L327_C4", "label": "polarityRanking = polarityDifferenceRanking()", "type": "assigned_variable", "loc": [327, 327], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "vector": [14, 1, 0.6264, 0.0019, 1, 0.63, 0.25, 951, 3, 0, 0, 0, 615, 10, 1], "semantic": {"name": "polarityRanking", "arg_names": [], "import_names": [], "rhs_call_name": "polarityDifferenceRanking", "annotation": ""}, "snippet": " polarityRanking = polarityCounter.polarityDifferenceRanking()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L329_C4", "label": "headings =", "type": "assigned_variable", "loc": [329, 329], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "vector": [14, 1, 0.6303, 0.0019, 1, 0.63, 0.3333, 469, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "headings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headings = [\"user id\", \"username\", \"Greatest polarity difference\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L330_C4", "label": "writeHTML()", "type": "expression", "loc": [330, 330], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "vector": [8, 1, 0.6322, 0.0019, 1, 0.63, 0.4167, 665, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeHTML", "annotation": ""}, "snippet": " writeHTML(rankingsFile, headings, polarityRanking[:limit], readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L332_C4", "label": "reverse()", "type": "expression", "loc": [332, 332], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "vector": [8, 1, 0.636, 0.0019, 1, 0.63, 0.5, 109, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reverse", "arg_names": [], "import_names": [], "rhs_call_name": "reverse", "annotation": ""}, "snippet": " polarityRanking.reverse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L333_C4", "label": "headings =", "type": "assigned_variable", "loc": [333, 333], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "vector": [14, 1, 0.6379, 0.0019, 1, 0.63, 0.5833, 469, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "headings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headings = [\"user id\", \"username\", \"Lowest polarity difference\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L334_C4", "label": "writeHTML()", "type": "expression", "loc": [334, 334], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "vector": [8, 1, 0.6398, 0.0019, 1, 0.63, 0.6667, 665, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeHTML", "annotation": ""}, "snippet": " writeHTML(rankingsFile, headings, polarityRanking[:limit], readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L336_C4", "label": "print()", "type": "expression", "loc": [336, 336], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "vector": [8, 1, 0.6437, 0.0019, 1, 0.63, 0.75, 535, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"users: %s, ranking length: %s\" % (len(sqlUsers), len(polarityRanking)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L337_C4", "label": "print()", "type": "expression", "loc": [337, 337], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "vector": [8, 1, 0.6456, 0.0019, 1, 0.63, 0.8333, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(len(polarityCounter.replies))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L338_C4", "label": "print()", "type": "expression", "loc": [338, 338], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "vector": [8, 1, 0.6475, 0.0019, 1, 0.63, 0.9167, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(len(polarityCounter.edges))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L339_C4", "label": "print()", "type": "expression", "loc": [339, 339], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "vector": [8, 1, 0.6494, 0.0019, 1, 0.63, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"NDI=\" + str(polarityCounter.NDI))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L342_C0", "label": "printTime", "type": "function", "loc": [342, 347], "level": 0, "parent": null, "vector": [2, 0, 0.66, 0.0115, 0, 0.66, 0.7857, 109, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printTime", "arg_names": ["interval"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def printTime(interval):\n seconds = interval / 1000\n minutes = seconds / 60\n hours = minutes / 60\n days = hours / 24\n print(days, hours, minutes, seconds)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L343_C4", "label": "seconds =", "type": "assigned_variable", "loc": [343, 343], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L342_C0", "vector": [14, 1, 0.6571, 0.0019, 1, 0.22, 0.0, 862, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "seconds", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " seconds = interval / 1000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L344_C4", "label": "minutes =", "type": "assigned_variable", "loc": [344, 344], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L342_C0", "vector": [14, 1, 0.659, 0.0019, 1, 0.22, 0.25, 234, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "minutes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " minutes = seconds / 60"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L345_C4", "label": "hours =", "type": "assigned_variable", "loc": [345, 345], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L342_C0", "vector": [14, 1, 0.6609, 0.0019, 1, 0.22, 0.5, 855, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "hours", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hours = minutes / 60"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L346_C4", "label": "days =", "type": "assigned_variable", "loc": [346, 346], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L342_C0", "vector": [14, 1, 0.6628, 0.0019, 1, 0.22, 0.75, 939, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "days", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " days = hours / 24"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L347_C4", "label": "print()", "type": "expression", "loc": [347, 347], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L342_C0", "vector": [8, 1, 0.6648, 0.0019, 1, 0.22, 1.0, 535, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(days, hours, minutes, seconds)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L349_C0", "label": "polarizationForAllForums", "type": "function", "loc": [349, 355], "level": 0, "parent": null, "vector": [2, 0, 0.6743, 0.0134, 0, 0.66, 0.8095, 209, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "polarizationForAllForums", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def polarizationForAllForums():\n forums = getForums()\n \n for forum in forums:\n forumID = forum[\"id\"]\n replies = polarityReplies(forum=forumID)\n computePolarizationOverTime(replies, forumID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L350_C4", "label": "forums = getForums()", "type": "assigned_variable", "loc": [350, 350], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L349_C0", "vector": [14, 1, 0.6705, 0.0019, 1, 0.12, 0.0, 763, 3, 0, 0, 0, 929, 10, 1], "semantic": {"name": "forums", "arg_names": [], "import_names": [], "rhs_call_name": "getForums", "annotation": ""}, "snippet": " forums = getForums()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L352_C4", "label": "for forum", "type": "for", "loc": [352, 355], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L349_C0", "vector": [6, 1, 0.6772, 0.0077, 1, 0.12, 1.0, 659, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "forum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for forum in forums:\n forumID = forum[\"id\"]\n replies = polarityReplies(forum=forumID)\n computePolarizationOverTime(replies, forumID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L353_C8", "label": "forumID =", "type": "assigned_variable", "loc": [353, 353], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L352_C4", "vector": [14, 2, 0.6762, 0.0019, 2, 0.63, 0.0, 457, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "forumID", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " forumID = forum[\"id\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L354_C8", "label": "replies = polarityReplies()", "type": "assigned_variable", "loc": [354, 354], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L352_C4", "vector": [14, 2, 0.6782, 0.0019, 2, 0.63, 0.5, 205, 3, 1, 0, 0, 533, 10, 1], "semantic": {"name": "replies", "arg_names": [], "import_names": [], "rhs_call_name": "polarityReplies", "annotation": ""}, "snippet": " replies = polarityReplies(forum=forumID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L355_C8", "label": "computePolarizationOverTime()", "type": "expression", "loc": [355, 355], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L352_C4", "vector": [8, 2, 0.6801, 0.0019, 2, 0.63, 1.0, 539, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "computePolarizationOverTime", "arg_names": [], "import_names": [], "rhs_call_name": "computePolarizationOverTime", "annotation": ""}, "snippet": " computePolarizationOverTime(replies, forumID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "label": "computePolarizationOverTime", "type": "function", "loc": [357, 384], "level": 0, "parent": null, "vector": [2, 0, 0.7098, 0.0536, 0, 0.66, 0.8333, 539, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "computePolarizationOverTime", "arg_names": ["replies", "forumID"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def computePolarizationOverTime(replies, forumID):\n timeSortedReplies = sorted(replies, key=lambda x: x[\"timestamp\"])\n first = timeSortedReplies[0][\"timestamp\"]\n last = timeSortedReplies[-1][\"timestamp\"]\n interval = last - first\n timeSliceCount = 20\n deltaTimeMillis = interval / timeSliceCount\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L358_C4", "label": "timeSortedReplies = sorted()", "type": "assigned_variable", "loc": [358, 358], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "vector": [14, 1, 0.6858, 0.0019, 1, 0.05, 0.0, 639, 3, 2, 0, 0, 134, 10, 1], "semantic": {"name": "timeSortedReplies", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " timeSortedReplies = sorted(replies, key=lambda x: x[\"timestamp\"])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L359_C4", "label": "first =", "type": "assigned_variable", "loc": [359, 359], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "vector": [14, 1, 0.6877, 0.0019, 1, 0.05, 0.0769, 199, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = timeSortedReplies[0][\"timestamp\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L360_C4", "label": "last =", "type": "assigned_variable", "loc": [360, 360], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "vector": [14, 1, 0.6897, 0.0019, 1, 0.05, 0.1538, 95, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "last", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last = timeSortedReplies[-1][\"timestamp\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L361_C4", "label": "interval =", "type": "assigned_variable", "loc": [361, 361], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "vector": [14, 1, 0.6916, 0.0019, 1, 0.05, 0.2308, 628, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "interval", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " interval = last - first"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L362_C4", "label": "timeSliceCount =", "type": "assigned_variable", "loc": [362, 362], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "vector": [14, 1, 0.6935, 0.0019, 1, 0.05, 0.3077, 3, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "timeSliceCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " timeSliceCount = 20"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L363_C4", "label": "deltaTimeMillis =", "type": "assigned_variable", "loc": [363, 363], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "vector": [14, 1, 0.6954, 0.0019, 1, 0.05, 0.3846, 545, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "deltaTimeMillis", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " deltaTimeMillis = interval / timeSliceCount"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L365_C4", "label": "ndiVariation =", "type": "assigned_variable", "loc": [365, 365], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "vector": [14, 1, 0.6992, 0.0019, 1, 0.05, 0.4615, 178, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "ndiVariation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ndiVariation = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L366_C4", "label": "timeThreshold =", "type": "assigned_variable", "loc": [366, 366], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "vector": [14, 1, 0.7011, 0.0019, 1, 0.05, 0.5385, 816, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "timeThreshold", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " timeThreshold = first + deltaTimeMillis"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:While_L367_C4", "label": "while", "type": "while", "loc": [367, 373], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "vector": [5, 1, 0.7088, 0.0134, 1, 0.05, 0.6154, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while timeThreshold <= last:\n r = repliesBeforeTime(timeSortedReplies, timeThreshold)\n polarityCounter = PolarityCounter(r)\n edgesCount = len(polarityCounter.edges)\n ndiVariation += [(timeThreshold, polarityCounter.NDI, edgesCount)]\n \n timeThreshold += deltaTimeMillis"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L368_C8", "label": "r = repliesBeforeTime()", "type": "assigned_variable", "loc": [368, 368], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:While_L367_C4", "vector": [14, 2, 0.705, 0.0019, 2, 0.1, 0.0, 436, 3, 2, 0, 0, 186, 10, 1], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "repliesBeforeTime", "annotation": ""}, "snippet": " r = repliesBeforeTime(timeSortedReplies, timeThreshold)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L369_C8", "label": "polarityCounter = PolarityCounter()", "type": "assigned_variable", "loc": [369, 369], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:While_L367_C4", "vector": [14, 2, 0.7069, 0.0019, 2, 0.1, 0.5, 889, 3, 1, 0, 0, 151, 10, 1], "semantic": {"name": "polarityCounter", "arg_names": [], "import_names": [], "rhs_call_name": "PolarityCounter", "annotation": ""}, "snippet": " polarityCounter = PolarityCounter(r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L370_C8", "label": "edgesCount = len()", "type": "assigned_variable", "loc": [370, 370], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:While_L367_C4", "vector": [14, 2, 0.7088, 0.0019, 2, 0.1, 1.0, 984, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "edgesCount", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " edgesCount = len(polarityCounter.edges)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L375_C4", "label": "times =", "type": "assigned_variable", "loc": [375, 375], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "vector": [14, 1, 0.7184, 0.0019, 1, 0.05, 0.6923, 342, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "times", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " times = [x[0] for x in ndiVariation]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L376_C4", "label": "ndis =", "type": "assigned_variable", "loc": [376, 376], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "vector": [14, 1, 0.7203, 0.0019, 1, 0.05, 0.7692, 718, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ndis", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ndis = [x[1] for x in ndiVariation]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L377_C4", "label": "edgesCounts =", "type": "assigned_variable", "loc": [377, 377], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "vector": [14, 1, 0.7222, 0.0019, 1, 0.05, 0.8462, 913, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "edgesCounts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " edgesCounts = [x[2] for x in ndiVariation]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L383_C4", "label": "filename =", "type": "assigned_variable", "loc": [383, 383], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "vector": [14, 1, 0.7337, 0.0019, 1, 0.05, 0.9231, 275, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename = \"topic\" + str(forumID) + \".m\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L384_C4", "label": "writeListsToFile()", "type": "expression", "loc": [384, 384], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "vector": [8, 1, 0.7356, 0.0019, 1, 0.05, 1.0, 499, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeListsToFile", "arg_names": [], "import_names": [], "rhs_call_name": "writeListsToFile", "annotation": ""}, "snippet": " writeListsToFile(times, ndis, edgesCounts, filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L386_C0", "label": "writeListsToFile", "type": "function", "loc": [386, 398], "level": 0, "parent": null, "vector": [2, 0, 0.751, 0.0249, 0, 0.66, 0.8571, 499, 0, 4, 0, 0, 0, 0, 8], "semantic": {"name": "writeListsToFile", "arg_names": ["times", "ndis", "edgesCounts", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def writeListsToFile(times, ndis, edgesCounts, filename):\n with open(filename, 'w+') as file:\n file.write(\"times = \" + str(times) + \";\\n\")\n file.write(\"ndis = \" + str(ndis) + \";\\n\")\n file.write(\"edges = \" + str(edgesCounts) + \";\\n\")\n \n plotCode = \"\"\"\nfigure"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L388_C8", "label": "write()", "type": "expression", "loc": [388, 388], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L386_C0", "vector": [8, 1, 0.7433, 0.0019, 1, 0.01, 0.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " file.write(\"times = \" + str(times) + \";\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L389_C8", "label": "write()", "type": "expression", "loc": [389, 389], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L386_C0", "vector": [8, 1, 0.7452, 0.0019, 1, 0.01, 0.25, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " file.write(\"ndis = \" + str(ndis) + \";\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L390_C8", "label": "write()", "type": "expression", "loc": [390, 390], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L386_C0", "vector": [8, 1, 0.7471, 0.0019, 1, 0.01, 0.5, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " file.write(\"edges = \" + str(edgesCounts) + \";\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L392_C8", "label": "plotCode =", "type": "assigned_variable", "loc": [392, 397], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L386_C0", "vector": [14, 1, 0.7557, 0.0115, 1, 0.01, 0.75, 182, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "plotCode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " plotCode = \"\"\"\nfigure\nplot(times, ndis)\nxlabel('Time (timestamp)')\nylabel('Network Disagreement Index (NDI)')\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L398_C8", "label": "write()", "type": "expression", "loc": [398, 398], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L386_C0", "vector": [8, 1, 0.7625, 0.0019, 1, 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": " file.write(plotCode)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L400_C0", "label": "repliesBeforeTime", "type": "function", "loc": [400, 401], "level": 0, "parent": null, "vector": [2, 0, 0.7672, 0.0038, 0, 0.66, 0.881, 186, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "repliesBeforeTime", "arg_names": ["replies", "time"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def repliesBeforeTime(replies, time):\n return [reply for reply in replies if reply[\"timestamp\"] <= time]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Return_L401_C4", "label": "return", "type": "return", "loc": [401, 401], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L400_C0", "vector": [13, 1, 0.7682, 0.0019, 1, 0.77, 0.0, 0, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [reply for reply in replies if reply[\"timestamp\"] <= time]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L403_C0", "label": "usersWhoSentMultipleMessages", "type": "function", "loc": [403, 427], "level": 0, "parent": null, "vector": [2, 0, 0.795, 0.0479, 0, 0.66, 0.9048, 703, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "usersWhoSentMultipleMessages", "arg_names": ["forum"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def usersWhoSentMultipleMessages(forum=1):\n query = \"\"\"\nSELECT m.fkauthor, f.id, COUNT(*) as count\nFROM threadmessage as m\nINNER JOIN forumthread as t\n ON m.fkforumthread=t.id\nINNER JOIN forum as f\n ON t.fkparentforum=f.id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L404_C4", "label": "query =", "type": "assigned_variable", "loc": [404, 414], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L403_C0", "vector": [14, 1, 0.7835, 0.0211, 1, 0.92, 0.0, 546, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query = \"\"\"\nSELECT m.fkauthor, f.id, COUNT(*) as count\nFROM threadmessage as m\nINNER JOIN forumthread as t\n ON m.fkforumthread=t.id\nINNER JOIN forum as f\n ON t.fkparentforum=f.id\nWHERE f.id=%s"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L416_C4", "label": "users =", "type": "assigned_variable", "loc": [416, 416], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L403_C0", "vector": [14, 1, 0.7969, 0.0019, 1, 0.92, 0.5, 395, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "users", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " users = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L419_C8", "label": "cursor = cursor()", "type": "assigned_variable", "loc": [419, 419], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L403_C0", "vector": [14, 1, 0.8027, 0.0019, 1, 0.92, 0.0, 231, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cursor", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cursor = connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L420_C8", "label": "execute()", "type": "expression", "loc": [420, 420], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L403_C0", "vector": [8, 1, 0.8046, 0.0019, 1, 0.92, 0.3333, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cursor.execute(query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L422_C8", "label": "for user", "type": "for", "loc": [422, 423], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L403_C0", "vector": [6, 1, 0.8094, 0.0038, 1, 0.92, 0.6667, 503, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for user in cursor:\n users += [user]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L425_C8", "label": "close()", "type": "expression", "loc": [425, 425], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L403_C0", "vector": [8, 1, 0.8142, 0.0019, 1, 0.92, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cursor.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Return_L427_C4", "label": "return", "type": "return", "loc": [427, 427], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L403_C0", "vector": [13, 1, 0.818, 0.0019, 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 users"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L429_C0", "label": "usersWhoParticipateInForum", "type": "function", "loc": [429, 452], "level": 0, "parent": null, "vector": [2, 0, 0.8439, 0.046, 0, 0.66, 0.9286, 7, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "usersWhoParticipateInForum", "arg_names": ["forum"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def usersWhoParticipateInForum(forum=1):\n query = \"\"\"\nSELECT m.fkauthor, f.id, COUNT(*) as count\nFROM threadmessage as m\nINNER JOIN forumthread as t\n ON m.fkforumthread=t.id\nINNER JOIN forum as f\n ON t.fkparentforum=f.id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L430_C4", "label": "query =", "type": "assigned_variable", "loc": [430, 439], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L429_C0", "vector": [14, 1, 0.8324, 0.0192, 1, 0.37, 0.0, 546, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query = \"\"\"\nSELECT m.fkauthor, f.id, COUNT(*) as count\nFROM threadmessage as m\nINNER JOIN forumthread as t\n ON m.fkforumthread=t.id\nINNER JOIN forum as f\n ON t.fkparentforum=f.id\nWHERE f.id=%s"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L441_C4", "label": "users =", "type": "assigned_variable", "loc": [441, 441], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L429_C0", "vector": [14, 1, 0.8448, 0.0019, 1, 0.37, 0.5, 395, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "users", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " users = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L444_C8", "label": "cursor = cursor()", "type": "assigned_variable", "loc": [444, 444], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L429_C0", "vector": [14, 1, 0.8506, 0.0019, 1, 0.37, 0.0, 231, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cursor", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cursor = connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L445_C8", "label": "execute()", "type": "expression", "loc": [445, 445], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L429_C0", "vector": [8, 1, 0.8525, 0.0019, 1, 0.37, 0.3333, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cursor.execute(query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L447_C8", "label": "for user", "type": "for", "loc": [447, 448], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L429_C0", "vector": [6, 1, 0.8573, 0.0038, 1, 0.37, 0.6667, 503, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for user in cursor:\n users += [user]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L450_C8", "label": "close()", "type": "expression", "loc": [450, 450], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L429_C0", "vector": [8, 1, 0.8621, 0.0019, 1, 0.37, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cursor.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Return_L452_C4", "label": "return", "type": "return", "loc": [452, 452], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L429_C0", "vector": [13, 1, 0.8659, 0.0019, 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 users"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L455_C0", "label": "getUserCount", "type": "function", "loc": [455, 465], "level": 0, "parent": null, "vector": [2, 0, 0.8812, 0.0211, 0, 0.66, 0.9524, 720, 0, 0, 1, 0, 0, 0, 4], "semantic": {"name": "getUserCount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getUserCount():\n query = \"SELECT COUNT(*) as count FROM user\"\n with sqlite3.connect(databasePath) as connection:\n cursor = connection.cursor()\n cursor.execute(query)\n for row in cursor:\n count = row[0]\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L456_C4", "label": "query =", "type": "assigned_variable", "loc": [456, 456], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L455_C0", "vector": [14, 1, 0.8736, 0.0019, 1, 0.15, 0.0, 546, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query = \"SELECT COUNT(*) as count FROM user\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L458_C8", "label": "cursor = cursor()", "type": "assigned_variable", "loc": [458, 458], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L455_C0", "vector": [14, 1, 0.8774, 0.0019, 1, 0.15, 0.0, 231, 3, 0, 0, 0, 231, 10, 1], "semantic": {"name": "cursor", "arg_names": [], "import_names": [], "rhs_call_name": "cursor", "annotation": ""}, "snippet": " cursor = connection.cursor()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L459_C8", "label": "execute()", "type": "expression", "loc": [459, 459], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L455_C0", "vector": [8, 1, 0.8793, 0.0019, 1, 0.15, 0.3333, 569, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "execute", "arg_names": [], "import_names": [], "rhs_call_name": "execute", "annotation": ""}, "snippet": " cursor.execute(query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L460_C8", "label": "for row", "type": "for", "loc": [460, 461], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L455_C0", "vector": [6, 1, 0.8822, 0.0038, 1, 0.15, 0.6667, 767, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for row in cursor:\n count = row[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L461_C12", "label": "count =", "type": "assigned_variable", "loc": [461, 461], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L460_C8", "vector": [14, 2, 0.8831, 0.0019, 2, 0.51, 0.0, 778, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " count = row[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L463_C8", "label": "close()", "type": "expression", "loc": [463, 463], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L455_C0", "vector": [8, 1, 0.887, 0.0019, 1, 0.15, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " cursor.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Return_L465_C4", "label": "return", "type": "return", "loc": [465, 465], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L455_C0", "vector": [13, 1, 0.8908, 0.0019, 1, 0.15, 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_1082:FunctionDef_L467_C0", "label": "forumContributionRanking", "type": "function", "loc": [467, 486], "level": 0, "parent": null, "vector": [2, 0, 0.9128, 0.0383, 0, 0.66, 0.9762, 35, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "forumContributionRanking", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def forumContributionRanking():\n forums = getForums()\n \n ranking = []\n \n for forum in forums:\n forumID = forum[\"id\"]\n usersWhoSentMoreThanOneMessage = usersWhoSentMultipleMessages(forum=forumID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L468_C4", "label": "forums = getForums()", "type": "assigned_variable", "loc": [468, 468], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L467_C0", "vector": [14, 1, 0.8966, 0.0019, 1, 0.46, 0.0, 763, 3, 0, 0, 0, 929, 10, 1], "semantic": {"name": "forums", "arg_names": [], "import_names": [], "rhs_call_name": "getForums", "annotation": ""}, "snippet": " forums = getForums()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L470_C4", "label": "ranking =", "type": "assigned_variable", "loc": [470, 470], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L467_C0", "vector": [14, 1, 0.9004, 0.0019, 1, 0.46, 0.2, 761, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "ranking", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ranking = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L472_C4", "label": "for forum", "type": "for", "loc": [472, 480], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L467_C0", "vector": [6, 1, 0.9119, 0.0172, 1, 0.46, 0.4, 659, 2, 0, 0, 0, 0, 0, 6], "semantic": {"name": "forum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for forum in forums:\n forumID = forum[\"id\"]\n usersWhoSentMoreThanOneMessage = usersWhoSentMultipleMessages(forum=forumID)\n users = usersWhoParticipateInForum(forum=forumID)\n gtOne = len(usersWhoSentMoreThanOneMessage)\n total = len(users)\n ratio = gtOne/float(total)*100\n line = (forumID, gtOne, total, str(ratio) + \"%\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L473_C8", "label": "forumID =", "type": "assigned_variable", "loc": [473, 473], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L472_C4", "vector": [14, 2, 0.9061, 0.0019, 2, 0.79, 0.0, 457, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "forumID", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " forumID = forum[\"id\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L474_C8", "label": "usersWhoSentMoreThanOneMessage = usersWhoSentMultipleMessages()", "type": "assigned_variable", "loc": [474, 474], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L472_C4", "vector": [14, 2, 0.908, 0.0019, 2, 0.79, 0.1667, 822, 3, 1, 0, 0, 703, 10, 1], "semantic": {"name": "usersWhoSentMoreThanOneMessage", "arg_names": [], "import_names": [], "rhs_call_name": "usersWhoSentMultipleMessages", "annotation": ""}, "snippet": " usersWhoSentMoreThanOneMessage = usersWhoSentMultipleMessages(forum=forumID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L475_C8", "label": "users = usersWhoParticipateInForum()", "type": "assigned_variable", "loc": [475, 475], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L472_C4", "vector": [14, 2, 0.91, 0.0019, 2, 0.79, 0.3333, 395, 3, 1, 0, 0, 7, 10, 1], "semantic": {"name": "users", "arg_names": [], "import_names": [], "rhs_call_name": "usersWhoParticipateInForum", "annotation": ""}, "snippet": " users = usersWhoParticipateInForum(forum=forumID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L476_C8", "label": "gtOne = len()", "type": "assigned_variable", "loc": [476, 476], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L472_C4", "vector": [14, 2, 0.9119, 0.0019, 2, 0.79, 0.5, 792, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "gtOne", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " gtOne = len(usersWhoSentMoreThanOneMessage)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L477_C8", "label": "total = len()", "type": "assigned_variable", "loc": [477, 477], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L472_C4", "vector": [14, 2, 0.9138, 0.0019, 2, 0.79, 0.6667, 878, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "total", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " total = len(users)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L478_C8", "label": "ratio =", "type": "assigned_variable", "loc": [478, 478], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L472_C4", "vector": [14, 2, 0.9157, 0.0019, 2, 0.79, 0.8333, 188, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ratio", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ratio = gtOne/float(total)*100"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L479_C8", "label": "line =", "type": "assigned_variable", "loc": [479, 479], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L472_C4", "vector": [14, 2, 0.9176, 0.0019, 2, 0.79, 1.0, 373, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " line = (forumID, gtOne, total, str(ratio) + \"%\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L482_C4", "label": "ranking = sorted()", "type": "assigned_variable", "loc": [482, 482], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L467_C0", "vector": [14, 1, 0.9234, 0.0019, 1, 0.46, 0.6, 761, 3, 3, 0, 0, 134, 10, 2], "semantic": {"name": "ranking", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " ranking = sorted(ranking, key=lambda x: x[1]/float(x[2]), reverse=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L485_C4", "label": "headings =", "type": "assigned_variable", "loc": [485, 485], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L467_C0", "vector": [14, 1, 0.9291, 0.0019, 1, 0.46, 0.8, 469, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "headings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headings = [\"forum id\", \"users with sent messages count > 1\", \"users who sent at least 1 message count\", \"ratio\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L486_C4", "label": "writeRawHTML()", "type": "expression", "loc": [486, 486], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L467_C0", "vector": [8, 1, 0.931, 0.0019, 1, 0.46, 1.0, 256, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "writeRawHTML", "arg_names": [], "import_names": [], "rhs_call_name": "writeRawHTML", "annotation": ""}, "snippet": " writeRawHTML(rankingsFile, headings, ranking, readWriteMode='a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "label": "if", "type": "if", "loc": [488, 522], "level": 0, "parent": null, "vector": [4, 0, 0.9674, 0.067, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 31], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n (g1, g2) = readGraphs()\n print(len(g1.nodes()))\n print(len(g2.nodes()))\n \n writeHeader(rankingsFile)\n \n print(\"-----\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L489_C4", "label": "g1, g2 = readGraphs()", "type": "assigned_variable", "loc": [489, 489], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [14, 1, 0.9368, 0.0019, 1, 0.95, 0.0, 926, 3, 0, 0, 0, 595, 10, 1], "semantic": {"name": "g1, g2", "arg_names": [], "import_names": [], "rhs_call_name": "readGraphs", "annotation": ""}, "snippet": " (g1, g2) = readGraphs()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L490_C4", "label": "print()", "type": "expression", "loc": [490, 490], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9387, 0.0019, 1, 0.95, 0.0385, 535, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(len(g1.nodes()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L491_C4", "label": "print()", "type": "expression", "loc": [491, 491], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9406, 0.0019, 1, 0.95, 0.0769, 535, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(len(g2.nodes()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L493_C4", "label": "writeHeader()", "type": "expression", "loc": [493, 493], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9444, 0.0019, 1, 0.95, 0.1154, 746, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "writeHeader", "arg_names": [], "import_names": [], "rhs_call_name": "writeHeader", "annotation": ""}, "snippet": " writeHeader(rankingsFile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L495_C4", "label": "print()", "type": "expression", "loc": [495, 495], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9483, 0.0019, 1, 0.95, 0.1538, 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_1082:Expr_L496_C4", "label": "print()", "type": "expression", "loc": [496, 496], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9502, 0.0019, 1, 0.95, 0.1923, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Centrality Rankings for graph 1\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L497_C4", "label": "print()", "type": "expression", "loc": [497, 497], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9521, 0.0019, 1, 0.95, 0.2308, 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_1082:Expr_L498_C4", "label": "writeH1()", "type": "expression", "loc": [498, 498], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.954, 0.0019, 1, 0.95, 0.2692, 600, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "writeH1", "arg_names": [], "import_names": [], "rhs_call_name": "writeH1", "annotation": ""}, "snippet": " writeH1(rankingsFile, \"Replies graph centrality measures (directed weighted)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L499_C4", "label": "createRanking()", "type": "expression", "loc": [499, 499], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9559, 0.0019, 1, 0.95, 0.3077, 45, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "createRanking", "arg_names": [], "import_names": [], "rhs_call_name": "createRanking", "annotation": ""}, "snippet": " createRanking(g1, directed=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L501_C4", "label": "print()", "type": "expression", "loc": [501, 501], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9598, 0.0019, 1, 0.95, 0.3462, 535, 3, 0, 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_1082:Expr_L502_C4", "label": "print()", "type": "expression", "loc": [502, 502], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9617, 0.0019, 1, 0.95, 0.3846, 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_1082:Expr_L503_C4", "label": "print()", "type": "expression", "loc": [503, 503], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9636, 0.0019, 1, 0.95, 0.4231, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Centrality Rankings for graph 2\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L504_C4", "label": "print()", "type": "expression", "loc": [504, 504], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9655, 0.0019, 1, 0.95, 0.4615, 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_1082:Expr_L505_C4", "label": "writeH1()", "type": "expression", "loc": [505, 505], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9674, 0.0019, 1, 0.95, 0.5, 600, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "writeH1", "arg_names": [], "import_names": [], "rhs_call_name": "writeH1", "annotation": ""}, "snippet": " writeH1(rankingsFile, \"User-Discussion graph centrality measures (bipartite)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L506_C4", "label": "createRanking()", "type": "expression", "loc": [506, 506], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9693, 0.0019, 1, 0.95, 0.5385, 45, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "createRanking", "arg_names": [], "import_names": [], "rhs_call_name": "createRanking", "annotation": ""}, "snippet": " createRanking(g2, ev=False) # do not compute Eigenvector centrality"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L508_C4", "label": "print()", "type": "expression", "loc": [508, 508], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9732, 0.0019, 1, 0.95, 0.5769, 535, 3, 0, 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_1082:Expr_L509_C4", "label": "print()", "type": "expression", "loc": [509, 509], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9751, 0.0019, 1, 0.95, 0.6154, 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_1082:Expr_L510_C4", "label": "print()", "type": "expression", "loc": [510, 510], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.977, 0.0019, 1, 0.95, 0.6538, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Conclusion\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L511_C4", "label": "print()", "type": "expression", "loc": [511, 511], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9789, 0.0019, 1, 0.95, 0.6923, 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_1082:Expr_L512_C4", "label": "writeH1()", "type": "expression", "loc": [512, 512], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9808, 0.0019, 1, 0.95, 0.7308, 600, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "writeH1", "arg_names": [], "import_names": [], "rhs_call_name": "writeH1", "annotation": ""}, "snippet": " writeH1(rankingsFile, \"Conclusion\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L513_C4", "label": "createGeneralRanking()", "type": "expression", "loc": [513, 513], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9828, 0.0019, 1, 0.95, 0.7692, 714, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "createGeneralRanking", "arg_names": [], "import_names": [], "rhs_call_name": "createGeneralRanking", "annotation": ""}, "snippet": " createGeneralRanking()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L515_C4", "label": "createPolarityRanking()", "type": "expression", "loc": [515, 515], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9866, 0.0019, 1, 0.95, 0.8077, 308, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "createPolarityRanking", "arg_names": [], "import_names": [], "rhs_call_name": "createPolarityRanking", "annotation": ""}, "snippet": " createPolarityRanking()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L516_C4", "label": "polarizationForAllForums()", "type": "expression", "loc": [516, 516], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9885, 0.0019, 1, 0.95, 0.8462, 209, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "polarizationForAllForums", "arg_names": [], "import_names": [], "rhs_call_name": "polarizationForAllForums", "annotation": ""}, "snippet": " polarizationForAllForums()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L517_C4", "label": "forumContributionRanking()", "type": "expression", "loc": [517, 517], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9904, 0.0019, 1, 0.95, 0.8846, 35, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "forumContributionRanking", "arg_names": [], "import_names": [], "rhs_call_name": "forumContributionRanking", "annotation": ""}, "snippet": " forumContributionRanking()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L519_C4", "label": "writeFooter()", "type": "expression", "loc": [519, 519], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9943, 0.0019, 1, 0.95, 0.9231, 820, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "writeFooter", "arg_names": [], "import_names": [], "rhs_call_name": "writeFooter", "annotation": ""}, "snippet": " writeFooter(rankingsFile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L521_C4", "label": "print()", "type": "expression", "loc": [521, 521], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 0.9981, 0.0019, 1, 0.95, 0.9615, 535, 3, 0, 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_1082:Expr_L522_C4", "label": "print()", "type": "expression", "loc": [522, 522], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "vector": [8, 1, 1.0, 0.0019, 1, 0.95, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Successfully generated HTML report.\")"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Return_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Return_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:While_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:While_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L143_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L144_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L145_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L146_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:While_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:While_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:While_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:While_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L181_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L182_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L187_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L190_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L191_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L194_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L196_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L201_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L202_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L205_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L206_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L208_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L206_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L211_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L213_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L215_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L218_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L218_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L219_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L218_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L220_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L220_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Try_L221_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:Try_L221_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L222_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:Try_L221_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L224_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L218_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L230_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L235_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L236_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L239_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L241_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L242_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L244_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L245_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L248_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L252_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L254_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L256_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L257_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L259_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L260_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L262_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L263_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L266_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L266_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L267_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L266_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L269_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L266_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L270_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L266_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L271_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L266_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L272_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L274_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Return_L276_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L278_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L279_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L281_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L282_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L283_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L284_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L285_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L287_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L287_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L288_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L287_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L289_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L291_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Return_L292_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L295_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L296_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L295_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L297_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L295_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L298_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L298_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L299_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L299_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L300_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L299_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L301_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L299_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Try_L302_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:Try_L302_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L305_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L299_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Try_L307_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:Try_L307_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L310_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L295_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L312_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L295_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L313_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L313_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L314_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L295_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L317_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L295_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L319_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L295_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L320_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L323_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L325_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L326_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L327_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L329_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L330_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L332_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L333_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L334_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L336_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L337_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L338_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L322_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L339_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L342_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L343_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L342_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L344_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L342_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L345_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L342_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L346_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L342_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L347_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L349_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L350_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L349_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L352_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L352_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L353_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L352_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L354_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L352_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L355_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L358_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L359_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L360_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L361_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L362_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L363_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L365_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L366_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:While_L367_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:While_L367_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L368_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:While_L367_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L369_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:While_L367_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L370_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L375_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L376_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L377_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L383_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L357_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L384_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L386_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L388_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L386_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L389_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L386_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L390_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L386_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L392_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L386_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L398_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L400_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Return_L401_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L403_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L404_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L403_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L416_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L403_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L419_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L403_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L420_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L403_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L422_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L403_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L425_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L403_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Return_L427_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L429_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L430_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L429_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L441_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L429_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L444_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L429_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L445_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L429_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L447_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L429_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L450_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L429_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Return_L452_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L455_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L456_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L455_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L458_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L455_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L459_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L455_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L460_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L460_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L461_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L455_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L463_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L455_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Return_L465_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L467_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L468_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L467_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L470_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L467_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L472_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L472_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L473_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L472_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L474_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L472_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L475_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L472_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L476_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L472_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L477_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L472_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L478_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:For_L472_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L479_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L467_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L482_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L467_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L485_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:FunctionDef_L467_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L486_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Assign_L489_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L490_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L491_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L493_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L495_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L496_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L497_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L498_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L499_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L501_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L502_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L503_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L504_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L505_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L506_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L508_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L509_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L510_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L511_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L512_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L513_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L515_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L516_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L517_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L519_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L521_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1082:If_L488_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1082:Expr_L522_C4"}]
''' Created on 8 avr. 2013 @author: Nils Amiet ''' # coding: utf-8 class HTMLTableGenerator: infrarougeUserURL = "http://www.infrarouge.ch/ir/member-" tableBorder = 1 def __init__(self, th=[], rows=[], title="Untitled page", users=None): self.th = th self.rows = rows self.title = title self.users = users def header(self): html = "<!DOCTYPE html>" html += "\n" html += "<html>" html += "\n" html += "<head>" html += "<title>" html += str(self.title) html += "</title>" html += "</head>" html += "\n" html += "<body>" html += "\n" return html def footer(self): html = "</body>" html += "\n" html += "</html>" return html def h1(self, text): html = "<h1>" + text + "</h1>" return html def raw(self): html = "<table border=\"" + str(self.tableBorder) + "\">" html += "\n" html += "<tr>" for heading in self.th: html += "<th>" + str(heading) + "</th>" html += "</tr>" html += "\n" for row in self.rows: html += "<tr>" for col in row: html += "<td>" html += str(col) html += "</td>" html += "</tr>" html += "\n" html += "</table>" html += "\n" html += "<br />" html += "\n" return html def __repr__(self): html = "<table border=\"" + str(self.tableBorder) + "\">" html += "\n" html += "<tr>" for heading in self.th: html += "<th>" + str(heading) + "</th>" html += "</tr>" html += "\n" for row in self.rows: html += "<tr>" colID = 0 for col in row: html += "<td>" if colID == 0: html += "<a href=\"" + self.infrarougeUserURL + str(col) + "\">" html += str(col) if colID == 0: html += "</a>" html += "</td>" if colID == 0: html += "<td>" try: userTuple = [user for user in self.users if user[0] == col][0] username = userTuple[1] except: username = "username not found" html += username html += "</td>" colID += 1 html += "</tr>" html += "\n" html += "</table>" html += "\n" html += "<br />" html += "\n" return html
ajibawa-2023/Python-Code-Large/train/row_1083
38
114
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1083:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0263, 0.0439, 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 8 avr. 2013\n\n@author: Nils Amiet\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:ClassDef_L9_C0", "label": "HTMLTableGenerator", "type": "class", "loc": [9, 114], "level": 0, "parent": null, "vector": [3, 0, 0.5395, 0.9298, 0, 0.66, 1.0, 408, 0, 6, 0, 0, 0, 0, 8], "semantic": {"name": "HTMLTableGenerator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class HTMLTableGenerator:\n \n infrarougeUserURL = \"http://www.infrarouge.ch/ir/member-\"\n tableBorder = 1\n \n def __init__(self, th=[], rows=[], title=\"Untitled page\", users=None):\n self.th = th\n self.rows = rows"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L11_C4", "label": "infrarougeUserURL =", "type": "assigned_variable", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:ClassDef_L9_C0", "vector": [14, 1, 0.0965, 0.0088, 1, 0.97, 0.0, 747, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "infrarougeUserURL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " infrarougeUserURL = \"http://www.infrarouge.ch/ir/member-\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L12_C4", "label": "tableBorder =", "type": "assigned_variable", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:ClassDef_L9_C0", "vector": [14, 1, 0.1053, 0.0088, 1, 0.97, 0.1429, 207, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "tableBorder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tableBorder = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L14_C4", "label": "__init__", "type": "function", "loc": [14, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:ClassDef_L9_C0", "vector": [2, 1, 0.1404, 0.0439, 1, 0.97, 0.2857, 555, 0, 5, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "th", "rows", "title", "users"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, th=[], rows=[], title=\"Untitled page\", users=None):\n self.th = th\n self.rows = rows\n self.title = title\n self.users = users"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L15_C8", "label": "self.th =", "type": "assigned_variable", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L14_C4", "vector": [14, 2, 0.1316, 0.0088, 2, 0.73, 0.0, 992, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.th", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.th = th"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L16_C8", "label": "self.rows =", "type": "assigned_variable", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L14_C4", "vector": [14, 2, 0.1404, 0.0088, 2, 0.73, 0.3333, 881, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.rows", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.rows = rows"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L17_C8", "label": "self.title =", "type": "assigned_variable", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L14_C4", "vector": [14, 2, 0.1491, 0.0088, 2, 0.73, 0.6667, 629, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.title = title"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L18_C8", "label": "self.users =", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L14_C4", "vector": [14, 2, 0.1579, 0.0088, 2, 0.73, 1.0, 606, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.users", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.users = users"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L20_C4", "label": "header", "type": "function", "loc": [20, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:ClassDef_L9_C0", "vector": [2, 1, 0.2325, 0.1228, 1, 0.97, 0.4286, 481, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "header", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def header(self):\n html = \"<!DOCTYPE html>\"\n html += \"\\n\"\n html += \"<html>\"\n html += \"\\n\"\n html += \"<head>\"\n html += \"<title>\"\n html += str(self.title)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L21_C8", "label": "html =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L20_C4", "vector": [14, 2, 0.1842, 0.0088, 2, 0.3, 0.0, 271, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "html", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " html = \"<!DOCTYPE html>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:Return_L33_C8", "label": "return", "type": "return", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L20_C4", "vector": [13, 2, 0.2895, 0.0088, 2, 0.3, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return html"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L35_C4", "label": "footer", "type": "function", "loc": [35, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:ClassDef_L9_C0", "vector": [2, 1, 0.3246, 0.0439, 1, 0.97, 0.5714, 105, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "footer", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def footer(self):\n html = \"</body>\"\n html += \"\\n\"\n html += \"</html>\"\n return html"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L36_C8", "label": "html =", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L35_C4", "vector": [14, 2, 0.3158, 0.0088, 2, 0.98, 0.0, 271, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "html", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " html = \"</body>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:Return_L39_C8", "label": "return", "type": "return", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L35_C4", "vector": [13, 2, 0.3421, 0.0088, 2, 0.98, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return html"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L41_C4", "label": "h1", "type": "function", "loc": [41, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:ClassDef_L9_C0", "vector": [2, 1, 0.3684, 0.0263, 1, 0.97, 0.7143, 428, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "h1", "arg_names": ["self", "text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def h1(self, text):\n html = \"<h1>\" + text + \"</h1>\"\n return html"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L42_C8", "label": "html =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L41_C4", "vector": [14, 2, 0.3684, 0.0088, 2, 0.94, 0.0, 271, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "html", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " html = \"<h1>\" + text + \"</h1>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:Return_L43_C8", "label": "return", "type": "return", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L41_C4", "vector": [13, 2, 0.3772, 0.0088, 2, 0.94, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return html"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L45_C4", "label": "raw", "type": "function", "loc": [45, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:ClassDef_L9_C0", "vector": [2, 1, 0.5044, 0.2281, 1, 0.97, 0.8571, 23, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "raw", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def raw(self):\n html = \"<table border=\\\"\" + str(self.tableBorder) + \"\\\">\"\n html += \"\\n\"\n \n html += \"<tr>\"\n for heading in self.th:\n html += \"<th>\" + str(heading) + \"</th>\"\n html += \"</tr>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L46_C8", "label": "html =", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L45_C4", "vector": [14, 2, 0.4035, 0.0088, 2, 0.73, 0.0, 271, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "html", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " html = \"<table border=\\\"\" + str(self.tableBorder) + \"\\\">\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L50_C8", "label": "for heading", "type": "for", "loc": [50, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L45_C4", "vector": [6, 2, 0.443, 0.0175, 2, 0.73, 0.3333, 841, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "heading", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for heading in self.th:\n html += \"<th>\" + str(heading) + \"</th>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L55_C8", "label": "for row", "type": "for", "loc": [55, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L45_C4", "vector": [6, 2, 0.5175, 0.0789, 2, 0.73, 0.6667, 767, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for row in self.rows:\n html += \"<tr>\"\n for col in row:\n html += \"<td>\"\n html += str(col)\n html += \"</td>\"\n \n html += \"</tr>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L57_C12", "label": "for col", "type": "for", "loc": [57, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L55_C8", "vector": [6, 3, 0.5132, 0.0351, 3, 0.52, 0.0, 157, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for col in row:\n html += \"<td>\"\n html += str(col)\n html += \"</td>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:Return_L70_C8", "label": "return", "type": "return", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L45_C4", "vector": [13, 2, 0.614, 0.0088, 2, 0.73, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return html"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L72_C4", "label": "__repr__", "type": "function", "loc": [72, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:ClassDef_L9_C0", "vector": [2, 1, 0.8158, 0.3772, 1, 0.97, 1.0, 204, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "__repr__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __repr__(self):\n html = \"<table border=\\\"\" + str(self.tableBorder) + \"\\\">\"\n html += \"\\n\"\n \n html += \"<tr>\"\n for heading in self.th:\n html += \"<th>\" + str(heading) + \"</th>\"\n html += \"</tr>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L73_C8", "label": "html =", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L72_C4", "vector": [14, 2, 0.6404, 0.0088, 2, 0.37, 0.0, 271, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "html", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " html = \"<table border=\\\"\" + str(self.tableBorder) + \"\\\">\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L77_C8", "label": "for heading", "type": "for", "loc": [77, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L72_C4", "vector": [6, 2, 0.6798, 0.0175, 2, 0.37, 0.3333, 841, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "heading", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for heading in self.th:\n html += \"<th>\" + str(heading) + \"</th>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L83_C8", "label": "for row", "type": "for", "loc": [83, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L72_C4", "vector": [6, 2, 0.8333, 0.2193, 2, 0.37, 0.6667, 767, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for row in self.rows:\n html += \"<tr>\" \n colID = 0\n for col in row:\n html += \"<td>\"\n if colID == 0:\n html += \"<a href=\\\"\" + self.infrarougeUserURL + str(col) + \"\\\">\"\n html += str(col)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L85_C12", "label": "colID =", "type": "assigned_variable", "loc": [85, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L83_C8", "vector": [14, 3, 0.7456, 0.0088, 3, 0.83, 0.0, 837, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "colID", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " colID = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L86_C12", "label": "for col", "type": "for", "loc": [86, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L83_C8", "vector": [6, 3, 0.8377, 0.1754, 3, 0.83, 1.0, 157, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "col", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for col in row:\n html += \"<td>\"\n if colID == 0:\n html += \"<a href=\\\"\" + self.infrarougeUserURL + str(col) + \"\\\">\"\n html += str(col)\n if colID == 0:\n html += \"</a>\"\n html += \"</td>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:If_L88_C16", "label": "if", "type": "if", "loc": [88, 89], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L86_C12", "vector": [4, 4, 0.7763, 0.0175, 4, 0.48, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if colID == 0:\n html += \"<a href=\\\"\" + self.infrarougeUserURL + str(col) + \"\\\">\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:If_L91_C16", "label": "if", "type": "if", "loc": [91, 92], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L86_C12", "vector": [4, 4, 0.8026, 0.0175, 4, 0.48, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if colID == 0:\n html += \"</a>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:If_L95_C16", "label": "if", "type": "if", "loc": [95, 103], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L86_C12", "vector": [4, 4, 0.8684, 0.0789, 4, 0.48, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if colID == 0:\n html += \"<td>\"\n try:\n userTuple = [user for user in self.users if user[0] == col][0]\n username = userTuple[1]\n except:\n username = \"username not found\"\n html += username"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:Try_L97_C20", "label": "try", "type": "try", "loc": [97, 101], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:If_L95_C16", "vector": [7, 5, 0.8684, 0.0439, 5, 0.87, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n userTuple = [user for user in self.users if user[0] == col][0]\n username = userTuple[1]\n except:\n username = \"username not found\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L98_C24", "label": "userTuple =", "type": "assigned_variable", "loc": [98, 98], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:Try_L97_C20", "vector": [14, 6, 0.8596, 0.0088, 6, 0.92, 0.0, 904, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "userTuple", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userTuple = [user for user in self.users if user[0] == col][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L99_C24", "label": "username =", "type": "assigned_variable", "loc": [99, 99], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:Try_L97_C20", "vector": [14, 6, 0.8684, 0.0088, 6, 0.92, 1.0, 718, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "username", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " username = userTuple[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L101_C24", "label": "username =", "type": "assigned_variable", "loc": [101, 101], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:Try_L97_C20", "vector": [14, 6, 0.886, 0.0088, 6, 0.92, 0.0, 718, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "username", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " username = \"username not found\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1083:Return_L114_C8", "label": "return", "type": "return", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L72_C4", "vector": [13, 2, 1.0, 0.0088, 2, 0.37, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return html"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1083:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:Return_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:Return_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:Return_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L55_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:Return_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L83_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L85_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L83_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L86_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L86_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:If_L88_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L86_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:If_L91_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:For_L86_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:If_L95_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:If_L95_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:Try_L97_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:Try_L97_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L98_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:Try_L97_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L99_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:Try_L97_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:Assign_L101_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1083:FunctionDef_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1083:Return_L114_C8"}]
''' 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_1084
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_1084: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_1084: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_1084: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_1084: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_1084: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_1084:Expr_L13_C2", "label": "expression", "type": "expression", "loc": [13, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L12_C0", "vector": [8, 1, 0.1596, 0.0532, 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 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_1084:Assign_L18_C2", "label": "process = Popen()", "type": "assigned_variable", "loc": [18, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L12_C0", "vector": [14, 1, 0.2074, 0.0426, 1, 0.58, 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_1084:Assign_L22_C2", "label": "output =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L12_C0", "vector": [14, 1, 0.234, 0.0106, 1, 0.58, 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_1084:Return_L23_C2", "label": "return", "type": "return", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L12_C0", "vector": [13, 1, 0.2447, 0.0106, 1, 0.58, 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_1084: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_1084:Expr_L27_C2", "label": "expression", "type": "expression", "loc": [27, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L26_C0", "vector": [8, 1, 0.3191, 0.0745, 1, 0.43, 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_1084:Assign_L35_C2", "label": "output_lines = _GetOutputLines()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L26_C0", "vector": [14, 1, 0.3723, 0.0106, 1, 0.43, 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_1084:Assign_L38_C2", "label": "line_revs =", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L26_C0", "vector": [14, 1, 0.4043, 0.0106, 1, 0.43, 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_1084:For_L39_C2", "label": "for line", "type": "for", "loc": [39, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L26_C0", "vector": [6, 1, 0.4415, 0.0638, 1, 0.43, 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_1084:Assign_L40_C4", "label": "rev_match = match()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L39_C2", "vector": [14, 2, 0.4255, 0.0106, 2, 0.79, 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_1084:If_L41_C4", "label": "if", "type": "if", "loc": [41, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L39_C2", "vector": [4, 2, 0.4415, 0.0213, 2, 0.79, 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_1084:Assign_L43_C4", "label": "rev_hash = group()", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L39_C2", "vector": [14, 2, 0.4574, 0.0106, 2, 0.79, 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_1084:Expr_L44_C4", "label": "append()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L39_C2", "vector": [8, 2, 0.4681, 0.0106, 2, 0.79, 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_1084:For_L46_C2", "label": "for str", "type": "for", "loc": [46, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L26_C0", "vector": [6, 1, 0.5745, 0.1809, 1, 0.43, 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_1084:Assign_L48_C4", "label": "start_line =", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L46_C2", "vector": [14, 2, 0.5106, 0.0106, 2, 0.68, 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_1084:Assign_L49_C4", "label": "end_line =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L46_C2", "vector": [14, 2, 0.5213, 0.0106, 2, 0.68, 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_1084:Assign_L52_C4", "label": "revs =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L46_C2", "vector": [14, 2, 0.5532, 0.0106, 2, 0.68, 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_1084:For_L53_C4", "label": "for line_number", "type": "for", "loc": [53, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L46_C2", "vector": [6, 2, 0.5691, 0.0213, 2, 0.68, 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_1084:Expr_L54_C6", "label": "append()", "type": "expression", "loc": [54, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L53_C4", "vector": [8, 3, 0.5745, 0.0106, 3, 0.77, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " revs.append(line_revs[line_number])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1084:If_L58_C4", "label": "if", "type": "if", "loc": [58, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L46_C2", "vector": [4, 2, 0.6223, 0.0213, 2, 0.68, 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_1084:Assign_L62_C4", "label": " = frozenset()", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L46_C2", "vector": [14, 2, 0.6596, 0.0106, 2, 0.68, 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_1084: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_1084:Expr_L65_C2", "label": "expression", "type": "expression", "loc": [65, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L64_C0", "vector": [8, 1, 0.7394, 0.1064, 1, 0.3, 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_1084:If_L75_C2", "label": "if", "type": "if", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L64_C0", "vector": [4, 1, 0.8032, 0.0213, 1, 0.3, 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_1084:Return_L76_C4", "label": "return", "type": "return", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:If_L75_C2", "vector": [13, 2, 0.8085, 0.0106, 2, 0.28, 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_1084:Assign_L79_C2", "label": "args =", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L64_C0", "vector": [14, 1, 0.8404, 0.0106, 1, 0.3, 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_1084:Assign_L80_C2", "label": "output_lines = _GetOutputLines()", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L64_C0", "vector": [14, 1, 0.8511, 0.0106, 1, 0.3, 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_1084:Return_L82_C2", "label": "return", "type": "return", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L64_C0", "vector": [13, 1, 0.8723, 0.0106, 1, 0.3, 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_1084: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_1084:Expr_L85_C2", "label": "expression", "type": "expression", "loc": [85, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L84_C0", "vector": [8, 1, 0.9362, 0.0745, 1, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n 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_1084:If_L92_C2", "label": "if", "type": "if", "loc": [92, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L84_C0", "vector": [4, 1, 0.984, 0.0213, 1, 0.4, 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_1084:Return_L93_C4", "label": "return", "type": "return", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:If_L92_C2", "vector": [13, 2, 0.9894, 0.0106, 2, 0.38, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rev1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1084:Return_L94_C2", "label": "return", "type": "return", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L84_C0", "vector": [13, 1, 1.0, 0.0106, 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 rev2"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Expr_L13_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Assign_L22_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Return_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Expr_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Assign_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Assign_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:If_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Expr_L54_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:If_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Expr_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:If_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:If_L75_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Return_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Assign_L79_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Assign_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Return_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Expr_L85_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:If_L92_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:If_L92_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Return_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1084:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1084:Return_L94_C2"}]
''' 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_1085
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_1085: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_1085: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_1085: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_1085: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_1085: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_1085:FunctionDef_L14_C2", "label": "__init__", "type": "function", "loc": [14, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:ClassDef_L12_C0", "vector": [2, 1, 0.2174, 0.2, 1, 0.45, 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_1085:Expr_L15_C4", "label": "expression", "type": "expression", "loc": [15, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L14_C2", "vector": [8, 2, 0.1522, 0.0522, 2, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n 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_1085:Assign_L21_C4", "label": "self._langs =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L14_C2", "vector": [14, 2, 0.1826, 0.0087, 2, 0.28, 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_1085:Assign_L22_C4", "label": "self._master =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L14_C2", "vector": [14, 2, 0.1913, 0.0087, 2, 0.28, 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_1085:Assign_L23_C4", "label": "self._language_paths =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L14_C2", "vector": [14, 2, 0.2, 0.0087, 2, 0.28, 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_1085:Assign_L25_C4", "label": "parser = StringsParser()", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L14_C2", "vector": [14, 2, 0.2174, 0.0087, 2, 0.28, 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_1085:For_L26_C4", "label": "for lang, lang_dir", "type": "for", "loc": [26, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L14_C2", "vector": [6, 2, 0.2609, 0.0783, 2, 0.28, 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_1085:Assign_L27_C6", "label": "filename = join()", "type": "assigned_variable", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L26_C4", "vector": [14, 3, 0.2348, 0.0087, 3, 0.51, 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_1085:Assign_L28_C6", "label": "parsed_file = Parse()", "type": "assigned_variable", "loc": [28, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L26_C4", "vector": [14, 3, 0.2435, 0.0087, 3, 0.51, 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_1085:Expr_L29_C6", "label": "FillMercurialRevisions()", "type": "expression", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L26_C4", "vector": [8, 3, 0.2522, 0.0087, 3, 0.51, 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_1085:If_L31_C6", "label": "if", "type": "if", "loc": [31, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L26_C4", "vector": [4, 3, 0.2826, 0.0348, 3, 0.51, 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_1085:Assign_L32_C8", "label": "self._master =", "type": "assigned_variable", "loc": [32, 32], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:If_L31_C6", "vector": [14, 4, 0.2783, 0.0087, 4, 0.78, 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_1085:Assign_L34_C8", "label": "assign", "type": "assigned_variable", "loc": [34, 34], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:If_L31_C6", "vector": [14, 4, 0.2957, 0.0087, 4, 0.78, 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_1085:Expr_L36_C4", "label": "_Reset()", "type": "expression", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L14_C2", "vector": [8, 2, 0.313, 0.0087, 2, 0.28, 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_1085:FunctionDef_L38_C2", "label": "Validate", "type": "function", "loc": [38, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:ClassDef_L12_C0", "vector": [2, 1, 0.3565, 0.0609, 1, 0.45, 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_1085:Expr_L39_C4", "label": "expression", "type": "expression", "loc": [39, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L38_C2", "vector": [8, 2, 0.3478, 0.0261, 2, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Computes whether all the data in the files for the given languages is valid.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1085:Expr_L42_C4", "label": "_Reset()", "type": "expression", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L38_C2", "vector": [8, 2, 0.3652, 0.0087, 2, 0.44, 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_1085:Expr_L43_C4", "label": "_ValidateMissingKeys()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L38_C2", "vector": [8, 2, 0.3739, 0.0087, 2, 0.44, 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_1085:Expr_L44_C4", "label": "_ValidateOutdatedKeys()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L38_C2", "vector": [8, 2, 0.3826, 0.0087, 2, 0.44, 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_1085:FunctionDef_L46_C2", "label": "valid", "type": "function", "loc": [46, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:ClassDef_L12_C0", "vector": [2, 1, 0.413, 0.0348, 1, 0.45, 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_1085:Return_L47_C4", "label": "return", "type": "return", "loc": [47, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L46_C2", "vector": [13, 2, 0.4174, 0.0261, 2, 0.24, 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_1085:FunctionDef_L51_C2", "label": "missing_in_master", "type": "function", "loc": [51, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:ClassDef_L12_C0", "vector": [2, 1, 0.4478, 0.0174, 1, 0.45, 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_1085:Return_L52_C4", "label": "return", "type": "return", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L51_C2", "vector": [13, 2, 0.4522, 0.0087, 2, 0.31, 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_1085:FunctionDef_L54_C2", "label": "missing_in_lang", "type": "function", "loc": [54, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:ClassDef_L12_C0", "vector": [2, 1, 0.4739, 0.0174, 1, 0.45, 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_1085:Return_L55_C4", "label": "return", "type": "return", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L54_C2", "vector": [13, 2, 0.4783, 0.0087, 2, 0.99, 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_1085:FunctionDef_L57_C2", "label": "outdated_in_lang", "type": "function", "loc": [57, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:ClassDef_L12_C0", "vector": [2, 1, 0.5, 0.0174, 1, 0.45, 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_1085:Return_L58_C4", "label": "return", "type": "return", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L57_C2", "vector": [13, 2, 0.5043, 0.0087, 2, 0.88, 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_1085:FunctionDef_L60_C2", "label": "_Reset", "type": "function", "loc": [60, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:ClassDef_L12_C0", "vector": [2, 1, 0.5391, 0.0435, 1, 0.45, 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_1085:Assign_L62_C4", "label": "self._missing_in_master =", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L60_C2", "vector": [14, 2, 0.5391, 0.0087, 2, 0.99, 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_1085:Assign_L63_C4", "label": "self._missing_in_lang =", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L60_C2", "vector": [14, 2, 0.5478, 0.0087, 2, 0.99, 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_1085:Assign_L64_C4", "label": "self._outdated_in_lang =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L60_C2", "vector": [14, 2, 0.5565, 0.0087, 2, 0.99, 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_1085:FunctionDef_L66_C2", "label": "_ValidateMissingKeys", "type": "function", "loc": [66, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:ClassDef_L12_C0", "vector": [2, 1, 0.6304, 0.1217, 1, 0.45, 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_1085:Expr_L67_C4", "label": "expression", "type": "expression", "loc": [67, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L66_C2", "vector": [8, 2, 0.5913, 0.0261, 2, 0.47, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Computes whether there are missing keys on either side.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L70_C4", "label": "master_keys = frozenset()", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L66_C2", "vector": [14, 2, 0.6087, 0.0087, 2, 0.47, 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_1085:For_L71_C4", "label": "for lang, file", "type": "for", "loc": [71, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L66_C2", "vector": [6, 2, 0.6522, 0.0783, 2, 0.47, 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_1085:Assign_L72_C6", "label": "keys = frozenset()", "type": "assigned_variable", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L71_C4", "vector": [14, 3, 0.6261, 0.0087, 3, 0.41, 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_1085:Assign_L73_C6", "label": "missing_in_master =", "type": "assigned_variable", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L71_C4", "vector": [14, 3, 0.6348, 0.0087, 3, 0.41, 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_1085:Assign_L74_C6", "label": "missing_in_lang =", "type": "assigned_variable", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L71_C4", "vector": [14, 3, 0.6435, 0.0087, 3, 0.41, 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_1085:If_L76_C6", "label": "if", "type": "if", "loc": [76, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L71_C4", "vector": [4, 3, 0.6652, 0.0174, 3, 0.41, 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_1085:Assign_L77_C8", "label": "assign", "type": "assigned_variable", "loc": [77, 77], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:If_L76_C6", "vector": [14, 4, 0.6696, 0.0087, 4, 0.7, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._missing_in_master[lang] = missing_in_master"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1085:If_L78_C6", "label": "if", "type": "if", "loc": [78, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L71_C4", "vector": [4, 3, 0.6826, 0.0174, 3, 0.41, 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_1085:Assign_L79_C8", "label": "assign", "type": "assigned_variable", "loc": [79, 79], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:If_L78_C6", "vector": [14, 4, 0.687, 0.0087, 4, 0.89, 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_1085:FunctionDef_L81_C2", "label": "_ValidateOutdatedKeys", "type": "function", "loc": [81, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:ClassDef_L12_C0", "vector": [2, 1, 0.8522, 0.3043, 1, 0.45, 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_1085:Expr_L82_C4", "label": "expression", "type": "expression", "loc": [82, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L81_C2", "vector": [8, 2, 0.7261, 0.0348, 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 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_1085:For_L86_C4", "label": "for lang, file", "type": "for", "loc": [86, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L81_C2", "vector": [6, 2, 0.8739, 0.2609, 2, 0.41, 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_1085:Assign_L87_C6", "label": "outdated =", "type": "assigned_variable", "loc": [87, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L86_C4", "vector": [14, 3, 0.7565, 0.0087, 3, 0.4, 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_1085:For_L88_C6", "label": "for key, str", "type": "for", "loc": [88, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L86_C4", "vector": [6, 3, 0.8696, 0.2174, 3, 0.4, 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_1085:Assign_L91_C8", "label": "master_str =", "type": "assigned_variable", "loc": [91, 91], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L88_C6", "vector": [14, 4, 0.7913, 0.0087, 4, 0.95, 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_1085:Assign_L92_C8", "label": "master_revs =", "type": "assigned_variable", "loc": [92, 92], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L88_C6", "vector": [14, 4, 0.8, 0.0087, 4, 0.95, 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_1085:Assign_L93_C8", "label": "lang_revs =", "type": "assigned_variable", "loc": [93, 93], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L88_C6", "vector": [14, 4, 0.8087, 0.0087, 4, 0.95, 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_1085:If_L94_C8", "label": "if", "type": "if", "loc": [94, 96], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L88_C6", "vector": [4, 4, 0.8261, 0.0261, 4, 0.95, 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_1085:Expr_L95_C10", "label": "print()", "type": "expression", "loc": [95, 95], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:If_L94_C8", "vector": [8, 5, 0.8261, 0.0087, 5, 0.11, 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_1085:Assign_L98_C8", "label": "master_file = join()", "type": "assigned_variable", "loc": [98, 98], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L88_C6", "vector": [14, 4, 0.8522, 0.0087, 4, 0.95, 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_1085:Assign_L99_C8", "label": "lang_file = join()", "type": "assigned_variable", "loc": [99, 99], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L88_C6", "vector": [14, 4, 0.8609, 0.0087, 4, 0.95, 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_1085:Assign_L103_C8", "label": "master_rev = reduce()", "type": "assigned_variable", "loc": [103, 105], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L88_C6", "vector": [14, 4, 0.9043, 0.0261, 4, 0.95, 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_1085:Assign_L106_C8", "label": "lang_rev = reduce()", "type": "assigned_variable", "loc": [106, 108], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L88_C6", "vector": [14, 4, 0.9304, 0.0261, 4, 0.95, 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_1085:If_L111_C8", "label": "if", "type": "if", "loc": [111, 112], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L88_C6", "vector": [4, 4, 0.9696, 0.0174, 4, 0.95, 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_1085:Expr_L112_C10", "label": "append()", "type": "expression", "loc": [112, 112], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:If_L111_C8", "vector": [8, 5, 0.9739, 0.0087, 5, 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": " outdated.append(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1085:If_L114_C6", "label": "if", "type": "if", "loc": [114, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L86_C4", "vector": [4, 3, 0.9957, 0.0174, 3, 0.4, 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_1085:Assign_L115_C8", "label": "assign", "type": "assigned_variable", "loc": [115, 115], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1085:If_L114_C6", "vector": [14, 4, 1.0, 0.0087, 4, 0.07, 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_1085:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L27_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L28_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Expr_L29_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:If_L31_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:If_L31_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:If_L31_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Expr_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Return_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L51_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Return_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Return_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Return_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L72_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L73_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L74_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:If_L76_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:If_L76_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:If_L78_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:If_L78_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L81_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L81_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Expr_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:FunctionDef_L81_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L87_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L88_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:If_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:If_L94_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Expr_L95_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:If_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:If_L111_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Expr_L112_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:For_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:If_L114_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1085:If_L114_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1085:Assign_L115_C8"}]
#!/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_1086
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_1086: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_1086: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_1086: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_1086: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_1086: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_1086: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_1086:Expr_L14_C2", "label": "print()", "type": "expression", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L13_C0", "vector": [8, 1, 0.1458, 0.0104, 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('Usage: %s <command> [<language> ...]\\n' % sys.argv[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1086:Expr_L15_C2", "label": "print()", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L13_C0", "vector": [8, 1, 0.1562, 0.0104, 1, 0.7, 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_1086:Expr_L16_C2", "label": "print()", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L13_C0", "vector": [8, 1, 0.1667, 0.0104, 1, 0.7, 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_1086:Expr_L17_C2", "label": "print()", "type": "expression", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L13_C0", "vector": [8, 1, 0.1771, 0.0104, 1, 0.7, 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_1086:Expr_L18_C2", "label": "print()", "type": "expression", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L13_C0", "vector": [8, 1, 0.1875, 0.0104, 1, 0.7, 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_1086:Expr_L19_C2", "label": "exit()", "type": "expression", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L13_C0", "vector": [8, 1, 0.1979, 0.0104, 1, 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_1086: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_1086:Expr_L23_C2", "label": "expression", "type": "expression", "loc": [23, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L22_C0", "vector": [8, 1, 0.2656, 0.0625, 1, 0.62, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n 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_1086:Assign_L29_C2", "label": "validator = Validator()", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L22_C0", "vector": [14, 1, 0.3021, 0.0104, 1, 0.62, 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_1086:Expr_L30_C2", "label": "Validate()", "type": "expression", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L22_C0", "vector": [8, 1, 0.3125, 0.0104, 1, 0.62, 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_1086:Assign_L31_C2", "label": "missing = missing_in_lang()", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L22_C0", "vector": [14, 1, 0.3229, 0.0104, 1, 0.62, 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_1086:Assign_L32_C2", "label": "outdated = outdated_in_lang()", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L22_C0", "vector": [14, 1, 0.3333, 0.0104, 1, 0.62, 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_1086:For_L34_C2", "label": "for lang", "type": "for", "loc": [34, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L22_C0", "vector": [6, 1, 0.3906, 0.0833, 1, 0.62, 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_1086:Assign_L35_C4", "label": "untranslated =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L34_C2", "vector": [14, 2, 0.3646, 0.0104, 2, 0.51, 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_1086:If_L37_C4", "label": "if", "type": "if", "loc": [37, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L34_C2", "vector": [4, 2, 0.3906, 0.0208, 2, 0.51, 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_1086:Assign_L40_C4", "label": "translator = Translator()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L34_C2", "vector": [14, 2, 0.4167, 0.0104, 2, 0.51, 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_1086:Expr_L41_C4", "label": "Translate()", "type": "expression", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L34_C2", "vector": [8, 2, 0.4271, 0.0104, 2, 0.51, 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_1086: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_1086:Expr_L45_C2", "label": "expression", "type": "expression", "loc": [45, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L44_C0", "vector": [8, 1, 0.4896, 0.0521, 1, 0.07, 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_1086:Assign_L50_C2", "label": "validator = Validator()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L44_C0", "vector": [14, 1, 0.5208, 0.0104, 1, 0.07, 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_1086:Expr_L51_C2", "label": "Validate()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L44_C0", "vector": [8, 1, 0.5312, 0.0104, 1, 0.07, 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_1086:Assign_L53_C2", "label": "error_count =", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L44_C0", "vector": [14, 1, 0.5521, 0.0104, 1, 0.07, 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_1086:If_L54_C2", "label": "if", "type": "if", "loc": [54, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L44_C0", "vector": [4, 1, 0.6198, 0.125, 1, 0.07, 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_1086:Expr_L55_C4", "label": "print()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L54_C2", "vector": [8, 2, 0.5729, 0.0104, 2, 0.45, 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_1086:For_L57_C4", "label": "for lang, missing", "type": "for", "loc": [57, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L54_C2", "vector": [6, 2, 0.6042, 0.0312, 2, 0.45, 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_1086:Expr_L58_C6", "label": "print()", "type": "expression", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L57_C4", "vector": [8, 3, 0.6042, 0.0104, 3, 0.45, 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_1086:Assign_L59_C6", "label": "error_count =", "type": "assigned_variable", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L57_C4", "vector": [14, 3, 0.6146, 0.0104, 3, 0.45, 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_1086:For_L60_C4", "label": "for lang, missing", "type": "for", "loc": [60, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L54_C2", "vector": [6, 2, 0.6354, 0.0312, 2, 0.45, 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_1086:Expr_L61_C6", "label": "print()", "type": "expression", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L60_C4", "vector": [8, 3, 0.6354, 0.0104, 3, 0.64, 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_1086:Assign_L62_C6", "label": "error_count =", "type": "assigned_variable", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L60_C4", "vector": [14, 3, 0.6458, 0.0104, 3, 0.64, 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_1086:For_L63_C4", "label": "for lang, outdated", "type": "for", "loc": [63, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L54_C2", "vector": [6, 2, 0.6667, 0.0312, 2, 0.45, 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_1086:Expr_L64_C6", "label": "print()", "type": "expression", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L63_C4", "vector": [8, 3, 0.6667, 0.0104, 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('Outdated in %s: %s:' % (lang, str(outdated)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1086:Assign_L65_C6", "label": "error_count =", "type": "assigned_variable", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L63_C4", "vector": [14, 3, 0.6771, 0.0104, 3, 0.93, 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_1086:Return_L67_C2", "label": "return", "type": "return", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L44_C0", "vector": [13, 1, 0.6979, 0.0104, 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 error_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1086: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_1086:Assign_L71_C2", "label": "argv =", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L70_C0", "vector": [14, 1, 0.7396, 0.0104, 1, 0.99, 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_1086:Assign_L72_C2", "label": "argc = len()", "type": "assigned_variable", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L70_C0", "vector": [14, 1, 0.75, 0.0104, 1, 0.99, 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_1086:If_L73_C2", "label": "if", "type": "if", "loc": [73, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L70_C0", "vector": [4, 1, 0.7656, 0.0208, 1, 0.99, 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_1086:Expr_L74_C4", "label": "Usage()", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L73_C2", "vector": [8, 2, 0.7708, 0.0104, 2, 0.44, 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_1086:Assign_L76_C2", "label": "languages = GetAllLanguageFiles()", "type": "assigned_variable", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L70_C0", "vector": [14, 1, 0.7917, 0.0104, 1, 0.99, 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_1086:If_L77_C2", "label": "if", "type": "if", "loc": [77, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L70_C0", "vector": [4, 1, 0.8438, 0.0938, 1, 0.99, 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_1086:Assign_L78_C4", "label": "langs = set()", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086: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_1086:If_L79_C4", "label": "if", "type": "if", "loc": [79, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086: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_1086:Assign_L83_C4", "label": "languages = dict()", "type": "assigned_variable", "loc": [83, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086: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_1086:Assign_L87_C2", "label": "cmd =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L70_C0", "vector": [14, 1, 0.9062, 0.0104, 1, 0.99, 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_1086:If_L88_C2", "label": "if", "type": "if", "loc": [88, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L70_C0", "vector": [4, 1, 0.9479, 0.0729, 1, 0.99, 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_1086:Expr_L89_C4", "label": "Translate()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L88_C2", "vector": [8, 2, 0.9271, 0.0104, 2, 0.8, 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_1086:If_L90_C2", "label": "if", "type": "if", "loc": [90, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L88_C2", "vector": [4, 2, 0.9583, 0.0521, 2, 0.8, 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_1086:Assign_L91_C4", "label": "error_count = Validate()", "type": "assigned_variable", "loc": [91, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L90_C2", "vector": [14, 3, 0.9479, 0.0104, 3, 0.9, 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_1086:Expr_L93_C4", "label": "Usage()", "type": "expression", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L90_C2", "vector": [8, 3, 0.9688, 0.0104, 3, 0.9, 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_1086:Assign_L94_C4", "label": "error_count =", "type": "assigned_variable", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L90_C2", "vector": [14, 3, 0.9792, 0.0104, 3, 0.9, 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_1086:Expr_L96_C2", "label": "print()", "type": "expression", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L70_C0", "vector": [8, 1, 1.0, 0.0104, 1, 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": " print('%d errors found.' % error_count)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Expr_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Expr_L15_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Expr_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Expr_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Expr_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Expr_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Expr_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Assign_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Expr_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Assign_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Assign_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Expr_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Assign_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Expr_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Expr_L58_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Assign_L59_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Expr_L61_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Assign_L62_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Expr_L64_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:For_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Assign_L65_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Return_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Assign_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Assign_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L73_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Assign_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Assign_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Assign_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Expr_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1086:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1086:Expr_L96_C2"}]
''' 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_1087
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_1087: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_1087: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_1087: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_1087: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_1087: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_1087: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_1087: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_1087: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_1087:Expr_L16_C2", "label": "expression", "type": "expression", "loc": [16, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L15_C0", "vector": [8, 1, 0.3778, 0.0667, 1, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Returns the directory in which the MyTracks directory is located.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1087:Assign_L19_C2", "label": "path = getcwd()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L15_C0", "vector": [14, 1, 0.4222, 0.0222, 1, 0.74, 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_1087:While_L20_C2", "label": "while", "type": "while", "loc": [20, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L15_C0", "vector": [5, 1, 0.5, 0.1333, 1, 0.74, 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_1087:If_L21_C4", "label": "if", "type": "if", "loc": [21, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1087:While_L20_C2", "vector": [4, 2, 0.4778, 0.0444, 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 path == '/':\n raise 'Not in My Tracks project'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1087:Assign_L25_C4", "label": "path =", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1087:While_L20_C2", "vector": [14, 2, 0.5556, 0.0222, 2, 0.55, 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_1087:Return_L27_C2", "label": "return", "type": "return", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L15_C0", "vector": [13, 1, 0.6, 0.0222, 1, 0.74, 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_1087: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_1087:Expr_L31_C2", "label": "expression", "type": "expression", "loc": [31, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L30_C0", "vector": [8, 1, 0.7111, 0.0667, 1, 0.96, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Returns a mapping from all found languages to their respective directories.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1087:Assign_L34_C2", "label": "mytracks_path = GetMyTracksDir()", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L30_C0", "vector": [14, 1, 0.7556, 0.0222, 1, 0.96, 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_1087:Assign_L35_C2", "label": "res_dir = join()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L30_C0", "vector": [14, 1, 0.7778, 0.0222, 1, 0.96, 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_1087:Assign_L36_C2", "label": "language_dirs = glob()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L30_C0", "vector": [14, 1, 0.8, 0.0222, 1, 0.96, 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_1087:Assign_L37_C2", "label": "master_dir = join()", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L30_C0", "vector": [14, 1, 0.8222, 0.0222, 1, 0.96, 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_1087:If_L38_C2", "label": "if", "type": "if", "loc": [38, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L30_C0", "vector": [4, 1, 0.8556, 0.0444, 1, 0.96, 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_1087:If_L40_C2", "label": "if", "type": "if", "loc": [40, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L30_C0", "vector": [4, 1, 0.9, 0.0444, 1, 0.96, 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_1087:Assign_L43_C2", "label": "language_tuples =", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L30_C0", "vector": [14, 1, 0.9556, 0.0222, 1, 0.96, 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_1087:Expr_L44_C2", "label": "append()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L30_C0", "vector": [8, 1, 0.9778, 0.0222, 1, 0.96, 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_1087:Return_L45_C2", "label": "return", "type": "return", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L30_C0", "vector": [13, 1, 1.0, 0.0222, 1, 0.96, 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_1087:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1087:Expr_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1087:Assign_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1087:While_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1087:While_L20_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1087:If_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1087:While_L20_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1087:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1087:Return_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1087:Expr_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1087:Assign_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1087:Assign_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1087:Assign_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1087:Assign_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1087:If_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1087:If_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1087:Assign_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1087:Expr_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1087:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1087: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_1088
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_1088: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_1088: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_1088: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_1088: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_1088:Expr_L12_C2", "label": "expression", "type": "expression", "loc": [12, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:ClassDef_L11_C0", "vector": [8, 1, 0.1261, 0.0522, 1, 0.87, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n 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_1088:FunctionDef_L19_C2", "label": "Parse", "type": "function", "loc": [19, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:ClassDef_L11_C0", "vector": [2, 1, 0.3, 0.2783, 1, 0.87, 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_1088:Expr_L20_C4", "label": "expression", "type": "expression", "loc": [20, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2", "vector": [8, 2, 0.2435, 0.1478, 2, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n 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_1088:Expr_L37_C4", "label": "_Reset()", "type": "expression", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2", "vector": [8, 2, 0.3217, 0.0087, 2, 0.05, 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_1088:Assign_L40_C4", "label": "self._xml_parser = ParserCreate()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2", "vector": [14, 2, 0.3478, 0.0087, 2, 0.05, 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_1088:Assign_L41_C4", "label": "self._xml_parser.StartElementHandler =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2", "vector": [14, 2, 0.3565, 0.0087, 2, 0.05, 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_1088:Assign_L42_C4", "label": "self._xml_parser.EndElementHandler =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2", "vector": [14, 2, 0.3652, 0.0087, 2, 0.05, 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_1088:Assign_L43_C4", "label": "self._xml_parser.CharacterDataHandler =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2", "vector": [14, 2, 0.3739, 0.0087, 2, 0.05, 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_1088:Assign_L44_C4", "label": "self._xml_parser.CommentHandler =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2", "vector": [14, 2, 0.3826, 0.0087, 2, 0.05, 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_1088:Assign_L46_C4", "label": "file_obj = open()", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2", "vector": [14, 2, 0.4, 0.0087, 2, 0.05, 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_1088:Expr_L47_C4", "label": "ParseFile()", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2", "vector": [8, 2, 0.4087, 0.0087, 2, 0.05, 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_1088:Expr_L48_C4", "label": "close()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2", "vector": [8, 2, 0.4174, 0.0087, 2, 0.05, 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_1088:Return_L50_C4", "label": "return", "type": "return", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2", "vector": [13, 2, 0.4348, 0.0087, 2, 0.05, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._all_strings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L52_C2", "label": "_Reset", "type": "function", "loc": [52, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:ClassDef_L11_C0", "vector": [2, 1, 0.4696, 0.0435, 1, 0.87, 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_1088:Assign_L53_C4", "label": "self._currentString =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L52_C2", "vector": [14, 2, 0.4609, 0.0087, 2, 0.19, 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_1088:Assign_L54_C4", "label": "self._currentStringName =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L52_C2", "vector": [14, 2, 0.4696, 0.0087, 2, 0.19, 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_1088:Assign_L55_C4", "label": "self._currentStringValue =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L52_C2", "vector": [14, 2, 0.4783, 0.0087, 2, 0.19, 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_1088:Assign_L56_C4", "label": "self._all_strings =", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L52_C2", "vector": [14, 2, 0.487, 0.0087, 2, 0.19, 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_1088:FunctionDef_L58_C2", "label": "_StartElementHandler", "type": "function", "loc": [58, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:ClassDef_L11_C0", "vector": [2, 1, 0.5783, 0.1565, 1, 0.87, 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_1088:If_L59_C4", "label": "if", "type": "if", "loc": [59, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L58_C2", "vector": [4, 2, 0.5174, 0.0174, 2, 0.05, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name != 'string':\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1088:Return_L60_C6", "label": "return", "type": "return", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:If_L59_C4", "vector": [13, 3, 0.5217, 0.0087, 3, 0.77, 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_1088:If_L62_C4", "label": "if", "type": "if", "loc": [62, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L58_C2", "vector": [4, 2, 0.5435, 0.0174, 2, 0.05, 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_1088:Return_L63_C6", "label": "return", "type": "return", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:If_L62_C4", "vector": [13, 3, 0.5478, 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_1088:Assign_L67_C4", "label": "self._currentString =", "type": "assigned_variable", "loc": [67, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L58_C2", "vector": [14, 2, 0.5913, 0.0261, 2, 0.05, 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_1088:If_L71_C4", "label": "if", "type": "if", "loc": [71, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L58_C2", "vector": [4, 2, 0.6217, 0.0174, 2, 0.05, 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_1088:Assign_L72_C6", "label": "assign", "type": "assigned_variable", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:If_L71_C4", "vector": [14, 3, 0.6261, 0.0087, 3, 0.76, 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_1088:Assign_L74_C4", "label": "self._currentStringName =", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L58_C2", "vector": [14, 2, 0.6435, 0.0087, 2, 0.05, 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_1088:Assign_L75_C4", "label": "self._currentStringValue =", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L58_C2", "vector": [14, 2, 0.6522, 0.0087, 2, 0.05, 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_1088:FunctionDef_L77_C2", "label": "_EndElementHandler", "type": "function", "loc": [77, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:ClassDef_L11_C0", "vector": [2, 1, 0.7217, 0.113, 1, 0.87, 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_1088:If_L78_C4", "label": "if", "type": "if", "loc": [78, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L77_C2", "vector": [4, 2, 0.6826, 0.0174, 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 name != 'string':\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1088:Return_L79_C6", "label": "return", "type": "return", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:If_L78_C4", "vector": [13, 3, 0.687, 0.0087, 3, 0.97, 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_1088:Assign_L83_C4", "label": "assign", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L77_C2", "vector": [14, 2, 0.7217, 0.0087, 2, 0.02, 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_1088:Assign_L84_C4", "label": "assign", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L77_C2", "vector": [14, 2, 0.7304, 0.0087, 2, 0.02, 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_1088:Assign_L85_C4", "label": "assign", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L77_C2", "vector": [14, 2, 0.7391, 0.0087, 2, 0.02, 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_1088:Assign_L87_C4", "label": "self._currentString =", "type": "assigned_variable", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L77_C2", "vector": [14, 2, 0.7565, 0.0087, 2, 0.02, 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_1088:Assign_L88_C4", "label": "self._currentStringName =", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L77_C2", "vector": [14, 2, 0.7652, 0.0087, 2, 0.02, 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_1088:Assign_L89_C4", "label": "self._currentStringValue =", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L77_C2", "vector": [14, 2, 0.7739, 0.0087, 2, 0.02, 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_1088:FunctionDef_L91_C2", "label": "_CharacterDataHandler", "type": "function", "loc": [91, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:ClassDef_L11_C0", "vector": [2, 1, 0.8087, 0.0435, 1, 0.87, 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_1088:If_L92_C4", "label": "if", "type": "if", "loc": [92, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L91_C2", "vector": [4, 2, 0.8043, 0.0174, 2, 0.36, 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_1088:Return_L93_C6", "label": "return", "type": "return", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:If_L92_C4", "vector": [13, 3, 0.8087, 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_1088:Assign_L97_C2", "label": "_KEEP_PARENT_REGEX = compile()", "type": "assigned_variable", "loc": [97, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:ClassDef_L11_C0", "vector": [14, 1, 0.8565, 0.0348, 1, 0.87, 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_1088:FunctionDef_L102_C2", "label": "_CommentHandler", "type": "function", "loc": [102, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:ClassDef_L11_C0", "vector": [2, 1, 0.9435, 0.1217, 1, 0.87, 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_1088:Assign_L103_C4", "label": "keep_parent_match = match()", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L102_C2", "vector": [14, 2, 0.8957, 0.0087, 2, 0.87, 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_1088:If_L104_C4", "label": "if", "type": "if", "loc": [104, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L102_C2", "vector": [4, 2, 0.9087, 0.0174, 2, 0.87, 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_1088:Return_L105_C6", "label": "return", "type": "return", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:If_L104_C4", "vector": [13, 3, 0.913, 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_1088:Assign_L107_C4", "label": "name = group()", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L102_C2", "vector": [14, 2, 0.9304, 0.0087, 2, 0.87, 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_1088:Assign_L108_C4", "label": "assign", "type": "assigned_variable", "loc": [108, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L102_C2", "vector": [14, 2, 0.9565, 0.0435, 2, 0.87, 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_1088:Assign_L113_C4", "label": "rev = group()", "type": "assigned_variable", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L102_C2", "vector": [14, 2, 0.9826, 0.0087, 2, 0.87, 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_1088:If_L114_C4", "label": "if", "type": "if", "loc": [114, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L102_C2", "vector": [4, 2, 0.9957, 0.0174, 2, 0.87, 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_1088:Assign_L115_C6", "label": "assign", "type": "assigned_variable", "loc": [115, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1088:If_L114_C4", "vector": [14, 3, 1.0, 0.0087, 3, 0.21, 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_1088:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Expr_L12_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Return_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:If_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:If_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Return_L60_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:If_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Return_L63_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:If_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:If_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L72_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:If_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:If_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Return_L79_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:If_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:If_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Return_L93_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L97_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L102_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:If_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:If_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Return_L105_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:If_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1088:If_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1088:Assign_L115_C6"}]
''' 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_1089
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_1089: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_1089: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_1089:Expr_L10_C2", "label": "expression", "type": "expression", "loc": [10, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1089:ClassDef_L9_C0", "vector": [8, 1, 0.5238, 0.1429, 1, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n classdocs\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1089:FunctionDef_L14_C2", "label": "__init__", "type": "function", "loc": [14, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1089:ClassDef_L9_C0", "vector": [2, 1, 0.7619, 0.2381, 1, 0.56, 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_1089:Expr_L15_C4", "label": "expression", "type": "expression", "loc": [15, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1089:FunctionDef_L14_C2", "vector": [8, 2, 0.7619, 0.1429, 2, 0.93, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Constructor\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1089:Assign_L18_C4", "label": "self._language =", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1089:FunctionDef_L14_C2", "vector": [14, 2, 0.8571, 0.0476, 2, 0.93, 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_1089:FunctionDef_L20_C2", "label": "Translate", "type": "function", "loc": [20, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1089:ClassDef_L9_C0", "vector": [2, 1, 0.9762, 0.0952, 1, 0.56, 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_1089:Expr_L21_C4", "label": "print()", "type": "expression", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1089:FunctionDef_L20_C2", "vector": [8, 2, 1.0, 0.0476, 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(string_names)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1089:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1089:Expr_L10_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1089:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1089:FunctionDef_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1089:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1089:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1089:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1089:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1089:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1089:FunctionDef_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1089:FunctionDef_L20_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1089:Expr_L21_C4"}]
#!/usr/bin/env python # Copyright 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import sys import os from StringIO import StringIO from PIL import Image import datauri RGBA_BLACK = (0, 0, 0, 255) sign_ = lambda n: -1 if n < 0 else (1 if n > 0 else 0) def find_black_region_(im, sx, sy, ex, ey): dx = sign_(ex - sx) dy = sign_(ey - sy) if abs(dx) == abs(dy): raise 'findRegion_ can\'t look both horizontally and vertically at once.' pixel_changes = [] pixel_on = False x = sx y = sy while True: if not pixel_on and im.getpixel((x, y)) == RGBA_BLACK: pixel_changes.append((x, y)) pixel_on = True elif pixel_on and im.getpixel((x, y)) != RGBA_BLACK: pixel_changes.append((x, y)) pixel_on = False x += dx y += dy if x == ex and y == ey: break return (pixel_changes[0][0 if dx else 1] - (sx if dx else sy), pixel_changes[1][0 if dx else 1] - (sx if dx else sy)) def image_to_data_uri_(im): f = StringIO() im.save(f, 'PNG') uri = datauri.to_data_uri(f.getvalue(), 'foo.png') f.close() return uri def main(): src_im = Image.open(sys.argv[1]) # read and parse 9-patch stretch and padding regions stretch_l, stretch_r = find_black_region_(src_im, 0, 0, src_im.size[0], 0) stretch_t, stretch_b = find_black_region_(src_im, 0, 0, 0, src_im.size[1]) pad_l, pad_r = find_black_region_(src_im, 0, src_im.size[1] - 1, src_im.size[0], src_im.size[1] - 1) pad_t, pad_b = find_black_region_(src_im, src_im.size[0] - 1, 0, src_im.size[0] - 1, src_im.size[1]) #padding_box = {} template_params = {} template_params['id'] = sys.argv[1] template_params['icon_uri'] = image_to_data_uri_(src_im) template_params['dim_constraint_attributes'] = '' # p:lockHeight="true" template_params['image_uri'] = image_to_data_uri_(src_im.crop((1, 1, src_im.size[0] - 1, src_im.size[1] - 1))) template_params['width_l'] = stretch_l - 1 template_params['width_r'] = src_im.size[0] - stretch_r - 1 template_params['height_t'] = stretch_t - 1 template_params['height_b'] = src_im.size[1] - stretch_b - 1 template_params['pad_l'] = pad_l - 1 template_params['pad_t'] = pad_t - 1 template_params['pad_r'] = src_im.size[0] - pad_r - 1 template_params['pad_b'] = src_im.size[1] - pad_b - 1 print open('res/shape_9patch_template.xml').read() % template_params if __name__ == '__main__': main()
ajibawa-2023/Python-Code-Large/train/row_1090
52
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_1090:Import_L17_C0", "label": "sys import sys", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.1753, 0.0103, 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_1090:Import_L18_C0", "label": "os import os", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1856, 0.0103, 0, 0.66, 0.1, 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_1090:ImportFrom_L19_C0", "label": "from StringIO import StringIO", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.1959, 0.0103, 0, 0.66, 0.2, 609, 0, 1, 0, 0, 609, 0, 0], "semantic": {"name": "StringIO", "arg_names": [], "import_names": ["StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": "from StringIO import StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:ImportFrom_L20_C0", "label": "from PIL import Image", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.2062, 0.0103, 0, 0.66, 0.3, 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_1090:Import_L22_C0", "label": "datauri import datauri", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.2268, 0.0103, 0, 0.66, 0.4, 597, 0, 1, 0, 0, 597, 0, 0], "semantic": {"name": "datauri", "arg_names": [], "import_names": ["datauri"], "rhs_call_name": "", "annotation": ""}, "snippet": "import datauri"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L25_C0", "label": "RGBA_BLACK =", "type": "assigned_variable", "loc": [25, 25], "level": 0, "parent": null, "vector": [14, 0, 0.2577, 0.0103, 0, 0.66, 0.5, 332, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "RGBA_BLACK", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "RGBA_BLACK = (0, 0, 0, 255)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L28_C0", "label": "sign_ =", "type": "assigned_variable", "loc": [28, 28], "level": 0, "parent": null, "vector": [14, 0, 0.2887, 0.0103, 0, 0.66, 0.6, 173, 9, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sign_", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "sign_ = lambda n: -1 if n < 0 else (1 if n > 0 else 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L31_C0", "label": "find_black_region_", "type": "function", "loc": [31, 54], "level": 0, "parent": null, "vector": [2, 0, 0.4381, 0.2474, 0, 0.66, 0.7, 5, 0, 5, 1, 0, 0, 0, 8], "semantic": {"name": "find_black_region_", "arg_names": ["im", "sx", "sy", "ex", "ey"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def find_black_region_(im, sx, sy, ex, ey):\n dx = sign_(ex - sx)\n dy = sign_(ey - sy)\n if abs(dx) == abs(dy):\n raise 'findRegion_ can\\'t look both horizontally and vertically at once.'\n\n pixel_changes = []\n pixel_on = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L32_C2", "label": "dx = sign_()", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L31_C0", "vector": [14, 1, 0.3299, 0.0103, 1, 0.56, 0.0, 870, 3, 1, 0, 0, 173, 10, 1], "semantic": {"name": "dx", "arg_names": [], "import_names": [], "rhs_call_name": "sign_", "annotation": ""}, "snippet": " dx = sign_(ex - sx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L33_C2", "label": "dy = sign_()", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L31_C0", "vector": [14, 1, 0.3402, 0.0103, 1, 0.56, 0.125, 477, 3, 1, 0, 0, 173, 10, 1], "semantic": {"name": "dy", "arg_names": [], "import_names": [], "rhs_call_name": "sign_", "annotation": ""}, "snippet": " dy = sign_(ey - sy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:If_L34_C2", "label": "if", "type": "if", "loc": [34, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L31_C0", "vector": [4, 1, 0.3557, 0.0206, 1, 0.56, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if abs(dx) == abs(dy):\n raise 'findRegion_ can\\'t look both horizontally and vertically at once.'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L37_C2", "label": "pixel_changes =", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L31_C0", "vector": [14, 1, 0.3814, 0.0103, 1, 0.56, 0.375, 431, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "pixel_changes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pixel_changes = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L38_C2", "label": "pixel_on =", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L31_C0", "vector": [14, 1, 0.3918, 0.0103, 1, 0.56, 0.5, 580, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "pixel_on", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pixel_on = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L39_C2", "label": "x =", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L31_C0", "vector": [14, 1, 0.4021, 0.0103, 1, 0.56, 0.625, 190, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " x = sx"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L40_C2", "label": "y =", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L31_C0", "vector": [14, 1, 0.4124, 0.0103, 1, 0.56, 0.75, 304, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " y = sy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:While_L41_C2", "label": "while", "type": "while", "loc": [41, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L31_C0", "vector": [5, 1, 0.4742, 0.1134, 1, 0.56, 0.875, 0, 1, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n if not pixel_on and im.getpixel((x, y)) == RGBA_BLACK:\n pixel_changes.append((x, y))\n pixel_on = True\n elif pixel_on and im.getpixel((x, y)) != RGBA_BLACK:\n pixel_changes.append((x, y))\n pixel_on = False\n x += dx"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:If_L42_C4", "label": "if", "type": "if", "loc": [42, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:While_L41_C2", "vector": [4, 2, 0.4588, 0.0619, 2, 0.94, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not pixel_on and im.getpixel((x, y)) == RGBA_BLACK:\n pixel_changes.append((x, y))\n pixel_on = True\n elif pixel_on and im.getpixel((x, y)) != RGBA_BLACK:\n pixel_changes.append((x, y))\n pixel_on = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Expr_L43_C6", "label": "append()", "type": "expression", "loc": [43, 43], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:If_L42_C4", "vector": [8, 3, 0.4433, 0.0103, 3, 0.98, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " pixel_changes.append((x, y))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L44_C6", "label": "pixel_on =", "type": "assigned_variable", "loc": [44, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:If_L42_C4", "vector": [14, 3, 0.4536, 0.0103, 3, 0.98, 0.5, 580, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "pixel_on", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pixel_on = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:If_L45_C4", "label": "if", "type": "if", "loc": [45, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:If_L42_C4", "vector": [4, 3, 0.4742, 0.0309, 3, 0.98, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif pixel_on and im.getpixel((x, y)) != RGBA_BLACK:\n pixel_changes.append((x, y))\n pixel_on = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Expr_L46_C6", "label": "append()", "type": "expression", "loc": [46, 46], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:If_L45_C4", "vector": [8, 4, 0.4742, 0.0103, 4, 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": " pixel_changes.append((x, y))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L47_C6", "label": "pixel_on =", "type": "assigned_variable", "loc": [47, 47], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:If_L45_C4", "vector": [14, 4, 0.4845, 0.0103, 4, 0.45, 1.0, 580, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "pixel_on", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pixel_on = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:If_L50_C4", "label": "if", "type": "if", "loc": [50, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:While_L41_C2", "vector": [4, 2, 0.5206, 0.0206, 2, 0.94, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if x == ex and y == ey:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Return_L53_C2", "label": "return", "type": "return", "loc": [53, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L31_C0", "vector": [13, 1, 0.5515, 0.0206, 1, 0.56, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (pixel_changes[0][0 if dx else 1] - (sx if dx else sy),\n pixel_changes[1][0 if dx else 1] - (sx if dx else sy))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L57_C0", "label": "image_to_data_uri_", "type": "function", "loc": [57, 62], "level": 0, "parent": null, "vector": [2, 0, 0.6134, 0.0619, 0, 0.66, 0.8, 588, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "image_to_data_uri_", "arg_names": ["im"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def image_to_data_uri_(im):\n f = StringIO()\n im.save(f, 'PNG')\n uri = datauri.to_data_uri(f.getvalue(), 'foo.png')\n f.close()\n return uri"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L58_C2", "label": "f = StringIO()", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L57_C0", "vector": [14, 1, 0.5979, 0.0103, 1, 0.9, 0.0, 899, 3, 0, 0, 0, 609, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": " f = StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Expr_L59_C2", "label": "save()", "type": "expression", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L57_C0", "vector": [8, 1, 0.6082, 0.0103, 1, 0.9, 0.25, 928, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " im.save(f, 'PNG')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L60_C2", "label": "uri = to_data_uri()", "type": "assigned_variable", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L57_C0", "vector": [14, 1, 0.6186, 0.0103, 1, 0.9, 0.5, 600, 3, 2, 0, 0, 70, 10, 2], "semantic": {"name": "uri", "arg_names": [], "import_names": [], "rhs_call_name": "to_data_uri", "annotation": ""}, "snippet": " uri = datauri.to_data_uri(f.getvalue(), 'foo.png')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Expr_L61_C2", "label": "close()", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L57_C0", "vector": [8, 1, 0.6289, 0.0103, 1, 0.9, 0.75, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Return_L62_C2", "label": "return", "type": "return", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L57_C0", "vector": [13, 1, 0.6392, 0.0103, 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 uri"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "label": "main", "type": "function", "loc": [65, 93], "level": 0, "parent": null, "vector": [2, 0, 0.8144, 0.299, 0, 0.66, 0.9, 624, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n src_im = Image.open(sys.argv[1])\n\n # read and parse 9-patch stretch and padding regions\n stretch_l, stretch_r = find_black_region_(src_im, 0, 0, src_im.size[0], 0)\n stretch_t, stretch_b = find_black_region_(src_im, 0, 0, 0, src_im.size[1])\n \n pad_l, pad_r = find_black_region_(src_im, 0, src_im.size[1] - 1, src_im.size[0], src_im.size[1] - 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L66_C2", "label": "src_im = open()", "type": "assigned_variable", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "vector": [14, 1, 0.6804, 0.0103, 1, 0.58, 0.0, 272, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "src_im", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " src_im = Image.open(sys.argv[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L69_C2", "label": "stretch_l, stretch_r = find_black_region_()", "type": "assigned_variable", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "vector": [14, 1, 0.7113, 0.0103, 1, 0.58, 0.0556, 344, 3, 5, 0, 0, 5, 10, 1], "semantic": {"name": "stretch_l, stretch_r", "arg_names": [], "import_names": [], "rhs_call_name": "find_black_region_", "annotation": ""}, "snippet": " stretch_l, stretch_r = find_black_region_(src_im, 0, 0, src_im.size[0], 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L70_C2", "label": "stretch_t, stretch_b = find_black_region_()", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "vector": [14, 1, 0.7216, 0.0103, 1, 0.58, 0.1111, 104, 3, 5, 0, 0, 5, 10, 1], "semantic": {"name": "stretch_t, stretch_b", "arg_names": [], "import_names": [], "rhs_call_name": "find_black_region_", "annotation": ""}, "snippet": " stretch_t, stretch_b = find_black_region_(src_im, 0, 0, 0, src_im.size[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L72_C2", "label": "pad_l, pad_r = find_black_region_()", "type": "assigned_variable", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "vector": [14, 1, 0.7423, 0.0103, 1, 0.58, 0.1667, 536, 3, 5, 0, 0, 5, 10, 1], "semantic": {"name": "pad_l, pad_r", "arg_names": [], "import_names": [], "rhs_call_name": "find_black_region_", "annotation": ""}, "snippet": " pad_l, pad_r = find_black_region_(src_im, 0, src_im.size[1] - 1, src_im.size[0], src_im.size[1] - 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L73_C2", "label": "pad_t, pad_b = find_black_region_()", "type": "assigned_variable", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "vector": [14, 1, 0.7526, 0.0103, 1, 0.58, 0.2222, 525, 3, 5, 0, 0, 5, 10, 1], "semantic": {"name": "pad_t, pad_b", "arg_names": [], "import_names": [], "rhs_call_name": "find_black_region_", "annotation": ""}, "snippet": " pad_t, pad_b = find_black_region_(src_im, src_im.size[0] - 1, 0, src_im.size[0] - 1, src_im.size[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L76_C2", "label": "template_params =", "type": "assigned_variable", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "vector": [14, 1, 0.7835, 0.0103, 1, 0.58, 0.2778, 866, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "template_params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " template_params = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L77_C2", "label": "assign", "type": "assigned_variable", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "vector": [14, 1, 0.7938, 0.0103, 1, 0.58, 0.3333, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " template_params['id'] = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L78_C2", "label": " = image_to_data_uri_()", "type": "assigned_variable", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "vector": [14, 1, 0.8041, 0.0103, 1, 0.58, 0.3889, 0, 3, 1, 0, 0, 588, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "image_to_data_uri_", "annotation": ""}, "snippet": " template_params['icon_uri'] = image_to_data_uri_(src_im)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L79_C2", "label": "assign", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "vector": [14, 1, 0.8144, 0.0103, 1, 0.58, 0.4444, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " template_params['dim_constraint_attributes'] = '' # p:lockHeight=\"true\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L81_C2", "label": " = image_to_data_uri_()", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "vector": [14, 1, 0.8351, 0.0103, 1, 0.58, 0.5, 0, 3, 1, 0, 0, 588, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "image_to_data_uri_", "annotation": ""}, "snippet": " template_params['image_uri'] = image_to_data_uri_(src_im.crop((1, 1, src_im.size[0] - 1, src_im.size[1] - 1)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L83_C2", "label": "assign", "type": "assigned_variable", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "vector": [14, 1, 0.8557, 0.0103, 1, 0.58, 0.5556, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " template_params['width_l'] = stretch_l - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L84_C2", "label": "assign", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "vector": [14, 1, 0.866, 0.0103, 1, 0.58, 0.6111, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " template_params['width_r'] = src_im.size[0] - stretch_r - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L85_C2", "label": "assign", "type": "assigned_variable", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "vector": [14, 1, 0.8763, 0.0103, 1, 0.58, 0.6667, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " template_params['height_t'] = stretch_t - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L86_C2", "label": "assign", "type": "assigned_variable", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "vector": [14, 1, 0.8866, 0.0103, 1, 0.58, 0.7222, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " template_params['height_b'] = src_im.size[1] - stretch_b - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L88_C2", "label": "assign", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "vector": [14, 1, 0.9072, 0.0103, 1, 0.58, 0.7778, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " template_params['pad_l'] = pad_l - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L89_C2", "label": "assign", "type": "assigned_variable", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "vector": [14, 1, 0.9175, 0.0103, 1, 0.58, 0.8333, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " template_params['pad_t'] = pad_t - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L90_C2", "label": "assign", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "vector": [14, 1, 0.9278, 0.0103, 1, 0.58, 0.8889, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " template_params['pad_r'] = src_im.size[0] - pad_r - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L91_C2", "label": "assign", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "vector": [14, 1, 0.9381, 0.0103, 1, 0.58, 0.9444, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " template_params['pad_b'] = src_im.size[1] - pad_b - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090:Expr_L93_C2", "label": "print()", "type": "expression", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "vector": [8, 1, 0.9588, 0.0103, 1, 0.58, 1.0, 535, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(open('res/shape_9patch_template.xml').read() % template_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1090: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_1090:Expr_L97_C2", "label": "main()", "type": "expression", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1090:If_L96_C0", "vector": [8, 1, 1.0, 0.0103, 1, 0.18, 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_1090:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:If_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:While_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:While_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:If_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:If_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Expr_L43_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:If_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L44_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:If_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:If_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:If_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Expr_L46_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:If_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L47_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:While_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:If_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Return_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Expr_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Expr_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Return_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L79_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L81_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L84_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L85_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L86_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L89_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Assign_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Expr_L93_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1090:If_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1090:Expr_L97_C2"}]
#!/usr/bin/env python # Copyright 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import sys import os from StringIO import StringIO from PIL import Image import datauri def image_to_data_uri_(im): f = StringIO() im.save(f, 'PNG') uri = datauri.to_data_uri(f.getvalue(), 'foo.png') f.close() return uri def main(): src_im = Image.open(sys.argv[1]) template_params = {} template_params['id'] = sys.argv[1] template_params['image_uri'] = image_to_data_uri_(src_im) template_params['icon_uri'] = image_to_data_uri_(src_im) template_params['width'] = src_im.size[0] template_params['height'] = src_im.size[1] print open('res/shape_png_template.xml').read() % template_params if __name__ == '__main__': main()
ajibawa-2023/Python-Code-Large/train/row_1091
22
48
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1091:Import_L17_C0", "label": "sys import sys", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.3542, 0.0208, 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_1091:Import_L18_C0", "label": "os import os", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.375, 0.0208, 0, 0.66, 0.1429, 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_1091:ImportFrom_L19_C0", "label": "from StringIO import StringIO", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.3958, 0.0208, 0, 0.66, 0.2857, 609, 0, 1, 0, 0, 609, 0, 0], "semantic": {"name": "StringIO", "arg_names": [], "import_names": ["StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": "from StringIO import StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1091:ImportFrom_L20_C0", "label": "from PIL import Image", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.4167, 0.0208, 0, 0.66, 0.4286, 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_1091:Import_L22_C0", "label": "datauri import datauri", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.4583, 0.0208, 0, 0.66, 0.5714, 597, 0, 1, 0, 0, 597, 0, 0], "semantic": {"name": "datauri", "arg_names": [], "import_names": ["datauri"], "rhs_call_name": "", "annotation": ""}, "snippet": "import datauri"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L25_C0", "label": "image_to_data_uri_", "type": "function", "loc": [25, 30], "level": 0, "parent": null, "vector": [2, 0, 0.5729, 0.125, 0, 0.66, 0.7143, 588, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "image_to_data_uri_", "arg_names": ["im"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def image_to_data_uri_(im):\n f = StringIO()\n im.save(f, 'PNG')\n uri = datauri.to_data_uri(f.getvalue(), 'foo.png')\n f.close()\n return uri"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1091:Assign_L26_C2", "label": "f = StringIO()", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L25_C0", "vector": [14, 1, 0.5417, 0.0208, 1, 0.97, 0.0, 899, 3, 0, 0, 0, 609, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": " f = StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1091:Expr_L27_C2", "label": "save()", "type": "expression", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L25_C0", "vector": [8, 1, 0.5625, 0.0208, 1, 0.97, 0.25, 928, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "save", "arg_names": [], "import_names": [], "rhs_call_name": "save", "annotation": ""}, "snippet": " im.save(f, 'PNG')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1091:Assign_L28_C2", "label": "uri = to_data_uri()", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L25_C0", "vector": [14, 1, 0.5833, 0.0208, 1, 0.97, 0.5, 600, 3, 2, 0, 0, 70, 10, 2], "semantic": {"name": "uri", "arg_names": [], "import_names": [], "rhs_call_name": "to_data_uri", "annotation": ""}, "snippet": " uri = datauri.to_data_uri(f.getvalue(), 'foo.png')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1091:Expr_L29_C2", "label": "close()", "type": "expression", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L25_C0", "vector": [8, 1, 0.6042, 0.0208, 1, 0.97, 0.75, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1091:Return_L30_C2", "label": "return", "type": "return", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L25_C0", "vector": [13, 1, 0.625, 0.0208, 1, 0.97, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return uri"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L33_C0", "label": "main", "type": "function", "loc": [33, 44], "level": 0, "parent": null, "vector": [2, 0, 0.8021, 0.25, 0, 0.66, 0.8571, 624, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n src_im = Image.open(sys.argv[1])\n\n template_params = {}\n template_params['id'] = sys.argv[1]\n template_params['image_uri'] = image_to_data_uri_(src_im)\n template_params['icon_uri'] = image_to_data_uri_(src_im)\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1091:Assign_L34_C2", "label": "src_im = open()", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L33_C0", "vector": [14, 1, 0.7083, 0.0208, 1, 0.42, 0.0, 272, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "src_im", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " src_im = Image.open(sys.argv[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1091:Assign_L36_C2", "label": "template_params =", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L33_C0", "vector": [14, 1, 0.75, 0.0208, 1, 0.42, 0.1429, 866, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "template_params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " template_params = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1091:Assign_L37_C2", "label": "assign", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L33_C0", "vector": [14, 1, 0.7708, 0.0208, 1, 0.42, 0.2857, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " template_params['id'] = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1091:Assign_L38_C2", "label": " = image_to_data_uri_()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L33_C0", "vector": [14, 1, 0.7917, 0.0208, 1, 0.42, 0.4286, 0, 3, 1, 0, 0, 588, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "image_to_data_uri_", "annotation": ""}, "snippet": " template_params['image_uri'] = image_to_data_uri_(src_im)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1091:Assign_L39_C2", "label": " = image_to_data_uri_()", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L33_C0", "vector": [14, 1, 0.8125, 0.0208, 1, 0.42, 0.5714, 0, 3, 1, 0, 0, 588, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "image_to_data_uri_", "annotation": ""}, "snippet": " template_params['icon_uri'] = image_to_data_uri_(src_im)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1091:Assign_L41_C2", "label": "assign", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L33_C0", "vector": [14, 1, 0.8542, 0.0208, 1, 0.42, 0.7143, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " template_params['width'] = src_im.size[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1091:Assign_L42_C2", "label": "assign", "type": "assigned_variable", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L33_C0", "vector": [14, 1, 0.875, 0.0208, 1, 0.42, 0.8571, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " template_params['height'] = src_im.size[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1091:Expr_L44_C2", "label": "print()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L33_C0", "vector": [8, 1, 0.9167, 0.0208, 1, 0.42, 1.0, 535, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(open('res/shape_png_template.xml').read() % template_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1091:If_L47_C0", "label": "if", "type": "if", "loc": [47, 48], "level": 0, "parent": null, "vector": [4, 0, 0.9896, 0.0417, 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_1091:Expr_L48_C2", "label": "main()", "type": "expression", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1091:If_L47_C0", "vector": [8, 1, 1.0, 0.0208, 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_1091:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1091:Assign_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1091:Expr_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1091:Assign_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1091:Expr_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1091:Return_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1091:Assign_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1091:Assign_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1091:Assign_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1091:Assign_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1091:Assign_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1091:Assign_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1091:Assign_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1091:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1091:Expr_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1091:If_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1091:Expr_L48_C2"}]
#!/usr/bin/env python # Copyright 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import sys import os import os.path import shutil import zipfile def main(): params = {} params['id'] = sys.argv[1] params['displayname'] = sys.argv[2] params['description'] = sys.argv[3] zip_file = zipfile.ZipFile('dist/stencil-%s.zip' % params['id'], 'w', zipfile.ZIP_DEFLATED) # save stencil XML shapes_xml = '' shapes_folder = 'res/sets/%s/shapes' % params['id'] for shape_file in os.listdir(shapes_folder): if not shape_file.endswith('.xml'): continue shape_xml = open(os.path.join(shapes_folder, shape_file)).read() shapes_xml += shape_xml params['shapes'] = shapes_xml final_xml = open('res/stencil_template.xml').read() % params zip_file.writestr('Definition.xml', final_xml) # save icons icons_folder = 'res/sets/%s/icons' % params['id'] for icon_file in os.listdir(icons_folder): if not icon_file.endswith('.png'): continue zip_file.writestr( 'icons/%s' % icon_file, open(os.path.join(icons_folder, icon_file), 'rb').read()) zip_file.close() if __name__ == '__main__': main()
ajibawa-2023/Python-Code-Large/train/row_1092
26
59
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1092:Import_L17_C0", "label": "sys import sys", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.2881, 0.0169, 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_1092:Import_L18_C0", "label": "os import os", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.3051, 0.0169, 0, 0.66, 0.1667, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1092:Import_L19_C0", "label": "os.path import os.path", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.322, 0.0169, 0, 0.66, 0.3333, 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_1092:Import_L20_C0", "label": "shutil import shutil", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.339, 0.0169, 0, 0.66, 0.5, 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_1092:Import_L21_C0", "label": "zipfile import zipfile", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.3559, 0.0169, 0, 0.66, 0.6667, 93, 0, 1, 0, 0, 93, 0, 0], "semantic": {"name": "zipfile", "arg_names": [], "import_names": ["zipfile"], "rhs_call_name": "", "annotation": ""}, "snippet": "import zipfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "label": "main", "type": "function", "loc": [24, 55], "level": 0, "parent": null, "vector": [2, 0, 0.6695, 0.5424, 0, 0.66, 0.8333, 624, 0, 0, 0, 0, 0, 0, 16], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n params = {}\n params['id'] = sys.argv[1]\n params['displayname'] = sys.argv[2]\n params['description'] = sys.argv[3]\n\n zip_file = zipfile.ZipFile('dist/stencil-%s.zip' % params['id'], 'w',\n zipfile.ZIP_DEFLATED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1092:Assign_L25_C2", "label": "params =", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "vector": [14, 1, 0.4237, 0.0169, 1, 0.3, 0.0, 206, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1092:Assign_L26_C2", "label": "assign", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "vector": [14, 1, 0.4407, 0.0169, 1, 0.3, 0.0769, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params['id'] = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1092:Assign_L27_C2", "label": "assign", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "vector": [14, 1, 0.4576, 0.0169, 1, 0.3, 0.1538, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params['displayname'] = sys.argv[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1092:Assign_L28_C2", "label": "assign", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "vector": [14, 1, 0.4746, 0.0169, 1, 0.3, 0.2308, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params['description'] = sys.argv[3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1092:Assign_L30_C2", "label": "zip_file = ZipFile()", "type": "assigned_variable", "loc": [30, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "vector": [14, 1, 0.5169, 0.0339, 1, 0.3, 0.3077, 731, 3, 3, 0, 0, 299, 10, 1], "semantic": {"name": "zip_file", "arg_names": [], "import_names": [], "rhs_call_name": "ZipFile", "annotation": ""}, "snippet": " zip_file = zipfile.ZipFile('dist/stencil-%s.zip' % params['id'], 'w',\n zipfile.ZIP_DEFLATED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1092:Assign_L34_C2", "label": "shapes_xml =", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "vector": [14, 1, 0.5763, 0.0169, 1, 0.3, 0.3846, 313, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "shapes_xml", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " shapes_xml = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1092:Assign_L35_C2", "label": "shapes_folder =", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "vector": [14, 1, 0.5932, 0.0169, 1, 0.3, 0.4615, 871, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "shapes_folder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " shapes_folder = 'res/sets/%s/shapes' % params['id']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1092:For_L36_C2", "label": "for shape_file", "type": "for", "loc": [36, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "vector": [6, 1, 0.6441, 0.0847, 1, 0.3, 0.5385, 597, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "shape_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for shape_file in os.listdir(shapes_folder):\n if not shape_file.endswith('.xml'):\n continue\n shape_xml = open(os.path.join(shapes_folder, shape_file)).read()\n shapes_xml += shape_xml"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1092:If_L37_C4", "label": "if", "type": "if", "loc": [37, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1092:For_L36_C2", "vector": [4, 2, 0.6356, 0.0339, 2, 0.07, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not shape_file.endswith('.xml'):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1092:Assign_L39_C4", "label": "shape_xml = read()", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1092:For_L36_C2", "vector": [14, 2, 0.661, 0.0169, 2, 0.07, 1.0, 824, 3, 0, 0, 0, 453, 10, 3], "semantic": {"name": "shape_xml", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " shape_xml = open(os.path.join(shapes_folder, shape_file)).read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1092:Assign_L42_C2", "label": "assign", "type": "assigned_variable", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "vector": [14, 1, 0.7119, 0.0169, 1, 0.3, 0.6154, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params['shapes'] = shapes_xml"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1092:Assign_L43_C2", "label": "final_xml =", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "vector": [14, 1, 0.7288, 0.0169, 1, 0.3, 0.6923, 988, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "final_xml", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " final_xml = open('res/stencil_template.xml').read() % params"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1092:Expr_L44_C2", "label": "writestr()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "vector": [8, 1, 0.7458, 0.0169, 1, 0.3, 0.7692, 641, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "writestr", "arg_names": [], "import_names": [], "rhs_call_name": "writestr", "annotation": ""}, "snippet": " zip_file.writestr('Definition.xml', final_xml)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1092:Assign_L47_C2", "label": "icons_folder =", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "vector": [14, 1, 0.7966, 0.0169, 1, 0.3, 0.8462, 262, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "icons_folder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " icons_folder = 'res/sets/%s/icons' % params['id']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1092:For_L48_C2", "label": "for icon_file", "type": "for", "loc": [48, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "vector": [6, 1, 0.8559, 0.1017, 1, 0.3, 0.9231, 370, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "icon_file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for icon_file in os.listdir(icons_folder):\n if not icon_file.endswith('.png'):\n continue\n zip_file.writestr(\n 'icons/%s' % icon_file,\n open(os.path.join(icons_folder, icon_file), 'rb').read())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1092:If_L49_C4", "label": "if", "type": "if", "loc": [49, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1092:For_L48_C2", "vector": [4, 2, 0.839, 0.0339, 2, 0.46, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not icon_file.endswith('.png'):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1092:Expr_L51_C4", "label": "writestr()", "type": "expression", "loc": [51, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1092:For_L48_C2", "vector": [8, 2, 0.8814, 0.0508, 2, 0.46, 1.0, 641, 3, 2, 0, 0, 0, 0, 4], "semantic": {"name": "writestr", "arg_names": [], "import_names": [], "rhs_call_name": "writestr", "annotation": ""}, "snippet": " zip_file.writestr(\n 'icons/%s' % icon_file,\n open(os.path.join(icons_folder, icon_file), 'rb').read())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1092:Expr_L55_C2", "label": "close()", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "vector": [8, 1, 0.9322, 0.0169, 1, 0.3, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " zip_file.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1092:If_L58_C0", "label": "if", "type": "if", "loc": [58, 59], "level": 0, "parent": null, "vector": [4, 0, 0.9915, 0.0339, 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_1092:Expr_L59_C2", "label": "main()", "type": "expression", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1092:If_L58_C0", "vector": [8, 1, 1.0, 0.0169, 1, 0.4, 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_1092:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1092:Assign_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1092:Assign_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1092:Assign_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1092:Assign_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1092:Assign_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1092:Assign_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1092:Assign_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1092:For_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1092:For_L36_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1092:If_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1092:For_L36_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1092:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1092:Assign_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1092:Assign_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1092:Expr_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1092:Assign_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1092:For_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1092:For_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1092:If_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1092:For_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1092:Expr_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1092:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1092:Expr_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1092:If_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1092:Expr_L59_C2"}]
#!/usr/bin/env python # Copyright 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import base64 import sys import mimetypes def to_data_uri(data, file_name): '''Takes a file object and returns its data: string.''' mime_type = mimetypes.guess_type(file_name) return 'data:%(mimetype)s;base64,%(data)s' % dict(mimetype=mime_type[0], data=base64.b64encode(data)) def main(): print to_data_uri(open(sys.argv[1], 'rb').read(), sys.argv[1]) if __name__ == '__main__': main()
ajibawa-2023/Python-Code-Large/train/row_1093
11
34
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1093:Import_L17_C0", "label": "base64 import base64", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.0294, 0, 0.66, 0.0, 177, 0, 1, 0, 0, 177, 0, 0], "semantic": {"name": "base64", "arg_names": [], "import_names": ["base64"], "rhs_call_name": "", "annotation": ""}, "snippet": "import base64"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1093:Import_L18_C0", "label": "sys import sys", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.5294, 0.0294, 0, 0.66, 0.2, 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_1093:Import_L19_C0", "label": "mimetypes import mimetypes", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.5588, 0.0294, 0, 0.66, 0.4, 583, 0, 1, 0, 0, 583, 0, 0], "semantic": {"name": "mimetypes", "arg_names": [], "import_names": ["mimetypes"], "rhs_call_name": "", "annotation": ""}, "snippet": "import mimetypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1093:FunctionDef_L22_C0", "label": "to_data_uri", "type": "function", "loc": [22, 26], "level": 0, "parent": null, "vector": [2, 0, 0.7059, 0.1471, 0, 0.66, 0.6, 70, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "to_data_uri", "arg_names": ["data", "file_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def to_data_uri(data, file_name):\n '''Takes a file object and returns its data: string.'''\n mime_type = mimetypes.guess_type(file_name)\n return 'data:%(mimetype)s;base64,%(data)s' % dict(mimetype=mime_type[0],\n data=base64.b64encode(data))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1093:Expr_L23_C2", "label": "expression", "type": "expression", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1093:FunctionDef_L22_C0", "vector": [8, 1, 0.6765, 0.0294, 1, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Takes a file object and returns its data: string.'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1093:Assign_L24_C2", "label": "mime_type = guess_type()", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1093:FunctionDef_L22_C0", "vector": [14, 1, 0.7059, 0.0294, 1, 0.37, 0.5, 188, 3, 1, 0, 0, 213, 10, 1], "semantic": {"name": "mime_type", "arg_names": [], "import_names": [], "rhs_call_name": "guess_type", "annotation": ""}, "snippet": " mime_type = mimetypes.guess_type(file_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1093:Return_L25_C2", "label": "return", "type": "return", "loc": [25, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1093:FunctionDef_L22_C0", "vector": [13, 1, 0.75, 0.0588, 1, 0.37, 1.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'data:%(mimetype)s;base64,%(data)s' % dict(mimetype=mime_type[0],\n data=base64.b64encode(data))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1093:FunctionDef_L29_C0", "label": "main", "type": "function", "loc": [29, 30], "level": 0, "parent": null, "vector": [2, 0, 0.8676, 0.0588, 0, 0.66, 0.8, 624, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n print(to_data_uri(open(sys.argv[1], 'rb').read(), sys.argv[1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1093:Expr_L30_C2", "label": "print()", "type": "expression", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1093:FunctionDef_L29_C0", "vector": [8, 1, 0.8824, 0.0294, 1, 0.18, 0.0, 535, 3, 1, 0, 0, 0, 0, 4], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(to_data_uri(open(sys.argv[1], 'rb').read(), sys.argv[1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1093:If_L33_C0", "label": "if", "type": "if", "loc": [33, 34], "level": 0, "parent": null, "vector": [4, 0, 0.9853, 0.0588, 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_1093:Expr_L34_C2", "label": "main()", "type": "expression", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1093:If_L33_C0", "vector": [8, 1, 1.0, 0.0294, 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_1093:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1093:Expr_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1093:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1093:Assign_L24_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1093:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1093:Return_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1093:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1093:Expr_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1093:If_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1093:Expr_L34_C2"}]
# -*- coding: UTF-8 -*- from google.appengine.ext import deferred from notifiy import email from notifiy import model from notifiy import phone from notifiy import templates def notify_created(wavelet, blip, modified_by): """Sends a created notification to all participants except the modified_by""" for participant in wavelet.participants: if participant == modified_by: continue notify_participant(participant, wavelet, modified_by, blip, blip.text) def notify_submitted(wavelet, blip, modified_by, message=None): """Sends a submitted notification to all participants except the modified_by""" for participant in wavelet.participants: if participant == modified_by: continue notify_participant(participant, wavelet, modified_by, blip, message or (blip and blip.text) or '[no content]') def notify_removed(wavelet, modified_by): """Sends a deleted notification to all participants except the modified_by""" for participant in wavelet.participants: if participant == modified_by: continue notify_participant(participant, wavelet, modified_by, wavelet.root_blip, templates.CONTENT_DELETED) def notify_participant(participant, wavelet, modified_by, blip, message): deferred.defer(notify_participant_deferred, participant=participant, modified_by=modified_by, title=wavelet.title, wave_id=wavelet.wave_id, wavelet_id=wavelet.wavelet_id, blip_id=blip and blip.blip_id or '', message=message, _queue='notify-participant') def notify_participant_deferred(participant, modified_by, title, wave_id, wavelet_id, blip_id, message): """Sends a notification to the participant""" pp = model.ParticipantPreferences.get_by_pk(participant) if not pp or not pp.notify: return pwp = model.ParticipantWavePreferences.get_by_pk(participant, wave_id) if not pwp or pwp.notify_type == model.NOTIFY_NONE: return if pwp.notify_type == model.NOTIFY_ONCE: if not pwp.visited: return message = templates.NOTIFY_ONCE_TEMPLATE % message pwp.visited = False email.send_message(pwp, modified_by, title, wave_id, wavelet_id, blip_id, message) phone.send_message(pwp, modified_by, title, wave_id, wavelet_id, blip_id, message)
ajibawa-2023/Python-Code-Large/train/row_1095
37
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_1095:ImportFrom_L3_C0", "label": "from google.appengine.ext import deferred", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0469, 0.0156, 0, 0.66, 0.0, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["deferred"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import deferred"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:ImportFrom_L5_C0", "label": "from notifiy import email", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0781, 0.0156, 0, 0.66, 0.1111, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["email"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import email"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:ImportFrom_L6_C0", "label": "from notifiy import model", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0938, 0.0156, 0, 0.66, 0.2222, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["model"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import model"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:ImportFrom_L7_C0", "label": "from notifiy import phone", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1094, 0.0156, 0, 0.66, 0.3333, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["phone"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import phone"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:ImportFrom_L8_C0", "label": "from notifiy import templates", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.0156, 0, 0.66, 0.4444, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["templates"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import templates"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L11_C0", "label": "notify_created", "type": "function", "loc": [11, 16], "level": 0, "parent": null, "vector": [2, 0, 0.2109, 0.0938, 0, 0.66, 0.5556, 451, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "notify_created", "arg_names": ["wavelet", "blip", "modified_by"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def notify_created(wavelet, blip, modified_by):\n \"\"\"Sends a created notification to all participants except the modified_by\"\"\"\n\n for participant in wavelet.participants:\n if participant == modified_by: continue\n notify_participant(participant, wavelet, modified_by, blip, blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:Expr_L12_C4", "label": "expression", "type": "expression", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L11_C0", "vector": [8, 1, 0.1875, 0.0156, 1, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Sends a created notification to all participants except the modified_by\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:For_L14_C4", "label": "for participant", "type": "for", "loc": [14, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L11_C0", "vector": [6, 1, 0.2344, 0.0469, 1, 0.66, 1.0, 606, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "participant", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for participant in wavelet.participants:\n if participant == modified_by: continue\n notify_participant(participant, wavelet, modified_by, blip, blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L15_C8", "label": "if", "type": "if", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:For_L14_C4", "vector": [4, 2, 0.2344, 0.0156, 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 participant == modified_by: continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:Expr_L16_C8", "label": "notify_participant()", "type": "expression", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:For_L14_C4", "vector": [8, 2, 0.25, 0.0156, 2, 0.55, 1.0, 237, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "notify_participant", "arg_names": [], "import_names": [], "rhs_call_name": "notify_participant", "annotation": ""}, "snippet": " notify_participant(participant, wavelet, modified_by, blip, blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L19_C0", "label": "notify_submitted", "type": "function", "loc": [19, 25], "level": 0, "parent": null, "vector": [2, 0, 0.3438, 0.1094, 0, 0.66, 0.6667, 798, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "notify_submitted", "arg_names": ["wavelet", "blip", "modified_by", "message"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def notify_submitted(wavelet, blip, modified_by, message=None):\n \"\"\"Sends a submitted notification to all participants except the modified_by\"\"\"\n\n for participant in wavelet.participants:\n if participant == modified_by: continue\n notify_participant(participant, wavelet, modified_by, blip,\n message or (blip and blip.text) or '[no content]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:Expr_L20_C4", "label": "expression", "type": "expression", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L19_C0", "vector": [8, 1, 0.3125, 0.0156, 1, 0.36, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Sends a submitted notification to all participants except the modified_by\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:For_L22_C4", "label": "for participant", "type": "for", "loc": [22, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L19_C0", "vector": [6, 1, 0.3672, 0.0625, 1, 0.36, 1.0, 606, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "participant", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for participant in wavelet.participants:\n if participant == modified_by: continue\n notify_participant(participant, wavelet, modified_by, blip,\n message or (blip and blip.text) or '[no content]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L23_C8", "label": "if", "type": "if", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:For_L22_C4", "vector": [4, 2, 0.3594, 0.0156, 2, 0.63, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if participant == modified_by: continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:Expr_L24_C8", "label": "notify_participant()", "type": "expression", "loc": [24, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:For_L22_C4", "vector": [8, 2, 0.3828, 0.0312, 2, 0.63, 1.0, 237, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "notify_participant", "arg_names": [], "import_names": [], "rhs_call_name": "notify_participant", "annotation": ""}, "snippet": " notify_participant(participant, wavelet, modified_by, blip,\n message or (blip and blip.text) or '[no content]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L28_C0", "label": "notify_removed", "type": "function", "loc": [28, 34], "level": 0, "parent": null, "vector": [2, 0, 0.4844, 0.1094, 0, 0.66, 0.7778, 810, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "notify_removed", "arg_names": ["wavelet", "modified_by"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def notify_removed(wavelet, modified_by):\n \"\"\"Sends a deleted notification to all participants except the modified_by\"\"\"\n\n for participant in wavelet.participants:\n if participant == modified_by: continue\n notify_participant(participant, wavelet, modified_by,\n wavelet.root_blip, templates.CONTENT_DELETED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:Expr_L29_C4", "label": "expression", "type": "expression", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L28_C0", "vector": [8, 1, 0.4531, 0.0156, 1, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Sends a deleted notification to all participants except the modified_by\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:For_L31_C4", "label": "for participant", "type": "for", "loc": [31, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L28_C0", "vector": [6, 1, 0.5078, 0.0625, 1, 0.41, 1.0, 606, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "participant", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for participant in wavelet.participants:\n if participant == modified_by: continue\n notify_participant(participant, wavelet, modified_by,\n wavelet.root_blip, templates.CONTENT_DELETED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L32_C8", "label": "if", "type": "if", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:For_L31_C4", "vector": [4, 2, 0.5, 0.0156, 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 participant == modified_by: continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:Expr_L33_C8", "label": "notify_participant()", "type": "expression", "loc": [33, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:For_L31_C4", "vector": [8, 2, 0.5234, 0.0312, 2, 0.49, 1.0, 237, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "notify_participant", "arg_names": [], "import_names": [], "rhs_call_name": "notify_participant", "annotation": ""}, "snippet": " notify_participant(participant, wavelet, modified_by,\n wavelet.root_blip, templates.CONTENT_DELETED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L37_C0", "label": "notify_participant", "type": "function", "loc": [37, 46], "level": 0, "parent": null, "vector": [2, 0, 0.6484, 0.1562, 0, 0.66, 0.8889, 237, 0, 5, 0, 0, 0, 0, 1], "semantic": {"name": "notify_participant", "arg_names": ["participant", "wavelet", "modified_by", "blip", "message"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def notify_participant(participant, wavelet, modified_by, blip, message):\n deferred.defer(notify_participant_deferred,\n participant=participant,\n modified_by=modified_by,\n title=wavelet.title,\n wave_id=wavelet.wave_id,\n wavelet_id=wavelet.wavelet_id,\n blip_id=blip and blip.blip_id or '',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:Expr_L38_C4", "label": "defer()", "type": "expression", "loc": [38, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L37_C0", "vector": [8, 1, 0.6562, 0.1406, 1, 0.23, 0.0, 826, 3, 9, 0, 0, 0, 0, 1], "semantic": {"name": "defer", "arg_names": [], "import_names": [], "rhs_call_name": "defer", "annotation": ""}, "snippet": " deferred.defer(notify_participant_deferred,\n participant=participant,\n modified_by=modified_by,\n title=wavelet.title,\n wave_id=wavelet.wave_id,\n wavelet_id=wavelet.wavelet_id,\n blip_id=blip and blip.blip_id or '',\n message=message,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L49_C0", "label": "notify_participant_deferred", "type": "function", "loc": [49, 64], "level": 0, "parent": null, "vector": [2, 0, 0.8828, 0.25, 0, 0.66, 1.0, 622, 0, 7, 0, 0, 0, 0, 4], "semantic": {"name": "notify_participant_deferred", "arg_names": ["participant", "modified_by", "title", "wave_id", "wavelet_id", "blip_id", "message"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def notify_participant_deferred(participant, modified_by, title, wave_id, wavelet_id, blip_id, message):\n \"\"\"Sends a notification to the participant\"\"\"\n\n pp = model.ParticipantPreferences.get_by_pk(participant)\n if not pp or not pp.notify: return\n\n pwp = model.ParticipantWavePreferences.get_by_pk(participant, wave_id)\n if not pwp or pwp.notify_type == model.NOTIFY_NONE: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:Expr_L50_C4", "label": "expression", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L49_C0", "vector": [8, 1, 0.7812, 0.0156, 1, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Sends a notification to the participant\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:Assign_L52_C4", "label": "pp = get_by_pk()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L49_C0", "vector": [14, 1, 0.8125, 0.0156, 1, 0.85, 0.1429, 632, 3, 1, 0, 0, 243, 10, 1], "semantic": {"name": "pp", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_pk", "annotation": ""}, "snippet": " pp = model.ParticipantPreferences.get_by_pk(participant)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L53_C4", "label": "if", "type": "if", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L49_C0", "vector": [4, 1, 0.8281, 0.0156, 1, 0.85, 0.2857, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not pp or not pp.notify: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:Return_L53_C32", "label": "return", "type": "return", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L53_C4", "vector": [13, 2, 0.8281, 0.0156, 2, 0.83, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not pp or not pp.notify: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:Assign_L55_C4", "label": "pwp = get_by_pk()", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L49_C0", "vector": [14, 1, 0.8594, 0.0156, 1, 0.85, 0.4286, 506, 3, 2, 0, 0, 243, 10, 1], "semantic": {"name": "pwp", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_pk", "annotation": ""}, "snippet": " pwp = model.ParticipantWavePreferences.get_by_pk(participant, wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L56_C4", "label": "if", "type": "if", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L49_C0", "vector": [4, 1, 0.875, 0.0156, 1, 0.85, 0.5714, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not pwp or pwp.notify_type == model.NOTIFY_NONE: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:Return_L56_C56", "label": "return", "type": "return", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L56_C4", "vector": [13, 2, 0.875, 0.0156, 2, 0.71, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not pwp or pwp.notify_type == model.NOTIFY_NONE: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L58_C4", "label": "if", "type": "if", "loc": [58, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L49_C0", "vector": [4, 1, 0.9297, 0.0625, 1, 0.85, 0.7143, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if pwp.notify_type == model.NOTIFY_ONCE:\n if not pwp.visited: return\n message = templates.NOTIFY_ONCE_TEMPLATE % message\n pwp.visited = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L59_C8", "label": "if", "type": "if", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L58_C4", "vector": [4, 2, 0.9219, 0.0156, 2, 0.42, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not pwp.visited: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:Return_L59_C28", "label": "return", "type": "return", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L59_C8", "vector": [13, 3, 0.9219, 0.0156, 3, 0.69, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not pwp.visited: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:Assign_L60_C8", "label": "message =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L58_C4", "vector": [14, 2, 0.9375, 0.0156, 2, 0.42, 0.5, 635, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " message = templates.NOTIFY_ONCE_TEMPLATE % message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:Assign_L61_C8", "label": "pwp.visited =", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L58_C4", "vector": [14, 2, 0.9531, 0.0156, 2, 0.42, 1.0, 467, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "pwp.visited", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pwp.visited = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:Expr_L63_C4", "label": "send_message()", "type": "expression", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L49_C0", "vector": [8, 1, 0.9844, 0.0156, 1, 0.85, 0.8571, 32, 3, 7, 0, 0, 0, 0, 1], "semantic": {"name": "send_message", "arg_names": [], "import_names": [], "rhs_call_name": "send_message", "annotation": ""}, "snippet": " email.send_message(pwp, modified_by, title, wave_id, wavelet_id, blip_id, message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1095:Expr_L64_C4", "label": "send_message()", "type": "expression", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L49_C0", "vector": [8, 1, 1.0, 0.0156, 1, 0.85, 1.0, 32, 3, 7, 0, 0, 0, 0, 1], "semantic": {"name": "send_message", "arg_names": [], "import_names": [], "rhs_call_name": "send_message", "annotation": ""}, "snippet": " phone.send_message(pwp, modified_by, title, wave_id, wavelet_id, blip_id, message)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:For_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:For_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:For_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:Expr_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:For_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:For_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:For_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:Expr_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:Expr_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:For_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:For_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:For_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:Expr_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:Expr_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:Return_L53_C32"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:Return_L56_C56"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:Return_L59_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:If_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:Expr_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1095:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1095:Expr_L64_C4"}]
# -*- coding: UTF-8 -*- from google.appengine.ext import db from google.appengine.ext import deferred from notifiy import email from notifiy import gadget from notifiy import preferences from notifiy import templates from notifiy import model def wavelet_init(wavelet, modified_by): """Initialize the wavelet""" gadget.gadget_add(wavelet) for participant in wavelet.participants: participant_wavelet_init(wavelet, participant, modified_by, message=templates.ROBOT_ADDED) def participant_init(wavelet, participant): """Initialize the participant and return it""" pp = model.ParticipantPreferences.get_by_pk(participant) if pp: return pp pp = model.ParticipantPreferences.get_by_pk(participant, create=True) if participant.endswith('@googlewave.com'): pp.email = '%s@gmail.com' % participant.split('@')[0] pp.put() preferences.create_preferences_wave(wavelet.robot, participant) return pp # TODO do this deferred def participant_wavelet_init_deferred(wavelet, participant, modified_by, message): deferred.defer(participant_wavelet_init_deferred, wavelet, participant, modified_by, message, _queue='participant-wavelet-init') def participant_wavelet_init(wavelet, participant, modified_by, message=None): """Initialize the participant in the wavelet""" pwp = model.ParticipantWavePreferences.get_by_pk(participant, wavelet.wave_id) if pwp: return pwp = model.ParticipantWavePreferences.get_by_pk(participant, wavelet.wave_id, create=True) pp = participant_init(wavelet, participant) if not pp.notify_initial: return email.send_message(pwp, modified_by, wavelet.title, wavelet.wave_id, wavelet.wavelet_id, wavelet.root_blip.blip_id, message) def wavelet_deinit(wavelet): """De-initialize the wavelet""" gadget.gadget_remove(wavelet) def participant_deinit(wavelet, participant): """De-initialize the participant, removes al records available and the preferences wave""" query = model.ParticipantPreferences.all() query.filter("participant =", participant) db.delete(query) query = model.ParticipantWavePreferences.all() query.filter("participant =", participant) db.delete(query) preferences.delete_preferences_wavelet(wavelet)
ajibawa-2023/Python-Code-Large/train/row_1096
47
75
15
["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"]
[{"id": "ajibawa-2023/Python-Code-Large/train/row_1096:ImportFrom_L3_C0", "label": "from google.appengine.ext import db", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.04, 0.0133, 0, 0.66, 0.0, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["db"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:ImportFrom_L4_C0", "label": "from google.appengine.ext import deferred", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0533, 0.0133, 0, 0.66, 0.0833, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["deferred"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import deferred"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:ImportFrom_L6_C0", "label": "from notifiy import email", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.08, 0.0133, 0, 0.66, 0.1667, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["email"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import email"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:ImportFrom_L7_C0", "label": "from notifiy import gadget", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0933, 0.0133, 0, 0.66, 0.25, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["gadget"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import gadget"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:ImportFrom_L8_C0", "label": "from notifiy import preferences", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.1067, 0.0133, 0, 0.66, 0.3333, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["preferences"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import preferences"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:ImportFrom_L9_C0", "label": "from notifiy import templates", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.12, 0.0133, 0, 0.66, 0.4167, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["templates"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import templates"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:ImportFrom_L10_C0", "label": "from notifiy import model", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1333, 0.0133, 0, 0.66, 0.5, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["model"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import model"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L13_C0", "label": "wavelet_init", "type": "function", "loc": [13, 20], "level": 0, "parent": null, "vector": [2, 0, 0.22, 0.1067, 0, 0.66, 0.5833, 515, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "wavelet_init", "arg_names": ["wavelet", "modified_by"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def wavelet_init(wavelet, modified_by):\n \"\"\"Initialize the wavelet\"\"\"\n\n gadget.gadget_add(wavelet)\n\n for participant in wavelet.participants:\n participant_wavelet_init(wavelet, participant, modified_by,\n message=templates.ROBOT_ADDED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L14_C4", "label": "expression", "type": "expression", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L13_C0", "vector": [8, 1, 0.1867, 0.0133, 1, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Initialize the wavelet\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L16_C4", "label": "gadget_add()", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L13_C0", "vector": [8, 1, 0.2133, 0.0133, 1, 0.85, 0.5, 851, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "gadget_add", "arg_names": [], "import_names": [], "rhs_call_name": "gadget_add", "annotation": ""}, "snippet": " gadget.gadget_add(wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:For_L18_C4", "label": "for participant", "type": "for", "loc": [18, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L13_C0", "vector": [6, 1, 0.2533, 0.04, 1, 0.85, 1.0, 606, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "participant", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for participant in wavelet.participants:\n participant_wavelet_init(wavelet, participant, modified_by,\n message=templates.ROBOT_ADDED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L19_C8", "label": "participant_wavelet_init()", "type": "expression", "loc": [19, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:For_L18_C4", "vector": [8, 2, 0.26, 0.0267, 2, 0.4, 0.0, 50, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "participant_wavelet_init", "arg_names": [], "import_names": [], "rhs_call_name": "participant_wavelet_init", "annotation": ""}, "snippet": " participant_wavelet_init(wavelet, participant, modified_by,\n message=templates.ROBOT_ADDED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L23_C0", "label": "participant_init", "type": "function", "loc": [23, 35], "level": 0, "parent": null, "vector": [2, 0, 0.3867, 0.1733, 0, 0.66, 0.6667, 354, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "participant_init", "arg_names": ["wavelet", "participant"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def participant_init(wavelet, participant):\n \"\"\"Initialize the participant and return it\"\"\"\n\n pp = model.ParticipantPreferences.get_by_pk(participant)\n if pp: return pp\n\n pp = model.ParticipantPreferences.get_by_pk(participant, create=True)\n if participant.endswith('@googlewave.com'):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L24_C4", "label": "expression", "type": "expression", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L23_C0", "vector": [8, 1, 0.32, 0.0133, 1, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Initialize the participant and return it\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Assign_L26_C4", "label": "pp = get_by_pk()", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L23_C0", "vector": [14, 1, 0.3467, 0.0133, 1, 0.85, 0.1429, 632, 3, 1, 0, 0, 243, 10, 1], "semantic": {"name": "pp", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_pk", "annotation": ""}, "snippet": " pp = model.ParticipantPreferences.get_by_pk(participant)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:If_L27_C4", "label": "if", "type": "if", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L23_C0", "vector": [4, 1, 0.36, 0.0133, 1, 0.85, 0.2857, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if pp: return pp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Return_L27_C11", "label": "return", "type": "return", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:If_L27_C4", "vector": [13, 2, 0.36, 0.0133, 2, 0.97, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if pp: return pp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Assign_L29_C4", "label": "pp = get_by_pk()", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L23_C0", "vector": [14, 1, 0.3867, 0.0133, 1, 0.85, 0.4286, 632, 3, 2, 0, 0, 243, 10, 1], "semantic": {"name": "pp", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_pk", "annotation": ""}, "snippet": " pp = model.ParticipantPreferences.get_by_pk(participant, create=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:If_L30_C4", "label": "if", "type": "if", "loc": [30, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L23_C0", "vector": [4, 1, 0.4067, 0.0267, 1, 0.85, 0.5714, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if participant.endswith('@googlewave.com'):\n pp.email = '%s@gmail.com' % participant.split('@')[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Assign_L31_C8", "label": "pp.email =", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:If_L30_C4", "vector": [14, 2, 0.4133, 0.0133, 2, 0.34, 0.0, 820, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pp.email", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pp.email = '%s@gmail.com' % participant.split('@')[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L32_C4", "label": "put()", "type": "expression", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L23_C0", "vector": [8, 1, 0.4267, 0.0133, 1, 0.85, 0.7143, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " pp.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L33_C4", "label": "create_preferences_wave()", "type": "expression", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L23_C0", "vector": [8, 1, 0.44, 0.0133, 1, 0.85, 0.8571, 622, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "create_preferences_wave", "arg_names": [], "import_names": [], "rhs_call_name": "create_preferences_wave", "annotation": ""}, "snippet": " preferences.create_preferences_wave(wavelet.robot, participant)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Return_L35_C4", "label": "return", "type": "return", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L23_C0", "vector": [13, 1, 0.4667, 0.0133, 1, 0.85, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return pp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L39_C0", "label": "participant_wavelet_init_deferred", "type": "function", "loc": [39, 41], "level": 0, "parent": null, "vector": [2, 0, 0.5333, 0.04, 0, 0.66, 0.75, 245, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "participant_wavelet_init_deferred", "arg_names": ["wavelet", "participant", "modified_by", "message"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def participant_wavelet_init_deferred(wavelet, participant, modified_by, message):\n deferred.defer(participant_wavelet_init_deferred, wavelet, participant,\n modified_by, message, _queue='participant-wavelet-init')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L40_C4", "label": "defer()", "type": "expression", "loc": [40, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L39_C0", "vector": [8, 1, 0.54, 0.0267, 1, 0.18, 0.0, 826, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "defer", "arg_names": [], "import_names": [], "rhs_call_name": "defer", "annotation": ""}, "snippet": " deferred.defer(participant_wavelet_init_deferred, wavelet, participant,\n modified_by, message, _queue='participant-wavelet-init')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L44_C0", "label": "participant_wavelet_init", "type": "function", "loc": [44, 55], "level": 0, "parent": null, "vector": [2, 0, 0.66, 0.16, 0, 0.66, 0.8333, 50, 0, 4, 0, 0, 0, 0, 4], "semantic": {"name": "participant_wavelet_init", "arg_names": ["wavelet", "participant", "modified_by", "message"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def participant_wavelet_init(wavelet, participant, modified_by, message=None):\n \"\"\"Initialize the participant in the wavelet\"\"\"\n\n pwp = model.ParticipantWavePreferences.get_by_pk(participant, wavelet.wave_id)\n if pwp: return\n pwp = model.ParticipantWavePreferences.get_by_pk(participant, wavelet.wave_id, create=True)\n\n pp = participant_init(wavelet, participant)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L45_C4", "label": "expression", "type": "expression", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L44_C0", "vector": [8, 1, 0.6, 0.0133, 1, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Initialize the participant in the wavelet\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Assign_L47_C4", "label": "pwp = get_by_pk()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L44_C0", "vector": [14, 1, 0.6267, 0.0133, 1, 0.98, 0.1667, 506, 3, 2, 0, 0, 243, 10, 1], "semantic": {"name": "pwp", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_pk", "annotation": ""}, "snippet": " pwp = model.ParticipantWavePreferences.get_by_pk(participant, wavelet.wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:If_L48_C4", "label": "if", "type": "if", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L44_C0", "vector": [4, 1, 0.64, 0.0133, 1, 0.98, 0.3333, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if pwp: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Return_L48_C12", "label": "return", "type": "return", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:If_L48_C4", "vector": [13, 2, 0.64, 0.0133, 2, 0.11, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if pwp: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Assign_L49_C4", "label": "pwp = get_by_pk()", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L44_C0", "vector": [14, 1, 0.6533, 0.0133, 1, 0.98, 0.5, 506, 3, 3, 0, 0, 243, 10, 1], "semantic": {"name": "pwp", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_pk", "annotation": ""}, "snippet": " pwp = model.ParticipantWavePreferences.get_by_pk(participant, wavelet.wave_id, create=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Assign_L51_C4", "label": "pp = participant_init()", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L44_C0", "vector": [14, 1, 0.68, 0.0133, 1, 0.98, 0.6667, 632, 3, 2, 0, 0, 354, 10, 1], "semantic": {"name": "pp", "arg_names": [], "import_names": [], "rhs_call_name": "participant_init", "annotation": ""}, "snippet": " pp = participant_init(wavelet, participant)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:If_L52_C4", "label": "if", "type": "if", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L44_C0", "vector": [4, 1, 0.6933, 0.0133, 1, 0.98, 0.8333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not pp.notify_initial: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Return_L52_C30", "label": "return", "type": "return", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:If_L52_C4", "vector": [13, 2, 0.6933, 0.0133, 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 not pp.notify_initial: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L54_C4", "label": "send_message()", "type": "expression", "loc": [54, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L44_C0", "vector": [8, 1, 0.7267, 0.0267, 1, 0.98, 1.0, 32, 3, 7, 0, 0, 0, 0, 1], "semantic": {"name": "send_message", "arg_names": [], "import_names": [], "rhs_call_name": "send_message", "annotation": ""}, "snippet": " email.send_message(pwp, modified_by, wavelet.title, wavelet.wave_id,\n wavelet.wavelet_id, wavelet.root_blip.blip_id, message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L58_C0", "label": "wavelet_deinit", "type": "function", "loc": [58, 61], "level": 0, "parent": null, "vector": [2, 0, 0.7933, 0.0533, 0, 0.66, 0.9167, 934, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "wavelet_deinit", "arg_names": ["wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def wavelet_deinit(wavelet):\n \"\"\"De-initialize the wavelet\"\"\"\n\n gadget.gadget_remove(wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L59_C4", "label": "expression", "type": "expression", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L58_C0", "vector": [8, 1, 0.7867, 0.0133, 1, 0.06, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"De-initialize the wavelet\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L61_C4", "label": "gadget_remove()", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L58_C0", "vector": [8, 1, 0.8133, 0.0133, 1, 0.06, 1.0, 259, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "gadget_remove", "arg_names": [], "import_names": [], "rhs_call_name": "gadget_remove", "annotation": ""}, "snippet": " gadget.gadget_remove(wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L64_C0", "label": "participant_deinit", "type": "function", "loc": [64, 75], "level": 0, "parent": null, "vector": [2, 0, 0.9267, 0.16, 0, 0.66, 1.0, 141, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "participant_deinit", "arg_names": ["wavelet", "participant"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def participant_deinit(wavelet, participant):\n \"\"\"De-initialize the participant, removes al records available and the preferences wave\"\"\"\n\n query = model.ParticipantPreferences.all()\n query.filter(\"participant =\", participant)\n db.delete(query)\n\n query = model.ParticipantWavePreferences.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L65_C4", "label": "expression", "type": "expression", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L64_C0", "vector": [8, 1, 0.8667, 0.0133, 1, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"De-initialize the participant, removes al records available and the preferences wave\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Assign_L67_C4", "label": "query = all()", "type": "assigned_variable", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L64_C0", "vector": [14, 1, 0.8933, 0.0133, 1, 0.26, 0.1429, 546, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " query = model.ParticipantPreferences.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L68_C4", "label": "filter()", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L64_C0", "vector": [8, 1, 0.9067, 0.0133, 1, 0.26, 0.2857, 526, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "filter", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " query.filter(\"participant =\", participant)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L69_C4", "label": "delete()", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L64_C0", "vector": [8, 1, 0.92, 0.0133, 1, 0.26, 0.4286, 266, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " db.delete(query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Assign_L71_C4", "label": "query = all()", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L64_C0", "vector": [14, 1, 0.9467, 0.0133, 1, 0.26, 0.5714, 546, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " query = model.ParticipantWavePreferences.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L72_C4", "label": "filter()", "type": "expression", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L64_C0", "vector": [8, 1, 0.96, 0.0133, 1, 0.26, 0.7143, 526, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "filter", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " query.filter(\"participant =\", participant)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L73_C4", "label": "delete()", "type": "expression", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L64_C0", "vector": [8, 1, 0.9733, 0.0133, 1, 0.26, 0.8571, 266, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " db.delete(query)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L75_C4", "label": "delete_preferences_wavelet()", "type": "expression", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L64_C0", "vector": [8, 1, 1.0, 0.0133, 1, 0.26, 1.0, 226, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "delete_preferences_wavelet", "arg_names": [], "import_names": [], "rhs_call_name": "delete_preferences_wavelet", "annotation": ""}, "snippet": " preferences.delete_preferences_wavelet(wavelet)"}]
[{"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:For_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:For_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:If_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:If_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Return_L27_C11"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:If_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Return_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:If_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:If_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Return_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:If_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:If_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Return_L52_C30"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Assign_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1096:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1096:Expr_L75_C4"}]