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 |
|---|---|---|---|---|---|---|---|
import os
from Tkinter import *
from Tkconstants import W, E
import Tkinter as tk
from tkMessageBox import askyesnocancel
from multiprocessing import freeze_support
from globalconst import *
from aboutbox import AboutBox
from setupboard import SetupBoard
from gamemanager import GameManager
from centeredwindow import CenteredWindow
from prefdlg import PreferencesDialog
class MainFrame(object, CenteredWindow):
def __init__(self, master):
self.root = master
self.root.withdraw()
self.root.iconbitmap(RAVEN_ICON)
self.root.title('Raven ' + VERSION)
self.root.protocol('WM_DELETE_WINDOW', self._on_close)
self.thinkTime = IntVar(value=5)
self.manager = GameManager(root=self.root, parent=self)
self.menubar = tk.Menu(self.root)
self.create_game_menu()
self.create_options_menu()
self.create_help_menu()
self.root.config(menu=self.menubar)
CenteredWindow.__init__(self, self.root)
self.root.deiconify()
def _on_close(self):
if self.manager.view.is_dirty():
msg = 'Do you want to save your changes before exiting?'
result = askyesnocancel(TITLE, msg)
if result == True:
self.manager.save_game()
elif result == None:
return
self.root.destroy()
def set_title_bar_filename(self, filename=None):
if not filename:
self.root.title(TITLE)
else:
self.root.title(TITLE + ' - ' + os.path.basename(filename))
def undo_all_moves(self, *args):
self.stop_processes()
self.manager.model.undo_all_moves(None,
self.manager.view.get_annotation())
self.manager._controller1.remove_highlights()
self.manager._controller2.remove_highlights()
self.manager.view.update_statusbar()
def redo_all_moves(self, *args):
self.stop_processes()
self.manager.model.redo_all_moves(None,
self.manager.view.get_annotation())
self.manager._controller1.remove_highlights()
self.manager._controller2.remove_highlights()
self.manager.view.update_statusbar()
def undo_single_move(self, *args):
self.stop_processes()
self.manager.model.undo_move(None, None, True, True,
self.manager.view.get_annotation())
self.manager._controller1.remove_highlights()
self.manager._controller2.remove_highlights()
self.manager.view.update_statusbar()
def redo_single_move(self, *args):
self.stop_processes()
annotation = self.manager.view.get_annotation()
self.manager.model.redo_move(None, None, annotation)
self.manager._controller1.remove_highlights()
self.manager._controller2.remove_highlights()
self.manager.view.update_statusbar()
def create_game_menu(self):
game = Menu(self.menubar, tearoff=0)
game.add_command(label='New game', underline=0,
command=self.manager.new_game)
game.add_command(label='Open game ...', underline=0,
command=self.manager.open_game)
game.add_separator()
game.add_command(label='Save game', underline=0,
command=self.manager.save_game)
game.add_command(label='Save game As ...', underline=10,
command=self.manager.save_game_as)
game.add_separator()
game.add_command(label='Set up Board ...', underline=7,
command=self.show_setup_board_dialog)
game.add_command(label='Flip board', underline=0,
command=self.flip_board)
game.add_separator()
game.add_command(label='Exit', underline=0,
command=self._on_close)
self.menubar.add_cascade(label='Game', menu=game)
def create_options_menu(self):
options = Menu(self.menubar, tearoff=0)
think = Menu(options, tearoff=0)
think.add_radiobutton(label="1 second", underline=None,
command=self.set_think_time,
variable=self.thinkTime,
value=1)
think.add_radiobutton(label="2 seconds", underline=None,
command=self.set_think_time,
variable=self.thinkTime,
value=2)
think.add_radiobutton(label="5 seconds", underline=None,
command=self.set_think_time,
variable=self.thinkTime,
value=5)
think.add_radiobutton(label="10 seconds", underline=None,
command=self.set_think_time,
variable=self.thinkTime,
value=10)
think.add_radiobutton(label="30 seconds", underline=None,
command=self.set_think_time,
variable=self.thinkTime,
value=30)
think.add_radiobutton(label="1 minute", underline=None,
command=self.set_think_time,
variable=self.thinkTime,
value=60)
options.add_cascade(label='CPU think time', underline=0,
menu=think)
options.add_separator()
options.add_command(label='Preferences ...', underline=0,
command=self.show_preferences_dialog)
self.menubar.add_cascade(label='Options', menu=options)
def create_help_menu(self):
helpmenu = Menu(self.menubar, tearoff=0)
helpmenu.add_command(label='About Raven ...', underline=0,
command=self.show_about_box)
self.menubar.add_cascade(label='Help', menu=helpmenu)
def stop_processes(self):
# stop any controller processes from making moves
self.manager.model.curr_state.ok_to_move = False
self.manager._controller1.stop_process()
self.manager._controller2.stop_process()
def show_about_box(self):
AboutBox(self.root, 'About Raven')
def show_setup_board_dialog(self):
self.stop_processes()
dlg = SetupBoard(self.root, 'Set up board', self.manager)
self.manager.set_controllers()
self.root.focus_set()
self.manager.turn_finished()
def show_preferences_dialog(self):
font, size = get_preferences_from_file()
dlg = PreferencesDialog(self.root, 'Preferences', font, size)
if dlg.result:
self.manager.view.init_font_sizes(dlg.font, dlg.size)
self.manager.view.init_tags()
write_preferences_to_file(dlg.font, dlg.size)
def set_think_time(self):
self.manager._controller1.set_search_time(self.thinkTime.get())
self.manager._controller2.set_search_time(self.thinkTime.get())
def flip_board(self):
if self.manager.model.to_move == BLACK:
self.manager._controller1.remove_highlights()
else:
self.manager._controller2.remove_highlights()
self.manager.view.flip_board(not self.manager.view.flip_view)
if self.manager.model.to_move == BLACK:
self.manager._controller1.add_highlights()
else:
self.manager._controller2.add_highlights()
def start():
root = Tk()
mainframe = MainFrame(root)
mainframe.root.update()
mainframe.root.mainloop()
if __name__=='__main__':
freeze_support()
start()
| ajibawa-2023/Python-Code-Large/train/row_373 | 134 | 187 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_373:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0053, 0.0053, 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_373:ImportFrom_L2_C0", "label": "from Tkinter import *", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0107, 0.0053, 0, 0.66, 0.0714, 368, 0, 1, 0, 0, 368, 0, 0], "semantic": {"name": "Tkinter", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from Tkinter import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:ImportFrom_L3_C0", "label": "from Tkconstants import W, E", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.016, 0.0053, 0, 0.66, 0.1429, 2, 0, 2, 0, 0, 2, 0, 0], "semantic": {"name": "Tkconstants", "arg_names": [], "import_names": ["W", "E"], "rhs_call_name": "", "annotation": ""}, "snippet": "from Tkconstants import W, E"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Import_L4_C0", "label": "Tkinter import tk", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0214, 0.0053, 0, 0.66, 0.2143, 368, 0, 1, 0, 0, 368, 0, 0], "semantic": {"name": "Tkinter", "arg_names": [], "import_names": ["tk"], "rhs_call_name": "", "annotation": ""}, "snippet": "import Tkinter as tk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:ImportFrom_L5_C0", "label": "from tkMessageBox import askyesnocancel", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0267, 0.0053, 0, 0.66, 0.2857, 507, 0, 1, 0, 0, 507, 0, 0], "semantic": {"name": "tkMessageBox", "arg_names": [], "import_names": ["askyesnocancel"], "rhs_call_name": "", "annotation": ""}, "snippet": "from tkMessageBox import askyesnocancel"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:ImportFrom_L6_C0", "label": "from multiprocessing import freeze_support", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0321, 0.0053, 0, 0.66, 0.3571, 901, 0, 1, 0, 0, 901, 0, 0], "semantic": {"name": "multiprocessing", "arg_names": [], "import_names": ["freeze_support"], "rhs_call_name": "", "annotation": ""}, "snippet": "from multiprocessing import freeze_support"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:ImportFrom_L7_C0", "label": "from globalconst import *", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0374, 0.0053, 0, 0.66, 0.4286, 871, 0, 1, 0, 0, 871, 0, 0], "semantic": {"name": "globalconst", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from globalconst import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:ImportFrom_L8_C0", "label": "from aboutbox import AboutBox", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0428, 0.0053, 0, 0.66, 0.5, 177, 0, 1, 0, 0, 177, 0, 0], "semantic": {"name": "aboutbox", "arg_names": [], "import_names": ["AboutBox"], "rhs_call_name": "", "annotation": ""}, "snippet": "from aboutbox import AboutBox"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:ImportFrom_L9_C0", "label": "from setupboard import SetupBoard", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0481, 0.0053, 0, 0.66, 0.5714, 451, 0, 1, 0, 0, 451, 0, 0], "semantic": {"name": "setupboard", "arg_names": [], "import_names": ["SetupBoard"], "rhs_call_name": "", "annotation": ""}, "snippet": "from setupboard import SetupBoard"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:ImportFrom_L10_C0", "label": "from gamemanager import GameManager", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0535, 0.0053, 0, 0.66, 0.6429, 911, 0, 1, 0, 0, 911, 0, 0], "semantic": {"name": "gamemanager", "arg_names": [], "import_names": ["GameManager"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gamemanager import GameManager"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:ImportFrom_L11_C0", "label": "from centeredwindow import CenteredWindow", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0053, 0, 0.66, 0.7143, 112, 0, 1, 0, 0, 112, 0, 0], "semantic": {"name": "centeredwindow", "arg_names": [], "import_names": ["CenteredWindow"], "rhs_call_name": "", "annotation": ""}, "snippet": "from centeredwindow import CenteredWindow"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:ImportFrom_L12_C0", "label": "from prefdlg import PreferencesDialog", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0642, 0.0053, 0, 0.66, 0.7857, 982, 0, 1, 0, 0, 982, 0, 0], "semantic": {"name": "prefdlg", "arg_names": [], "import_names": ["PreferencesDialog"], "rhs_call_name": "", "annotation": ""}, "snippet": "from prefdlg import PreferencesDialog"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "label": "MainFrame", "type": "class", "loc": [14, 177], "level": 0, "parent": null, "vector": [3, 0, 0.5107, 0.877, 0, 0.66, 0.8571, 418, 0, 16, 0, 0, 186, 0, 93], "semantic": {"name": "MainFrame", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MainFrame(object, CenteredWindow):\n def __init__(self, master):\n self.root = master\n self.root.withdraw()\n self.root.iconbitmap(RAVEN_ICON)\n self.root.title('Raven ' + VERSION)\n self.root.protocol('WM_DELETE_WINDOW', self._on_close)\n self.thinkTime = IntVar(value=5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "label": "__init__", "type": "function", "loc": [15, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "vector": [2, 1, 0.1176, 0.0802, 1, 0.46, 0.0, 555, 0, 2, 0, 0, 0, 0, 13], "semantic": {"name": "__init__", "arg_names": ["self", "master"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, master):\n self.root = master\n self.root.withdraw()\n self.root.iconbitmap(RAVEN_ICON)\n self.root.title('Raven ' + VERSION)\n self.root.protocol('WM_DELETE_WINDOW', self._on_close)\n self.thinkTime = IntVar(value=5)\n self.manager = GameManager(root=self.root, parent=self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L16_C8", "label": "self.root =", "type": "assigned_variable", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "vector": [14, 2, 0.0856, 0.0053, 2, 0.24, 0.0, 81, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.root", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.root = master"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L17_C8", "label": "withdraw()", "type": "expression", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "vector": [8, 2, 0.0909, 0.0053, 2, 0.24, 0.0769, 309, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "withdraw", "arg_names": [], "import_names": [], "rhs_call_name": "withdraw", "annotation": ""}, "snippet": " self.root.withdraw()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L18_C8", "label": "iconbitmap()", "type": "expression", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "vector": [8, 2, 0.0963, 0.0053, 2, 0.24, 0.1538, 578, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "iconbitmap", "arg_names": [], "import_names": [], "rhs_call_name": "iconbitmap", "annotation": ""}, "snippet": " self.root.iconbitmap(RAVEN_ICON)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L19_C8", "label": "title()", "type": "expression", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "vector": [8, 2, 0.1016, 0.0053, 2, 0.24, 0.2308, 48, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "title", "annotation": ""}, "snippet": " self.root.title('Raven ' + VERSION)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L20_C8", "label": "protocol()", "type": "expression", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "vector": [8, 2, 0.107, 0.0053, 2, 0.24, 0.3077, 393, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "protocol", "arg_names": [], "import_names": [], "rhs_call_name": "protocol", "annotation": ""}, "snippet": " self.root.protocol('WM_DELETE_WINDOW', self._on_close)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L21_C8", "label": "self.thinkTime = IntVar()", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "vector": [14, 2, 0.1123, 0.0053, 2, 0.24, 0.3846, 703, 3, 1, 0, 0, 198, 10, 1], "semantic": {"name": "self.thinkTime", "arg_names": [], "import_names": [], "rhs_call_name": "IntVar", "annotation": ""}, "snippet": " self.thinkTime = IntVar(value=5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L22_C8", "label": "self.manager = GameManager()", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "vector": [14, 2, 0.1176, 0.0053, 2, 0.24, 0.4615, 379, 3, 2, 0, 0, 274, 10, 1], "semantic": {"name": "self.manager", "arg_names": [], "import_names": [], "rhs_call_name": "GameManager", "annotation": ""}, "snippet": " self.manager = GameManager(root=self.root, parent=self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L23_C8", "label": "self.menubar = Menu()", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "vector": [14, 2, 0.123, 0.0053, 2, 0.24, 0.5385, 552, 3, 1, 0, 0, 184, 10, 1], "semantic": {"name": "self.menubar", "arg_names": [], "import_names": [], "rhs_call_name": "Menu", "annotation": ""}, "snippet": " self.menubar = tk.Menu(self.root)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L24_C8", "label": "create_game_menu()", "type": "expression", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "vector": [8, 2, 0.1283, 0.0053, 2, 0.24, 0.6154, 76, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "create_game_menu", "arg_names": [], "import_names": [], "rhs_call_name": "create_game_menu", "annotation": ""}, "snippet": " self.create_game_menu()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L25_C8", "label": "create_options_menu()", "type": "expression", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "vector": [8, 2, 0.1337, 0.0053, 2, 0.24, 0.6923, 113, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "create_options_menu", "arg_names": [], "import_names": [], "rhs_call_name": "create_options_menu", "annotation": ""}, "snippet": " self.create_options_menu()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L26_C8", "label": "create_help_menu()", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "vector": [8, 2, 0.139, 0.0053, 2, 0.24, 0.7692, 718, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "create_help_menu", "arg_names": [], "import_names": [], "rhs_call_name": "create_help_menu", "annotation": ""}, "snippet": " self.create_help_menu()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L27_C8", "label": "config()", "type": "expression", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "vector": [8, 2, 0.1444, 0.0053, 2, 0.24, 0.8462, 308, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "config", "arg_names": [], "import_names": [], "rhs_call_name": "config", "annotation": ""}, "snippet": " self.root.config(menu=self.menubar)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L28_C8", "label": "__init__()", "type": "expression", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "vector": [8, 2, 0.1497, 0.0053, 2, 0.24, 0.9231, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " CenteredWindow.__init__(self, self.root)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L29_C8", "label": "deiconify()", "type": "expression", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "vector": [8, 2, 0.1551, 0.0053, 2, 0.24, 1.0, 753, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "deiconify", "arg_names": [], "import_names": [], "rhs_call_name": "deiconify", "annotation": ""}, "snippet": " self.root.deiconify()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L31_C4", "label": "_on_close", "type": "function", "loc": [31, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "vector": [2, 1, 0.1872, 0.0481, 1, 0.46, 0.0667, 932, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "_on_close", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _on_close(self):\n if self.manager.view.is_dirty():\n msg = 'Do you want to save your changes before exiting?'\n result = askyesnocancel(TITLE, msg)\n if result == True:\n self.manager.save_game()\n elif result == None:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:If_L32_C8", "label": "if", "type": "if", "loc": [32, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L31_C4", "vector": [4, 2, 0.1872, 0.0374, 2, 0.68, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.manager.view.is_dirty():\n msg = 'Do you want to save your changes before exiting?'\n result = askyesnocancel(TITLE, msg)\n if result == True:\n self.manager.save_game()\n elif result == None:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L33_C12", "label": "msg =", "type": "assigned_variable", "loc": [33, 33], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:If_L32_C8", "vector": [14, 3, 0.1765, 0.0053, 3, 0.39, 0.0, 712, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg = 'Do you want to save your changes before exiting?'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L34_C12", "label": "result = askyesnocancel()", "type": "assigned_variable", "loc": [34, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:If_L32_C8", "vector": [14, 3, 0.1818, 0.0053, 3, 0.39, 0.5, 51, 3, 2, 0, 0, 919, 10, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "askyesnocancel", "annotation": ""}, "snippet": " result = askyesnocancel(TITLE, msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:If_L35_C12", "label": "if", "type": "if", "loc": [35, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:If_L32_C8", "vector": [4, 3, 0.1952, 0.0214, 3, 0.39, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if result == True:\n self.manager.save_game()\n elif result == None:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L36_C16", "label": "save_game()", "type": "expression", "loc": [36, 36], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:If_L35_C12", "vector": [8, 4, 0.1925, 0.0053, 4, 0.72, 0.0, 241, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "save_game", "arg_names": [], "import_names": [], "rhs_call_name": "save_game", "annotation": ""}, "snippet": " self.manager.save_game()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:If_L37_C12", "label": "if", "type": "if", "loc": [37, 38], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:If_L35_C12", "vector": [4, 4, 0.2005, 0.0107, 4, 0.72, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif result == None:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Return_L38_C16", "label": "return", "type": "return", "loc": [38, 38], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:If_L37_C12", "vector": [13, 5, 0.2032, 0.0053, 5, 0.52, 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_373:Expr_L39_C8", "label": "destroy()", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L31_C4", "vector": [8, 2, 0.2086, 0.0053, 2, 0.68, 1.0, 388, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "destroy", "arg_names": [], "import_names": [], "rhs_call_name": "destroy", "annotation": ""}, "snippet": " self.root.destroy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L41_C4", "label": "set_title_bar_filename", "type": "function", "loc": [41, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "vector": [2, 1, 0.2299, 0.0267, 1, 0.46, 0.1333, 437, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "set_title_bar_filename", "arg_names": ["self", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_title_bar_filename(self, filename=None):\n if not filename:\n self.root.title(TITLE)\n else:\n self.root.title(TITLE + ' - ' + os.path.basename(filename))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:If_L42_C8", "label": "if", "type": "if", "loc": [42, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L41_C4", "vector": [4, 2, 0.2326, 0.0214, 2, 0.33, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not filename:\n self.root.title(TITLE)\n else:\n self.root.title(TITLE + ' - ' + os.path.basename(filename))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L43_C12", "label": "title()", "type": "expression", "loc": [43, 43], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:If_L42_C8", "vector": [8, 3, 0.2299, 0.0053, 3, 0.85, 0.0, 48, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "title", "annotation": ""}, "snippet": " self.root.title(TITLE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L45_C12", "label": "title()", "type": "expression", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:If_L42_C8", "vector": [8, 3, 0.2406, 0.0053, 3, 0.85, 1.0, 48, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "title", "annotation": ""}, "snippet": " self.root.title(TITLE + ' - ' + os.path.basename(filename))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L47_C4", "label": "undo_all_moves", "type": "function", "loc": [47, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "vector": [2, 1, 0.2674, 0.0374, 1, 0.46, 0.2, 987, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "undo_all_moves", "arg_names": ["self", "args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def undo_all_moves(self, *args):\n self.stop_processes()\n self.manager.model.undo_all_moves(None,\n self.manager.view.get_annotation())\n self.manager._controller1.remove_highlights()\n self.manager._controller2.remove_highlights()\n self.manager.view.update_statusbar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L48_C8", "label": "stop_processes()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L47_C4", "vector": [8, 2, 0.2567, 0.0053, 2, 0.81, 0.0, 818, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop_processes", "arg_names": [], "import_names": [], "rhs_call_name": "stop_processes", "annotation": ""}, "snippet": " self.stop_processes()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L49_C8", "label": "undo_all_moves()", "type": "expression", "loc": [49, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L47_C4", "vector": [8, 2, 0.2647, 0.0107, 2, 0.81, 0.25, 987, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "undo_all_moves", "arg_names": [], "import_names": [], "rhs_call_name": "undo_all_moves", "annotation": ""}, "snippet": " self.manager.model.undo_all_moves(None,\n self.manager.view.get_annotation())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L51_C8", "label": "remove_highlights()", "type": "expression", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L47_C4", "vector": [8, 2, 0.2727, 0.0053, 2, 0.81, 0.5, 879, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "remove_highlights", "arg_names": [], "import_names": [], "rhs_call_name": "remove_highlights", "annotation": ""}, "snippet": " self.manager._controller1.remove_highlights()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L52_C8", "label": "remove_highlights()", "type": "expression", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L47_C4", "vector": [8, 2, 0.2781, 0.0053, 2, 0.81, 0.75, 879, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "remove_highlights", "arg_names": [], "import_names": [], "rhs_call_name": "remove_highlights", "annotation": ""}, "snippet": " self.manager._controller2.remove_highlights()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L53_C8", "label": "update_statusbar()", "type": "expression", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L47_C4", "vector": [8, 2, 0.2834, 0.0053, 2, 0.81, 1.0, 743, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update_statusbar", "arg_names": [], "import_names": [], "rhs_call_name": "update_statusbar", "annotation": ""}, "snippet": " self.manager.view.update_statusbar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L55_C4", "label": "redo_all_moves", "type": "function", "loc": [55, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "vector": [2, 1, 0.3102, 0.0374, 1, 0.46, 0.2667, 524, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "redo_all_moves", "arg_names": ["self", "args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def redo_all_moves(self, *args):\n self.stop_processes()\n self.manager.model.redo_all_moves(None,\n self.manager.view.get_annotation())\n self.manager._controller1.remove_highlights()\n self.manager._controller2.remove_highlights()\n self.manager.view.update_statusbar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L56_C8", "label": "stop_processes()", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L55_C4", "vector": [8, 2, 0.2995, 0.0053, 2, 0.3, 0.0, 818, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop_processes", "arg_names": [], "import_names": [], "rhs_call_name": "stop_processes", "annotation": ""}, "snippet": " self.stop_processes()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L57_C8", "label": "redo_all_moves()", "type": "expression", "loc": [57, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L55_C4", "vector": [8, 2, 0.3075, 0.0107, 2, 0.3, 0.25, 524, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "redo_all_moves", "arg_names": [], "import_names": [], "rhs_call_name": "redo_all_moves", "annotation": ""}, "snippet": " self.manager.model.redo_all_moves(None,\n self.manager.view.get_annotation())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L59_C8", "label": "remove_highlights()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L55_C4", "vector": [8, 2, 0.3155, 0.0053, 2, 0.3, 0.5, 879, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "remove_highlights", "arg_names": [], "import_names": [], "rhs_call_name": "remove_highlights", "annotation": ""}, "snippet": " self.manager._controller1.remove_highlights()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L60_C8", "label": "remove_highlights()", "type": "expression", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L55_C4", "vector": [8, 2, 0.3209, 0.0053, 2, 0.3, 0.75, 879, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "remove_highlights", "arg_names": [], "import_names": [], "rhs_call_name": "remove_highlights", "annotation": ""}, "snippet": " self.manager._controller2.remove_highlights()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L61_C8", "label": "update_statusbar()", "type": "expression", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L55_C4", "vector": [8, 2, 0.3262, 0.0053, 2, 0.3, 1.0, 743, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update_statusbar", "arg_names": [], "import_names": [], "rhs_call_name": "update_statusbar", "annotation": ""}, "snippet": " self.manager.view.update_statusbar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L63_C4", "label": "undo_single_move", "type": "function", "loc": [63, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "vector": [2, 1, 0.3529, 0.0374, 1, 0.46, 0.3333, 412, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "undo_single_move", "arg_names": ["self", "args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def undo_single_move(self, *args):\n self.stop_processes()\n self.manager.model.undo_move(None, None, True, True,\n self.manager.view.get_annotation())\n self.manager._controller1.remove_highlights()\n self.manager._controller2.remove_highlights()\n self.manager.view.update_statusbar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L64_C8", "label": "stop_processes()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L63_C4", "vector": [8, 2, 0.3422, 0.0053, 2, 0.32, 0.0, 818, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop_processes", "arg_names": [], "import_names": [], "rhs_call_name": "stop_processes", "annotation": ""}, "snippet": " self.stop_processes()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L65_C8", "label": "undo_move()", "type": "expression", "loc": [65, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L63_C4", "vector": [8, 2, 0.3503, 0.0107, 2, 0.32, 0.25, 752, 3, 5, 0, 0, 0, 0, 2], "semantic": {"name": "undo_move", "arg_names": [], "import_names": [], "rhs_call_name": "undo_move", "annotation": ""}, "snippet": " self.manager.model.undo_move(None, None, True, True,\n self.manager.view.get_annotation())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L67_C8", "label": "remove_highlights()", "type": "expression", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L63_C4", "vector": [8, 2, 0.3583, 0.0053, 2, 0.32, 0.5, 879, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "remove_highlights", "arg_names": [], "import_names": [], "rhs_call_name": "remove_highlights", "annotation": ""}, "snippet": " self.manager._controller1.remove_highlights()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L68_C8", "label": "remove_highlights()", "type": "expression", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L63_C4", "vector": [8, 2, 0.3636, 0.0053, 2, 0.32, 0.75, 879, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "remove_highlights", "arg_names": [], "import_names": [], "rhs_call_name": "remove_highlights", "annotation": ""}, "snippet": " self.manager._controller2.remove_highlights()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L69_C8", "label": "update_statusbar()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L63_C4", "vector": [8, 2, 0.369, 0.0053, 2, 0.32, 1.0, 743, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update_statusbar", "arg_names": [], "import_names": [], "rhs_call_name": "update_statusbar", "annotation": ""}, "snippet": " self.manager.view.update_statusbar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L71_C4", "label": "redo_single_move", "type": "function", "loc": [71, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "vector": [2, 1, 0.3957, 0.0374, 1, 0.46, 0.4, 788, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "redo_single_move", "arg_names": ["self", "args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def redo_single_move(self, *args):\n self.stop_processes()\n annotation = self.manager.view.get_annotation()\n self.manager.model.redo_move(None, None, annotation)\n self.manager._controller1.remove_highlights()\n self.manager._controller2.remove_highlights()\n self.manager.view.update_statusbar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L72_C8", "label": "stop_processes()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L71_C4", "vector": [8, 2, 0.385, 0.0053, 2, 0.52, 0.0, 818, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop_processes", "arg_names": [], "import_names": [], "rhs_call_name": "stop_processes", "annotation": ""}, "snippet": " self.stop_processes()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L73_C8", "label": "annotation = get_annotation()", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L71_C4", "vector": [14, 2, 0.3904, 0.0053, 2, 0.52, 0.2, 792, 3, 0, 0, 0, 904, 10, 1], "semantic": {"name": "annotation", "arg_names": [], "import_names": [], "rhs_call_name": "get_annotation", "annotation": ""}, "snippet": " annotation = self.manager.view.get_annotation()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L74_C8", "label": "redo_move()", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L71_C4", "vector": [8, 2, 0.3957, 0.0053, 2, 0.52, 0.4, 664, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "redo_move", "arg_names": [], "import_names": [], "rhs_call_name": "redo_move", "annotation": ""}, "snippet": " self.manager.model.redo_move(None, None, annotation)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L75_C8", "label": "remove_highlights()", "type": "expression", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L71_C4", "vector": [8, 2, 0.4011, 0.0053, 2, 0.52, 0.6, 879, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "remove_highlights", "arg_names": [], "import_names": [], "rhs_call_name": "remove_highlights", "annotation": ""}, "snippet": " self.manager._controller1.remove_highlights()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L76_C8", "label": "remove_highlights()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L71_C4", "vector": [8, 2, 0.4064, 0.0053, 2, 0.52, 0.8, 879, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "remove_highlights", "arg_names": [], "import_names": [], "rhs_call_name": "remove_highlights", "annotation": ""}, "snippet": " self.manager._controller2.remove_highlights()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L77_C8", "label": "update_statusbar()", "type": "expression", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L71_C4", "vector": [8, 2, 0.4118, 0.0053, 2, 0.52, 1.0, 743, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update_statusbar", "arg_names": [], "import_names": [], "rhs_call_name": "update_statusbar", "annotation": ""}, "snippet": " self.manager.view.update_statusbar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "label": "create_game_menu", "type": "function", "loc": [79, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "vector": [2, 1, 0.4733, 0.107, 1, 0.46, 0.4667, 76, 0, 1, 0, 0, 0, 0, 12], "semantic": {"name": "create_game_menu", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def create_game_menu(self):\n game = Menu(self.menubar, tearoff=0)\n game.add_command(label='New game', underline=0,\n command=self.manager.new_game)\n game.add_command(label='Open game ...', underline=0,\n command=self.manager.open_game)\n game.add_separator()\n game.add_command(label='Save game', underline=0,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L80_C8", "label": "game = Menu()", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "vector": [14, 2, 0.4278, 0.0053, 2, 0.06, 0.0, 339, 3, 2, 0, 0, 184, 10, 1], "semantic": {"name": "game", "arg_names": [], "import_names": [], "rhs_call_name": "Menu", "annotation": ""}, "snippet": " game = Menu(self.menubar, tearoff=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L81_C8", "label": "add_command()", "type": "expression", "loc": [81, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "vector": [8, 2, 0.4358, 0.0107, 2, 0.06, 0.0909, 64, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "add_command", "arg_names": [], "import_names": [], "rhs_call_name": "add_command", "annotation": ""}, "snippet": " game.add_command(label='New game', underline=0,\n command=self.manager.new_game)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L83_C8", "label": "add_command()", "type": "expression", "loc": [83, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "vector": [8, 2, 0.4465, 0.0107, 2, 0.06, 0.1818, 64, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "add_command", "arg_names": [], "import_names": [], "rhs_call_name": "add_command", "annotation": ""}, "snippet": " game.add_command(label='Open game ...', underline=0,\n command=self.manager.open_game)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L85_C8", "label": "add_separator()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "vector": [8, 2, 0.4545, 0.0053, 2, 0.06, 0.2727, 469, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "add_separator", "arg_names": [], "import_names": [], "rhs_call_name": "add_separator", "annotation": ""}, "snippet": " game.add_separator()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L86_C8", "label": "add_command()", "type": "expression", "loc": [86, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "vector": [8, 2, 0.4626, 0.0107, 2, 0.06, 0.3636, 64, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "add_command", "arg_names": [], "import_names": [], "rhs_call_name": "add_command", "annotation": ""}, "snippet": " game.add_command(label='Save game', underline=0,\n command=self.manager.save_game)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L88_C8", "label": "add_command()", "type": "expression", "loc": [88, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "vector": [8, 2, 0.4733, 0.0107, 2, 0.06, 0.4545, 64, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "add_command", "arg_names": [], "import_names": [], "rhs_call_name": "add_command", "annotation": ""}, "snippet": " game.add_command(label='Save game As ...', underline=10,\n command=self.manager.save_game_as)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L90_C8", "label": "add_separator()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "vector": [8, 2, 0.4813, 0.0053, 2, 0.06, 0.5455, 469, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "add_separator", "arg_names": [], "import_names": [], "rhs_call_name": "add_separator", "annotation": ""}, "snippet": " game.add_separator()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L91_C8", "label": "add_command()", "type": "expression", "loc": [91, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "vector": [8, 2, 0.4893, 0.0107, 2, 0.06, 0.6364, 64, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "add_command", "arg_names": [], "import_names": [], "rhs_call_name": "add_command", "annotation": ""}, "snippet": " game.add_command(label='Set up Board ...', underline=7,\n command=self.show_setup_board_dialog)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L93_C8", "label": "add_command()", "type": "expression", "loc": [93, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "vector": [8, 2, 0.5, 0.0107, 2, 0.06, 0.7273, 64, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "add_command", "arg_names": [], "import_names": [], "rhs_call_name": "add_command", "annotation": ""}, "snippet": " game.add_command(label='Flip board', underline=0,\n command=self.flip_board)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L95_C8", "label": "add_separator()", "type": "expression", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "vector": [8, 2, 0.508, 0.0053, 2, 0.06, 0.8182, 469, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "add_separator", "arg_names": [], "import_names": [], "rhs_call_name": "add_separator", "annotation": ""}, "snippet": " game.add_separator()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L96_C8", "label": "add_command()", "type": "expression", "loc": [96, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "vector": [8, 2, 0.516, 0.0107, 2, 0.06, 0.9091, 64, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "add_command", "arg_names": [], "import_names": [], "rhs_call_name": "add_command", "annotation": ""}, "snippet": " game.add_command(label='Exit', underline=0,\n command=self._on_close)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L98_C8", "label": "add_cascade()", "type": "expression", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "vector": [8, 2, 0.5241, 0.0053, 2, 0.06, 1.0, 876, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "add_cascade", "arg_names": [], "import_names": [], "rhs_call_name": "add_cascade", "annotation": ""}, "snippet": " self.menubar.add_cascade(label='Game', menu=game)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "label": "create_options_menu", "type": "function", "loc": [100, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "vector": [2, 1, 0.6203, 0.1765, 1, 0.46, 0.5333, 113, 0, 1, 0, 0, 0, 0, 12], "semantic": {"name": "create_options_menu", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def create_options_menu(self):\n options = Menu(self.menubar, tearoff=0)\n think = Menu(options, tearoff=0)\n think.add_radiobutton(label=\"1 second\", underline=None,\n command=self.set_think_time,\n variable=self.thinkTime,\n value=1)\n think.add_radiobutton(label=\"2 seconds\", underline=None,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L101_C8", "label": "options = Menu()", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "vector": [14, 2, 0.5401, 0.0053, 2, 0.01, 0.0, 707, 3, 2, 0, 0, 184, 10, 1], "semantic": {"name": "options", "arg_names": [], "import_names": [], "rhs_call_name": "Menu", "annotation": ""}, "snippet": " options = Menu(self.menubar, tearoff=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L102_C8", "label": "think = Menu()", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "vector": [14, 2, 0.5455, 0.0053, 2, 0.01, 0.0909, 77, 3, 2, 0, 0, 184, 10, 1], "semantic": {"name": "think", "arg_names": [], "import_names": [], "rhs_call_name": "Menu", "annotation": ""}, "snippet": " think = Menu(options, tearoff=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L103_C8", "label": "add_radiobutton()", "type": "expression", "loc": [103, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "vector": [8, 2, 0.5588, 0.0214, 2, 0.01, 0.1818, 679, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_radiobutton", "arg_names": [], "import_names": [], "rhs_call_name": "add_radiobutton", "annotation": ""}, "snippet": " think.add_radiobutton(label=\"1 second\", underline=None,\n command=self.set_think_time,\n variable=self.thinkTime,\n value=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L107_C8", "label": "add_radiobutton()", "type": "expression", "loc": [107, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "vector": [8, 2, 0.5802, 0.0214, 2, 0.01, 0.2727, 679, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_radiobutton", "arg_names": [], "import_names": [], "rhs_call_name": "add_radiobutton", "annotation": ""}, "snippet": " think.add_radiobutton(label=\"2 seconds\", underline=None,\n command=self.set_think_time,\n variable=self.thinkTime,\n value=2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L111_C8", "label": "add_radiobutton()", "type": "expression", "loc": [111, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "vector": [8, 2, 0.6016, 0.0214, 2, 0.01, 0.3636, 679, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_radiobutton", "arg_names": [], "import_names": [], "rhs_call_name": "add_radiobutton", "annotation": ""}, "snippet": " think.add_radiobutton(label=\"5 seconds\", underline=None,\n command=self.set_think_time,\n variable=self.thinkTime,\n value=5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L115_C8", "label": "add_radiobutton()", "type": "expression", "loc": [115, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "vector": [8, 2, 0.623, 0.0214, 2, 0.01, 0.4545, 679, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_radiobutton", "arg_names": [], "import_names": [], "rhs_call_name": "add_radiobutton", "annotation": ""}, "snippet": " think.add_radiobutton(label=\"10 seconds\", underline=None,\n command=self.set_think_time,\n variable=self.thinkTime,\n value=10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L119_C8", "label": "add_radiobutton()", "type": "expression", "loc": [119, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "vector": [8, 2, 0.6444, 0.0214, 2, 0.01, 0.5455, 679, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_radiobutton", "arg_names": [], "import_names": [], "rhs_call_name": "add_radiobutton", "annotation": ""}, "snippet": " think.add_radiobutton(label=\"30 seconds\", underline=None,\n command=self.set_think_time,\n variable=self.thinkTime,\n value=30)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L123_C8", "label": "add_radiobutton()", "type": "expression", "loc": [123, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "vector": [8, 2, 0.6658, 0.0214, 2, 0.01, 0.6364, 679, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "add_radiobutton", "arg_names": [], "import_names": [], "rhs_call_name": "add_radiobutton", "annotation": ""}, "snippet": " think.add_radiobutton(label=\"1 minute\", underline=None,\n command=self.set_think_time,\n variable=self.thinkTime,\n value=60)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L127_C8", "label": "add_cascade()", "type": "expression", "loc": [127, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "vector": [8, 2, 0.6818, 0.0107, 2, 0.01, 0.7273, 876, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "add_cascade", "arg_names": [], "import_names": [], "rhs_call_name": "add_cascade", "annotation": ""}, "snippet": " options.add_cascade(label='CPU think time', underline=0,\n menu=think)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L129_C8", "label": "add_separator()", "type": "expression", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "vector": [8, 2, 0.6898, 0.0053, 2, 0.01, 0.8182, 469, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "add_separator", "arg_names": [], "import_names": [], "rhs_call_name": "add_separator", "annotation": ""}, "snippet": " options.add_separator()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L130_C8", "label": "add_command()", "type": "expression", "loc": [130, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "vector": [8, 2, 0.6979, 0.0107, 2, 0.01, 0.9091, 64, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "add_command", "arg_names": [], "import_names": [], "rhs_call_name": "add_command", "annotation": ""}, "snippet": " options.add_command(label='Preferences ...', underline=0,\n command=self.show_preferences_dialog)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L132_C8", "label": "add_cascade()", "type": "expression", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "vector": [8, 2, 0.7059, 0.0053, 2, 0.01, 1.0, 876, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "add_cascade", "arg_names": [], "import_names": [], "rhs_call_name": "add_cascade", "annotation": ""}, "snippet": " self.menubar.add_cascade(label='Options', menu=options)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L134_C4", "label": "create_help_menu", "type": "function", "loc": [134, 138], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "vector": [2, 1, 0.7273, 0.0267, 1, 0.46, 0.6, 718, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "create_help_menu", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def create_help_menu(self):\n helpmenu = Menu(self.menubar, tearoff=0)\n helpmenu.add_command(label='About Raven ...', underline=0,\n command=self.show_about_box)\n self.menubar.add_cascade(label='Help', menu=helpmenu)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L135_C8", "label": "helpmenu = Menu()", "type": "assigned_variable", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L134_C4", "vector": [14, 2, 0.7219, 0.0053, 2, 0.48, 0.0, 78, 3, 2, 0, 0, 184, 10, 1], "semantic": {"name": "helpmenu", "arg_names": [], "import_names": [], "rhs_call_name": "Menu", "annotation": ""}, "snippet": " helpmenu = Menu(self.menubar, tearoff=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L136_C8", "label": "add_command()", "type": "expression", "loc": [136, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L134_C4", "vector": [8, 2, 0.7299, 0.0107, 2, 0.48, 0.5, 64, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "add_command", "arg_names": [], "import_names": [], "rhs_call_name": "add_command", "annotation": ""}, "snippet": " helpmenu.add_command(label='About Raven ...', underline=0,\n command=self.show_about_box)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L138_C8", "label": "add_cascade()", "type": "expression", "loc": [138, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L134_C4", "vector": [8, 2, 0.738, 0.0053, 2, 0.48, 1.0, 876, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "add_cascade", "arg_names": [], "import_names": [], "rhs_call_name": "add_cascade", "annotation": ""}, "snippet": " self.menubar.add_cascade(label='Help', menu=helpmenu)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L140_C4", "label": "stop_processes", "type": "function", "loc": [140, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "vector": [2, 1, 0.7594, 0.0267, 1, 0.46, 0.6667, 818, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "stop_processes", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def stop_processes(self):\n # stop any controller processes from making moves\n self.manager.model.curr_state.ok_to_move = False\n self.manager._controller1.stop_process()\n self.manager._controller2.stop_process()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L142_C8", "label": "self.manager.model.curr_state.ok_to_move =", "type": "assigned_variable", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L140_C4", "vector": [14, 2, 0.7594, 0.0053, 2, 0.11, 0.0, 224, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.manager.model.curr_state.ok_to_move", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.manager.model.curr_state.ok_to_move = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L143_C8", "label": "stop_process()", "type": "expression", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L140_C4", "vector": [8, 2, 0.7647, 0.0053, 2, 0.11, 0.5, 116, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop_process", "arg_names": [], "import_names": [], "rhs_call_name": "stop_process", "annotation": ""}, "snippet": " self.manager._controller1.stop_process()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L144_C8", "label": "stop_process()", "type": "expression", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L140_C4", "vector": [8, 2, 0.7701, 0.0053, 2, 0.11, 1.0, 116, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop_process", "arg_names": [], "import_names": [], "rhs_call_name": "stop_process", "annotation": ""}, "snippet": " self.manager._controller2.stop_process()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L146_C4", "label": "show_about_box", "type": "function", "loc": [146, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "vector": [2, 1, 0.7834, 0.0107, 1, 0.46, 0.7333, 444, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "show_about_box", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def show_about_box(self):\n AboutBox(self.root, 'About Raven')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L147_C8", "label": "AboutBox()", "type": "expression", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L146_C4", "vector": [8, 2, 0.7861, 0.0053, 2, 0.5, 0.0, 774, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "AboutBox", "arg_names": [], "import_names": [], "rhs_call_name": "AboutBox", "annotation": ""}, "snippet": " AboutBox(self.root, 'About Raven')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L149_C4", "label": "show_setup_board_dialog", "type": "function", "loc": [149, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "vector": [2, 1, 0.8102, 0.0321, 1, 0.46, 0.8, 851, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "show_setup_board_dialog", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def show_setup_board_dialog(self):\n self.stop_processes()\n dlg = SetupBoard(self.root, 'Set up board', self.manager)\n self.manager.set_controllers()\n self.root.focus_set()\n self.manager.turn_finished()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L150_C8", "label": "stop_processes()", "type": "expression", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L149_C4", "vector": [8, 2, 0.8021, 0.0053, 2, 0.44, 0.0, 818, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop_processes", "arg_names": [], "import_names": [], "rhs_call_name": "stop_processes", "annotation": ""}, "snippet": " self.stop_processes()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L151_C8", "label": "dlg = SetupBoard()", "type": "assigned_variable", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L149_C4", "vector": [14, 2, 0.8075, 0.0053, 2, 0.44, 0.25, 19, 3, 3, 0, 0, 26, 10, 1], "semantic": {"name": "dlg", "arg_names": [], "import_names": [], "rhs_call_name": "SetupBoard", "annotation": ""}, "snippet": " dlg = SetupBoard(self.root, 'Set up board', self.manager)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L152_C8", "label": "set_controllers()", "type": "expression", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L149_C4", "vector": [8, 2, 0.8128, 0.0053, 2, 0.44, 0.5, 611, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "set_controllers", "arg_names": [], "import_names": [], "rhs_call_name": "set_controllers", "annotation": ""}, "snippet": " self.manager.set_controllers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L153_C8", "label": "focus_set()", "type": "expression", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L149_C4", "vector": [8, 2, 0.8182, 0.0053, 2, 0.44, 0.75, 278, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "focus_set", "arg_names": [], "import_names": [], "rhs_call_name": "focus_set", "annotation": ""}, "snippet": " self.root.focus_set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L154_C8", "label": "turn_finished()", "type": "expression", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L149_C4", "vector": [8, 2, 0.8235, 0.0053, 2, 0.44, 1.0, 268, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "turn_finished", "arg_names": [], "import_names": [], "rhs_call_name": "turn_finished", "annotation": ""}, "snippet": " self.manager.turn_finished()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L156_C4", "label": "show_preferences_dialog", "type": "function", "loc": [156, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "vector": [2, 1, 0.8503, 0.0374, 1, 0.46, 0.8667, 699, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "show_preferences_dialog", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def show_preferences_dialog(self):\n font, size = get_preferences_from_file()\n dlg = PreferencesDialog(self.root, 'Preferences', font, size)\n if dlg.result:\n self.manager.view.init_font_sizes(dlg.font, dlg.size)\n self.manager.view.init_tags()\n write_preferences_to_file(dlg.font, dlg.size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L157_C8", "label": "font, size = get_preferences_from_file()", "type": "assigned_variable", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L156_C4", "vector": [14, 2, 0.8396, 0.0053, 2, 0.32, 0.0, 677, 3, 0, 0, 0, 801, 10, 1], "semantic": {"name": "font, size", "arg_names": [], "import_names": [], "rhs_call_name": "get_preferences_from_file", "annotation": ""}, "snippet": " font, size = get_preferences_from_file()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L158_C8", "label": "dlg = PreferencesDialog()", "type": "assigned_variable", "loc": [158, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L156_C4", "vector": [14, 2, 0.8449, 0.0053, 2, 0.32, 0.5, 19, 3, 4, 0, 0, 302, 10, 1], "semantic": {"name": "dlg", "arg_names": [], "import_names": [], "rhs_call_name": "PreferencesDialog", "annotation": ""}, "snippet": " dlg = PreferencesDialog(self.root, 'Preferences', font, size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:If_L159_C8", "label": "if", "type": "if", "loc": [159, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L156_C4", "vector": [4, 2, 0.8583, 0.0214, 2, 0.32, 1.0, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if dlg.result:\n self.manager.view.init_font_sizes(dlg.font, dlg.size)\n self.manager.view.init_tags()\n write_preferences_to_file(dlg.font, dlg.size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L160_C12", "label": "init_font_sizes()", "type": "expression", "loc": [160, 160], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:If_L159_C8", "vector": [8, 3, 0.8556, 0.0053, 3, 0.19, 0.0, 974, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "init_font_sizes", "arg_names": [], "import_names": [], "rhs_call_name": "init_font_sizes", "annotation": ""}, "snippet": " self.manager.view.init_font_sizes(dlg.font, dlg.size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L161_C12", "label": "init_tags()", "type": "expression", "loc": [161, 161], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:If_L159_C8", "vector": [8, 3, 0.861, 0.0053, 3, 0.19, 0.5, 369, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "init_tags", "arg_names": [], "import_names": [], "rhs_call_name": "init_tags", "annotation": ""}, "snippet": " self.manager.view.init_tags()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L162_C12", "label": "write_preferences_to_file()", "type": "expression", "loc": [162, 162], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:If_L159_C8", "vector": [8, 3, 0.8663, 0.0053, 3, 0.19, 1.0, 15, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "write_preferences_to_file", "arg_names": [], "import_names": [], "rhs_call_name": "write_preferences_to_file", "annotation": ""}, "snippet": " write_preferences_to_file(dlg.font, dlg.size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L164_C4", "label": "set_think_time", "type": "function", "loc": [164, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "vector": [2, 1, 0.8824, 0.016, 1, 0.46, 0.9333, 458, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "set_think_time", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_think_time(self):\n self.manager._controller1.set_search_time(self.thinkTime.get())\n self.manager._controller2.set_search_time(self.thinkTime.get())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L165_C8", "label": "set_search_time()", "type": "expression", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L164_C4", "vector": [8, 2, 0.8824, 0.0053, 2, 0.46, 0.0, 29, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "set_search_time", "arg_names": [], "import_names": [], "rhs_call_name": "set_search_time", "annotation": ""}, "snippet": " self.manager._controller1.set_search_time(self.thinkTime.get())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L166_C8", "label": "set_search_time()", "type": "expression", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L164_C4", "vector": [8, 2, 0.8877, 0.0053, 2, 0.46, 1.0, 29, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "set_search_time", "arg_names": [], "import_names": [], "rhs_call_name": "set_search_time", "annotation": ""}, "snippet": " self.manager._controller2.set_search_time(self.thinkTime.get())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L168_C4", "label": "flip_board", "type": "function", "loc": [168, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "vector": [2, 1, 0.9225, 0.0535, 1, 0.46, 1.0, 555, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "flip_board", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def flip_board(self):\n if self.manager.model.to_move == BLACK:\n self.manager._controller1.remove_highlights()\n else:\n self.manager._controller2.remove_highlights()\n self.manager.view.flip_board(not self.manager.view.flip_view)\n if self.manager.model.to_move == BLACK:\n self.manager._controller1.add_highlights()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:If_L169_C8", "label": "if", "type": "if", "loc": [169, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L168_C4", "vector": [4, 2, 0.9118, 0.0214, 2, 0.18, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.manager.model.to_move == BLACK:\n self.manager._controller1.remove_highlights()\n else:\n self.manager._controller2.remove_highlights()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L170_C12", "label": "remove_highlights()", "type": "expression", "loc": [170, 170], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:If_L169_C8", "vector": [8, 3, 0.9091, 0.0053, 3, 0.95, 0.0, 879, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "remove_highlights", "arg_names": [], "import_names": [], "rhs_call_name": "remove_highlights", "annotation": ""}, "snippet": " self.manager._controller1.remove_highlights()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L172_C12", "label": "remove_highlights()", "type": "expression", "loc": [172, 172], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:If_L169_C8", "vector": [8, 3, 0.9198, 0.0053, 3, 0.95, 1.0, 879, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "remove_highlights", "arg_names": [], "import_names": [], "rhs_call_name": "remove_highlights", "annotation": ""}, "snippet": " self.manager._controller2.remove_highlights()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L173_C8", "label": "flip_board()", "type": "expression", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L168_C4", "vector": [8, 2, 0.9251, 0.0053, 2, 0.18, 0.5, 555, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "flip_board", "arg_names": [], "import_names": [], "rhs_call_name": "flip_board", "annotation": ""}, "snippet": " self.manager.view.flip_board(not self.manager.view.flip_view)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:If_L174_C8", "label": "if", "type": "if", "loc": [174, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L168_C4", "vector": [4, 2, 0.9385, 0.0214, 2, 0.18, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.manager.model.to_move == BLACK:\n self.manager._controller1.add_highlights()\n else:\n self.manager._controller2.add_highlights()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L175_C12", "label": "add_highlights()", "type": "expression", "loc": [175, 175], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:If_L174_C8", "vector": [8, 3, 0.9358, 0.0053, 3, 0.92, 0.0, 23, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "add_highlights", "arg_names": [], "import_names": [], "rhs_call_name": "add_highlights", "annotation": ""}, "snippet": " self.manager._controller1.add_highlights()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L177_C12", "label": "add_highlights()", "type": "expression", "loc": [177, 177], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:If_L174_C8", "vector": [8, 3, 0.9465, 0.0053, 3, 0.92, 1.0, 23, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "add_highlights", "arg_names": [], "import_names": [], "rhs_call_name": "add_highlights", "annotation": ""}, "snippet": " self.manager._controller2.add_highlights()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L179_C0", "label": "start", "type": "function", "loc": [179, 183], "level": 0, "parent": null, "vector": [2, 0, 0.9679, 0.0267, 0, 0.66, 0.9286, 511, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def start():\n root = Tk()\n mainframe = MainFrame(root)\n mainframe.root.update()\n mainframe.root.mainloop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L180_C4", "label": "root = Tk()", "type": "assigned_variable", "loc": [180, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L179_C0", "vector": [14, 1, 0.9626, 0.0053, 1, 0.76, 0.0, 696, 3, 0, 0, 0, 309, 10, 1], "semantic": {"name": "root", "arg_names": [], "import_names": [], "rhs_call_name": "Tk", "annotation": ""}, "snippet": " root = Tk()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L181_C4", "label": "mainframe = MainFrame()", "type": "assigned_variable", "loc": [181, 181], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L179_C0", "vector": [14, 1, 0.9679, 0.0053, 1, 0.76, 0.3333, 320, 3, 1, 0, 0, 418, 10, 1], "semantic": {"name": "mainframe", "arg_names": [], "import_names": [], "rhs_call_name": "MainFrame", "annotation": ""}, "snippet": " mainframe = MainFrame(root)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L182_C4", "label": "update()", "type": "expression", "loc": [182, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L179_C0", "vector": [8, 1, 0.9733, 0.0053, 1, 0.76, 0.6667, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " mainframe.root.update()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L183_C4", "label": "mainloop()", "type": "expression", "loc": [183, 183], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L179_C0", "vector": [8, 1, 0.9786, 0.0053, 1, 0.76, 1.0, 192, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "mainloop", "arg_names": [], "import_names": [], "rhs_call_name": "mainloop", "annotation": ""}, "snippet": " mainframe.root.mainloop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:If_L185_C0", "label": "if", "type": "if", "loc": [185, 187], "level": 0, "parent": null, "vector": [4, 0, 0.9947, 0.016, 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 freeze_support()\n start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L186_C4", "label": "freeze_support()", "type": "expression", "loc": [186, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:If_L185_C0", "vector": [8, 1, 0.9947, 0.0053, 1, 0.9, 0.0, 241, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "freeze_support", "arg_names": [], "import_names": [], "rhs_call_name": "freeze_support", "annotation": ""}, "snippet": " freeze_support()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L187_C4", "label": "start()", "type": "expression", "loc": [187, 187], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_373:If_L185_C0", "vector": [8, 1, 1.0, 0.0053, 1, 0.9, 1.0, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " start()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:If_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:If_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L33_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:If_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:If_L32_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_373:If_L35_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:If_L35_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L36_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:If_L35_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_373:If_L37_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:If_L37_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Return_L38_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:If_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L140_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L140_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L140_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L156_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:If_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:If_L159_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L160_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:If_L159_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L161_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:If_L159_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L162_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:If_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:If_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L170_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:If_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L172_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L173_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_373:If_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:If_L174_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L175_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:If_L174_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L177_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L180_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Assign_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:If_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_373:If_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_373:Expr_L187_C4"}] |
from globalconst import BLACK, WHITE, MAN, KING
from goalevaluator import GoalEvaluator
from onekingattack import Goal_OneKingAttack
class OneKingAttackOneKingEvaluator(GoalEvaluator):
def __init__(self, bias):
GoalEvaluator.__init__(self, bias)
def calculateDesirability(self, board):
plr_color = board.to_move
enemy_color = board.enemy
# if we don't have one man on each side or the player
# doesn't have the opposition, then goal is undesirable.
if (board.count(BLACK) != 1 or board.count(WHITE) != 1 or
not board.has_opposition(plr_color)):
return 0.0
player = board.get_pieces(plr_color)[0]
p_idx, p_val = player
p_row, p_col = board.row_col_for_index(p_idx)
enemy = board.get_pieces(enemy_color)[0]
e_idx, e_val = enemy
e_row, e_col = board.row_col_for_index(e_idx)
# must be two kings against each other and the distance
# between them at least three rows away
if ((p_val & KING) and (e_val & KING) and
(abs(p_row - e_row) > 2 or abs(p_col - e_col) > 2)):
return 1.0
return 0.0
def setGoal(self, board):
player = board.to_move
board.removeAllSubgoals()
if player == WHITE:
goalset = board.addWhiteSubgoal
else:
goalset = board.addBlackSubgoal
goalset(Goal_OneKingAttack(board))
class OneKingFleeOneKingEvaluator(GoalEvaluator):
def __init__(self, bias):
GoalEvaluator.__init__(self, bias)
def calculateDesirability(self, board):
plr_color = board.to_move
enemy_color = board.enemy
# if we don't have one man on each side or the player
# has the opposition (meaning we should attack instead),
# then goal is not applicable.
if (board.count(BLACK) != 1 or board.count(WHITE) != 1 or
board.has_opposition(plr_color)):
return 0.0
player = board.get_pieces(plr_color)[0]
p_idx, p_val = player
enemy = board.get_pieces(enemy_color)[0]
e_idx, e_val = enemy
# must be two kings against each other; otherwise it's
# not applicable.
if not ((p_val & KING) and (e_val & KING)):
return 0.0
return 1.0
def setGoal(self, board):
player = board.to_move
board.removeAllSubgoals()
if player == WHITE:
goalset = board.addWhiteSubgoal
else:
goalset = board.addBlackSubgoal
goalset(Goal_OneKingFlee(board))
| ajibawa-2023/Python-Code-Large/train/row_374 | 49 | 69 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_374:ImportFrom_L1_C0", "label": "from globalconst import BLACK, WHITE, MAN\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0145, 0.0145, 0, 0.66, 0.0, 871, 0, 4, 0, 0, 871, 0, 0], "semantic": {"name": "globalconst", "arg_names": [], "import_names": ["BLACK", "WHITE", "MAN", "KING"], "rhs_call_name": "", "annotation": ""}, "snippet": "from globalconst import BLACK, WHITE, MAN, KING"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:ImportFrom_L2_C0", "label": "from goalevaluator import GoalEvaluator", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.029, 0.0145, 0, 0.66, 0.25, 37, 0, 1, 0, 0, 37, 0, 0], "semantic": {"name": "goalevaluator", "arg_names": [], "import_names": ["GoalEvaluator"], "rhs_call_name": "", "annotation": ""}, "snippet": "from goalevaluator import GoalEvaluator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:ImportFrom_L3_C0", "label": "from onekingattack import Goal_OneKingAttack", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0435, 0.0145, 0, 0.66, 0.5, 194, 0, 1, 0, 0, 194, 0, 0], "semantic": {"name": "onekingattack", "arg_names": [], "import_names": ["Goal_OneKingAttack"], "rhs_call_name": "", "annotation": ""}, "snippet": "from onekingattack import Goal_OneKingAttack"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:ClassDef_L5_C0", "label": "OneKingAttackOneKingEvaluator", "type": "class", "loc": [5, 37], "level": 0, "parent": null, "vector": [3, 0, 0.3043, 0.4783, 0, 0.66, 0.75, 473, 0, 3, 0, 0, 985, 0, 13], "semantic": {"name": "OneKingAttackOneKingEvaluator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OneKingAttackOneKingEvaluator(GoalEvaluator):\n def __init__(self, bias):\n GoalEvaluator.__init__(self, bias)\n\n def calculateDesirability(self, board):\n plr_color = board.to_move\n enemy_color = board.enemy\n # if we don't have one man on each side or the player"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L6_C4", "label": "__init__", "type": "function", "loc": [6, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:ClassDef_L5_C0", "vector": [2, 1, 0.0942, 0.029, 1, 0.09, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "bias"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, bias):\n GoalEvaluator.__init__(self, bias)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Expr_L7_C8", "label": "__init__()", "type": "expression", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L6_C4", "vector": [8, 2, 0.1014, 0.0145, 2, 0.95, 0.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " GoalEvaluator.__init__(self, bias)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "label": "calculateDesirability", "type": "function", "loc": [9, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:ClassDef_L5_C0", "vector": [2, 1, 0.2681, 0.2899, 1, 0.09, 0.5, 943, 0, 2, 1, 0, 0, 0, 9], "semantic": {"name": "calculateDesirability", "arg_names": ["self", "board"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def calculateDesirability(self, board):\n plr_color = board.to_move\n enemy_color = board.enemy\n # if we don't have one man on each side or the player\n # doesn't have the opposition, then goal is undesirable.\n if (board.count(BLACK) != 1 or board.count(WHITE) != 1 or\n not board.has_opposition(plr_color)):\n return 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L10_C8", "label": "plr_color =", "type": "assigned_variable", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "vector": [14, 2, 0.1449, 0.0145, 2, 0.18, 0.0, 95, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "plr_color", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " plr_color = board.to_move"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L11_C8", "label": "enemy_color =", "type": "assigned_variable", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "vector": [14, 2, 0.1594, 0.0145, 2, 0.18, 0.1, 644, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "enemy_color", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " enemy_color = board.enemy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:If_L14_C8", "label": "if", "type": "if", "loc": [14, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "vector": [4, 2, 0.2174, 0.0435, 2, 0.18, 0.2, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (board.count(BLACK) != 1 or board.count(WHITE) != 1 or\n not board.has_opposition(plr_color)):\n return 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Return_L16_C12", "label": "return", "type": "return", "loc": [16, 16], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:If_L14_C8", "vector": [13, 3, 0.2319, 0.0145, 3, 0.62, 0.0, 0, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L17_C8", "label": "player =", "type": "assigned_variable", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "vector": [14, 2, 0.2464, 0.0145, 2, 0.18, 0.3, 895, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "player", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " player = board.get_pieces(plr_color)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L18_C8", "label": "p_idx, p_val =", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "vector": [14, 2, 0.2609, 0.0145, 2, 0.18, 0.4, 959, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "p_idx, p_val", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " p_idx, p_val = player"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L19_C8", "label": "p_row, p_col = row_col_for_index()", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "vector": [14, 2, 0.2754, 0.0145, 2, 0.18, 0.5, 948, 3, 1, 0, 0, 844, 10, 1], "semantic": {"name": "p_row, p_col", "arg_names": [], "import_names": [], "rhs_call_name": "row_col_for_index", "annotation": ""}, "snippet": " p_row, p_col = board.row_col_for_index(p_idx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L20_C8", "label": "enemy =", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "vector": [14, 2, 0.2899, 0.0145, 2, 0.18, 0.6, 655, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "enemy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " enemy = board.get_pieces(enemy_color)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L21_C8", "label": "e_idx, e_val =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "vector": [14, 2, 0.3043, 0.0145, 2, 0.18, 0.7, 493, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "e_idx, e_val", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " e_idx, e_val = enemy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L22_C8", "label": "e_row, e_col = row_col_for_index()", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "vector": [14, 2, 0.3188, 0.0145, 2, 0.18, 0.8, 694, 3, 1, 0, 0, 844, 10, 1], "semantic": {"name": "e_row, e_col", "arg_names": [], "import_names": [], "rhs_call_name": "row_col_for_index", "annotation": ""}, "snippet": " e_row, e_col = board.row_col_for_index(e_idx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:If_L25_C8", "label": "if", "type": "if", "loc": [25, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "vector": [4, 2, 0.3768, 0.0435, 2, 0.18, 0.9, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ((p_val & KING) and (e_val & KING) and\n (abs(p_row - e_row) > 2 or abs(p_col - e_col) > 2)):\n return 1.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Return_L27_C12", "label": "return", "type": "return", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:If_L25_C8", "vector": [13, 3, 0.3913, 0.0145, 3, 0.0, 0.0, 0, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 1.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Return_L28_C8", "label": "return", "type": "return", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "vector": [13, 2, 0.4058, 0.0145, 2, 0.18, 1.0, 0, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L30_C4", "label": "setGoal", "type": "function", "loc": [30, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:ClassDef_L5_C0", "vector": [2, 1, 0.4855, 0.1159, 1, 0.09, 1.0, 509, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "setGoal", "arg_names": ["self", "board"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setGoal(self, board):\n player = board.to_move\n board.removeAllSubgoals()\n if player == WHITE:\n goalset = board.addWhiteSubgoal\n else:\n goalset = board.addBlackSubgoal\n goalset(Goal_OneKingAttack(board))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L31_C8", "label": "player =", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L30_C4", "vector": [14, 2, 0.4493, 0.0145, 2, 0.6, 0.0, 895, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "player", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " player = board.to_move"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Expr_L32_C8", "label": "removeAllSubgoals()", "type": "expression", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L30_C4", "vector": [8, 2, 0.4638, 0.0145, 2, 0.6, 0.3333, 594, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "removeAllSubgoals", "arg_names": [], "import_names": [], "rhs_call_name": "removeAllSubgoals", "annotation": ""}, "snippet": " board.removeAllSubgoals()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:If_L33_C8", "label": "if", "type": "if", "loc": [33, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L30_C4", "vector": [4, 2, 0.5, 0.058, 2, 0.6, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if player == WHITE:\n goalset = board.addWhiteSubgoal\n else:\n goalset = board.addBlackSubgoal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L34_C12", "label": "goalset =", "type": "assigned_variable", "loc": [34, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:If_L33_C8", "vector": [14, 3, 0.4928, 0.0145, 3, 0.56, 0.0, 433, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "goalset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " goalset = board.addWhiteSubgoal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L36_C12", "label": "goalset =", "type": "assigned_variable", "loc": [36, 36], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:If_L33_C8", "vector": [14, 3, 0.5217, 0.0145, 3, 0.56, 1.0, 433, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "goalset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " goalset = board.addBlackSubgoal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Expr_L37_C8", "label": "goalset()", "type": "expression", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L30_C4", "vector": [8, 2, 0.5362, 0.0145, 2, 0.6, 1.0, 433, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "goalset", "arg_names": [], "import_names": [], "rhs_call_name": "goalset", "annotation": ""}, "snippet": " goalset(Goal_OneKingAttack(board))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:ClassDef_L39_C0", "label": "OneKingFleeOneKingEvaluator", "type": "class", "loc": [39, 69], "level": 0, "parent": null, "vector": [3, 0, 0.7826, 0.4493, 0, 0.66, 1.0, 317, 0, 3, 0, 0, 985, 0, 9], "semantic": {"name": "OneKingFleeOneKingEvaluator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OneKingFleeOneKingEvaluator(GoalEvaluator):\n def __init__(self, bias):\n GoalEvaluator.__init__(self, bias)\n\n def calculateDesirability(self, board):\n plr_color = board.to_move\n enemy_color = board.enemy\n # if we don't have one man on each side or the player"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L40_C4", "label": "__init__", "type": "function", "loc": [40, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:ClassDef_L39_C0", "vector": [2, 1, 0.587, 0.029, 1, 0.67, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "bias"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, bias):\n GoalEvaluator.__init__(self, bias)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Expr_L41_C8", "label": "__init__()", "type": "expression", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L40_C4", "vector": [8, 2, 0.5942, 0.0145, 2, 0.71, 0.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " GoalEvaluator.__init__(self, bias)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L43_C4", "label": "calculateDesirability", "type": "function", "loc": [43, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:ClassDef_L39_C0", "vector": [2, 1, 0.7464, 0.2609, 1, 0.67, 0.5, 943, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "calculateDesirability", "arg_names": ["self", "board"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def calculateDesirability(self, board):\n plr_color = board.to_move\n enemy_color = board.enemy\n # if we don't have one man on each side or the player\n # has the opposition (meaning we should attack instead),\n # then goal is not applicable.\n if (board.count(BLACK) != 1 or board.count(WHITE) != 1 or\n board.has_opposition(plr_color)):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L44_C8", "label": "plr_color =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L43_C4", "vector": [14, 2, 0.6377, 0.0145, 2, 0.91, 0.0, 95, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "plr_color", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " plr_color = board.to_move"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L45_C8", "label": "enemy_color =", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L43_C4", "vector": [14, 2, 0.6522, 0.0145, 2, 0.91, 0.125, 644, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "enemy_color", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " enemy_color = board.enemy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:If_L49_C8", "label": "if", "type": "if", "loc": [49, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L43_C4", "vector": [4, 2, 0.7246, 0.0435, 2, 0.91, 0.25, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (board.count(BLACK) != 1 or board.count(WHITE) != 1 or\n board.has_opposition(plr_color)):\n return 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Return_L51_C12", "label": "return", "type": "return", "loc": [51, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:If_L49_C8", "vector": [13, 3, 0.7391, 0.0145, 3, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L52_C8", "label": "player =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L43_C4", "vector": [14, 2, 0.7536, 0.0145, 2, 0.91, 0.375, 895, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "player", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " player = board.get_pieces(plr_color)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L53_C8", "label": "p_idx, p_val =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L43_C4", "vector": [14, 2, 0.7681, 0.0145, 2, 0.91, 0.5, 959, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "p_idx, p_val", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " p_idx, p_val = player"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L54_C8", "label": "enemy =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L43_C4", "vector": [14, 2, 0.7826, 0.0145, 2, 0.91, 0.625, 655, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "enemy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " enemy = board.get_pieces(enemy_color)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L55_C8", "label": "e_idx, e_val =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L43_C4", "vector": [14, 2, 0.7971, 0.0145, 2, 0.91, 0.75, 493, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "e_idx, e_val", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " e_idx, e_val = enemy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:If_L58_C8", "label": "if", "type": "if", "loc": [58, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L43_C4", "vector": [4, 2, 0.8478, 0.029, 2, 0.91, 0.875, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not ((p_val & KING) and (e_val & KING)):\n return 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Return_L59_C12", "label": "return", "type": "return", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:If_L58_C8", "vector": [13, 3, 0.8551, 0.0145, 3, 0.47, 0.0, 0, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Return_L60_C8", "label": "return", "type": "return", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L43_C4", "vector": [13, 2, 0.8696, 0.0145, 2, 0.91, 1.0, 0, 1, 0, 0, 0, 0, 2, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 1.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L62_C4", "label": "setGoal", "type": "function", "loc": [62, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:ClassDef_L39_C0", "vector": [2, 1, 0.9493, 0.1159, 1, 0.67, 1.0, 509, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "setGoal", "arg_names": ["self", "board"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setGoal(self, board):\n player = board.to_move\n board.removeAllSubgoals()\n if player == WHITE:\n goalset = board.addWhiteSubgoal\n else:\n goalset = board.addBlackSubgoal\n goalset(Goal_OneKingFlee(board))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L63_C8", "label": "player =", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L62_C4", "vector": [14, 2, 0.913, 0.0145, 2, 0.12, 0.0, 895, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "player", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " player = board.to_move"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Expr_L64_C8", "label": "removeAllSubgoals()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L62_C4", "vector": [8, 2, 0.9275, 0.0145, 2, 0.12, 0.3333, 594, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "removeAllSubgoals", "arg_names": [], "import_names": [], "rhs_call_name": "removeAllSubgoals", "annotation": ""}, "snippet": " board.removeAllSubgoals()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:If_L65_C8", "label": "if", "type": "if", "loc": [65, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L62_C4", "vector": [4, 2, 0.9638, 0.058, 2, 0.12, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if player == WHITE:\n goalset = board.addWhiteSubgoal\n else:\n goalset = board.addBlackSubgoal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L66_C12", "label": "goalset =", "type": "assigned_variable", "loc": [66, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:If_L65_C8", "vector": [14, 3, 0.9565, 0.0145, 3, 0.88, 0.0, 433, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "goalset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " goalset = board.addWhiteSubgoal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L68_C12", "label": "goalset =", "type": "assigned_variable", "loc": [68, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:If_L65_C8", "vector": [14, 3, 0.9855, 0.0145, 3, 0.88, 1.0, 433, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "goalset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " goalset = board.addBlackSubgoal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_374:Expr_L69_C8", "label": "goalset()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L62_C4", "vector": [8, 2, 1.0, 0.0145, 2, 0.12, 1.0, 433, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "goalset", "arg_names": [], "import_names": [], "rhs_call_name": "goalset", "annotation": ""}, "snippet": " goalset(Goal_OneKingFlee(board))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_374:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Expr_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:If_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:If_L14_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Return_L16_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:If_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:If_L25_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Return_L27_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Return_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Expr_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:If_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L36_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Expr_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:If_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:If_L49_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Return_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:If_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Return_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Return_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Expr_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:If_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:If_L65_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L66_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:If_L65_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Assign_L68_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_374:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_374:Expr_L69_C8"}] |
from Tkinter import *
class CenteredWindow:
def __init__(self, root):
self.root = root
self.root.after_idle(self.center_on_screen)
self.root.update()
def center_on_screen(self):
self.root.update_idletasks()
sw = self.root.winfo_screenwidth()
sh = self.root.winfo_screenheight()
w = self.root.winfo_reqwidth()
h = self.root.winfo_reqheight()
new_geometry = "+%d+%d" % ((sw-w)/2, (sh-h)/2)
self.root.geometry(newGeometry=new_geometry) | ajibawa-2023/Python-Code-Large/train/row_375 | 14 | 16 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_375:ImportFrom_L1_C0", "label": "from Tkinter import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0625, 0.0625, 0, 0.66, 0.0, 368, 0, 1, 0, 0, 368, 0, 0], "semantic": {"name": "Tkinter", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from Tkinter import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_375:ClassDef_L3_C0", "label": "CenteredWindow", "type": "class", "loc": [3, 16], "level": 0, "parent": null, "vector": [3, 0, 0.5938, 0.875, 0, 0.66, 1.0, 592, 0, 2, 0, 0, 0, 0, 8], "semantic": {"name": "CenteredWindow", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CenteredWindow:\n def __init__(self, root):\n self.root = root\n self.root.after_idle(self.center_on_screen)\n self.root.update()\n\n def center_on_screen(self):\n self.root.update_idletasks()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L4_C4", "label": "__init__", "type": "function", "loc": [4, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_375:ClassDef_L3_C0", "vector": [2, 1, 0.3438, 0.25, 1, 0.19, 0.0, 555, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "root"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, root):\n self.root = root\n self.root.after_idle(self.center_on_screen)\n self.root.update()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_375:Assign_L5_C8", "label": "self.root =", "type": "assigned_variable", "loc": [5, 5], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L4_C4", "vector": [14, 2, 0.3125, 0.0625, 2, 0.01, 0.0, 81, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.root", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.root = root"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_375:Expr_L6_C8", "label": "after_idle()", "type": "expression", "loc": [6, 6], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L4_C4", "vector": [8, 2, 0.375, 0.0625, 2, 0.01, 0.5, 370, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "after_idle", "arg_names": [], "import_names": [], "rhs_call_name": "after_idle", "annotation": ""}, "snippet": " self.root.after_idle(self.center_on_screen)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_375:Expr_L7_C8", "label": "update()", "type": "expression", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L4_C4", "vector": [8, 2, 0.4375, 0.0625, 2, 0.01, 1.0, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.root.update()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L9_C4", "label": "center_on_screen", "type": "function", "loc": [9, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_375:ClassDef_L3_C0", "vector": [2, 1, 0.7812, 0.5, 1, 0.19, 1.0, 79, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "center_on_screen", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def center_on_screen(self):\n self.root.update_idletasks()\n sw = self.root.winfo_screenwidth()\n sh = self.root.winfo_screenheight()\n w = self.root.winfo_reqwidth()\n h = self.root.winfo_reqheight()\n new_geometry = \"+%d+%d\" % ((sw-w)/2, (sh-h)/2)\n self.root.geometry(newGeometry=new_geometry)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_375:Expr_L10_C8", "label": "update_idletasks()", "type": "expression", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L9_C4", "vector": [8, 2, 0.625, 0.0625, 2, 0.97, 0.0, 392, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "update_idletasks", "arg_names": [], "import_names": [], "rhs_call_name": "update_idletasks", "annotation": ""}, "snippet": " self.root.update_idletasks()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_375:Assign_L11_C8", "label": "sw = winfo_screenwidth()", "type": "assigned_variable", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L9_C4", "vector": [14, 2, 0.6875, 0.0625, 2, 0.97, 0.1667, 945, 3, 0, 0, 0, 791, 10, 1], "semantic": {"name": "sw", "arg_names": [], "import_names": [], "rhs_call_name": "winfo_screenwidth", "annotation": ""}, "snippet": " sw = self.root.winfo_screenwidth()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_375:Assign_L12_C8", "label": "sh = winfo_screenheight()", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L9_C4", "vector": [14, 2, 0.75, 0.0625, 2, 0.97, 0.3333, 437, 3, 0, 0, 0, 934, 10, 1], "semantic": {"name": "sh", "arg_names": [], "import_names": [], "rhs_call_name": "winfo_screenheight", "annotation": ""}, "snippet": " sh = self.root.winfo_screenheight()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_375:Assign_L13_C8", "label": "w = winfo_reqwidth()", "type": "assigned_variable", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L9_C4", "vector": [14, 2, 0.8125, 0.0625, 2, 0.97, 0.5, 549, 3, 0, 0, 0, 592, 10, 1], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "winfo_reqwidth", "annotation": ""}, "snippet": " w = self.root.winfo_reqwidth()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_375:Assign_L14_C8", "label": "h = winfo_reqheight()", "type": "assigned_variable", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L9_C4", "vector": [14, 2, 0.875, 0.0625, 2, 0.97, 0.6667, 686, 3, 0, 0, 0, 149, 10, 1], "semantic": {"name": "h", "arg_names": [], "import_names": [], "rhs_call_name": "winfo_reqheight", "annotation": ""}, "snippet": " h = self.root.winfo_reqheight()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_375:Assign_L15_C8", "label": "new_geometry =", "type": "assigned_variable", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L9_C4", "vector": [14, 2, 0.9375, 0.0625, 2, 0.97, 0.8333, 362, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_geometry", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_geometry = \"+%d+%d\" % ((sw-w)/2, (sh-h)/2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_375:Expr_L16_C8", "label": "geometry()", "type": "expression", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L9_C4", "vector": [8, 2, 1.0, 0.0625, 2, 0.97, 1.0, 486, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "geometry", "arg_names": [], "import_names": [], "rhs_call_name": "geometry", "annotation": ""}, "snippet": " self.root.geometry(newGeometry=new_geometry)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_375:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_375:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_375:Expr_L6_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_375:Expr_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_375:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_375:Expr_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_375:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_375:Assign_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_375:Assign_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_375:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_375:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_375:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_375:Expr_L16_C8"}] |
import sys
from goal import Goal
from composite import CompositeGoal
class Goal_OneKingFlee(CompositeGoal):
def __init__(self, owner):
CompositeGoal.__init__(self, owner)
def activate(self):
self.status = self.ACTIVE
self.removeAllSubgoals()
# because goals are *pushed* onto the front of the subgoal list they must
# be added in reverse order.
self.addSubgoal(Goal_MoveTowardNearestDoubleCorner(self.owner))
self.addSubgoal(Goal_SeeSaw(self.owner))
def process(self):
self.activateIfInactive()
return self.processSubgoals()
def terminate(self):
self.status = self.INACTIVE
class Goal_MoveTowardBestDoubleCorner(Goal):
def __init__(self, owner):
Goal.__init__(self, owner)
self.dc = [8, 13, 27, 32]
def activate(self):
self.status = self.ACTIVE
def process(self):
# if status is inactive, activate
self.activateIfInactive()
# only moves (not captures) are a valid goal
if self.owner.captures:
self.status = self.FAILED
return
# identify player king and enemy king
plr_color = self.owner.to_move
enemy_color = self.owner.enemy
player = self.owner.get_pieces(plr_color)[0]
p_idx, _ = player
p_row, p_col = self.owner.row_col_for_index(p_idx)
enemy = self.owner.get_pieces(enemy_color)[0]
e_idx, _ = enemy
e_row, e_col = self.owner.row_col_for_index(e_idx)
# pick DC that isn't blocked by enemy
lowest_dist = sys.maxint
dc = 0
for i in self.dc:
dc_row, dc_col = self.owner.row_col_for_index(i)
pdist = abs(dc_row - p_row) + abs(dc_col - p_col)
edist = abs(dc_row - e_row) + abs(dc_col - e_col)
if pdist < lowest_dist and edist > pdist:
lowest_dist = pdist
dc = i
# if lowest distance is 0, then goal is complete.
if lowest_dist == 0:
self.status = self.COMPLETED
return
# select the available move that decreases the distance
# between the original player position and the chosen double corner.
# If no such move exists, the goal has failed.
dc_row, dc_col = self.owner.row_col_for_index(dc)
good_move = None
for m in self.owner.moves:
# try a move and gather the new row & col for the player
self.owner.make_move(m, False, False)
plr_update = self.owner.get_pieces(plr_color)[0]
pu_idx, _ = plr_update
pu_row, pu_col = self.owner.row_col_for_index(pu_idx)
self.owner.undo_move(m, False, False)
new_diff = abs(pu_row - dc_row) + abs(pu_col - dc_col)
if new_diff < lowest_dist:
good_move = m
break
if good_move:
self.owner.make_move(good_move, True, True)
else:
self.status = self.FAILED
def terminate(self):
self.status = self.INACTIVE
class Goal_SeeSaw(Goal):
def __init__(self, owner):
Goal.__init__(self, owner)
def activate(self):
self.status = self.ACTIVE
def process(self):
# for now, I'm not even sure I need this goal, but I'm saving it
# as a placeholder.
self.status = self.COMPLETED
def terminate(self):
self.status = self.INACTIVE
| ajibawa-2023/Python-Code-Large/train/row_376 | 72 | 105 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_376:Import_L1_C0", "label": "sys import sys", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0095, 0.0095, 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_376:ImportFrom_L2_C0", "label": "from goal import Goal", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.019, 0.0095, 0, 0.66, 0.2, 914, 0, 1, 0, 0, 914, 0, 0], "semantic": {"name": "goal", "arg_names": [], "import_names": ["Goal"], "rhs_call_name": "", "annotation": ""}, "snippet": "from goal import Goal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:ImportFrom_L3_C0", "label": "from composite import CompositeGoal", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0286, 0.0095, 0, 0.66, 0.4, 334, 0, 1, 0, 0, 334, 0, 0], "semantic": {"name": "composite", "arg_names": [], "import_names": ["CompositeGoal"], "rhs_call_name": "", "annotation": ""}, "snippet": "from composite import CompositeGoal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L5_C0", "label": "Goal_OneKingFlee", "type": "class", "loc": [5, 22], "level": 0, "parent": null, "vector": [3, 0, 0.1286, 0.1714, 0, 0.66, 0.6, 885, 0, 4, 0, 0, 409, 0, 8], "semantic": {"name": "Goal_OneKingFlee", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Goal_OneKingFlee(CompositeGoal):\n def __init__(self, owner):\n CompositeGoal.__init__(self, owner)\n\n def activate(self):\n self.status = self.ACTIVE\n self.removeAllSubgoals()\n # because goals are *pushed* onto the front of the subgoal list they must"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L6_C4", "label": "__init__", "type": "function", "loc": [6, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L5_C0", "vector": [2, 1, 0.0619, 0.019, 1, 0.03, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "owner"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, owner):\n CompositeGoal.__init__(self, owner)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Expr_L7_C8", "label": "__init__()", "type": "expression", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L6_C4", "vector": [8, 2, 0.0667, 0.0095, 2, 0.12, 0.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " CompositeGoal.__init__(self, owner)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L9_C4", "label": "activate", "type": "function", "loc": [9, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L5_C0", "vector": [2, 1, 0.1143, 0.0667, 1, 0.03, 0.3333, 177, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "activate", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def activate(self):\n self.status = self.ACTIVE\n self.removeAllSubgoals()\n # because goals are *pushed* onto the front of the subgoal list they must\n # be added in reverse order.\n self.addSubgoal(Goal_MoveTowardNearestDoubleCorner(self.owner))\n self.addSubgoal(Goal_SeeSaw(self.owner))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L10_C8", "label": "self.status =", "type": "assigned_variable", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L9_C4", "vector": [14, 2, 0.0952, 0.0095, 2, 0.85, 0.0, 651, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.status = self.ACTIVE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Expr_L11_C8", "label": "removeAllSubgoals()", "type": "expression", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L9_C4", "vector": [8, 2, 0.1048, 0.0095, 2, 0.85, 0.3333, 594, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "removeAllSubgoals", "arg_names": [], "import_names": [], "rhs_call_name": "removeAllSubgoals", "annotation": ""}, "snippet": " self.removeAllSubgoals()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Expr_L14_C8", "label": "addSubgoal()", "type": "expression", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L9_C4", "vector": [8, 2, 0.1333, 0.0095, 2, 0.85, 0.6667, 314, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "addSubgoal", "arg_names": [], "import_names": [], "rhs_call_name": "addSubgoal", "annotation": ""}, "snippet": " self.addSubgoal(Goal_MoveTowardNearestDoubleCorner(self.owner))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Expr_L15_C8", "label": "addSubgoal()", "type": "expression", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L9_C4", "vector": [8, 2, 0.1429, 0.0095, 2, 0.85, 1.0, 314, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "addSubgoal", "arg_names": [], "import_names": [], "rhs_call_name": "addSubgoal", "annotation": ""}, "snippet": " self.addSubgoal(Goal_SeeSaw(self.owner))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L17_C4", "label": "process", "type": "function", "loc": [17, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L5_C0", "vector": [2, 1, 0.1714, 0.0286, 1, 0.03, 0.6667, 712, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "process", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def process(self):\n self.activateIfInactive()\n return self.processSubgoals()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Expr_L18_C8", "label": "activateIfInactive()", "type": "expression", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L17_C4", "vector": [8, 2, 0.1714, 0.0095, 2, 0.04, 0.0, 576, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "activateIfInactive", "arg_names": [], "import_names": [], "rhs_call_name": "activateIfInactive", "annotation": ""}, "snippet": " self.activateIfInactive()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Return_L19_C8", "label": "return", "type": "return", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L17_C4", "vector": [13, 2, 0.181, 0.0095, 2, 0.04, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.processSubgoals()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L21_C4", "label": "terminate", "type": "function", "loc": [21, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L5_C0", "vector": [2, 1, 0.2048, 0.019, 1, 0.03, 1.0, 617, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "terminate", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def terminate(self):\n self.status = self.INACTIVE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L22_C8", "label": "self.status =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L21_C4", "vector": [14, 2, 0.2095, 0.0095, 2, 0.24, 0.0, 651, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.status = self.INACTIVE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L24_C0", "label": "Goal_MoveTowardBestDoubleCorner", "type": "class", "loc": [24, 89], "level": 0, "parent": null, "vector": [3, 0, 0.5381, 0.6286, 0, 0.66, 0.8, 131, 0, 4, 0, 0, 302, 0, 19], "semantic": {"name": "Goal_MoveTowardBestDoubleCorner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Goal_MoveTowardBestDoubleCorner(Goal):\n def __init__(self, owner):\n Goal.__init__(self, owner)\n self.dc = [8, 13, 27, 32]\n\n def activate(self):\n self.status = self.ACTIVE\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L25_C4", "label": "__init__", "type": "function", "loc": [25, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L24_C0", "vector": [2, 1, 0.2476, 0.0286, 1, 0.36, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "owner"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, owner):\n Goal.__init__(self, owner)\n self.dc = [8, 13, 27, 32]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Expr_L26_C8", "label": "__init__()", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L25_C4", "vector": [8, 2, 0.2476, 0.0095, 2, 0.53, 0.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " Goal.__init__(self, owner)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L27_C8", "label": "self.dc =", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L25_C4", "vector": [14, 2, 0.2571, 0.0095, 2, 0.53, 1.0, 544, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.dc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dc = [8, 13, 27, 32]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L29_C4", "label": "activate", "type": "function", "loc": [29, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L24_C0", "vector": [2, 1, 0.281, 0.019, 1, 0.36, 0.3333, 177, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "activate", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def activate(self):\n self.status = self.ACTIVE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L30_C8", "label": "self.status =", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L29_C4", "vector": [14, 2, 0.2857, 0.0095, 2, 0.11, 0.0, 651, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.status = self.ACTIVE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "label": "process", "type": "function", "loc": [32, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L24_C0", "vector": [2, 1, 0.5619, 0.5238, 1, 0.36, 0.6667, 712, 0, 1, 0, 0, 0, 0, 18], "semantic": {"name": "process", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def process(self):\n # if status is inactive, activate\n self.activateIfInactive()\n \n # only moves (not captures) are a valid goal\n if self.owner.captures:\n self.status = self.FAILED\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Expr_L34_C8", "label": "activateIfInactive()", "type": "expression", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "vector": [8, 2, 0.3238, 0.0095, 2, 0.24, 0.0, 576, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "activateIfInactive", "arg_names": [], "import_names": [], "rhs_call_name": "activateIfInactive", "annotation": ""}, "snippet": " self.activateIfInactive()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:If_L37_C8", "label": "if", "type": "if", "loc": [37, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "vector": [4, 2, 0.3619, 0.0286, 2, 0.24, 0.0588, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.owner.captures:\n self.status = self.FAILED\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L38_C12", "label": "self.status =", "type": "assigned_variable", "loc": [38, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:If_L37_C8", "vector": [14, 3, 0.3619, 0.0095, 3, 0.29, 0.0, 651, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.status = self.FAILED"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Return_L39_C12", "label": "return", "type": "return", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:If_L37_C8", "vector": [13, 3, 0.3714, 0.0095, 3, 0.29, 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_376:Assign_L42_C8", "label": "plr_color =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "vector": [14, 2, 0.4, 0.0095, 2, 0.24, 0.1176, 95, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "plr_color", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " plr_color = self.owner.to_move"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L43_C8", "label": "enemy_color =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "vector": [14, 2, 0.4095, 0.0095, 2, 0.24, 0.1765, 644, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "enemy_color", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " enemy_color = self.owner.enemy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L44_C8", "label": "player =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "vector": [14, 2, 0.419, 0.0095, 2, 0.24, 0.2353, 895, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "player", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " player = self.owner.get_pieces(plr_color)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L45_C8", "label": "p_idx, _ =", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "vector": [14, 2, 0.4286, 0.0095, 2, 0.24, 0.2941, 338, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "p_idx, _", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " p_idx, _ = player"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L46_C8", "label": "p_row, p_col = row_col_for_index()", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "vector": [14, 2, 0.4381, 0.0095, 2, 0.24, 0.3529, 948, 3, 1, 0, 0, 844, 10, 1], "semantic": {"name": "p_row, p_col", "arg_names": [], "import_names": [], "rhs_call_name": "row_col_for_index", "annotation": ""}, "snippet": " p_row, p_col = self.owner.row_col_for_index(p_idx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L47_C8", "label": "enemy =", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "vector": [14, 2, 0.4476, 0.0095, 2, 0.24, 0.4118, 655, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "enemy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " enemy = self.owner.get_pieces(enemy_color)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L48_C8", "label": "e_idx, _ =", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "vector": [14, 2, 0.4571, 0.0095, 2, 0.24, 0.4706, 131, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "e_idx, _", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " e_idx, _ = enemy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L49_C8", "label": "e_row, e_col = row_col_for_index()", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "vector": [14, 2, 0.4667, 0.0095, 2, 0.24, 0.5294, 694, 3, 1, 0, 0, 844, 10, 1], "semantic": {"name": "e_row, e_col", "arg_names": [], "import_names": [], "rhs_call_name": "row_col_for_index", "annotation": ""}, "snippet": " e_row, e_col = self.owner.row_col_for_index(e_idx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L52_C8", "label": "lowest_dist =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "vector": [14, 2, 0.4952, 0.0095, 2, 0.24, 0.5882, 766, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lowest_dist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lowest_dist = sys.maxint"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L53_C8", "label": "dc =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "vector": [14, 2, 0.5048, 0.0095, 2, 0.24, 0.6471, 108, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "dc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dc = 0 "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:For_L54_C8", "label": "for i", "type": "for", "loc": [54, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "vector": [6, 2, 0.5429, 0.0667, 2, 0.24, 0.7059, 826, 7, 0, 0, 0, 0, 0, 5], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in self.dc:\n dc_row, dc_col = self.owner.row_col_for_index(i)\n pdist = abs(dc_row - p_row) + abs(dc_col - p_col)\n edist = abs(dc_row - e_row) + abs(dc_col - e_col)\n if pdist < lowest_dist and edist > pdist:\n lowest_dist = pdist\n dc = i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L55_C12", "label": "dc_row, dc_col = row_col_for_index()", "type": "assigned_variable", "loc": [55, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:For_L54_C8", "vector": [14, 3, 0.5238, 0.0095, 3, 0.82, 0.0, 819, 3, 1, 0, 0, 844, 10, 1], "semantic": {"name": "dc_row, dc_col", "arg_names": [], "import_names": [], "rhs_call_name": "row_col_for_index", "annotation": ""}, "snippet": " dc_row, dc_col = self.owner.row_col_for_index(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L56_C12", "label": "pdist =", "type": "assigned_variable", "loc": [56, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:For_L54_C8", "vector": [14, 3, 0.5333, 0.0095, 3, 0.82, 0.3333, 132, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "pdist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pdist = abs(dc_row - p_row) + abs(dc_col - p_col)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L57_C12", "label": "edist =", "type": "assigned_variable", "loc": [57, 57], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:For_L54_C8", "vector": [14, 3, 0.5429, 0.0095, 3, 0.82, 0.6667, 673, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "edist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " edist = abs(dc_row - e_row) + abs(dc_col - e_col)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:If_L58_C12", "label": "if", "type": "if", "loc": [58, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:For_L54_C8", "vector": [4, 3, 0.5619, 0.0286, 3, 0.82, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if pdist < lowest_dist and edist > pdist:\n lowest_dist = pdist\n dc = i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L59_C16", "label": "lowest_dist =", "type": "assigned_variable", "loc": [59, 59], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:If_L58_C12", "vector": [14, 4, 0.5619, 0.0095, 4, 0.97, 0.0, 766, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lowest_dist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lowest_dist = pdist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L60_C16", "label": "dc =", "type": "assigned_variable", "loc": [60, 60], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:If_L58_C12", "vector": [14, 4, 0.5714, 0.0095, 4, 0.97, 1.0, 108, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dc = i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:If_L63_C8", "label": "if", "type": "if", "loc": [63, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "vector": [4, 2, 0.6095, 0.0286, 2, 0.24, 0.7647, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lowest_dist == 0:\n self.status = self.COMPLETED\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L64_C12", "label": "self.status =", "type": "assigned_variable", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:If_L63_C8", "vector": [14, 3, 0.6095, 0.0095, 3, 0.99, 0.0, 651, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.status = self.COMPLETED"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Return_L65_C12", "label": "return", "type": "return", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:If_L63_C8", "vector": [13, 3, 0.619, 0.0095, 3, 0.99, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L70_C8", "label": "dc_row, dc_col = row_col_for_index()", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "vector": [14, 2, 0.6667, 0.0095, 2, 0.24, 0.8235, 819, 3, 1, 0, 0, 844, 10, 1], "semantic": {"name": "dc_row, dc_col", "arg_names": [], "import_names": [], "rhs_call_name": "row_col_for_index", "annotation": ""}, "snippet": " dc_row, dc_col = self.owner.row_col_for_index(dc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L71_C8", "label": "good_move =", "type": "assigned_variable", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "vector": [14, 2, 0.6762, 0.0095, 2, 0.24, 0.8824, 287, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "good_move", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " good_move = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:For_L72_C8", "label": "for m", "type": "for", "loc": [72, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "vector": [6, 2, 0.7333, 0.1048, 2, 0.24, 0.9412, 711, 7, 0, 0, 0, 0, 0, 6], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for m in self.owner.moves:\n # try a move and gather the new row & col for the player\n self.owner.make_move(m, False, False)\n plr_update = self.owner.get_pieces(plr_color)[0]\n pu_idx, _ = plr_update\n pu_row, pu_col = self.owner.row_col_for_index(pu_idx)\n self.owner.undo_move(m, False, False)\n new_diff = abs(pu_row - dc_row) + abs(pu_col - dc_col)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Expr_L74_C12", "label": "make_move()", "type": "expression", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:For_L72_C8", "vector": [8, 3, 0.7048, 0.0095, 3, 0.57, 0.0, 580, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "make_move", "arg_names": [], "import_names": [], "rhs_call_name": "make_move", "annotation": ""}, "snippet": " self.owner.make_move(m, False, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L75_C12", "label": "plr_update =", "type": "assigned_variable", "loc": [75, 75], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:For_L72_C8", "vector": [14, 3, 0.7143, 0.0095, 3, 0.57, 0.1667, 425, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "plr_update", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " plr_update = self.owner.get_pieces(plr_color)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L76_C12", "label": "pu_idx, _ =", "type": "assigned_variable", "loc": [76, 76], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:For_L72_C8", "vector": [14, 3, 0.7238, 0.0095, 3, 0.57, 0.3333, 371, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pu_idx, _", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pu_idx, _ = plr_update"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L77_C12", "label": "pu_row, pu_col = row_col_for_index()", "type": "assigned_variable", "loc": [77, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:For_L72_C8", "vector": [14, 3, 0.7333, 0.0095, 3, 0.57, 0.5, 823, 3, 1, 0, 0, 844, 10, 1], "semantic": {"name": "pu_row, pu_col", "arg_names": [], "import_names": [], "rhs_call_name": "row_col_for_index", "annotation": ""}, "snippet": " pu_row, pu_col = self.owner.row_col_for_index(pu_idx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Expr_L78_C12", "label": "undo_move()", "type": "expression", "loc": [78, 78], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:For_L72_C8", "vector": [8, 3, 0.7429, 0.0095, 3, 0.57, 0.6667, 752, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "undo_move", "arg_names": [], "import_names": [], "rhs_call_name": "undo_move", "annotation": ""}, "snippet": " self.owner.undo_move(m, False, False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L79_C12", "label": "new_diff =", "type": "assigned_variable", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:For_L72_C8", "vector": [14, 3, 0.7524, 0.0095, 3, 0.57, 0.8333, 774, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "new_diff", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_diff = abs(pu_row - dc_row) + abs(pu_col - dc_col)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:If_L80_C12", "label": "if", "type": "if", "loc": [80, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:For_L72_C8", "vector": [4, 3, 0.7714, 0.0286, 3, 0.57, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if new_diff < lowest_dist:\n good_move = m\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L81_C16", "label": "good_move =", "type": "assigned_variable", "loc": [81, 81], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:If_L80_C12", "vector": [14, 4, 0.7714, 0.0095, 4, 0.69, 0.0, 287, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "good_move", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " good_move = m"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:If_L83_C8", "label": "if", "type": "if", "loc": [83, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "vector": [4, 2, 0.8048, 0.0381, 2, 0.24, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if good_move:\n self.owner.make_move(good_move, True, True)\n else:\n self.status = self.FAILED"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Expr_L84_C12", "label": "make_move()", "type": "expression", "loc": [84, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:If_L83_C8", "vector": [8, 3, 0.8, 0.0095, 3, 0.98, 0.0, 580, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "make_move", "arg_names": [], "import_names": [], "rhs_call_name": "make_move", "annotation": ""}, "snippet": " self.owner.make_move(good_move, True, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L86_C12", "label": "self.status =", "type": "assigned_variable", "loc": [86, 86], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:If_L83_C8", "vector": [14, 3, 0.819, 0.0095, 3, 0.98, 1.0, 651, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.status = self.FAILED"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L88_C4", "label": "terminate", "type": "function", "loc": [88, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L24_C0", "vector": [2, 1, 0.8429, 0.019, 1, 0.36, 1.0, 617, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "terminate", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def terminate(self):\n self.status = self.INACTIVE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L89_C8", "label": "self.status =", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L88_C4", "vector": [14, 2, 0.8476, 0.0095, 2, 0.73, 0.0, 651, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.status = self.INACTIVE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L91_C0", "label": "Goal_SeeSaw", "type": "class", "loc": [91, 104], "level": 0, "parent": null, "vector": [3, 0, 0.9286, 0.1333, 0, 0.66, 1.0, 264, 0, 4, 0, 0, 302, 0, 1], "semantic": {"name": "Goal_SeeSaw", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Goal_SeeSaw(Goal):\n def __init__(self, owner):\n Goal.__init__(self, owner)\n\n def activate(self):\n self.status = self.ACTIVE\n\n def process(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L92_C4", "label": "__init__", "type": "function", "loc": [92, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L91_C0", "vector": [2, 1, 0.881, 0.019, 1, 0.81, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "owner"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, owner):\n Goal.__init__(self, owner)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Expr_L93_C8", "label": "__init__()", "type": "expression", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L92_C4", "vector": [8, 2, 0.8857, 0.0095, 2, 0.45, 0.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " Goal.__init__(self, owner)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L95_C4", "label": "activate", "type": "function", "loc": [95, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L91_C0", "vector": [2, 1, 0.9095, 0.019, 1, 0.81, 0.3333, 177, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "activate", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def activate(self):\n self.status = self.ACTIVE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L96_C8", "label": "self.status =", "type": "assigned_variable", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L95_C4", "vector": [14, 2, 0.9143, 0.0095, 2, 0.55, 0.0, 651, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.status = self.ACTIVE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L98_C4", "label": "process", "type": "function", "loc": [98, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L91_C0", "vector": [2, 1, 0.9476, 0.0381, 1, 0.81, 0.6667, 712, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "process", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def process(self):\n # for now, I'm not even sure I need this goal, but I'm saving it\n # as a placeholder.\n self.status = self.COMPLETED"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L101_C8", "label": "self.status =", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L98_C4", "vector": [14, 2, 0.9619, 0.0095, 2, 0.74, 0.0, 651, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.status = self.COMPLETED"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L103_C4", "label": "terminate", "type": "function", "loc": [103, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L91_C0", "vector": [2, 1, 0.9857, 0.019, 1, 0.81, 1.0, 617, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "terminate", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def terminate(self):\n self.status = self.INACTIVE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L104_C8", "label": "self.status =", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L103_C4", "vector": [14, 2, 0.9905, 0.0095, 2, 0.83, 0.0, 651, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.status = self.INACTIVE"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Expr_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Expr_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Expr_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Expr_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Expr_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Return_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Expr_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:If_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Return_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:For_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:For_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:For_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L56_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:For_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:For_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_376:If_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:If_L58_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L59_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:If_L58_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L60_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:If_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:If_L63_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L64_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:If_L63_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Return_L65_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:For_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:For_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Expr_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:For_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L75_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:For_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:For_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L77_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:For_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Expr_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:For_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:For_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_376:If_L80_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:If_L80_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L81_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:If_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:If_L83_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Expr_L84_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:If_L83_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L86_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Expr_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L95_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:ClassDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_376:FunctionDef_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_376:Assign_L104_C8"}] |
class Move(object):
def __init__(self, squares, annotation=''):
self.affected_squares = squares
self.annotation = annotation
def __repr__(self):
return str(self.affected_squares)
| ajibawa-2023/Python-Code-Large/train/row_380 | 6 | 7 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_380:ClassDef_L1_C0", "label": "Move", "type": "class", "loc": [1, 7], "level": 0, "parent": null, "vector": [3, 0, 0.5714, 1.0, 0, 0.66, 0.0, 512, 0, 2, 0, 0, 186, 0, 1], "semantic": {"name": "Move", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Move(object):\n def __init__(self, squares, annotation=''):\n self.affected_squares = squares\n self.annotation = annotation\n\n def __repr__(self):\n return str(self.affected_squares)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_380:FunctionDef_L2_C4", "label": "__init__", "type": "function", "loc": [2, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_380:ClassDef_L1_C0", "vector": [2, 1, 0.4286, 0.4286, 1, 0.24, 0.0, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "squares", "annotation"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, squares, annotation=''):\n self.affected_squares = squares\n self.annotation = annotation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_380:Assign_L3_C8", "label": "self.affected_squares =", "type": "assigned_variable", "loc": [3, 3], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_380:FunctionDef_L2_C4", "vector": [14, 2, 0.4286, 0.1429, 2, 0.14, 0.0, 937, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.affected_squares", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.affected_squares = squares"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_380:Assign_L4_C8", "label": "self.annotation =", "type": "assigned_variable", "loc": [4, 4], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_380:FunctionDef_L2_C4", "vector": [14, 2, 0.5714, 0.1429, 2, 0.14, 1.0, 139, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.annotation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.annotation = annotation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_380:FunctionDef_L6_C4", "label": "__repr__", "type": "function", "loc": [6, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_380:ClassDef_L1_C0", "vector": [2, 1, 0.9286, 0.2857, 1, 0.24, 1.0, 204, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__repr__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __repr__(self):\n return str(self.affected_squares)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_380:Return_L7_C8", "label": "return", "type": "return", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_380:FunctionDef_L6_C4", "vector": [13, 2, 1.0, 0.1429, 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 str(self.affected_squares)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_380:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_380:FunctionDef_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_380:FunctionDef_L2_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_380:Assign_L3_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_380:FunctionDef_L2_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_380:Assign_L4_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_380:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_380:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_380:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_380:Return_L7_C8"}] |
from Tkinter import *
from tkSimpleDialog import Dialog
from globalconst import *
class AboutBox(Dialog):
def body(self, master):
self.canvas = Canvas(self, width=300, height=275)
self.canvas.pack(side=TOP, fill=BOTH, expand=0)
self.canvas.create_text(152,47,text='Raven', fill='black',
font=('Helvetica', 36))
self.canvas.create_text(150,45,text='Raven', fill='white',
font=('Helvetica', 36))
self.canvas.create_text(150,85,text='Version '+ VERSION,
fill='black',
font=('Helvetica', 12))
self.canvas.create_text(150,115,text='An open source checkers program',
fill='black',
font=('Helvetica', 10))
self.canvas.create_text(150,130,text='by Brandon Corfman',
fill='black',
font=('Helvetica', 10))
self.canvas.create_text(150,160,text='Evaluation function translated from',
fill='black',
font=('Helvetica', 10))
self.canvas.create_text(150,175,text="Martin Fierz's Simple Checkers",
fill='black',
font=('Helvetica', 10))
self.canvas.create_text(150,205,text="Alpha-beta search code written by",
fill='black',
font=('Helvetica', 10))
self.canvas.create_text(150,220,text="Peter Norvig for the AIMA project;",
fill='black',
font=('Helvetica', 10))
self.canvas.create_text(150,235,text="adopted for checkers usage",
fill='black',
font=('Helvetica', 10))
self.canvas.create_text(150,250,text="by Brandon Corfman",
fill='black',
font=('Helvetica', 10))
return self.canvas
def cancel(self, event=None):
self.destroy()
def buttonbox(self):
self.button = Button(self, text='OK', padx='5m', command=self.cancel)
self.blank = Canvas(self, width=10, height=20)
self.blank.pack(side=BOTTOM, fill=BOTH, expand=0)
self.button.pack(side=BOTTOM)
self.button.focus_set()
self.bind("<Escape>", self.cancel)
| ajibawa-2023/Python-Code-Large/train/row_382 | 28 | 51 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_382:ImportFrom_L1_C0", "label": "from Tkinter import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0196, 0.0196, 0, 0.66, 0.0, 368, 0, 1, 0, 0, 368, 0, 0], "semantic": {"name": "Tkinter", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from Tkinter import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:ImportFrom_L2_C0", "label": "from tkSimpleDialog import Dialog", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0392, 0.0196, 0, 0.66, 0.3333, 774, 0, 1, 0, 0, 774, 0, 0], "semantic": {"name": "tkSimpleDialog", "arg_names": [], "import_names": ["Dialog"], "rhs_call_name": "", "annotation": ""}, "snippet": "from tkSimpleDialog import Dialog"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:ImportFrom_L3_C0", "label": "from globalconst import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0196, 0, 0.66, 0.6667, 871, 0, 1, 0, 0, 871, 0, 0], "semantic": {"name": "globalconst", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from globalconst import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:ClassDef_L5_C0", "label": "AboutBox", "type": "class", "loc": [5, 51], "level": 0, "parent": null, "vector": [3, 0, 0.549, 0.9216, 0, 0.66, 1.0, 774, 0, 3, 0, 0, 814, 0, 20], "semantic": {"name": "AboutBox", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class AboutBox(Dialog):\n def body(self, master):\n self.canvas = Canvas(self, width=300, height=275)\n self.canvas.pack(side=TOP, fill=BOTH, expand=0)\n self.canvas.create_text(152,47,text='Raven', fill='black',\n font=('Helvetica', 36))\n self.canvas.create_text(150,45,text='Raven', fill='white',\n font=('Helvetica', 36))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "label": "body", "type": "function", "loc": [6, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:ClassDef_L5_C0", "vector": [2, 1, 0.451, 0.6863, 1, 0.13, 0.0, 477, 0, 2, 1, 0, 0, 0, 13], "semantic": {"name": "body", "arg_names": ["self", "master"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def body(self, master):\n self.canvas = Canvas(self, width=300, height=275)\n self.canvas.pack(side=TOP, fill=BOTH, expand=0)\n self.canvas.create_text(152,47,text='Raven', fill='black',\n font=('Helvetica', 36))\n self.canvas.create_text(150,45,text='Raven', fill='white',\n font=('Helvetica', 36))\n self.canvas.create_text(150,85,text='Version '+ VERSION,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:Assign_L7_C8", "label": "self.canvas = Canvas()", "type": "assigned_variable", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "vector": [14, 2, 0.1373, 0.0196, 2, 0.69, 0.0, 371, 3, 3, 0, 0, 604, 10, 1], "semantic": {"name": "self.canvas", "arg_names": [], "import_names": [], "rhs_call_name": "Canvas", "annotation": ""}, "snippet": " self.canvas = Canvas(self, width=300, height=275)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L8_C8", "label": "pack()", "type": "expression", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "vector": [8, 2, 0.1569, 0.0196, 2, 0.69, 0.0769, 742, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self.canvas.pack(side=TOP, fill=BOTH, expand=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L9_C8", "label": "create_text()", "type": "expression", "loc": [9, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "vector": [8, 2, 0.1863, 0.0392, 2, 0.69, 0.1538, 328, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "create_text", "arg_names": [], "import_names": [], "rhs_call_name": "create_text", "annotation": ""}, "snippet": " self.canvas.create_text(152,47,text='Raven', fill='black',\n font=('Helvetica', 36))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L11_C8", "label": "create_text()", "type": "expression", "loc": [11, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "vector": [8, 2, 0.2255, 0.0392, 2, 0.69, 0.2308, 328, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "create_text", "arg_names": [], "import_names": [], "rhs_call_name": "create_text", "annotation": ""}, "snippet": " self.canvas.create_text(150,45,text='Raven', fill='white',\n font=('Helvetica', 36))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L13_C8", "label": "create_text()", "type": "expression", "loc": [13, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "vector": [8, 2, 0.2745, 0.0588, 2, 0.69, 0.3077, 328, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "create_text", "arg_names": [], "import_names": [], "rhs_call_name": "create_text", "annotation": ""}, "snippet": " self.canvas.create_text(150,85,text='Version '+ VERSION,\n fill='black',\n font=('Helvetica', 12))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L16_C8", "label": "create_text()", "type": "expression", "loc": [16, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "vector": [8, 2, 0.3333, 0.0588, 2, 0.69, 0.3846, 328, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "create_text", "arg_names": [], "import_names": [], "rhs_call_name": "create_text", "annotation": ""}, "snippet": " self.canvas.create_text(150,115,text='An open source checkers program',\n fill='black',\n font=('Helvetica', 10))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L19_C8", "label": "create_text()", "type": "expression", "loc": [19, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "vector": [8, 2, 0.3922, 0.0588, 2, 0.69, 0.4615, 328, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "create_text", "arg_names": [], "import_names": [], "rhs_call_name": "create_text", "annotation": ""}, "snippet": " self.canvas.create_text(150,130,text='by Brandon Corfman',\n fill='black',\n font=('Helvetica', 10))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L22_C8", "label": "create_text()", "type": "expression", "loc": [22, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "vector": [8, 2, 0.451, 0.0588, 2, 0.69, 0.5385, 328, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "create_text", "arg_names": [], "import_names": [], "rhs_call_name": "create_text", "annotation": ""}, "snippet": " self.canvas.create_text(150,160,text='Evaluation function translated from',\n fill='black',\n font=('Helvetica', 10))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L25_C8", "label": "create_text()", "type": "expression", "loc": [25, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "vector": [8, 2, 0.5098, 0.0588, 2, 0.69, 0.6154, 328, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "create_text", "arg_names": [], "import_names": [], "rhs_call_name": "create_text", "annotation": ""}, "snippet": " self.canvas.create_text(150,175,text=\"Martin Fierz's Simple Checkers\",\n fill='black',\n font=('Helvetica', 10))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L28_C8", "label": "create_text()", "type": "expression", "loc": [28, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "vector": [8, 2, 0.5686, 0.0588, 2, 0.69, 0.6923, 328, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "create_text", "arg_names": [], "import_names": [], "rhs_call_name": "create_text", "annotation": ""}, "snippet": " self.canvas.create_text(150,205,text=\"Alpha-beta search code written by\",\n fill='black',\n font=('Helvetica', 10))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L31_C8", "label": "create_text()", "type": "expression", "loc": [31, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "vector": [8, 2, 0.6275, 0.0588, 2, 0.69, 0.7692, 328, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "create_text", "arg_names": [], "import_names": [], "rhs_call_name": "create_text", "annotation": ""}, "snippet": " self.canvas.create_text(150,220,text=\"Peter Norvig for the AIMA project;\",\n fill='black',\n font=('Helvetica', 10))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L34_C8", "label": "create_text()", "type": "expression", "loc": [34, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "vector": [8, 2, 0.6863, 0.0588, 2, 0.69, 0.8462, 328, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "create_text", "arg_names": [], "import_names": [], "rhs_call_name": "create_text", "annotation": ""}, "snippet": " self.canvas.create_text(150,235,text=\"adopted for checkers usage\",\n fill='black',\n font=('Helvetica', 10))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L37_C8", "label": "create_text()", "type": "expression", "loc": [37, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "vector": [8, 2, 0.7451, 0.0588, 2, 0.69, 0.9231, 328, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "create_text", "arg_names": [], "import_names": [], "rhs_call_name": "create_text", "annotation": ""}, "snippet": " self.canvas.create_text(150,250,text=\"by Brandon Corfman\",\n fill='black',\n font=('Helvetica', 10))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:Return_L40_C8", "label": "return", "type": "return", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "vector": [13, 2, 0.7843, 0.0196, 2, 0.69, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.canvas"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L42_C4", "label": "cancel", "type": "function", "loc": [42, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:ClassDef_L5_C0", "vector": [2, 1, 0.8333, 0.0392, 1, 0.13, 0.5, 732, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "cancel", "arg_names": ["self", "event"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def cancel(self, event=None):\n self.destroy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L43_C8", "label": "destroy()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L42_C4", "vector": [8, 2, 0.8431, 0.0196, 2, 0.03, 0.0, 388, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "destroy", "arg_names": [], "import_names": [], "rhs_call_name": "destroy", "annotation": ""}, "snippet": " self.destroy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L45_C4", "label": "buttonbox", "type": "function", "loc": [45, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:ClassDef_L5_C0", "vector": [2, 1, 0.9412, 0.1373, 1, 0.13, 1.0, 14, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "buttonbox", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def buttonbox(self):\n self.button = Button(self, text='OK', padx='5m', command=self.cancel)\n self.blank = Canvas(self, width=10, height=20)\n self.blank.pack(side=BOTTOM, fill=BOTH, expand=0)\n self.button.pack(side=BOTTOM)\n self.button.focus_set()\n self.bind(\"<Escape>\", self.cancel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:Assign_L46_C8", "label": "self.button = Button()", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L45_C4", "vector": [14, 2, 0.902, 0.0196, 2, 0.57, 0.0, 611, 3, 4, 0, 0, 608, 10, 1], "semantic": {"name": "self.button", "arg_names": [], "import_names": [], "rhs_call_name": "Button", "annotation": ""}, "snippet": " self.button = Button(self, text='OK', padx='5m', command=self.cancel)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:Assign_L47_C8", "label": "self.blank = Canvas()", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L45_C4", "vector": [14, 2, 0.9216, 0.0196, 2, 0.57, 0.2, 34, 3, 3, 0, 0, 604, 10, 1], "semantic": {"name": "self.blank", "arg_names": [], "import_names": [], "rhs_call_name": "Canvas", "annotation": ""}, "snippet": " self.blank = Canvas(self, width=10, height=20)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L48_C8", "label": "pack()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L45_C4", "vector": [8, 2, 0.9412, 0.0196, 2, 0.57, 0.4, 742, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self.blank.pack(side=BOTTOM, fill=BOTH, expand=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L49_C8", "label": "pack()", "type": "expression", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L45_C4", "vector": [8, 2, 0.9608, 0.0196, 2, 0.57, 0.6, 742, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self.button.pack(side=BOTTOM)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L50_C8", "label": "focus_set()", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L45_C4", "vector": [8, 2, 0.9804, 0.0196, 2, 0.57, 0.8, 278, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "focus_set", "arg_names": [], "import_names": [], "rhs_call_name": "focus_set", "annotation": ""}, "snippet": " self.button.focus_set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L51_C8", "label": "bind()", "type": "expression", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L45_C4", "vector": [8, 2, 1.0, 0.0196, 2, 0.57, 1.0, 640, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "bind", "arg_names": [], "import_names": [], "rhs_call_name": "bind", "annotation": ""}, "snippet": " self.bind(\"<Escape>\", self.cancel)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_382:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_382:Assign_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_382:Return_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_382:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_382:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_382:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_382:Expr_L51_C8"}] |
from Tkinter import Widget
from controller import Controller
from globalconst import *
class PlayerController(Controller):
def __init__(self, **props):
self._model = props['model']
self._view = props['view']
self._before_turn_event = None
self._end_turn_event = props['end_turn_event']
self._highlights = []
self._move_in_progress = False
def _register_event_handlers(self):
Widget.bind(self._view.canvas, '<Button-1>', self.mouse_click)
def _unregister_event_handlers(self):
Widget.unbind(self._view.canvas, '<Button-1>')
def stop_process(self):
pass
def set_search_time(self, time):
pass
def get_player_type(self):
return HUMAN
def set_before_turn_event(self, evt):
self._before_turn_event = evt
def add_highlights(self):
for h in self._highlights:
self._view.highlight_square(h, OUTLINE_COLOR)
def remove_highlights(self):
for h in self._highlights:
self._view.highlight_square(h, DARK_SQUARES)
def start_turn(self):
self._register_event_handlers()
self._model.curr_state.attach(self._view)
def end_turn(self):
self._unregister_event_handlers()
self._model.curr_state.detach(self._view)
def mouse_click(self, event):
xi, yi = self._view.calc_board_loc(event.x, event.y)
pos = self._view.calc_board_pos(xi, yi)
sq = self._model.curr_state.squares[pos]
if not self._move_in_progress:
player = self._model.curr_state.to_move
self.moves = self._model.legal_moves()
if (sq & player) and self.moves:
self._before_turn_event()
# highlight the start square the user clicked on
self._view.highlight_square(pos, OUTLINE_COLOR)
self._highlights = [pos]
# reduce moves to number matching the positions entered
self.moves = self._filter_moves(pos, self.moves, 0)
self.idx = 2 if self._model.captures_available() else 1
# if only one move available, take it.
if len(self.moves) == 1:
self._make_move()
self._view.canvas.after(100, self._end_turn_event)
return
self._move_in_progress = True
else:
if sq & FREE:
self.moves = self._filter_moves(pos, self.moves, self.idx)
if len(self.moves) == 0: # illegal move
# remove previous square highlights
for h in self._highlights:
self._view.highlight_square(h, DARK_SQUARES)
self._move_in_progress = False
return
else:
self._view.highlight_square(pos, OUTLINE_COLOR)
self._highlights.append(pos)
if len(self.moves) == 1:
self._make_move()
self._view.canvas.after(100, self._end_turn_event)
return
self.idx += 2 if self._model.captures_available() else 1
def _filter_moves(self, pos, moves, idx):
del_list = []
for i, m in enumerate(moves):
if pos != m.affected_squares[idx][0]:
del_list.append(i)
for i in reversed(del_list):
del moves[i]
return moves
def _make_move(self):
move = self.moves[0].affected_squares
step = 2 if len(move) > 2 else 1
# highlight remaining board squares used in move
for m in move[step::step]:
idx = m[0]
self._view.highlight_square(idx, OUTLINE_COLOR)
self._highlights.append(idx)
self._model.make_move(self.moves[0], None, True, True,
self._view.get_annotation())
# a new move obliterates any more redo's along a branch of the game tree
self._model.curr_state.delete_redo_list()
self._move_in_progress = False
| ajibawa-2023/Python-Code-Large/train/row_384 | 81 | 109 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_384:ImportFrom_L1_C0", "label": "from Tkinter import Widget", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0092, 0.0092, 0, 0.66, 0.0, 368, 0, 1, 0, 0, 368, 0, 0], "semantic": {"name": "Tkinter", "arg_names": [], "import_names": ["Widget"], "rhs_call_name": "", "annotation": ""}, "snippet": "from Tkinter import Widget"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:ImportFrom_L2_C0", "label": "from controller import Controller", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0183, 0.0092, 0, 0.66, 0.3333, 360, 0, 1, 0, 0, 360, 0, 0], "semantic": {"name": "controller", "arg_names": [], "import_names": ["Controller"], "rhs_call_name": "", "annotation": ""}, "snippet": "from controller import Controller"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:ImportFrom_L3_C0", "label": "from globalconst import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0275, 0.0092, 0, 0.66, 0.6667, 871, 0, 1, 0, 0, 871, 0, 0], "semantic": {"name": "globalconst", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from globalconst import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "label": "PlayerController", "type": "class", "loc": [5, 109], "level": 0, "parent": null, "vector": [3, 0, 0.5229, 0.9633, 0, 0.66, 1.0, 257, 0, 14, 0, 0, 93, 0, 36], "semantic": {"name": "PlayerController", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PlayerController(Controller):\n def __init__(self, **props):\n self._model = props['model']\n self._view = props['view']\n self._before_turn_event = None\n self._end_turn_event = props['end_turn_event']\n self._highlights = []\n self._move_in_progress = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L6_C4", "label": "__init__", "type": "function", "loc": [6, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "vector": [2, 1, 0.0826, 0.0642, 1, 0.22, 0.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, **props):\n self._model = props['model']\n self._view = props['view']\n self._before_turn_event = None\n self._end_turn_event = props['end_turn_event']\n self._highlights = []\n self._move_in_progress = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L7_C8", "label": "self._model =", "type": "assigned_variable", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L6_C4", "vector": [14, 2, 0.0642, 0.0092, 2, 0.24, 0.0, 580, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._model", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._model = props['model']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L8_C8", "label": "self._view =", "type": "assigned_variable", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L6_C4", "vector": [14, 2, 0.0734, 0.0092, 2, 0.24, 0.2, 625, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._view", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._view = props['view']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L9_C8", "label": "self._before_turn_event =", "type": "assigned_variable", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L6_C4", "vector": [14, 2, 0.0826, 0.0092, 2, 0.24, 0.4, 569, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._before_turn_event", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._before_turn_event = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L10_C8", "label": "self._end_turn_event =", "type": "assigned_variable", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L6_C4", "vector": [14, 2, 0.0917, 0.0092, 2, 0.24, 0.6, 694, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._end_turn_event", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._end_turn_event = props['end_turn_event']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L11_C8", "label": "self._highlights =", "type": "assigned_variable", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L6_C4", "vector": [14, 2, 0.1009, 0.0092, 2, 0.24, 0.8, 150, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self._highlights", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._highlights = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L12_C8", "label": "self._move_in_progress =", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L6_C4", "vector": [14, 2, 0.1101, 0.0092, 2, 0.24, 1.0, 104, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self._move_in_progress", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._move_in_progress = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L14_C4", "label": "_register_event_handlers", "type": "function", "loc": [14, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "vector": [2, 1, 0.133, 0.0183, 1, 0.22, 0.0769, 21, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_register_event_handlers", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _register_event_handlers(self):\n Widget.bind(self._view.canvas, '<Button-1>', self.mouse_click)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L15_C8", "label": "bind()", "type": "expression", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L14_C4", "vector": [8, 2, 0.1376, 0.0092, 2, 0.92, 0.0, 640, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "bind", "arg_names": [], "import_names": [], "rhs_call_name": "bind", "annotation": ""}, "snippet": " Widget.bind(self._view.canvas, '<Button-1>', self.mouse_click)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L17_C4", "label": "_unregister_event_handlers", "type": "function", "loc": [17, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "vector": [2, 1, 0.1606, 0.0183, 1, 0.22, 0.1538, 309, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_unregister_event_handlers", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _unregister_event_handlers(self):\n Widget.unbind(self._view.canvas, '<Button-1>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L18_C8", "label": "unbind()", "type": "expression", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L17_C4", "vector": [8, 2, 0.1651, 0.0092, 2, 0.39, 0.0, 43, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "unbind", "arg_names": [], "import_names": [], "rhs_call_name": "unbind", "annotation": ""}, "snippet": " Widget.unbind(self._view.canvas, '<Button-1>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L20_C4", "label": "stop_process", "type": "function", "loc": [20, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "vector": [2, 1, 0.1881, 0.0183, 1, 0.22, 0.2308, 116, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "stop_process", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def stop_process(self):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L23_C4", "label": "set_search_time", "type": "function", "loc": [23, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "vector": [2, 1, 0.2156, 0.0183, 1, 0.22, 0.3077, 29, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "set_search_time", "arg_names": ["self", "time"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_search_time(self, time):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L26_C4", "label": "get_player_type", "type": "function", "loc": [26, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "vector": [2, 1, 0.2431, 0.0183, 1, 0.22, 0.3846, 234, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_player_type", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_player_type(self):\n return HUMAN"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Return_L27_C8", "label": "return", "type": "return", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L26_C4", "vector": [13, 2, 0.2477, 0.0092, 2, 0.22, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return HUMAN"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L29_C4", "label": "set_before_turn_event", "type": "function", "loc": [29, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "vector": [2, 1, 0.2706, 0.0183, 1, 0.22, 0.4615, 582, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "set_before_turn_event", "arg_names": ["self", "evt"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_before_turn_event(self, evt):\n self._before_turn_event = evt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L30_C8", "label": "self._before_turn_event =", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L29_C4", "vector": [14, 2, 0.2752, 0.0092, 2, 0.11, 0.0, 569, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._before_turn_event", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._before_turn_event = evt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L32_C4", "label": "add_highlights", "type": "function", "loc": [32, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "vector": [2, 1, 0.3028, 0.0275, 1, 0.22, 0.5385, 23, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add_highlights", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_highlights(self):\n for h in self._highlights:\n self._view.highlight_square(h, OUTLINE_COLOR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:For_L33_C8", "label": "for h", "type": "for", "loc": [33, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L32_C4", "vector": [6, 2, 0.3073, 0.0183, 2, 0.59, 0.0, 686, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "h", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for h in self._highlights:\n self._view.highlight_square(h, OUTLINE_COLOR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L34_C12", "label": "highlight_square()", "type": "expression", "loc": [34, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:For_L33_C8", "vector": [8, 3, 0.3119, 0.0092, 3, 0.35, 0.0, 240, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "highlight_square", "arg_names": [], "import_names": [], "rhs_call_name": "highlight_square", "annotation": ""}, "snippet": " self._view.highlight_square(h, OUTLINE_COLOR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L36_C4", "label": "remove_highlights", "type": "function", "loc": [36, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "vector": [2, 1, 0.3394, 0.0275, 1, 0.22, 0.6154, 879, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove_highlights", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remove_highlights(self):\n for h in self._highlights:\n self._view.highlight_square(h, DARK_SQUARES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:For_L37_C8", "label": "for h", "type": "for", "loc": [37, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L36_C4", "vector": [6, 2, 0.344, 0.0183, 2, 0.96, 0.0, 686, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "h", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for h in self._highlights:\n self._view.highlight_square(h, DARK_SQUARES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L38_C12", "label": "highlight_square()", "type": "expression", "loc": [38, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:For_L37_C8", "vector": [8, 3, 0.3486, 0.0092, 3, 0.43, 0.0, 240, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "highlight_square", "arg_names": [], "import_names": [], "rhs_call_name": "highlight_square", "annotation": ""}, "snippet": " self._view.highlight_square(h, DARK_SQUARES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L40_C4", "label": "start_turn", "type": "function", "loc": [40, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "vector": [2, 1, 0.3761, 0.0275, 1, 0.22, 0.6923, 498, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "start_turn", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def start_turn(self):\n self._register_event_handlers()\n self._model.curr_state.attach(self._view)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L41_C8", "label": "_register_event_handlers()", "type": "expression", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L40_C4", "vector": [8, 2, 0.3761, 0.0092, 2, 0.3, 0.0, 21, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_register_event_handlers", "arg_names": [], "import_names": [], "rhs_call_name": "_register_event_handlers", "annotation": ""}, "snippet": " self._register_event_handlers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L42_C8", "label": "attach()", "type": "expression", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L40_C4", "vector": [8, 2, 0.3853, 0.0092, 2, 0.3, 1.0, 522, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "attach", "arg_names": [], "import_names": [], "rhs_call_name": "attach", "annotation": ""}, "snippet": " self._model.curr_state.attach(self._view)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L44_C4", "label": "end_turn", "type": "function", "loc": [44, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "vector": [2, 1, 0.4128, 0.0275, 1, 0.22, 0.7692, 672, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "end_turn", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def end_turn(self):\n self._unregister_event_handlers()\n self._model.curr_state.detach(self._view)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L45_C8", "label": "_unregister_event_handlers()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L44_C4", "vector": [8, 2, 0.4128, 0.0092, 2, 0.17, 0.0, 309, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_unregister_event_handlers", "arg_names": [], "import_names": [], "rhs_call_name": "_unregister_event_handlers", "annotation": ""}, "snippet": " self._unregister_event_handlers()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L46_C8", "label": "detach()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L44_C4", "vector": [8, 2, 0.422, 0.0092, 2, 0.17, 1.0, 717, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "detach", "arg_names": [], "import_names": [], "rhs_call_name": "detach", "annotation": ""}, "snippet": " self._model.curr_state.detach(self._view)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L48_C4", "label": "mouse_click", "type": "function", "loc": [48, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "vector": [2, 1, 0.6101, 0.3486, 1, 0.22, 0.8462, 973, 0, 2, 0, 0, 0, 0, 19], "semantic": {"name": "mouse_click", "arg_names": ["self", "event"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def mouse_click(self, event):\n xi, yi = self._view.calc_board_loc(event.x, event.y)\n pos = self._view.calc_board_pos(xi, yi)\n sq = self._model.curr_state.squares[pos]\n if not self._move_in_progress:\n player = self._model.curr_state.to_move\n self.moves = self._model.legal_moves()\n if (sq & player) and self.moves:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L49_C8", "label": "xi, yi = calc_board_loc()", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L48_C4", "vector": [14, 2, 0.4495, 0.0092, 2, 0.75, 0.0, 56, 3, 2, 0, 0, 24, 10, 1], "semantic": {"name": "xi, yi", "arg_names": [], "import_names": [], "rhs_call_name": "calc_board_loc", "annotation": ""}, "snippet": " xi, yi = self._view.calc_board_loc(event.x, event.y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L50_C8", "label": "pos = calc_board_pos()", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L48_C4", "vector": [14, 2, 0.4587, 0.0092, 2, 0.75, 0.3333, 627, 3, 2, 0, 0, 227, 10, 1], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "calc_board_pos", "annotation": ""}, "snippet": " pos = self._view.calc_board_pos(xi, yi)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L51_C8", "label": "sq =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L48_C4", "vector": [14, 2, 0.4679, 0.0092, 2, 0.75, 0.6667, 271, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sq", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sq = self._model.curr_state.squares[pos]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:If_L52_C8", "label": "if", "type": "if", "loc": [52, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L48_C4", "vector": [4, 2, 0.6284, 0.3119, 2, 0.75, 1.0, 0, 0, 0, 0, 0, 0, 0, 17], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self._move_in_progress:\n player = self._model.curr_state.to_move\n self.moves = self._model.legal_moves()\n if (sq & player) and self.moves:\n self._before_turn_event()\n # highlight the start square the user clicked on\n self._view.highlight_square(pos, OUTLINE_COLOR)\n self._highlights = [pos]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L53_C12", "label": "player =", "type": "assigned_variable", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L52_C8", "vector": [14, 3, 0.4862, 0.0092, 3, 0.37, 0.0, 895, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "player", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " player = self._model.curr_state.to_move"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L54_C12", "label": "self.moves = legal_moves()", "type": "assigned_variable", "loc": [54, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L52_C8", "vector": [14, 3, 0.4954, 0.0092, 3, 0.37, 0.3333, 694, 3, 0, 0, 0, 295, 10, 1], "semantic": {"name": "self.moves", "arg_names": [], "import_names": [], "rhs_call_name": "legal_moves", "annotation": ""}, "snippet": " self.moves = self._model.legal_moves()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:If_L55_C12", "label": "if", "type": "if", "loc": [55, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L52_C8", "vector": [4, 3, 0.5642, 0.1284, 3, 0.37, 0.6667, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (sq & player) and self.moves:\n self._before_turn_event()\n # highlight the start square the user clicked on\n self._view.highlight_square(pos, OUTLINE_COLOR)\n self._highlights = [pos]\n # reduce moves to number matching the positions entered\n self.moves = self._filter_moves(pos, self.moves, 0)\n self.idx = 2 if self._model.captures_available() else 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L56_C16", "label": "_before_turn_event()", "type": "expression", "loc": [56, 56], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L55_C12", "vector": [8, 4, 0.5138, 0.0092, 4, 0.99, 0.0, 695, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_before_turn_event", "arg_names": [], "import_names": [], "rhs_call_name": "_before_turn_event", "annotation": ""}, "snippet": " self._before_turn_event()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L58_C16", "label": "highlight_square()", "type": "expression", "loc": [58, 58], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L55_C12", "vector": [8, 4, 0.5321, 0.0092, 4, 0.99, 0.1667, 240, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "highlight_square", "arg_names": [], "import_names": [], "rhs_call_name": "highlight_square", "annotation": ""}, "snippet": " self._view.highlight_square(pos, OUTLINE_COLOR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L59_C16", "label": "self._highlights =", "type": "assigned_variable", "loc": [59, 59], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L55_C12", "vector": [14, 4, 0.5413, 0.0092, 4, 0.99, 0.3333, 150, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self._highlights", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._highlights = [pos]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L61_C16", "label": "self.moves = _filter_moves()", "type": "assigned_variable", "loc": [61, 61], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L55_C12", "vector": [14, 4, 0.5596, 0.0092, 4, 0.99, 0.5, 694, 3, 3, 0, 0, 124, 10, 1], "semantic": {"name": "self.moves", "arg_names": [], "import_names": [], "rhs_call_name": "_filter_moves", "annotation": ""}, "snippet": " self.moves = self._filter_moves(pos, self.moves, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L62_C16", "label": "self.idx =", "type": "assigned_variable", "loc": [62, 62], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L55_C12", "vector": [14, 4, 0.5688, 0.0092, 4, 0.99, 0.6667, 326, 8, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.idx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.idx = 2 if self._model.captures_available() else 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:If_L64_C16", "label": "if", "type": "if", "loc": [64, 67], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L55_C12", "vector": [4, 4, 0.6009, 0.0367, 4, 0.99, 0.8333, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(self.moves) == 1:\n self._make_move()\n self._view.canvas.after(100, self._end_turn_event)\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L65_C20", "label": "_make_move()", "type": "expression", "loc": [65, 65], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L64_C16", "vector": [8, 5, 0.5963, 0.0092, 5, 0.53, 0.0, 482, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_make_move", "arg_names": [], "import_names": [], "rhs_call_name": "_make_move", "annotation": ""}, "snippet": " self._make_move()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L66_C20", "label": "after()", "type": "expression", "loc": [66, 66], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L64_C16", "vector": [8, 5, 0.6055, 0.0092, 5, 0.53, 0.5, 937, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "after", "arg_names": [], "import_names": [], "rhs_call_name": "after", "annotation": ""}, "snippet": " self._view.canvas.after(100, self._end_turn_event)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Return_L67_C20", "label": "return", "type": "return", "loc": [67, 67], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L64_C16", "vector": [13, 5, 0.6147, 0.0092, 5, 0.53, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L68_C16", "label": "self._move_in_progress =", "type": "assigned_variable", "loc": [68, 68], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L55_C12", "vector": [14, 4, 0.6239, 0.0092, 4, 0.99, 1.0, 104, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self._move_in_progress", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._move_in_progress = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:If_L70_C12", "label": "if", "type": "if", "loc": [70, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L52_C8", "vector": [4, 3, 0.711, 0.1468, 3, 0.37, 1.0, 0, 4, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if sq & FREE:\n self.moves = self._filter_moves(pos, self.moves, self.idx)\n if len(self.moves) == 0: # illegal move\n # remove previous square highlights\n for h in self._highlights:\n self._view.highlight_square(h, DARK_SQUARES)\n self._move_in_progress = False\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L71_C16", "label": "self.moves = _filter_moves()", "type": "assigned_variable", "loc": [71, 71], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L70_C12", "vector": [14, 4, 0.6514, 0.0092, 4, 0.56, 0.0, 694, 3, 3, 0, 0, 124, 10, 1], "semantic": {"name": "self.moves", "arg_names": [], "import_names": [], "rhs_call_name": "_filter_moves", "annotation": ""}, "snippet": " self.moves = self._filter_moves(pos, self.moves, self.idx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:If_L72_C16", "label": "if", "type": "if", "loc": [72, 85], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L70_C12", "vector": [4, 4, 0.7202, 0.1284, 4, 0.56, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(self.moves) == 0: # illegal move\n # remove previous square highlights\n for h in self._highlights:\n self._view.highlight_square(h, DARK_SQUARES)\n self._move_in_progress = False\n return\n else:\n self._view.highlight_square(pos, OUTLINE_COLOR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:For_L74_C20", "label": "for h", "type": "for", "loc": [74, 75], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L72_C16", "vector": [6, 5, 0.6835, 0.0183, 5, 0.92, 0.0, 686, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "h", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for h in self._highlights:\n self._view.highlight_square(h, DARK_SQUARES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L75_C24", "label": "highlight_square()", "type": "expression", "loc": [75, 75], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:For_L74_C20", "vector": [8, 6, 0.6881, 0.0092, 6, 0.11, 0.0, 240, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "highlight_square", "arg_names": [], "import_names": [], "rhs_call_name": "highlight_square", "annotation": ""}, "snippet": " self._view.highlight_square(h, DARK_SQUARES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L76_C20", "label": "self._move_in_progress =", "type": "assigned_variable", "loc": [76, 76], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L72_C16", "vector": [14, 5, 0.6972, 0.0092, 5, 0.92, 0.2, 104, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self._move_in_progress", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._move_in_progress = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Return_L77_C20", "label": "return", "type": "return", "loc": [77, 77], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L72_C16", "vector": [13, 5, 0.7064, 0.0092, 5, 0.92, 0.4, 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_384:Expr_L79_C20", "label": "highlight_square()", "type": "expression", "loc": [79, 79], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L72_C16", "vector": [8, 5, 0.7248, 0.0092, 5, 0.92, 0.6, 240, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "highlight_square", "arg_names": [], "import_names": [], "rhs_call_name": "highlight_square", "annotation": ""}, "snippet": " self._view.highlight_square(pos, OUTLINE_COLOR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L80_C20", "label": "append()", "type": "expression", "loc": [80, 80], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L72_C16", "vector": [8, 5, 0.7339, 0.0092, 5, 0.92, 0.8, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self._highlights.append(pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:If_L81_C20", "label": "if", "type": "if", "loc": [81, 84], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L72_C16", "vector": [4, 5, 0.7569, 0.0367, 5, 0.92, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(self.moves) == 1:\n self._make_move()\n self._view.canvas.after(100, self._end_turn_event)\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L82_C24", "label": "_make_move()", "type": "expression", "loc": [82, 82], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L81_C20", "vector": [8, 6, 0.7523, 0.0092, 6, 0.44, 0.0, 482, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_make_move", "arg_names": [], "import_names": [], "rhs_call_name": "_make_move", "annotation": ""}, "snippet": " self._make_move()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L83_C24", "label": "after()", "type": "expression", "loc": [83, 83], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L81_C20", "vector": [8, 6, 0.7615, 0.0092, 6, 0.44, 0.5, 937, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "after", "arg_names": [], "import_names": [], "rhs_call_name": "after", "annotation": ""}, "snippet": " self._view.canvas.after(100, self._end_turn_event)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Return_L84_C24", "label": "return", "type": "return", "loc": [84, 84], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L81_C20", "vector": [13, 6, 0.7706, 0.0092, 6, 0.44, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L88_C4", "label": "_filter_moves", "type": "function", "loc": [88, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "vector": [2, 1, 0.8394, 0.0734, 1, 0.22, 0.9231, 124, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "_filter_moves", "arg_names": ["self", "pos", "moves", "idx"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _filter_moves(self, pos, moves, idx):\n del_list = []\n for i, m in enumerate(moves):\n if pos != m.affected_squares[idx][0]:\n del_list.append(i)\n for i in reversed(del_list):\n del moves[i]\n return moves"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L89_C8", "label": "del_list =", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L88_C4", "vector": [14, 2, 0.8165, 0.0092, 2, 0.52, 0.0, 503, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "del_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " del_list = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:For_L90_C8", "label": "for i, m", "type": "for", "loc": [90, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L88_C4", "vector": [6, 2, 0.8349, 0.0275, 2, 0.52, 0.3333, 489, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i, m", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, m in enumerate(moves):\n if pos != m.affected_squares[idx][0]:\n del_list.append(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:If_L91_C12", "label": "if", "type": "if", "loc": [91, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:For_L90_C8", "vector": [4, 3, 0.8394, 0.0183, 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 pos != m.affected_squares[idx][0]:\n del_list.append(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L92_C16", "label": "append()", "type": "expression", "loc": [92, 92], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:If_L91_C12", "vector": [8, 4, 0.844, 0.0092, 4, 0.48, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " del_list.append(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:For_L93_C8", "label": "for i", "type": "for", "loc": [93, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L88_C4", "vector": [6, 2, 0.8578, 0.0183, 2, 0.52, 0.6667, 826, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in reversed(del_list):\n del moves[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Return_L95_C8", "label": "return", "type": "return", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L88_C4", "vector": [13, 2, 0.8716, 0.0092, 2, 0.52, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return moves"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L97_C4", "label": "_make_move", "type": "function", "loc": [97, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "vector": [2, 1, 0.945, 0.1193, 1, 0.22, 1.0, 482, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "_make_move", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _make_move(self):\n move = self.moves[0].affected_squares\n step = 2 if len(move) > 2 else 1\n # highlight remaining board squares used in move\n for m in move[step::step]:\n idx = m[0]\n self._view.highlight_square(idx, OUTLINE_COLOR)\n self._highlights.append(idx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L98_C8", "label": "move =", "type": "assigned_variable", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L97_C4", "vector": [14, 2, 0.8991, 0.0092, 2, 0.3, 0.0, 856, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "move", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " move = self.moves[0].affected_squares"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L99_C8", "label": "step =", "type": "assigned_variable", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L97_C4", "vector": [14, 2, 0.9083, 0.0092, 2, 0.3, 0.2, 880, 8, 0, 0, 0, 0, 0, 1], "semantic": {"name": "step", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " step = 2 if len(move) > 2 else 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:For_L101_C8", "label": "for m", "type": "for", "loc": [101, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L97_C4", "vector": [6, 2, 0.9404, 0.0367, 2, 0.3, 0.4, 711, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for m in move[step::step]:\n idx = m[0]\n self._view.highlight_square(idx, OUTLINE_COLOR)\n self._highlights.append(idx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L102_C12", "label": "idx =", "type": "assigned_variable", "loc": [102, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:For_L101_C8", "vector": [14, 3, 0.9358, 0.0092, 3, 0.82, 0.0, 187, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "idx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " idx = m[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L103_C12", "label": "highlight_square()", "type": "expression", "loc": [103, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:For_L101_C8", "vector": [8, 3, 0.945, 0.0092, 3, 0.82, 0.5, 240, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "highlight_square", "arg_names": [], "import_names": [], "rhs_call_name": "highlight_square", "annotation": ""}, "snippet": " self._view.highlight_square(idx, OUTLINE_COLOR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L104_C12", "label": "append()", "type": "expression", "loc": [104, 104], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:For_L101_C8", "vector": [8, 3, 0.9541, 0.0092, 3, 0.82, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self._highlights.append(idx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L105_C8", "label": "make_move()", "type": "expression", "loc": [105, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L97_C4", "vector": [8, 2, 0.9679, 0.0183, 2, 0.3, 0.6, 580, 3, 5, 0, 0, 0, 0, 2], "semantic": {"name": "make_move", "arg_names": [], "import_names": [], "rhs_call_name": "make_move", "annotation": ""}, "snippet": " self._model.make_move(self.moves[0], None, True, True,\n self._view.get_annotation())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L108_C8", "label": "delete_redo_list()", "type": "expression", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L97_C4", "vector": [8, 2, 0.9908, 0.0092, 2, 0.3, 0.8, 878, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "delete_redo_list", "arg_names": [], "import_names": [], "rhs_call_name": "delete_redo_list", "annotation": ""}, "snippet": " self._model.curr_state.delete_redo_list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L109_C8", "label": "self._move_in_progress =", "type": "assigned_variable", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L97_C4", "vector": [14, 2, 1.0, 0.0092, 2, 0.3, 1.0, 104, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self._move_in_progress", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._move_in_progress = False"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Return_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:For_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:For_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:For_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:For_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:If_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L52_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L52_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L52_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_384:If_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L55_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L56_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L55_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L58_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L55_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L59_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L55_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L61_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L55_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L62_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L55_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_384:If_L64_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L64_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L65_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L64_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L66_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L64_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Return_L67_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L55_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L68_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L52_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_384:If_L70_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L70_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L71_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L70_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_384:If_L72_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L72_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_384:For_L74_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:For_L74_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L75_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L72_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L76_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L72_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Return_L77_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L72_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L79_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L72_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L80_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L72_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_384:If_L81_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L81_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L82_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L81_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L83_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L81_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Return_L84_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:For_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:For_L90_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_384:If_L91_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:If_L91_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L92_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:For_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Return_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:For_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:For_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L102_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:For_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L103_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:For_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L104_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Expr_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_384:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_384:Assign_L109_C8"}] |
from abc import ABCMeta, abstractmethod
class GoalEvaluator(object):
__metaclass__ = ABCMeta
def __init__(self, bias):
self.bias = bias
@abstractmethod
def calculateDesirability(self, board):
pass
@abstractmethod
def setGoal(self, board):
pass
| ajibawa-2023/Python-Code-Large/train/row_385 | 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_385:ImportFrom_L1_C0", "label": "from abc import ABCMeta, abstractmethod", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0556, 0.0556, 0, 0.66, 0.0, 38, 0, 2, 0, 0, 38, 0, 0], "semantic": {"name": "abc", "arg_names": [], "import_names": ["ABCMeta", "abstractmethod"], "rhs_call_name": "", "annotation": ""}, "snippet": "from abc import ABCMeta, abstractmethod"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_385:ClassDef_L4_C0", "label": "GoalEvaluator", "type": "class", "loc": [4, 16], "level": 0, "parent": null, "vector": [3, 0, 0.5556, 0.7222, 0, 0.66, 1.0, 985, 0, 3, 0, 0, 186, 0, 0], "semantic": {"name": "GoalEvaluator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GoalEvaluator(object):\n __metaclass__ = ABCMeta\n\n def __init__(self, bias):\n self.bias = bias\n\n @abstractmethod\n def calculateDesirability(self, board):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_385:Assign_L5_C4", "label": "__metaclass__ =", "type": "assigned_variable", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_385:ClassDef_L4_C0", "vector": [14, 1, 0.2778, 0.0556, 1, 0.17, 0.0, 203, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "__metaclass__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " __metaclass__ = ABCMeta"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_385:FunctionDef_L7_C4", "label": "__init__", "type": "function", "loc": [7, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_385:ClassDef_L4_C0", "vector": [2, 1, 0.4167, 0.1111, 1, 0.17, 0.3333, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "bias"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, bias):\n self.bias = bias"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_385:Assign_L8_C8", "label": "self.bias =", "type": "assigned_variable", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_385:FunctionDef_L7_C4", "vector": [14, 2, 0.4444, 0.0556, 2, 0.08, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.bias", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.bias = bias"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_385:FunctionDef_L11_C4", "label": "calculateDesirability", "type": "function", "loc": [11, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_385:ClassDef_L4_C0", "vector": [2, 1, 0.6389, 0.1111, 1, 0.17, 0.6667, 943, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "calculateDesirability", "arg_names": ["self", "board"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def calculateDesirability(self, board):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_385:FunctionDef_L15_C4", "label": "setGoal", "type": "function", "loc": [15, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_385:ClassDef_L4_C0", "vector": [2, 1, 0.8611, 0.1111, 1, 0.17, 1.0, 509, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "setGoal", "arg_names": ["self", "board"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setGoal(self, board):\n pass"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_385:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_385:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_385:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_385:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_385:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_385:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_385:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_385:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_385:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_385:FunctionDef_L15_C4"}] |
from Tkinter import *
from time import time, localtime, strftime
class ToolTip( Toplevel ):
"""
Provides a ToolTip widget for Tkinter.
To apply a ToolTip to any Tkinter widget, simply pass the widget to the
ToolTip constructor
"""
def __init__( self, wdgt, msg=None, msgFunc=None, delay=1, follow=True ):
"""
Initialize the ToolTip
Arguments:
wdgt: The widget this ToolTip is assigned to
msg: A static string message assigned to the ToolTip
msgFunc: A function that retrieves a string to use as the ToolTip text
delay: The delay in seconds before the ToolTip appears(may be float)
follow: If True, the ToolTip follows motion, otherwise hides
"""
self.wdgt = wdgt
self.parent = self.wdgt.master # The parent of the ToolTip is the parent of the ToolTips widget
Toplevel.__init__( self, self.parent, bg='black', padx=1, pady=1 ) # Initalise the Toplevel
self.withdraw() # Hide initially
self.overrideredirect( True ) # The ToolTip Toplevel should have no frame or title bar
self.msgVar = StringVar() # The msgVar will contain the text displayed by the ToolTip
if msg == None:
self.msgVar.set( 'No message provided' )
else:
self.msgVar.set( msg )
self.msgFunc = msgFunc
self.delay = delay
self.follow = follow
self.visible = 0
self.lastMotion = 0
Message( self, textvariable=self.msgVar, bg='#FFFFDD',
aspect=1000 ).grid() # The test of the ToolTip is displayed in a Message widget
self.wdgt.bind( '<Enter>', self.spawn, '+' ) # Add bindings to the widget. This will NOT override bindings that the widget already has
self.wdgt.bind( '<Leave>', self.hide, '+' )
self.wdgt.bind( '<Motion>', self.move, '+' )
def spawn( self, event=None ):
"""
Spawn the ToolTip. This simply makes the ToolTip eligible for display.
Usually this is caused by entering the widget
Arguments:
event: The event that called this funciton
"""
self.visible = 1
self.after( int( self.delay * 1000 ), self.show ) # The after function takes a time argument in miliseconds
def show( self ):
"""
Displays the ToolTip if the time delay has been long enough
"""
if self.visible == 1 and time() - self.lastMotion > self.delay:
self.visible = 2
if self.visible == 2:
self.deiconify()
def move( self, event ):
"""
Processes motion within the widget.
Arguments:
event: The event that called this function
"""
self.lastMotion = time()
if self.follow == False: # If the follow flag is not set, motion within the widget will make the ToolTip dissapear
self.withdraw()
self.visible = 1
self.geometry( '+%i+%i' % ( event.x_root+10, event.y_root+10 ) ) # Offset the ToolTip 10x10 pixes southwest of the pointer
try:
self.msgVar.set( self.msgFunc() ) # Try to call the message function. Will not change the message if the message function is None or the message function fails
except:
pass
self.after( int( self.delay * 1000 ), self.show )
def hide( self, event=None ):
"""
Hides the ToolTip. Usually this is caused by leaving the widget
Arguments:
event: The event that called this function
"""
self.visible = 0
self.withdraw()
def xrange2d( n,m ):
"""
Returns a generator of values in a 2d range
Arguments:
n: The number of rows in the 2d range
m: The number of columns in the 2d range
Returns:
A generator of values in a 2d range
"""
return ( (i,j) for i in xrange(n) for j in xrange(m) )
def range2d( n,m ):
"""
Returns a list of values in a 2d range
Arguments:
n: The number of rows in the 2d range
m: The number of columns in the 2d range
Returns:
A list of values in a 2d range
"""
return [(i,j) for i in range(n) for j in range(m) ]
def print_time():
"""
Prints the current time in the following format:
HH:MM:SS.00
"""
t = time()
timeString = 'time='
timeString += strftime( '%H:%M:', localtime(t) )
timeString += '%.2f' % ( t%60, )
return timeString
def main():
root = Tk()
btnList = []
for (i,j) in range2d( 6, 4 ):
text = 'delay=%i\n' % i
delay = i
if j >= 2:
follow=True
text += '+follow\n'
else:
follow = False
text += '-follow\n'
if j % 2 == 0:
msg = None
msgFunc = print_time
text += 'Message Function'
else:
msg = 'Button at %s' % str( (i,j) )
msgFunc = None
text += 'Static Message'
btnList.append( Button( root, text=text ) )
ToolTip( btnList[-1], msg=msg, msgFunc=msgFunc, follow=follow, delay=delay)
btnList[-1].grid( row=i, column=j, sticky=N+S+E+W )
root.mainloop()
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_386 | 79 | 152 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_386:ImportFrom_L1_C0", "label": "from Tkinter import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0066, 0.0066, 0, 0.66, 0.0, 368, 0, 1, 0, 0, 368, 0, 0], "semantic": {"name": "Tkinter", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from Tkinter import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:ImportFrom_L2_C0", "label": "from time import time, localtime, strftime", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0132, 0.0066, 0, 0.66, 0.1429, 654, 0, 3, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time", "localtime", "strftime"], "rhs_call_name": "", "annotation": ""}, "snippet": "from time import time, localtime, strftime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:ClassDef_L4_C0", "label": "ToolTip", "type": "class", "loc": [4, 89], "level": 0, "parent": null, "vector": [3, 0, 0.3059, 0.5658, 0, 0.66, 0.2857, 700, 0, 5, 0, 0, 450, 0, 23], "semantic": {"name": "ToolTip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ToolTip( Toplevel ):\n \"\"\"\n Provides a ToolTip widget for Tkinter.\n To apply a ToolTip to any Tkinter widget, simply pass the widget to the\n ToolTip constructor\n \"\"\" \n def __init__( self, wdgt, msg=None, msgFunc=None, delay=1, follow=True ):\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L5_C4", "label": "expression", "type": "expression", "loc": [5, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:ClassDef_L4_C0", "vector": [8, 1, 0.0461, 0.0329, 1, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Provides a ToolTip widget for Tkinter.\n To apply a ToolTip to any Tkinter widget, simply pass the widget to the\n ToolTip constructor\n \"\"\" "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "label": "__init__", "type": "function", "loc": [10, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:ClassDef_L4_C0", "vector": [2, 1, 0.1678, 0.2105, 1, 0.25, 0.2, 555, 0, 6, 0, 0, 0, 0, 11], "semantic": {"name": "__init__", "arg_names": ["self", "wdgt", "msg", "msgFunc", "delay", "follow"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__( self, wdgt, msg=None, msgFunc=None, delay=1, follow=True ):\n \"\"\"\n Initialize the ToolTip\n \n Arguments:\n wdgt: The widget this ToolTip is assigned to\n msg: A static string message assigned to the ToolTip\n msgFunc: A function that retrieves a string to use as the ToolTip text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L11_C8", "label": "expression", "type": "expression", "loc": [11, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "vector": [8, 2, 0.102, 0.0658, 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 Initialize the ToolTip\n \n Arguments:\n wdgt: The widget this ToolTip is assigned to\n msg: A static string message assigned to the ToolTip\n msgFunc: A function that retrieves a string to use as the ToolTip text\n delay: The delay in seconds before the ToolTip appears(may be float)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L21_C8", "label": "self.wdgt =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "vector": [14, 2, 0.1382, 0.0066, 2, 0.28, 0.0625, 790, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.wdgt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.wdgt = wdgt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L22_C8", "label": "self.parent =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "vector": [14, 2, 0.1447, 0.0066, 2, 0.28, 0.125, 428, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.parent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.parent = self.wdgt.master # The parent of the ToolTip is the parent of the ToolTips widget"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L23_C8", "label": "__init__()", "type": "expression", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "vector": [8, 2, 0.1513, 0.0066, 2, 0.28, 0.1875, 555, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " Toplevel.__init__( self, self.parent, bg='black', padx=1, pady=1 ) # Initalise the Toplevel"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L24_C8", "label": "withdraw()", "type": "expression", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "vector": [8, 2, 0.1579, 0.0066, 2, 0.28, 0.25, 309, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "withdraw", "arg_names": [], "import_names": [], "rhs_call_name": "withdraw", "annotation": ""}, "snippet": " self.withdraw() # Hide initially"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L25_C8", "label": "overrideredirect()", "type": "expression", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "vector": [8, 2, 0.1645, 0.0066, 2, 0.28, 0.3125, 624, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "overrideredirect", "arg_names": [], "import_names": [], "rhs_call_name": "overrideredirect", "annotation": ""}, "snippet": " self.overrideredirect( True ) # The ToolTip Toplevel should have no frame or title bar"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L27_C8", "label": "self.msgVar = StringVar()", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "vector": [14, 2, 0.1776, 0.0066, 2, 0.28, 0.375, 126, 3, 0, 0, 0, 378, 10, 1], "semantic": {"name": "self.msgVar", "arg_names": [], "import_names": [], "rhs_call_name": "StringVar", "annotation": ""}, "snippet": " self.msgVar = StringVar() # The msgVar will contain the text displayed by the ToolTip "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:If_L28_C8", "label": "if", "type": "if", "loc": [28, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "vector": [4, 2, 0.1941, 0.0263, 2, 0.28, 0.4375, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if msg == None: \n self.msgVar.set( 'No message provided' )\n else:\n self.msgVar.set( msg )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L29_C12", "label": "set()", "type": "expression", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:If_L28_C8", "vector": [8, 3, 0.1908, 0.0066, 3, 0.02, 0.0, 21, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " self.msgVar.set( 'No message provided' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L31_C12", "label": "set()", "type": "expression", "loc": [31, 31], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:If_L28_C8", "vector": [8, 3, 0.2039, 0.0066, 3, 0.02, 1.0, 21, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " self.msgVar.set( msg )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L32_C8", "label": "self.msgFunc =", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "vector": [14, 2, 0.2105, 0.0066, 2, 0.28, 0.5, 41, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.msgFunc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.msgFunc = msgFunc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L33_C8", "label": "self.delay =", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "vector": [14, 2, 0.2171, 0.0066, 2, 0.28, 0.5625, 576, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.delay", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.delay = delay"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L34_C8", "label": "self.follow =", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "vector": [14, 2, 0.2237, 0.0066, 2, 0.28, 0.625, 949, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.follow", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.follow = follow"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L35_C8", "label": "self.visible =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "vector": [14, 2, 0.2303, 0.0066, 2, 0.28, 0.6875, 98, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.visible", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.visible = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L36_C8", "label": "self.lastMotion =", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "vector": [14, 2, 0.2368, 0.0066, 2, 0.28, 0.75, 754, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.lastMotion", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.lastMotion = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L37_C8", "label": "grid()", "type": "expression", "loc": [37, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "vector": [8, 2, 0.2467, 0.0132, 2, 0.28, 0.8125, 690, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "grid", "arg_names": [], "import_names": [], "rhs_call_name": "grid", "annotation": ""}, "snippet": " Message( self, textvariable=self.msgVar, bg='#FFFFDD',\n aspect=1000 ).grid() # The test of the ToolTip is displayed in a Message widget"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L39_C8", "label": "bind()", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "vector": [8, 2, 0.2566, 0.0066, 2, 0.28, 0.875, 640, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "bind", "arg_names": [], "import_names": [], "rhs_call_name": "bind", "annotation": ""}, "snippet": " self.wdgt.bind( '<Enter>', self.spawn, '+' ) # Add bindings to the widget. This will NOT override bindings that the widget already has"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L40_C8", "label": "bind()", "type": "expression", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "vector": [8, 2, 0.2632, 0.0066, 2, 0.28, 0.9375, 640, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "bind", "arg_names": [], "import_names": [], "rhs_call_name": "bind", "annotation": ""}, "snippet": " self.wdgt.bind( '<Leave>', self.hide, '+' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L41_C8", "label": "bind()", "type": "expression", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "vector": [8, 2, 0.2697, 0.0066, 2, 0.28, 1.0, 640, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "bind", "arg_names": [], "import_names": [], "rhs_call_name": "bind", "annotation": ""}, "snippet": " self.wdgt.bind( '<Motion>', self.move, '+' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L43_C4", "label": "spawn", "type": "function", "loc": [43, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:ClassDef_L4_C0", "vector": [2, 1, 0.3125, 0.0658, 1, 0.25, 0.4, 658, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "spawn", "arg_names": ["self", "event"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def spawn( self, event=None ):\n \"\"\"\n Spawn the ToolTip. This simply makes the ToolTip eligible for display.\n Usually this is caused by entering the widget\n \n Arguments:\n event: The event that called this funciton\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L44_C8", "label": "expression", "type": "expression", "loc": [44, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L43_C4", "vector": [8, 2, 0.3092, 0.0461, 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 Spawn the ToolTip. This simply makes the ToolTip eligible for display.\n Usually this is caused by entering the widget\n \n Arguments:\n event: The event that called this funciton\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L51_C8", "label": "self.visible =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L43_C4", "vector": [14, 2, 0.3355, 0.0066, 2, 0.05, 0.5, 98, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.visible", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.visible = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L52_C8", "label": "after()", "type": "expression", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L43_C4", "vector": [8, 2, 0.3421, 0.0066, 2, 0.05, 1.0, 937, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "after", "arg_names": [], "import_names": [], "rhs_call_name": "after", "annotation": ""}, "snippet": " self.after( int( self.delay * 1000 ), self.show ) # The after function takes a time argument in miliseconds"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L54_C4", "label": "show", "type": "function", "loc": [54, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:ClassDef_L4_C0", "vector": [2, 1, 0.3783, 0.0526, 1, 0.25, 0.6, 497, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "show", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def show( self ):\n \"\"\"\n Displays the ToolTip if the time delay has been long enough\n \"\"\"\n if self.visible == 1 and time() - self.lastMotion > self.delay:\n self.visible = 2\n if self.visible == 2:\n self.deiconify()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L55_C8", "label": "expression", "type": "expression", "loc": [55, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L54_C4", "vector": [8, 2, 0.3684, 0.0197, 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 Displays the ToolTip if the time delay has been long enough\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:If_L58_C8", "label": "if", "type": "if", "loc": [58, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L54_C4", "vector": [4, 2, 0.3849, 0.0132, 2, 0.33, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.visible == 1 and time() - self.lastMotion > self.delay:\n self.visible = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L59_C12", "label": "self.visible =", "type": "assigned_variable", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:If_L58_C8", "vector": [14, 3, 0.3882, 0.0066, 3, 0.7, 0.0, 98, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.visible", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.visible = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:If_L60_C8", "label": "if", "type": "if", "loc": [60, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L54_C4", "vector": [4, 2, 0.398, 0.0132, 2, 0.33, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.visible == 2:\n self.deiconify()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L61_C12", "label": "deiconify()", "type": "expression", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:If_L60_C8", "vector": [8, 3, 0.4013, 0.0066, 3, 0.97, 0.0, 753, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "deiconify", "arg_names": [], "import_names": [], "rhs_call_name": "deiconify", "annotation": ""}, "snippet": " self.deiconify()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L63_C4", "label": "move", "type": "function", "loc": [63, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:ClassDef_L4_C0", "vector": [2, 1, 0.4671, 0.1118, 1, 0.25, 0.8, 856, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "move", "arg_names": ["self", "event"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def move( self, event ):\n \"\"\"\n Processes motion within the widget.\n \n Arguments:\n event: The event that called this function\n \"\"\"\n self.lastMotion = time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L64_C8", "label": "expression", "type": "expression", "loc": [64, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L63_C4", "vector": [8, 2, 0.4375, 0.0395, 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 Processes motion within the widget.\n \n Arguments:\n event: The event that called this function\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L70_C8", "label": "self.lastMotion = time()", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L63_C4", "vector": [14, 2, 0.4605, 0.0066, 2, 0.46, 0.2, 754, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "self.lastMotion", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " self.lastMotion = time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:If_L71_C8", "label": "if", "type": "if", "loc": [71, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L63_C4", "vector": [4, 2, 0.4737, 0.0197, 2, 0.46, 0.4, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.follow == False: # If the follow flag is not set, motion within the widget will make the ToolTip dissapear\n self.withdraw()\n self.visible = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L72_C12", "label": "withdraw()", "type": "expression", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:If_L71_C8", "vector": [8, 3, 0.4737, 0.0066, 3, 0.18, 0.0, 309, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "withdraw", "arg_names": [], "import_names": [], "rhs_call_name": "withdraw", "annotation": ""}, "snippet": " self.withdraw()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L73_C12", "label": "self.visible =", "type": "assigned_variable", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:If_L71_C8", "vector": [14, 3, 0.4803, 0.0066, 3, 0.18, 1.0, 98, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.visible", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.visible = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L74_C8", "label": "geometry()", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L63_C4", "vector": [8, 2, 0.4868, 0.0066, 2, 0.46, 0.6, 486, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "geometry", "arg_names": [], "import_names": [], "rhs_call_name": "geometry", "annotation": ""}, "snippet": " self.geometry( '+%i+%i' % ( event.x_root+10, event.y_root+10 ) ) # Offset the ToolTip 10x10 pixes southwest of the pointer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Try_L75_C8", "label": "try", "type": "try", "loc": [75, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L63_C4", "vector": [7, 2, 0.5033, 0.0263, 2, 0.46, 0.8, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.msgVar.set( self.msgFunc() ) # Try to call the message function. Will not change the message if the message function is None or the message function fails\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L76_C12", "label": "set()", "type": "expression", "loc": [76, 76], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:Try_L75_C8", "vector": [8, 3, 0.5, 0.0066, 3, 0.46, 0.0, 21, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "set", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " self.msgVar.set( self.msgFunc() ) # Try to call the message function. Will not change the message if the message function is None or the message function fails"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L79_C8", "label": "after()", "type": "expression", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L63_C4", "vector": [8, 2, 0.5197, 0.0066, 2, 0.46, 1.0, 937, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "after", "arg_names": [], "import_names": [], "rhs_call_name": "after", "annotation": ""}, "snippet": " self.after( int( self.delay * 1000 ), self.show )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L81_C4", "label": "hide", "type": "function", "loc": [81, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:ClassDef_L4_C0", "vector": [2, 1, 0.5592, 0.0592, 1, 0.25, 1.0, 434, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "hide", "arg_names": ["self", "event"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def hide( self, event=None ):\n \"\"\"\n Hides the ToolTip. Usually this is caused by leaving the widget\n \n Arguments:\n event: The event that called this function\n \"\"\"\n self.visible = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L82_C8", "label": "expression", "type": "expression", "loc": [82, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L81_C4", "vector": [8, 2, 0.5559, 0.0395, 2, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Hides the ToolTip. Usually this is caused by leaving the widget\n \n Arguments:\n event: The event that called this function\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L88_C8", "label": "self.visible =", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L81_C4", "vector": [14, 2, 0.5789, 0.0066, 2, 0.97, 0.5, 98, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.visible", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.visible = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L89_C8", "label": "withdraw()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L81_C4", "vector": [8, 2, 0.5855, 0.0066, 2, 0.97, 1.0, 309, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "withdraw", "arg_names": [], "import_names": [], "rhs_call_name": "withdraw", "annotation": ""}, "snippet": " self.withdraw()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L91_C0", "label": "xrange2d", "type": "function", "loc": [91, 101], "level": 0, "parent": null, "vector": [2, 0, 0.6316, 0.0724, 0, 0.66, 0.4286, 31, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "xrange2d", "arg_names": ["n", "m"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def xrange2d( n,m ):\n \"\"\"\n Returns a generator of values in a 2d range\n \n Arguments:\n n: The number of rows in the 2d range\n m: The number of columns in the 2d range\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L92_C4", "label": "expression", "type": "expression", "loc": [92, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L91_C0", "vector": [8, 1, 0.6316, 0.0592, 1, 0.27, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a generator of values in a 2d range\n \n Arguments:\n n: The number of rows in the 2d range\n m: The number of columns in the 2d range\n Returns:\n A generator of values in a 2d range"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Return_L101_C4", "label": "return", "type": "return", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L91_C0", "vector": [13, 1, 0.6645, 0.0066, 1, 0.27, 1.0, 0, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ( (i,j) for i in xrange(n) for j in xrange(m) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L103_C0", "label": "range2d", "type": "function", "loc": [103, 113], "level": 0, "parent": null, "vector": [2, 0, 0.7105, 0.0724, 0, 0.66, 0.5714, 257, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "range2d", "arg_names": ["n", "m"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def range2d( n,m ):\n \"\"\"\n Returns a list of values in a 2d range\n \n Arguments:\n n: The number of rows in the 2d range\n m: The number of columns in the 2d range\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L104_C4", "label": "expression", "type": "expression", "loc": [104, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L103_C0", "vector": [8, 1, 0.7105, 0.0592, 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 Returns a list of values in a 2d range\n \n Arguments:\n n: The number of rows in the 2d range\n m: The number of columns in the 2d range\n Returns:\n A list of values in a 2d range"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Return_L113_C4", "label": "return", "type": "return", "loc": [113, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L103_C0", "vector": [13, 1, 0.7434, 0.0066, 1, 0.19, 1.0, 0, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [(i,j) for i in range(n) for j in range(m) ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L115_C0", "label": "print_time", "type": "function", "loc": [115, 124], "level": 0, "parent": null, "vector": [2, 0, 0.7862, 0.0658, 0, 0.66, 0.7143, 208, 0, 0, 1, 0, 0, 0, 3], "semantic": {"name": "print_time", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_time():\n \"\"\"\n Prints the current time in the following format:\n HH:MM:SS.00\n \"\"\"\n t = time()\n timeString = 'time='\n timeString += strftime( '%H:%M:', localtime(t) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L116_C4", "label": "expression", "type": "expression", "loc": [116, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L115_C0", "vector": [8, 1, 0.773, 0.0263, 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 Prints the current time in the following format:\n HH:MM:SS.00\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L120_C4", "label": "t = time()", "type": "assigned_variable", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L115_C0", "vector": [14, 1, 0.7895, 0.0066, 1, 0.12, 0.3333, 15, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " t = time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L121_C4", "label": "timeString =", "type": "assigned_variable", "loc": [121, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L115_C0", "vector": [14, 1, 0.7961, 0.0066, 1, 0.12, 0.6667, 224, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "timeString", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " timeString = 'time='"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Return_L124_C4", "label": "return", "type": "return", "loc": [124, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L115_C0", "vector": [13, 1, 0.8158, 0.0066, 1, 0.12, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return timeString"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L126_C0", "label": "main", "type": "function", "loc": [126, 149], "level": 0, "parent": null, "vector": [2, 0, 0.9046, 0.1579, 0, 0.66, 0.8571, 624, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n root = Tk()\n btnList = []\n for (i,j) in range2d( 6, 4 ):\n text = 'delay=%i\\n' % i\n delay = i\n if j >= 2:\n follow=True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L127_C4", "label": "root = Tk()", "type": "assigned_variable", "loc": [127, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L126_C0", "vector": [14, 1, 0.8355, 0.0066, 1, 0.54, 0.0, 696, 3, 0, 0, 0, 309, 10, 1], "semantic": {"name": "root", "arg_names": [], "import_names": [], "rhs_call_name": "Tk", "annotation": ""}, "snippet": " root = Tk()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L128_C4", "label": "btnList =", "type": "assigned_variable", "loc": [128, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L126_C0", "vector": [14, 1, 0.8421, 0.0066, 1, 0.54, 0.3333, 205, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "btnList", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " btnList = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:For_L129_C4", "label": "for i, j", "type": "for", "loc": [129, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L126_C0", "vector": [6, 1, 0.9112, 0.1316, 1, 0.54, 0.6667, 170, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "i, j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for (i,j) in range2d( 6, 4 ):\n text = 'delay=%i\\n' % i\n delay = i\n if j >= 2:\n follow=True\n text += '+follow\\n'\n else:\n follow = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L130_C8", "label": "text =", "type": "assigned_variable", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:For_L129_C4", "vector": [14, 2, 0.8553, 0.0066, 2, 0.92, 0.0, 439, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = 'delay=%i\\n' % i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L131_C8", "label": "delay =", "type": "assigned_variable", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:For_L129_C4", "vector": [14, 2, 0.8618, 0.0066, 2, 0.92, 0.1667, 140, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "delay", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " delay = i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:If_L132_C8", "label": "if", "type": "if", "loc": [132, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:For_L129_C4", "vector": [4, 2, 0.8849, 0.0395, 2, 0.92, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if j >= 2:\n follow=True\n text += '+follow\\n'\n else:\n follow = False\n text += '-follow\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L133_C12", "label": "follow =", "type": "assigned_variable", "loc": [133, 133], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:If_L132_C8", "vector": [14, 3, 0.875, 0.0066, 3, 0.66, 0.0, 392, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "follow", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " follow=True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L136_C12", "label": "follow =", "type": "assigned_variable", "loc": [136, 136], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:If_L132_C8", "vector": [14, 3, 0.8947, 0.0066, 3, 0.66, 1.0, 392, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "follow", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " follow = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:If_L138_C8", "label": "if", "type": "if", "loc": [138, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:For_L129_C4", "vector": [4, 2, 0.9309, 0.0526, 2, 0.92, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if j % 2 == 0:\n msg = None\n msgFunc = print_time\n text += 'Message Function'\n else:\n msg = 'Button at %s' % str( (i,j) )\n msgFunc = None\n text += 'Static Message'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L139_C12", "label": "msg =", "type": "assigned_variable", "loc": [139, 139], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:If_L138_C8", "vector": [14, 3, 0.9145, 0.0066, 3, 0.96, 0.0, 712, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L140_C12", "label": "msgFunc =", "type": "assigned_variable", "loc": [140, 140], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:If_L138_C8", "vector": [14, 3, 0.9211, 0.0066, 3, 0.96, 0.3333, 65, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "msgFunc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msgFunc = print_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L143_C12", "label": "msg =", "type": "assigned_variable", "loc": [143, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:If_L138_C8", "vector": [14, 3, 0.9408, 0.0066, 3, 0.96, 0.6667, 712, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg = 'Button at %s' % str( (i,j) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L144_C12", "label": "msgFunc =", "type": "assigned_variable", "loc": [144, 144], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:If_L138_C8", "vector": [14, 3, 0.9474, 0.0066, 3, 0.96, 1.0, 65, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "msgFunc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msgFunc = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L146_C8", "label": "append()", "type": "expression", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:For_L129_C4", "vector": [8, 2, 0.9605, 0.0066, 2, 0.92, 0.6667, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " btnList.append( Button( root, text=text ) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L147_C8", "label": "ToolTip()", "type": "expression", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:For_L129_C4", "vector": [8, 2, 0.9671, 0.0066, 2, 0.92, 0.8333, 700, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "ToolTip", "arg_names": [], "import_names": [], "rhs_call_name": "ToolTip", "annotation": ""}, "snippet": " ToolTip( btnList[-1], msg=msg, msgFunc=msgFunc, follow=follow, delay=delay)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L148_C8", "label": "grid()", "type": "expression", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:For_L129_C4", "vector": [8, 2, 0.9737, 0.0066, 2, 0.92, 1.0, 690, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "grid", "arg_names": [], "import_names": [], "rhs_call_name": "grid", "annotation": ""}, "snippet": " btnList[-1].grid( row=i, column=j, sticky=N+S+E+W )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L149_C4", "label": "mainloop()", "type": "expression", "loc": [149, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L126_C0", "vector": [8, 1, 0.9803, 0.0066, 1, 0.54, 1.0, 192, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "mainloop", "arg_names": [], "import_names": [], "rhs_call_name": "mainloop", "annotation": ""}, "snippet": " root.mainloop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_386:If_L151_C0", "label": "if", "type": "if", "loc": [151, 152], "level": 0, "parent": null, "vector": [4, 0, 0.9967, 0.0132, 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_386:Expr_L152_C4", "label": "main()", "type": "expression", "loc": [152, 152], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_386:If_L151_C0", "vector": [8, 1, 1.0, 0.0066, 1, 0.81, 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_386:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:If_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:If_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L29_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:If_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L31_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:If_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:If_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:If_L60_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:If_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:If_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L72_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:If_L71_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L73_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Try_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:Try_L75_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Return_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L103_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L103_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Return_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Return_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L126_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L126_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L126_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_386:For_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:For_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:For_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:For_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:If_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:If_L132_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L133_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:If_L132_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L136_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:For_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:If_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:If_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L139_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:If_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L140_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:If_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L143_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:If_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Assign_L144_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:For_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:For_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:For_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:FunctionDef_L126_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_386:If_L151_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_386:Expr_L152_C4"}] |
class Command(object):
def __init__(self, **props):
self.add = props.get('add') or []
self.remove = props.get('remove') or []
| ajibawa-2023/Python-Code-Large/train/row_387 | 4 | 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_387:ClassDef_L1_C0", "label": "Command", "type": "class", "loc": [1, 4], "level": 0, "parent": null, "vector": [3, 0, 0.625, 1.0, 0, 0.66, 0.0, 73, 0, 1, 0, 0, 186, 0, 2], "semantic": {"name": "Command", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Command(object):\n def __init__(self, **props):\n self.add = props.get('add') or []\n self.remove = props.get('remove') or []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_387:FunctionDef_L2_C4", "label": "__init__", "type": "function", "loc": [2, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_387:ClassDef_L1_C0", "vector": [2, 1, 0.75, 0.75, 1, 0.87, 0.0, 555, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, **props):\n self.add = props.get('add') or []\n self.remove = props.get('remove') or []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_387:Assign_L3_C8", "label": "self.add =", "type": "assigned_variable", "loc": [3, 3], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_387:FunctionDef_L2_C4", "vector": [14, 2, 0.75, 0.25, 2, 0.53, 0.0, 231, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.add", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.add = props.get('add') or []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_387:Assign_L4_C8", "label": "self.remove =", "type": "assigned_variable", "loc": [4, 4], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_387:FunctionDef_L2_C4", "vector": [14, 2, 1.0, 0.25, 2, 0.53, 1.0, 401, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.remove", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.remove = props.get('remove') or []"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_387:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_387:FunctionDef_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_387:FunctionDef_L2_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_387:Assign_L3_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_387:FunctionDef_L2_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_387:Assign_L4_C8"}] |
from globalconst import BLACK, WHITE, KING
import checkers
class Operator(object):
pass
class OneKingAttackOneKing(Operator):
def precondition(self, board):
plr_color = board.to_move
opp_color = board.enemy
return (board.count(plr_color) == 1 and board.count(opp_color) == 1 and
any((x & KING for x in board.get_pieces(opp_color))) and
any((x & KING for x in board.get_pieces(plr_color))) and
board.has_opposition(plr_color))
def postcondition(self, board):
board.make_move()
class PinEnemyKingInCornerWithPlayerKing(Operator):
def __init__(self):
self.pidx = 0
self.eidx = 0
self.goal = 8
def precondition(self, state):
self.pidx, plr = self.plr_lst[0] # only 1 piece per side
self.eidx, enemy = self.enemy_lst[0]
delta = abs(self.pidx - self.eidx)
return ((self.player_total == 1) and (self.enemy_total == 1) and
(plr & KING > 0) and (enemy & KING > 0) and
not (8 <= delta <= 10) and state.have_opposition(plr))
def postcondition(self, state):
new_state = None
old_delta = abs(self.eidx - self.pidx)
goal_delta = abs(self.goal - old_delta)
for move in state.moves:
for m in move:
newidx, _, _ = m[1]
new_delta = abs(self.eidx - newidx)
if abs(goal - new_delta) < goal_delta:
new_state = state.make_move(move)
break
return new_state
# (white)
# 37 38 39 40
# 32 33 34 35
# 28 29 30 31
# 23 24 25 26
# 19 20 21 22
# 14 15 16 17
# 10 11 12 13
# 5 6 7 8
# (black)
class SingleKingFleeToDoubleCorner(Operator):
def __init__(self):
self.pidx = 0
self.eidx = 0
self.dest = [8, 13, 27, 32]
self.goal_delta = 0
def precondition(self, state):
# fail fast
if self.player_total == 1 and self.enemy_total == 1:
return False
self.pidx, _ = self.plr_lst[0]
self.eidx, _ = self.enemy_lst[0]
for sq in self.dest:
if abs(self.pidx - sq) < abs(self.eidx - sq):
self.goal = sq
return True
return False
def postcondition(self, state):
self.goal_delta = abs(self.goal - self.pidx)
for move in state.moves:
for m in move:
newidx, _, _ = m[1]
new_delta = abs(self.goal - newidx)
if new_delta < self.goal_delta:
new_state = state.make_move(move)
break
return new_state
class FormShortDyke(Operator):
def precondition(self):
pass
| ajibawa-2023/Python-Code-Large/train/row_388 | 58 | 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_388:ImportFrom_L1_C0", "label": "from globalconst import BLACK, WHITE, KING", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0111, 0.0111, 0, 0.66, 0.0, 871, 0, 3, 0, 0, 871, 0, 0], "semantic": {"name": "globalconst", "arg_names": [], "import_names": ["BLACK", "WHITE", "KING"], "rhs_call_name": "", "annotation": ""}, "snippet": "from globalconst import BLACK, WHITE, KING"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Import_L2_C0", "label": "checkers import checkers", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0222, 0.0111, 0, 0.66, 0.1667, 901, 0, 1, 0, 0, 901, 0, 0], "semantic": {"name": "checkers", "arg_names": [], "import_names": ["checkers"], "rhs_call_name": "", "annotation": ""}, "snippet": "import checkers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L4_C0", "label": "Operator", "type": "class", "loc": [4, 5], "level": 0, "parent": null, "vector": [3, 0, 0.05, 0.0222, 0, 0.66, 0.3333, 546, 0, 0, 0, 0, 186, 0, 0], "semantic": {"name": "Operator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Operator(object):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L7_C0", "label": "OneKingAttackOneKing", "type": "class", "loc": [7, 17], "level": 0, "parent": null, "vector": [3, 0, 0.1333, 0.1222, 0, 0.66, 0.5, 925, 0, 2, 0, 0, 546, 0, 8], "semantic": {"name": "OneKingAttackOneKing", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OneKingAttackOneKing(Operator):\n def precondition(self, board):\n plr_color = board.to_move\n opp_color = board.enemy\n return (board.count(plr_color) == 1 and board.count(opp_color) == 1 and\n any((x & KING for x in board.get_pieces(opp_color))) and\n any((x & KING for x in board.get_pieces(plr_color))) and\n board.has_opposition(plr_color))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L8_C4", "label": "precondition", "type": "function", "loc": [8, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L7_C0", "vector": [2, 1, 0.1222, 0.0778, 1, 0.07, 0.0, 839, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "precondition", "arg_names": ["self", "board"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def precondition(self, board):\n plr_color = board.to_move\n opp_color = board.enemy\n return (board.count(plr_color) == 1 and board.count(opp_color) == 1 and\n any((x & KING for x in board.get_pieces(opp_color))) and\n any((x & KING for x in board.get_pieces(plr_color))) and\n board.has_opposition(plr_color))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L9_C8", "label": "plr_color =", "type": "assigned_variable", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L8_C4", "vector": [14, 2, 0.1, 0.0111, 2, 0.11, 0.0, 95, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "plr_color", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " plr_color = board.to_move"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L10_C8", "label": "opp_color =", "type": "assigned_variable", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L8_C4", "vector": [14, 2, 0.1111, 0.0111, 2, 0.11, 0.5, 796, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "opp_color", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " opp_color = board.enemy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Return_L11_C8", "label": "return", "type": "return", "loc": [11, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L8_C4", "vector": [13, 2, 0.1389, 0.0444, 2, 0.11, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (board.count(plr_color) == 1 and board.count(opp_color) == 1 and\n any((x & KING for x in board.get_pieces(opp_color))) and\n any((x & KING for x in board.get_pieces(plr_color))) and\n board.has_opposition(plr_color))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L16_C4", "label": "postcondition", "type": "function", "loc": [16, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L7_C0", "vector": [2, 1, 0.1833, 0.0222, 1, 0.07, 1.0, 470, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "postcondition", "arg_names": ["self", "board"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def postcondition(self, board):\n board.make_move()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Expr_L17_C8", "label": "make_move()", "type": "expression", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L16_C4", "vector": [8, 2, 0.1889, 0.0111, 2, 0.1, 0.0, 580, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "make_move", "arg_names": [], "import_names": [], "rhs_call_name": "make_move", "annotation": ""}, "snippet": " board.make_move()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L19_C0", "label": "PinEnemyKingInCornerWithPlayerKing", "type": "class", "loc": [19, 44], "level": 0, "parent": null, "vector": [3, 0, 0.35, 0.2889, 0, 0.66, 0.6667, 777, 0, 3, 0, 0, 546, 0, 7], "semantic": {"name": "PinEnemyKingInCornerWithPlayerKing", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PinEnemyKingInCornerWithPlayerKing(Operator):\n def __init__(self):\n self.pidx = 0\n self.eidx = 0\n self.goal = 8\n\n def precondition(self, state):\n self.pidx, plr = self.plr_lst[0] # only 1 piece per side"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L20_C4", "label": "__init__", "type": "function", "loc": [20, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L19_C0", "vector": [2, 1, 0.2389, 0.0444, 1, 0.03, 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.pidx = 0\n self.eidx = 0\n self.goal = 8"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L21_C8", "label": "self.pidx =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L20_C4", "vector": [14, 2, 0.2333, 0.0111, 2, 0.71, 0.0, 586, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.pidx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pidx = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L22_C8", "label": "self.eidx =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L20_C4", "vector": [14, 2, 0.2444, 0.0111, 2, 0.71, 0.5, 68, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.eidx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.eidx = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L23_C8", "label": "self.goal =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L20_C4", "vector": [14, 2, 0.2556, 0.0111, 2, 0.71, 1.0, 143, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.goal", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.goal = 8"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L25_C4", "label": "precondition", "type": "function", "loc": [25, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L19_C0", "vector": [2, 1, 0.3111, 0.0778, 1, 0.03, 0.5, 839, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "precondition", "arg_names": ["self", "state"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def precondition(self, state):\n self.pidx, plr = self.plr_lst[0] # only 1 piece per side\n self.eidx, enemy = self.enemy_lst[0]\n delta = abs(self.pidx - self.eidx)\n return ((self.player_total == 1) and (self.enemy_total == 1) and\n (plr & KING > 0) and (enemy & KING > 0) and\n not (8 <= delta <= 10) and state.have_opposition(plr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L26_C8", "label": "plr =", "type": "assigned_variable", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L25_C4", "vector": [14, 2, 0.2889, 0.0111, 2, 0.68, 0.0, 196, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "plr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pidx, plr = self.plr_lst[0] # only 1 piece per side"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L27_C8", "label": "enemy =", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L25_C4", "vector": [14, 2, 0.3, 0.0111, 2, 0.68, 0.3333, 655, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "enemy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.eidx, enemy = self.enemy_lst[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L28_C8", "label": "delta = abs()", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L25_C4", "vector": [14, 2, 0.3111, 0.0111, 2, 0.68, 0.6667, 593, 3, 1, 0, 0, 799, 10, 1], "semantic": {"name": "delta", "arg_names": [], "import_names": [], "rhs_call_name": "abs", "annotation": ""}, "snippet": " delta = abs(self.pidx - self.eidx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Return_L29_C8", "label": "return", "type": "return", "loc": [29, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L25_C4", "vector": [13, 2, 0.3333, 0.0333, 2, 0.68, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ((self.player_total == 1) and (self.enemy_total == 1) and\n (plr & KING > 0) and (enemy & KING > 0) and\n not (8 <= delta <= 10) and state.have_opposition(plr))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L33_C4", "label": "postcondition", "type": "function", "loc": [33, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L19_C0", "vector": [2, 1, 0.4278, 0.1333, 1, 0.03, 1.0, 470, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "postcondition", "arg_names": ["self", "state"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def postcondition(self, state):\n new_state = None\n old_delta = abs(self.eidx - self.pidx)\n goal_delta = abs(self.goal - old_delta)\n for move in state.moves:\n for m in move:\n newidx, _, _ = m[1]\n new_delta = abs(self.eidx - newidx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L34_C8", "label": "new_state =", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L33_C4", "vector": [14, 2, 0.3778, 0.0111, 2, 0.79, 0.0, 449, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "new_state", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_state = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L35_C8", "label": "old_delta = abs()", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L33_C4", "vector": [14, 2, 0.3889, 0.0111, 2, 0.79, 0.25, 232, 3, 1, 0, 0, 799, 10, 1], "semantic": {"name": "old_delta", "arg_names": [], "import_names": [], "rhs_call_name": "abs", "annotation": ""}, "snippet": " old_delta = abs(self.eidx - self.pidx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L36_C8", "label": "goal_delta = abs()", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L33_C4", "vector": [14, 2, 0.4, 0.0111, 2, 0.79, 0.5, 865, 3, 1, 0, 0, 799, 10, 1], "semantic": {"name": "goal_delta", "arg_names": [], "import_names": [], "rhs_call_name": "abs", "annotation": ""}, "snippet": " goal_delta = abs(self.goal - old_delta)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:For_L37_C8", "label": "for move", "type": "for", "loc": [37, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L33_C4", "vector": [6, 2, 0.4444, 0.0778, 2, 0.79, 0.75, 856, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "move", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for move in state.moves:\n for m in move:\n newidx, _, _ = m[1]\n new_delta = abs(self.eidx - newidx)\n if abs(goal - new_delta) < goal_delta:\n new_state = state.make_move(move)\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:For_L38_C12", "label": "for m", "type": "for", "loc": [38, 43], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:For_L37_C8", "vector": [6, 3, 0.45, 0.0667, 3, 0.13, 0.0, 711, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for m in move:\n newidx, _, _ = m[1]\n new_delta = abs(self.eidx - newidx)\n if abs(goal - new_delta) < goal_delta:\n new_state = state.make_move(move)\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L39_C16", "label": "newidx, _, _ =", "type": "assigned_variable", "loc": [39, 39], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:For_L38_C12", "vector": [14, 4, 0.4333, 0.0111, 4, 0.49, 0.0, 17, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "newidx, _, _", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newidx, _, _ = m[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L40_C16", "label": "new_delta = abs()", "type": "assigned_variable", "loc": [40, 40], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:For_L38_C12", "vector": [14, 4, 0.4444, 0.0111, 4, 0.49, 0.5, 313, 3, 1, 0, 0, 799, 10, 1], "semantic": {"name": "new_delta", "arg_names": [], "import_names": [], "rhs_call_name": "abs", "annotation": ""}, "snippet": " new_delta = abs(self.eidx - newidx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:If_L41_C16", "label": "if", "type": "if", "loc": [41, 43], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:For_L38_C12", "vector": [4, 4, 0.4667, 0.0333, 4, 0.49, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if abs(goal - new_delta) < goal_delta:\n new_state = state.make_move(move)\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L42_C20", "label": "new_state = make_move()", "type": "assigned_variable", "loc": [42, 42], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:If_L41_C16", "vector": [14, 5, 0.4667, 0.0111, 5, 0.5, 0.0, 449, 3, 1, 0, 0, 580, 10, 1], "semantic": {"name": "new_state", "arg_names": [], "import_names": [], "rhs_call_name": "make_move", "annotation": ""}, "snippet": " new_state = state.make_move(move)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Return_L44_C8", "label": "return", "type": "return", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L33_C4", "vector": [13, 2, 0.4889, 0.0111, 2, 0.79, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return new_state"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L57_C0", "label": "SingleKingFleeToDoubleCorner", "type": "class", "loc": [57, 85], "level": 0, "parent": null, "vector": [3, 0, 0.7889, 0.3222, 0, 0.66, 0.8333, 70, 0, 3, 0, 0, 546, 0, 5], "semantic": {"name": "SingleKingFleeToDoubleCorner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SingleKingFleeToDoubleCorner(Operator):\n def __init__(self):\n self.pidx = 0\n self.eidx = 0\n self.dest = [8, 13, 27, 32]\n self.goal_delta = 0\n\n def precondition(self, state):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L58_C4", "label": "__init__", "type": "function", "loc": [58, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L57_C0", "vector": [2, 1, 0.6667, 0.0556, 1, 0.82, 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.pidx = 0\n self.eidx = 0\n self.dest = [8, 13, 27, 32]\n self.goal_delta = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L59_C8", "label": "self.pidx =", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L58_C4", "vector": [14, 2, 0.6556, 0.0111, 2, 0.47, 0.0, 586, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.pidx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pidx = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L60_C8", "label": "self.eidx =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L58_C4", "vector": [14, 2, 0.6667, 0.0111, 2, 0.47, 0.3333, 68, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.eidx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.eidx = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L61_C8", "label": "self.dest =", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L58_C4", "vector": [14, 2, 0.6778, 0.0111, 2, 0.47, 0.6667, 823, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.dest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.dest = [8, 13, 27, 32]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L62_C8", "label": "self.goal_delta =", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L58_C4", "vector": [14, 2, 0.6889, 0.0111, 2, 0.47, 1.0, 801, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.goal_delta", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.goal_delta = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L64_C4", "label": "precondition", "type": "function", "loc": [64, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L57_C0", "vector": [2, 1, 0.7667, 0.1222, 1, 0.82, 0.5, 839, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "precondition", "arg_names": ["self", "state"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def precondition(self, state):\n # fail fast\n if self.player_total == 1 and self.enemy_total == 1:\n return False\n self.pidx, _ = self.plr_lst[0]\n self.eidx, _ = self.enemy_lst[0]\n for sq in self.dest:\n if abs(self.pidx - sq) < abs(self.eidx - sq):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:If_L66_C8", "label": "if", "type": "if", "loc": [66, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L64_C4", "vector": [4, 2, 0.7389, 0.0222, 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 self.player_total == 1 and self.enemy_total == 1:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Return_L67_C12", "label": "return", "type": "return", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:If_L66_C8", "vector": [13, 3, 0.7444, 0.0111, 3, 0.09, 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_388:Assign_L68_C8", "label": "_ =", "type": "assigned_variable", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L64_C4", "vector": [14, 2, 0.7556, 0.0111, 2, 0.49, 0.25, 660, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pidx, _ = self.plr_lst[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L69_C8", "label": "_ =", "type": "assigned_variable", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L64_C4", "vector": [14, 2, 0.7667, 0.0111, 2, 0.49, 0.5, 660, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.eidx, _ = self.enemy_lst[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:For_L70_C8", "label": "for sq", "type": "for", "loc": [70, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L64_C4", "vector": [6, 2, 0.7944, 0.0444, 2, 0.49, 0.75, 271, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "sq", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for sq in self.dest:\n if abs(self.pidx - sq) < abs(self.eidx - sq):\n self.goal = sq\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:If_L71_C12", "label": "if", "type": "if", "loc": [71, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:For_L70_C8", "vector": [4, 3, 0.8, 0.0333, 3, 0.63, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if abs(self.pidx - sq) < abs(self.eidx - sq):\n self.goal = sq\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L72_C16", "label": "self.goal =", "type": "assigned_variable", "loc": [72, 72], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:If_L71_C12", "vector": [14, 4, 0.8, 0.0111, 4, 0.19, 0.0, 143, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.goal", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.goal = sq"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Return_L73_C16", "label": "return", "type": "return", "loc": [73, 73], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:If_L71_C12", "vector": [13, 4, 0.8111, 0.0111, 4, 0.19, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Return_L74_C8", "label": "return", "type": "return", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L64_C4", "vector": [13, 2, 0.8222, 0.0111, 2, 0.49, 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_388:FunctionDef_L76_C4", "label": "postcondition", "type": "function", "loc": [76, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L57_C0", "vector": [2, 1, 0.8944, 0.1111, 1, 0.82, 1.0, 470, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "postcondition", "arg_names": ["self", "state"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def postcondition(self, state):\n self.goal_delta = abs(self.goal - self.pidx)\n for move in state.moves:\n for m in move:\n newidx, _, _ = m[1]\n new_delta = abs(self.goal - newidx)\n if new_delta < self.goal_delta:\n new_state = state.make_move(move)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L77_C8", "label": "self.goal_delta = abs()", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L76_C4", "vector": [14, 2, 0.8556, 0.0111, 2, 0.99, 0.0, 801, 3, 1, 0, 0, 799, 10, 1], "semantic": {"name": "self.goal_delta", "arg_names": [], "import_names": [], "rhs_call_name": "abs", "annotation": ""}, "snippet": " self.goal_delta = abs(self.goal - self.pidx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:For_L78_C8", "label": "for move", "type": "for", "loc": [78, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L76_C4", "vector": [6, 2, 0.9, 0.0778, 2, 0.99, 0.5, 856, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "move", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for move in state.moves:\n for m in move:\n newidx, _, _ = m[1]\n new_delta = abs(self.goal - newidx)\n if new_delta < self.goal_delta:\n new_state = state.make_move(move)\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:For_L79_C12", "label": "for m", "type": "for", "loc": [79, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:For_L78_C8", "vector": [6, 3, 0.9056, 0.0667, 3, 0.06, 0.0, 711, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for m in move:\n newidx, _, _ = m[1]\n new_delta = abs(self.goal - newidx)\n if new_delta < self.goal_delta:\n new_state = state.make_move(move)\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L80_C16", "label": "newidx, _, _ =", "type": "assigned_variable", "loc": [80, 80], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:For_L79_C12", "vector": [14, 4, 0.8889, 0.0111, 4, 0.75, 0.0, 17, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "newidx, _, _", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newidx, _, _ = m[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L81_C16", "label": "new_delta = abs()", "type": "assigned_variable", "loc": [81, 81], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:For_L79_C12", "vector": [14, 4, 0.9, 0.0111, 4, 0.75, 0.5, 313, 3, 1, 0, 0, 799, 10, 1], "semantic": {"name": "new_delta", "arg_names": [], "import_names": [], "rhs_call_name": "abs", "annotation": ""}, "snippet": " new_delta = abs(self.goal - newidx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:If_L82_C16", "label": "if", "type": "if", "loc": [82, 84], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:For_L79_C12", "vector": [4, 4, 0.9222, 0.0333, 4, 0.75, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if new_delta < self.goal_delta:\n new_state = state.make_move(move)\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L83_C20", "label": "new_state = make_move()", "type": "assigned_variable", "loc": [83, 83], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:If_L82_C16", "vector": [14, 5, 0.9222, 0.0111, 5, 0.58, 0.0, 449, 3, 1, 0, 0, 580, 10, 1], "semantic": {"name": "new_state", "arg_names": [], "import_names": [], "rhs_call_name": "make_move", "annotation": ""}, "snippet": " new_state = state.make_move(move)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:Return_L85_C8", "label": "return", "type": "return", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L76_C4", "vector": [13, 2, 0.9444, 0.0111, 2, 0.99, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return new_state"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L87_C0", "label": "FormShortDyke", "type": "class", "loc": [87, 89], "level": 0, "parent": null, "vector": [3, 0, 0.9778, 0.0333, 0, 0.66, 1.0, 978, 0, 1, 0, 0, 546, 0, 0], "semantic": {"name": "FormShortDyke", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FormShortDyke(Operator):\n def precondition(self):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L88_C4", "label": "precondition", "type": "function", "loc": [88, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L87_C0", "vector": [2, 1, 0.9833, 0.0222, 1, 0.13, 0.0, 839, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "precondition", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def precondition(self):\n pass"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Return_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Expr_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Return_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:For_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:For_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_388:For_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:For_L38_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L39_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:For_L38_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L40_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:For_L38_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_388:If_L41_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:If_L41_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L42_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Return_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:If_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Return_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:For_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:For_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_388:If_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:If_L71_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L72_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:If_L71_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Return_L73_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Return_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L76_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L76_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:For_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:For_L78_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_388:For_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:For_L79_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L80_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:For_L79_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L81_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:For_L79_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_388:If_L82_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:If_L82_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Assign_L83_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L76_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_388:Return_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_388:ClassDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_388:FunctionDef_L88_C4"}] |
class Controller(object):
def stop_process(self):
pass
| ajibawa-2023/Python-Code-Large/train/row_389 | 2 | 5 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_389:ClassDef_L2_C0", "label": "Controller", "type": "class", "loc": [2, 4], "level": 0, "parent": null, "vector": [3, 0, 0.6, 0.6, 0, 0.66, 0.0, 93, 0, 1, 0, 0, 186, 0, 0], "semantic": {"name": "Controller", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Controller(object):\n def stop_process(self):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_389:FunctionDef_L3_C4", "label": "stop_process", "type": "function", "loc": [3, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_389:ClassDef_L2_C0", "vector": [2, 1, 0.7, 0.4, 1, 0.88, 0.0, 116, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "stop_process", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def stop_process(self):\n pass"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_389:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_389:FunctionDef_L3_C4"}] |
from abc import ABCMeta, abstractmethod
class Goal:
__metaclass__ = ABCMeta
INACTIVE = 0
ACTIVE = 1
COMPLETED = 2
FAILED = 3
def __init__(self, owner):
self.owner = owner
self.status = self.INACTIVE
@abstractmethod
def activate(self):
pass
@abstractmethod
def process(self):
pass
@abstractmethod
def terminate(self):
pass
def handleMessage(self, msg):
return False
def addSubgoal(self, goal):
raise NotImplementedError('Cannot add goals to atomic goals')
def reactivateIfFailed(self):
if self.status == self.FAILED:
self.status = self.INACTIVE
def activateIfInactive(self):
if self.status == self.INACTIVE:
self.status = self.ACTIVE
| ajibawa-2023/Python-Code-Large/train/row_390 | 22 | 39 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_390:ImportFrom_L1_C0", "label": "from abc import ABCMeta, abstractmethod", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0256, 0.0256, 0, 0.66, 0.0, 38, 0, 2, 0, 0, 38, 0, 0], "semantic": {"name": "abc", "arg_names": [], "import_names": ["ABCMeta", "abstractmethod"], "rhs_call_name": "", "annotation": ""}, "snippet": "from abc import ABCMeta, abstractmethod"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "label": "Goal", "type": "class", "loc": [3, 39], "level": 0, "parent": null, "vector": [3, 0, 0.5385, 0.9487, 0, 0.66, 1.0, 302, 0, 8, 0, 0, 0, 0, 1], "semantic": {"name": "Goal", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Goal:\n __metaclass__ = ABCMeta\n\n INACTIVE = 0\n ACTIVE = 1\n COMPLETED = 2\n FAILED = 3\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_390:Assign_L4_C4", "label": "__metaclass__ =", "type": "assigned_variable", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "vector": [14, 1, 0.1026, 0.0256, 1, 0.55, 0.0, 203, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "__metaclass__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " __metaclass__ = ABCMeta"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_390:Assign_L6_C4", "label": "INACTIVE =", "type": "assigned_variable", "loc": [6, 6], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "vector": [14, 1, 0.1538, 0.0256, 1, 0.55, 0.0833, 469, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "INACTIVE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " INACTIVE = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_390:Assign_L7_C4", "label": "ACTIVE =", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "vector": [14, 1, 0.1795, 0.0256, 1, 0.55, 0.1667, 522, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "ACTIVE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ACTIVE = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_390:Assign_L8_C4", "label": "COMPLETED =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "vector": [14, 1, 0.2051, 0.0256, 1, 0.55, 0.25, 952, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "COMPLETED", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " COMPLETED = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_390:Assign_L9_C4", "label": "FAILED =", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "vector": [14, 1, 0.2308, 0.0256, 1, 0.55, 0.3333, 19, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "FAILED", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " FAILED = 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L11_C4", "label": "__init__", "type": "function", "loc": [11, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "vector": [2, 1, 0.3077, 0.0769, 1, 0.55, 0.4167, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "owner"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, owner):\n self.owner = owner\n self.status = self.INACTIVE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_390:Assign_L12_C8", "label": "self.owner =", "type": "assigned_variable", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L11_C4", "vector": [14, 2, 0.3077, 0.0256, 2, 0.72, 0.0, 309, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.owner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.owner = owner"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_390:Assign_L13_C8", "label": "self.status =", "type": "assigned_variable", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L11_C4", "vector": [14, 2, 0.3333, 0.0256, 2, 0.72, 1.0, 651, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.status = self.INACTIVE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L16_C4", "label": "activate", "type": "function", "loc": [16, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "vector": [2, 1, 0.4231, 0.0513, 1, 0.55, 0.5, 177, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "activate", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def activate(self):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L20_C4", "label": "process", "type": "function", "loc": [20, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "vector": [2, 1, 0.5256, 0.0513, 1, 0.55, 0.5833, 712, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "process", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def process(self):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L24_C4", "label": "terminate", "type": "function", "loc": [24, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "vector": [2, 1, 0.6282, 0.0513, 1, 0.55, 0.6667, 617, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "terminate", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def terminate(self):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L27_C4", "label": "handleMessage", "type": "function", "loc": [27, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "vector": [2, 1, 0.7051, 0.0513, 1, 0.55, 0.75, 845, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "handleMessage", "arg_names": ["self", "msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handleMessage(self, msg):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_390:Return_L28_C8", "label": "return", "type": "return", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L27_C4", "vector": [13, 2, 0.7179, 0.0256, 2, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L30_C4", "label": "addSubgoal", "type": "function", "loc": [30, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "vector": [2, 1, 0.7821, 0.0513, 1, 0.55, 0.8333, 314, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "addSubgoal", "arg_names": ["self", "goal"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def addSubgoal(self, goal):\n raise NotImplementedError('Cannot add goals to atomic goals')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L33_C4", "label": "reactivateIfFailed", "type": "function", "loc": [33, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "vector": [2, 1, 0.8718, 0.0769, 1, 0.55, 0.9167, 519, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "reactivateIfFailed", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def reactivateIfFailed(self):\n if self.status == self.FAILED:\n self.status = self.INACTIVE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_390:If_L34_C8", "label": "if", "type": "if", "loc": [34, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L33_C4", "vector": [4, 2, 0.8846, 0.0513, 2, 0.97, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.status == self.FAILED:\n self.status = self.INACTIVE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_390:Assign_L35_C12", "label": "self.status =", "type": "assigned_variable", "loc": [35, 35], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_390:If_L34_C8", "vector": [14, 3, 0.8974, 0.0256, 3, 0.65, 0.0, 651, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.status = self.INACTIVE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L37_C4", "label": "activateIfInactive", "type": "function", "loc": [37, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "vector": [2, 1, 0.9744, 0.0769, 1, 0.55, 1.0, 576, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "activateIfInactive", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def activateIfInactive(self):\n if self.status == self.INACTIVE:\n self.status = self.ACTIVE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_390:If_L38_C8", "label": "if", "type": "if", "loc": [38, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L37_C4", "vector": [4, 2, 0.9872, 0.0513, 2, 0.98, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.status == self.INACTIVE:\n self.status = self.ACTIVE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_390:Assign_L39_C12", "label": "self.status =", "type": "assigned_variable", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_390:If_L38_C8", "vector": [14, 3, 1.0, 0.0256, 3, 0.52, 0.0, 651, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.status = self.ACTIVE"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_390:Assign_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_390:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_390:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_390:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_390:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_390:Assign_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_390:Assign_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_390:Return_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_390:If_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_390:If_L34_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_390:Assign_L35_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_390:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_390:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_390:If_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_390:If_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_390:Assign_L39_C12"}] |
from Tkinter import *
from ttk import Checkbutton
from tkSimpleDialog import Dialog
from globalconst import *
class SetupBoard(Dialog):
def __init__(self, parent, title, gameManager):
self._master = parent
self._manager = gameManager
self._load_entry_box_vars()
self.result = False
Dialog.__init__(self, parent, title)
def body(self, master):
self._npLFrame = LabelFrame(master, text='No. of players:')
self._npFrameEx1 = Frame(self._npLFrame, width=30)
self._npFrameEx1.pack(side=LEFT, pady=5, expand=1)
self._npButton1 = Radiobutton(self._npLFrame, text='Zero (autoplay)',
value=0, variable=self._num_players,
command=self._disable_player_color)
self._npButton1.pack(side=LEFT, pady=5, expand=1)
self._npButton2 = Radiobutton(self._npLFrame, text='One',
value=1, variable=self._num_players,
command=self._enable_player_color)
self._npButton2.pack(side=LEFT, pady=5, expand=1)
self._npButton3 = Radiobutton(self._npLFrame, text='Two',
value=2, variable=self._num_players,
command=self._disable_player_color)
self._npButton3.pack(side=LEFT, pady=5, expand=1)
self._npFrameEx2 = Frame(self._npLFrame, width=30)
self._npFrameEx2.pack(side=LEFT, pady=5, expand=1)
self._npLFrame.pack(fill=X)
self._playerFrame = LabelFrame(master, text='Player color:')
self._playerFrameEx1 = Frame(self._playerFrame, width=50)
self._playerFrameEx1.pack(side=LEFT, pady=5, expand=1)
self._rbColor1 = Radiobutton(self._playerFrame, text='Black',
value=BLACK, variable=self._player_color)
self._rbColor1.pack(side=LEFT, padx=0, pady=5, expand=1)
self._rbColor2 = Radiobutton(self._playerFrame, text='White',
value=WHITE, variable=self._player_color)
self._rbColor2.pack(side=LEFT, padx=0, pady=5, expand=1)
self._playerFrameEx2 = Frame(self._playerFrame, width=50)
self._playerFrameEx2.pack(side=LEFT, pady=5, expand=1)
self._playerFrame.pack(fill=X)
self._rbFrame = LabelFrame(master, text='Next to move:')
self._rbFrameEx1 = Frame(self._rbFrame, width=50)
self._rbFrameEx1.pack(side=LEFT, pady=5, expand=1)
self._rbTurn1 = Radiobutton(self._rbFrame, text='Black',
value=BLACK, variable=self._player_turn)
self._rbTurn1.pack(side=LEFT, padx=0, pady=5, expand=1)
self._rbTurn2 = Radiobutton(self._rbFrame, text='White',
value=WHITE, variable=self._player_turn)
self._rbTurn2.pack(side=LEFT, padx=0, pady=5, expand=1)
self._rbFrameEx2 = Frame(self._rbFrame, width=50)
self._rbFrameEx2.pack(side=LEFT, pady=5, expand=1)
self._rbFrame.pack(fill=X)
self._bcFrame = LabelFrame(master, text='Board configuration')
self._wmFrame = Frame(self._bcFrame, borderwidth=0)
self._wmLabel = Label(self._wmFrame, text='White men:')
self._wmLabel.pack(side=LEFT, padx=7, pady=10)
self._wmEntry = Entry(self._wmFrame, width=40,
textvariable=self._white_men)
self._wmEntry.pack(side=LEFT, padx=10)
self._wmFrame.pack()
self._wkFrame = Frame(self._bcFrame, borderwidth=0)
self._wkLabel = Label(self._wkFrame, text='White kings:')
self._wkLabel.pack(side=LEFT, padx=5, pady=10)
self._wkEntry = Entry(self._wkFrame, width=40,
textvariable=self._white_kings)
self._wkEntry.pack(side=LEFT, padx=10)
self._wkFrame.pack()
self._bmFrame = Frame(self._bcFrame, borderwidth=0)
self._bmLabel = Label(self._bmFrame, text='Black men:')
self._bmLabel.pack(side=LEFT, padx=7, pady=10)
self._bmEntry = Entry(self._bmFrame, width=40,
textvariable=self._black_men)
self._bmEntry.pack(side=LEFT, padx=10)
self._bmFrame.pack()
self._bkFrame = Frame(self._bcFrame, borderwidth=0)
self._bkLabel = Label(self._bkFrame, text='Black kings:')
self._bkLabel.pack(side=LEFT, padx=5, pady=10)
self._bkEntry = Entry(self._bkFrame, width=40,
textvariable=self._black_kings)
self._bkEntry.pack(side=LEFT, padx=10)
self._bkFrame.pack()
self._bcFrame.pack(fill=X)
self._bsState = IntVar()
self._bsFrame = Frame(master, borderwidth=0)
self._bsCheck = Checkbutton(self._bsFrame, variable=self._bsState,
text='Start new game with the current setup?')
self._bsCheck.pack()
self._bsFrame.pack(fill=X)
if self._num_players.get() == 1:
self._enable_player_color()
else:
self._disable_player_color()
def validate(self):
self.wm_list = self._parse_int_list(self._white_men.get())
self.wk_list = self._parse_int_list(self._white_kings.get())
self.bm_list = self._parse_int_list(self._black_men.get())
self.bk_list = self._parse_int_list(self._black_kings.get())
if (self.wm_list == None or self.wk_list == None
or self.bm_list == None or self.bk_list == None):
return 0 # Error occurred during parsing
if not self._all_unique(self.wm_list, self.wk_list,
self.bm_list, self.bk_list):
return 0 # A repeated index occurred
return 1
def apply(self):
mgr = self._manager
model = mgr.model
view = mgr.view
state = model.curr_state
mgr.player_color = self._player_color.get()
mgr.num_players = self._num_players.get()
mgr.model.curr_state.to_move = self._player_turn.get()
# only reset the BoardView if men or kings have new positions
if (sorted(self.wm_list) != sorted(self._orig_white_men) or
sorted(self.wk_list) != sorted(self._orig_white_kings) or
sorted(self.bm_list) != sorted(self._orig_black_men) or
sorted(self.bk_list) != sorted(self._orig_black_kings) or
self._bsState.get() == 1):
state.clear()
sq = state.squares
for item in self.wm_list:
idx = squaremap[item]
sq[idx] = WHITE | MAN
for item in self.wk_list:
idx = squaremap[item]
sq[idx] = WHITE | KING
for item in self.bm_list:
idx = squaremap[item]
sq[idx] = BLACK | MAN
for item in self.bk_list:
idx = squaremap[item]
sq[idx] = BLACK | KING
state.to_move = self._player_turn.get()
state.reset_undo()
view.reset_view(mgr.model)
if self._bsState.get() == 1:
mgr.filename = None
mgr.parent.set_title_bar_filename()
state.ok_to_move = True
self.result = True
self.destroy()
def cancel(self, event=None):
self.destroy()
def _load_entry_box_vars(self):
self._white_men = StringVar()
self._white_kings = StringVar()
self._black_men = StringVar()
self._black_kings = StringVar()
self._player_color = IntVar()
self._player_turn = IntVar()
self._num_players = IntVar()
self._player_color.set(self._manager.player_color)
self._num_players.set(self._manager.num_players)
model = self._manager.model
self._player_turn.set(model.curr_state.to_move)
view = self._manager.view
self._white_men.set(', '.join(view.get_positions(WHITE | MAN)))
self._white_kings.set(', '.join(view.get_positions(WHITE | KING)))
self._black_men.set(', '.join(view.get_positions(BLACK | MAN)))
self._black_kings.set(', '.join(view.get_positions(BLACK | KING)))
self._orig_white_men = map(int, view.get_positions(WHITE | MAN))
self._orig_white_kings = map(int, view.get_positions(WHITE | KING))
self._orig_black_men = map(int, view.get_positions(BLACK | MAN))
self._orig_black_kings = map(int, view.get_positions(BLACK | KING))
def _disable_player_color(self):
self._rbColor1.configure(state=DISABLED)
self._rbColor2.configure(state=DISABLED)
def _enable_player_color(self):
self._rbColor1.configure(state=NORMAL)
self._rbColor2.configure(state=NORMAL)
def _all_unique(self, *lists):
s = set()
total_list = []
for i in lists:
total_list.extend(i)
s = s.union(i)
return sorted(total_list) == sorted(s)
def _parse_int_list(self, parsestr):
try:
lst = parsestr.split(',')
except AttributeError:
return None
if lst == ['']:
return []
try:
lst = [int(i) for i in lst]
except ValueError:
return None
if not all(((x>=1 and x<=MAX_VALID_SQ) for x in lst)):
return None
return lst
| ajibawa-2023/Python-Code-Large/train/row_391 | 168 | 216 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_391:ImportFrom_L1_C0", "label": "from Tkinter import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0046, 0.0046, 0, 0.66, 0.0, 368, 0, 1, 0, 0, 368, 0, 0], "semantic": {"name": "Tkinter", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from Tkinter import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:ImportFrom_L2_C0", "label": "from ttk import Checkbutton", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0093, 0.0046, 0, 0.66, 0.25, 718, 0, 1, 0, 0, 718, 0, 0], "semantic": {"name": "ttk", "arg_names": [], "import_names": ["Checkbutton"], "rhs_call_name": "", "annotation": ""}, "snippet": "from ttk import Checkbutton"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:ImportFrom_L3_C0", "label": "from tkSimpleDialog import Dialog", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0139, 0.0046, 0, 0.66, 0.5, 774, 0, 1, 0, 0, 774, 0, 0], "semantic": {"name": "tkSimpleDialog", "arg_names": [], "import_names": ["Dialog"], "rhs_call_name": "", "annotation": ""}, "snippet": "from tkSimpleDialog import Dialog"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:ImportFrom_L4_C0", "label": "from globalconst import *", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0185, 0.0046, 0, 0.66, 0.75, 871, 0, 1, 0, 0, 871, 0, 0], "semantic": {"name": "globalconst", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from globalconst import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:ClassDef_L6_C0", "label": "SetupBoard", "type": "class", "loc": [6, 216], "level": 0, "parent": null, "vector": [3, 0, 0.5139, 0.9769, 0, 0.66, 1.0, 26, 0, 10, 0, 0, 814, 0, 99], "semantic": {"name": "SetupBoard", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SetupBoard(Dialog):\n def __init__(self, parent, title, gameManager):\n self._master = parent\n self._manager = gameManager\n self._load_entry_box_vars()\n self.result = False\n Dialog.__init__(self, parent, title)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L7_C4", "label": "__init__", "type": "function", "loc": [7, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:ClassDef_L6_C0", "vector": [2, 1, 0.044, 0.0278, 1, 0.5, 0.0, 555, 0, 4, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "parent", "title", "gameManager"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, parent, title, gameManager):\n self._master = parent\n self._manager = gameManager\n self._load_entry_box_vars()\n self.result = False\n Dialog.__init__(self, parent, title)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L8_C8", "label": "self._master =", "type": "assigned_variable", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L7_C4", "vector": [14, 2, 0.037, 0.0046, 2, 0.51, 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 = parent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L9_C8", "label": "self._manager =", "type": "assigned_variable", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L7_C4", "vector": [14, 2, 0.0417, 0.0046, 2, 0.51, 0.25, 176, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._manager", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._manager = gameManager"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L10_C8", "label": "_load_entry_box_vars()", "type": "expression", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L7_C4", "vector": [8, 2, 0.0463, 0.0046, 2, 0.51, 0.5, 766, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_load_entry_box_vars", "arg_names": [], "import_names": [], "rhs_call_name": "_load_entry_box_vars", "annotation": ""}, "snippet": " self._load_entry_box_vars()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L11_C8", "label": "self.result =", "type": "assigned_variable", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L7_C4", "vector": [14, 2, 0.0509, 0.0046, 2, 0.51, 0.75, 341, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.result = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L12_C8", "label": "__init__()", "type": "expression", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L7_C4", "vector": [8, 2, 0.0556, 0.0046, 2, 0.51, 1.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " Dialog.__init__(self, parent, title)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "label": "body", "type": "function", "loc": [14, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:ClassDef_L6_C0", "vector": [2, 1, 0.2731, 0.4213, 1, 0.5, 0.1111, 477, 0, 2, 0, 0, 0, 0, 66], "semantic": {"name": "body", "arg_names": ["self", "master"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def body(self, master):\n self._npLFrame = LabelFrame(master, text='No. of players:')\n self._npFrameEx1 = Frame(self._npLFrame, width=30)\n self._npFrameEx1.pack(side=LEFT, pady=5, expand=1)\n self._npButton1 = Radiobutton(self._npLFrame, text='Zero (autoplay)',\n value=0, variable=self._num_players,\n command=self._disable_player_color)\n self._npButton1.pack(side=LEFT, pady=5, expand=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L15_C8", "label": "self._npLFrame = LabelFrame()", "type": "assigned_variable", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.0694, 0.0046, 2, 0.53, 0.0, 715, 3, 2, 0, 0, 260, 10, 1], "semantic": {"name": "self._npLFrame", "arg_names": [], "import_names": [], "rhs_call_name": "LabelFrame", "annotation": ""}, "snippet": " self._npLFrame = LabelFrame(master, text='No. of players:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L16_C8", "label": "self._npFrameEx1 = Frame()", "type": "assigned_variable", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.0741, 0.0046, 2, 0.53, 0.0159, 720, 3, 2, 0, 0, 342, 10, 1], "semantic": {"name": "self._npFrameEx1", "arg_names": [], "import_names": [], "rhs_call_name": "Frame", "annotation": ""}, "snippet": " self._npFrameEx1 = Frame(self._npLFrame, width=30)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L17_C8", "label": "pack()", "type": "expression", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.0787, 0.0046, 2, 0.53, 0.0317, 742, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._npFrameEx1.pack(side=LEFT, pady=5, expand=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L18_C8", "label": "self._npButton1 = Radiobutton()", "type": "assigned_variable", "loc": [18, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.088, 0.0139, 2, 0.53, 0.0476, 489, 3, 5, 0, 0, 483, 10, 1], "semantic": {"name": "self._npButton1", "arg_names": [], "import_names": [], "rhs_call_name": "Radiobutton", "annotation": ""}, "snippet": " self._npButton1 = Radiobutton(self._npLFrame, text='Zero (autoplay)',\n value=0, variable=self._num_players,\n command=self._disable_player_color)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L21_C8", "label": "pack()", "type": "expression", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.0972, 0.0046, 2, 0.53, 0.0635, 742, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._npButton1.pack(side=LEFT, pady=5, expand=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L22_C8", "label": "self._npButton2 = Radiobutton()", "type": "assigned_variable", "loc": [22, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.1065, 0.0139, 2, 0.53, 0.0794, 818, 3, 5, 0, 0, 483, 10, 1], "semantic": {"name": "self._npButton2", "arg_names": [], "import_names": [], "rhs_call_name": "Radiobutton", "annotation": ""}, "snippet": " self._npButton2 = Radiobutton(self._npLFrame, text='One',\n value=1, variable=self._num_players,\n command=self._enable_player_color)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L25_C8", "label": "pack()", "type": "expression", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.1157, 0.0046, 2, 0.53, 0.0952, 742, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._npButton2.pack(side=LEFT, pady=5, expand=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L26_C8", "label": "self._npButton3 = Radiobutton()", "type": "assigned_variable", "loc": [26, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.125, 0.0139, 2, 0.53, 0.1111, 762, 3, 5, 0, 0, 483, 10, 1], "semantic": {"name": "self._npButton3", "arg_names": [], "import_names": [], "rhs_call_name": "Radiobutton", "annotation": ""}, "snippet": " self._npButton3 = Radiobutton(self._npLFrame, text='Two',\n value=2, variable=self._num_players,\n command=self._disable_player_color)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L29_C8", "label": "pack()", "type": "expression", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.1343, 0.0046, 2, 0.53, 0.127, 742, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._npButton3.pack(side=LEFT, pady=5, expand=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L30_C8", "label": "self._npFrameEx2 = Frame()", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.1389, 0.0046, 2, 0.53, 0.1429, 676, 3, 2, 0, 0, 342, 10, 1], "semantic": {"name": "self._npFrameEx2", "arg_names": [], "import_names": [], "rhs_call_name": "Frame", "annotation": ""}, "snippet": " self._npFrameEx2 = Frame(self._npLFrame, width=30)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L31_C8", "label": "pack()", "type": "expression", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.1435, 0.0046, 2, 0.53, 0.1587, 742, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._npFrameEx2.pack(side=LEFT, pady=5, expand=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L32_C8", "label": "pack()", "type": "expression", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.1481, 0.0046, 2, 0.53, 0.1746, 742, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._npLFrame.pack(fill=X)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L34_C8", "label": "self._playerFrame = LabelFrame()", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.1574, 0.0046, 2, 0.53, 0.1905, 416, 3, 2, 0, 0, 260, 10, 1], "semantic": {"name": "self._playerFrame", "arg_names": [], "import_names": [], "rhs_call_name": "LabelFrame", "annotation": ""}, "snippet": " self._playerFrame = LabelFrame(master, text='Player color:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L35_C8", "label": "self._playerFrameEx1 = Frame()", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.162, 0.0046, 2, 0.53, 0.2063, 952, 3, 2, 0, 0, 342, 10, 1], "semantic": {"name": "self._playerFrameEx1", "arg_names": [], "import_names": [], "rhs_call_name": "Frame", "annotation": ""}, "snippet": " self._playerFrameEx1 = Frame(self._playerFrame, width=50)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L36_C8", "label": "pack()", "type": "expression", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.1667, 0.0046, 2, 0.53, 0.2222, 742, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._playerFrameEx1.pack(side=LEFT, pady=5, expand=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L37_C8", "label": "self._rbColor1 = Radiobutton()", "type": "assigned_variable", "loc": [37, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.1736, 0.0093, 2, 0.53, 0.2381, 383, 3, 4, 0, 0, 483, 10, 1], "semantic": {"name": "self._rbColor1", "arg_names": [], "import_names": [], "rhs_call_name": "Radiobutton", "annotation": ""}, "snippet": " self._rbColor1 = Radiobutton(self._playerFrame, text='Black',\n value=BLACK, variable=self._player_color)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L39_C8", "label": "pack()", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.1806, 0.0046, 2, 0.53, 0.254, 742, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._rbColor1.pack(side=LEFT, padx=0, pady=5, expand=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L40_C8", "label": "self._rbColor2 = Radiobutton()", "type": "assigned_variable", "loc": [40, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.1875, 0.0093, 2, 0.53, 0.2698, 216, 3, 4, 0, 0, 483, 10, 1], "semantic": {"name": "self._rbColor2", "arg_names": [], "import_names": [], "rhs_call_name": "Radiobutton", "annotation": ""}, "snippet": " self._rbColor2 = Radiobutton(self._playerFrame, text='White',\n value=WHITE, variable=self._player_color)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L42_C8", "label": "pack()", "type": "expression", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.1944, 0.0046, 2, 0.53, 0.2857, 742, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._rbColor2.pack(side=LEFT, padx=0, pady=5, expand=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L43_C8", "label": "self._playerFrameEx2 = Frame()", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.1991, 0.0046, 2, 0.53, 0.3016, 860, 3, 2, 0, 0, 342, 10, 1], "semantic": {"name": "self._playerFrameEx2", "arg_names": [], "import_names": [], "rhs_call_name": "Frame", "annotation": ""}, "snippet": " self._playerFrameEx2 = Frame(self._playerFrame, width=50)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L44_C8", "label": "pack()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.2037, 0.0046, 2, 0.53, 0.3175, 742, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._playerFrameEx2.pack(side=LEFT, pady=5, expand=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L45_C8", "label": "pack()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.2083, 0.0046, 2, 0.53, 0.3333, 742, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._playerFrame.pack(fill=X)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L47_C8", "label": "self._rbFrame = LabelFrame()", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.2176, 0.0046, 2, 0.53, 0.3492, 33, 3, 2, 0, 0, 260, 10, 1], "semantic": {"name": "self._rbFrame", "arg_names": [], "import_names": [], "rhs_call_name": "LabelFrame", "annotation": ""}, "snippet": " self._rbFrame = LabelFrame(master, text='Next to move:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L48_C8", "label": "self._rbFrameEx1 = Frame()", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.2222, 0.0046, 2, 0.53, 0.3651, 895, 3, 2, 0, 0, 342, 10, 1], "semantic": {"name": "self._rbFrameEx1", "arg_names": [], "import_names": [], "rhs_call_name": "Frame", "annotation": ""}, "snippet": " self._rbFrameEx1 = Frame(self._rbFrame, width=50)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L49_C8", "label": "pack()", "type": "expression", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.2269, 0.0046, 2, 0.53, 0.381, 742, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._rbFrameEx1.pack(side=LEFT, pady=5, expand=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L50_C8", "label": "self._rbTurn1 = Radiobutton()", "type": "assigned_variable", "loc": [50, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.2338, 0.0093, 2, 0.53, 0.3968, 735, 3, 4, 0, 0, 483, 10, 1], "semantic": {"name": "self._rbTurn1", "arg_names": [], "import_names": [], "rhs_call_name": "Radiobutton", "annotation": ""}, "snippet": " self._rbTurn1 = Radiobutton(self._rbFrame, text='Black',\n value=BLACK, variable=self._player_turn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L52_C8", "label": "pack()", "type": "expression", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.2407, 0.0046, 2, 0.53, 0.4127, 742, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._rbTurn1.pack(side=LEFT, padx=0, pady=5, expand=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L53_C8", "label": "self._rbTurn2 = Radiobutton()", "type": "assigned_variable", "loc": [53, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.2477, 0.0093, 2, 0.53, 0.4286, 581, 3, 4, 0, 0, 483, 10, 1], "semantic": {"name": "self._rbTurn2", "arg_names": [], "import_names": [], "rhs_call_name": "Radiobutton", "annotation": ""}, "snippet": " self._rbTurn2 = Radiobutton(self._rbFrame, text='White',\n value=WHITE, variable=self._player_turn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L55_C8", "label": "pack()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.2546, 0.0046, 2, 0.53, 0.4444, 742, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._rbTurn2.pack(side=LEFT, padx=0, pady=5, expand=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L56_C8", "label": "self._rbFrameEx2 = Frame()", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.2593, 0.0046, 2, 0.53, 0.4603, 571, 3, 2, 0, 0, 342, 10, 1], "semantic": {"name": "self._rbFrameEx2", "arg_names": [], "import_names": [], "rhs_call_name": "Frame", "annotation": ""}, "snippet": " self._rbFrameEx2 = Frame(self._rbFrame, width=50)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L57_C8", "label": "pack()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.2639, 0.0046, 2, 0.53, 0.4762, 742, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._rbFrameEx2.pack(side=LEFT, pady=5, expand=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L58_C8", "label": "pack()", "type": "expression", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.2685, 0.0046, 2, 0.53, 0.4921, 742, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._rbFrame.pack(fill=X)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L60_C8", "label": "self._bcFrame = LabelFrame()", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.2778, 0.0046, 2, 0.53, 0.5079, 511, 3, 2, 0, 0, 260, 10, 1], "semantic": {"name": "self._bcFrame", "arg_names": [], "import_names": [], "rhs_call_name": "LabelFrame", "annotation": ""}, "snippet": " self._bcFrame = LabelFrame(master, text='Board configuration')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L61_C8", "label": "self._wmFrame = Frame()", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.2824, 0.0046, 2, 0.53, 0.5238, 254, 3, 2, 0, 0, 342, 10, 1], "semantic": {"name": "self._wmFrame", "arg_names": [], "import_names": [], "rhs_call_name": "Frame", "annotation": ""}, "snippet": " self._wmFrame = Frame(self._bcFrame, borderwidth=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L62_C8", "label": "self._wmLabel = Label()", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.287, 0.0046, 2, 0.53, 0.5397, 650, 3, 2, 0, 0, 413, 10, 1], "semantic": {"name": "self._wmLabel", "arg_names": [], "import_names": [], "rhs_call_name": "Label", "annotation": ""}, "snippet": " self._wmLabel = Label(self._wmFrame, text='White men:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L63_C8", "label": "pack()", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.2917, 0.0046, 2, 0.53, 0.5556, 742, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._wmLabel.pack(side=LEFT, padx=7, pady=10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L64_C8", "label": "self._wmEntry = Entry()", "type": "assigned_variable", "loc": [64, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.2986, 0.0093, 2, 0.53, 0.5714, 293, 3, 3, 0, 0, 197, 10, 1], "semantic": {"name": "self._wmEntry", "arg_names": [], "import_names": [], "rhs_call_name": "Entry", "annotation": ""}, "snippet": " self._wmEntry = Entry(self._wmFrame, width=40,\n textvariable=self._white_men)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L66_C8", "label": "pack()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.3056, 0.0046, 2, 0.53, 0.5873, 742, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._wmEntry.pack(side=LEFT, padx=10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L67_C8", "label": "pack()", "type": "expression", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.3102, 0.0046, 2, 0.53, 0.6032, 742, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._wmFrame.pack()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L69_C8", "label": "self._wkFrame = Frame()", "type": "assigned_variable", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.3194, 0.0046, 2, 0.53, 0.619, 100, 3, 2, 0, 0, 342, 10, 1], "semantic": {"name": "self._wkFrame", "arg_names": [], "import_names": [], "rhs_call_name": "Frame", "annotation": ""}, "snippet": " self._wkFrame = Frame(self._bcFrame, borderwidth=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L70_C8", "label": "self._wkLabel = Label()", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.3241, 0.0046, 2, 0.53, 0.6349, 469, 3, 2, 0, 0, 413, 10, 1], "semantic": {"name": "self._wkLabel", "arg_names": [], "import_names": [], "rhs_call_name": "Label", "annotation": ""}, "snippet": " self._wkLabel = Label(self._wkFrame, text='White kings:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L71_C8", "label": "pack()", "type": "expression", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.3287, 0.0046, 2, 0.53, 0.6508, 742, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._wkLabel.pack(side=LEFT, padx=5, pady=10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L72_C8", "label": "self._wkEntry = Entry()", "type": "assigned_variable", "loc": [72, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.3356, 0.0093, 2, 0.53, 0.6667, 747, 3, 3, 0, 0, 197, 10, 1], "semantic": {"name": "self._wkEntry", "arg_names": [], "import_names": [], "rhs_call_name": "Entry", "annotation": ""}, "snippet": " self._wkEntry = Entry(self._wkFrame, width=40,\n textvariable=self._white_kings)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L74_C8", "label": "pack()", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.3426, 0.0046, 2, 0.53, 0.6825, 742, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._wkEntry.pack(side=LEFT, padx=10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L75_C8", "label": "pack()", "type": "expression", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.3472, 0.0046, 2, 0.53, 0.6984, 742, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._wkFrame.pack()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L77_C8", "label": "self._bmFrame = Frame()", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.3565, 0.0046, 2, 0.53, 0.7143, 876, 3, 2, 0, 0, 342, 10, 1], "semantic": {"name": "self._bmFrame", "arg_names": [], "import_names": [], "rhs_call_name": "Frame", "annotation": ""}, "snippet": " self._bmFrame = Frame(self._bcFrame, borderwidth=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L78_C8", "label": "self._bmLabel = Label()", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.3611, 0.0046, 2, 0.53, 0.7302, 79, 3, 2, 0, 0, 413, 10, 1], "semantic": {"name": "self._bmLabel", "arg_names": [], "import_names": [], "rhs_call_name": "Label", "annotation": ""}, "snippet": " self._bmLabel = Label(self._bmFrame, text='Black men:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L79_C8", "label": "pack()", "type": "expression", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.3657, 0.0046, 2, 0.53, 0.746, 742, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._bmLabel.pack(side=LEFT, padx=7, pady=10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L80_C8", "label": "self._bmEntry = Entry()", "type": "assigned_variable", "loc": [80, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.3727, 0.0093, 2, 0.53, 0.7619, 439, 3, 3, 0, 0, 197, 10, 1], "semantic": {"name": "self._bmEntry", "arg_names": [], "import_names": [], "rhs_call_name": "Entry", "annotation": ""}, "snippet": " self._bmEntry = Entry(self._bmFrame, width=40,\n textvariable=self._black_men)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L82_C8", "label": "pack()", "type": "expression", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.3796, 0.0046, 2, 0.53, 0.7778, 742, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._bmEntry.pack(side=LEFT, padx=10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L83_C8", "label": "pack()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.3843, 0.0046, 2, 0.53, 0.7937, 742, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._bmFrame.pack()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L85_C8", "label": "self._bkFrame = Frame()", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.3935, 0.0046, 2, 0.53, 0.8095, 341, 3, 2, 0, 0, 342, 10, 1], "semantic": {"name": "self._bkFrame", "arg_names": [], "import_names": [], "rhs_call_name": "Frame", "annotation": ""}, "snippet": " self._bkFrame = Frame(self._bcFrame, borderwidth=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L86_C8", "label": "self._bkLabel = Label()", "type": "assigned_variable", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.3981, 0.0046, 2, 0.53, 0.8254, 213, 3, 2, 0, 0, 413, 10, 1], "semantic": {"name": "self._bkLabel", "arg_names": [], "import_names": [], "rhs_call_name": "Label", "annotation": ""}, "snippet": " self._bkLabel = Label(self._bkFrame, text='Black kings:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L87_C8", "label": "pack()", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.4028, 0.0046, 2, 0.53, 0.8413, 742, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._bkLabel.pack(side=LEFT, padx=5, pady=10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L88_C8", "label": "self._bkEntry = Entry()", "type": "assigned_variable", "loc": [88, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.4097, 0.0093, 2, 0.53, 0.8571, 389, 3, 3, 0, 0, 197, 10, 1], "semantic": {"name": "self._bkEntry", "arg_names": [], "import_names": [], "rhs_call_name": "Entry", "annotation": ""}, "snippet": " self._bkEntry = Entry(self._bkFrame, width=40,\n textvariable=self._black_kings)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L90_C8", "label": "pack()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.4167, 0.0046, 2, 0.53, 0.873, 742, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._bkEntry.pack(side=LEFT, padx=10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L91_C8", "label": "pack()", "type": "expression", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.4213, 0.0046, 2, 0.53, 0.8889, 742, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._bkFrame.pack()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L92_C8", "label": "pack()", "type": "expression", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.4259, 0.0046, 2, 0.53, 0.9048, 742, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._bcFrame.pack(fill=X)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L94_C8", "label": "self._bsState = IntVar()", "type": "assigned_variable", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.4352, 0.0046, 2, 0.53, 0.9206, 81, 3, 0, 0, 0, 198, 10, 1], "semantic": {"name": "self._bsState", "arg_names": [], "import_names": [], "rhs_call_name": "IntVar", "annotation": ""}, "snippet": " self._bsState = IntVar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L95_C8", "label": "self._bsFrame = Frame()", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.4398, 0.0046, 2, 0.53, 0.9365, 463, 3, 2, 0, 0, 342, 10, 1], "semantic": {"name": "self._bsFrame", "arg_names": [], "import_names": [], "rhs_call_name": "Frame", "annotation": ""}, "snippet": " self._bsFrame = Frame(master, borderwidth=0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L96_C8", "label": "self._bsCheck = Checkbutton()", "type": "assigned_variable", "loc": [96, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [14, 2, 0.4468, 0.0093, 2, 0.53, 0.9524, 786, 3, 3, 0, 0, 456, 10, 1], "semantic": {"name": "self._bsCheck", "arg_names": [], "import_names": [], "rhs_call_name": "Checkbutton", "annotation": ""}, "snippet": " self._bsCheck = Checkbutton(self._bsFrame, variable=self._bsState,\n text='Start new game with the current setup?')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L98_C8", "label": "pack()", "type": "expression", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.4537, 0.0046, 2, 0.53, 0.9683, 742, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._bsCheck.pack()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L99_C8", "label": "pack()", "type": "expression", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [8, 2, 0.4583, 0.0046, 2, 0.53, 0.9841, 742, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " self._bsFrame.pack(fill=X)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:If_L101_C8", "label": "if", "type": "if", "loc": [101, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "vector": [4, 2, 0.4745, 0.0185, 2, 0.53, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._num_players.get() == 1:\n self._enable_player_color()\n else:\n self._disable_player_color()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L102_C12", "label": "_enable_player_color()", "type": "expression", "loc": [102, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:If_L101_C8", "vector": [8, 3, 0.4722, 0.0046, 3, 0.5, 0.0, 50, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_enable_player_color", "arg_names": [], "import_names": [], "rhs_call_name": "_enable_player_color", "annotation": ""}, "snippet": " self._enable_player_color()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L104_C12", "label": "_disable_player_color()", "type": "expression", "loc": [104, 104], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:If_L101_C8", "vector": [8, 3, 0.4815, 0.0046, 3, 0.5, 1.0, 30, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_disable_player_color", "arg_names": [], "import_names": [], "rhs_call_name": "_disable_player_color", "annotation": ""}, "snippet": " self._disable_player_color()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L106_C4", "label": "validate", "type": "function", "loc": [106, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:ClassDef_L6_C0", "vector": [2, 1, 0.5162, 0.0556, 1, 0.5, 0.2222, 628, 0, 1, 1, 0, 0, 0, 9], "semantic": {"name": "validate", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def validate(self):\n self.wm_list = self._parse_int_list(self._white_men.get())\n self.wk_list = self._parse_int_list(self._white_kings.get())\n self.bm_list = self._parse_int_list(self._black_men.get())\n self.bk_list = self._parse_int_list(self._black_kings.get())\n if (self.wm_list == None or self.wk_list == None\n or self.bm_list == None or self.bk_list == None):\n return 0 # Error occurred during parsing"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L107_C8", "label": "self.wm_list = _parse_int_list()", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L106_C4", "vector": [14, 2, 0.4954, 0.0046, 2, 0.03, 0.0, 632, 3, 1, 0, 0, 828, 10, 2], "semantic": {"name": "self.wm_list", "arg_names": [], "import_names": [], "rhs_call_name": "_parse_int_list", "annotation": ""}, "snippet": " self.wm_list = self._parse_int_list(self._white_men.get())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L108_C8", "label": "self.wk_list = _parse_int_list()", "type": "assigned_variable", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L106_C4", "vector": [14, 2, 0.5, 0.0046, 2, 0.03, 0.1667, 161, 3, 1, 0, 0, 828, 10, 2], "semantic": {"name": "self.wk_list", "arg_names": [], "import_names": [], "rhs_call_name": "_parse_int_list", "annotation": ""}, "snippet": " self.wk_list = self._parse_int_list(self._white_kings.get())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L109_C8", "label": "self.bm_list = _parse_int_list()", "type": "assigned_variable", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L106_C4", "vector": [14, 2, 0.5046, 0.0046, 2, 0.03, 0.3333, 370, 3, 1, 0, 0, 828, 10, 2], "semantic": {"name": "self.bm_list", "arg_names": [], "import_names": [], "rhs_call_name": "_parse_int_list", "annotation": ""}, "snippet": " self.bm_list = self._parse_int_list(self._black_men.get())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L110_C8", "label": "self.bk_list = _parse_int_list()", "type": "assigned_variable", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L106_C4", "vector": [14, 2, 0.5093, 0.0046, 2, 0.03, 0.5, 253, 3, 1, 0, 0, 828, 10, 2], "semantic": {"name": "self.bk_list", "arg_names": [], "import_names": [], "rhs_call_name": "_parse_int_list", "annotation": ""}, "snippet": " self.bk_list = self._parse_int_list(self._black_kings.get())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:If_L111_C8", "label": "if", "type": "if", "loc": [111, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L106_C4", "vector": [4, 2, 0.5185, 0.0139, 2, 0.03, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (self.wm_list == None or self.wk_list == None\n or self.bm_list == None or self.bk_list == None):\n return 0 # Error occurred during parsing"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Return_L113_C12", "label": "return", "type": "return", "loc": [113, 113], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:If_L111_C8", "vector": [13, 3, 0.5231, 0.0046, 3, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0 # Error occurred during parsing"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:If_L114_C8", "label": "if", "type": "if", "loc": [114, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L106_C4", "vector": [4, 2, 0.5324, 0.0139, 2, 0.03, 0.8333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self._all_unique(self.wm_list, self.wk_list,\n self.bm_list, self.bk_list):\n return 0 # A repeated index occurred"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Return_L116_C12", "label": "return", "type": "return", "loc": [116, 116], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:If_L114_C8", "vector": [13, 3, 0.537, 0.0046, 3, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0 # A repeated index occurred"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Return_L117_C8", "label": "return", "type": "return", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L106_C4", "vector": [13, 2, 0.5417, 0.0046, 2, 0.03, 1.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "label": "apply", "type": "function", "loc": [119, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:ClassDef_L6_C0", "vector": [2, 1, 0.6366, 0.1759, 1, 0.5, 0.3333, 524, 0, 1, 0, 0, 0, 0, 19], "semantic": {"name": "apply", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def apply(self):\n mgr = self._manager\n model = mgr.model\n view = mgr.view\n state = model.curr_state\n mgr.player_color = self._player_color.get()\n mgr.num_players = self._num_players.get()\n mgr.model.curr_state.to_move = self._player_turn.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L120_C8", "label": "mgr =", "type": "assigned_variable", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "vector": [14, 2, 0.5556, 0.0046, 2, 0.7, 0.0, 774, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "mgr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mgr = self._manager"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L121_C8", "label": "model =", "type": "assigned_variable", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "vector": [14, 2, 0.5602, 0.0046, 2, 0.7, 0.0909, 722, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "model", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " model = mgr.model"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L122_C8", "label": "view =", "type": "assigned_variable", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "vector": [14, 2, 0.5648, 0.0046, 2, 0.7, 0.1818, 781, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "view", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " view = mgr.view"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L123_C8", "label": "state =", "type": "assigned_variable", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "vector": [14, 2, 0.5694, 0.0046, 2, 0.7, 0.2727, 688, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "state", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " state = model.curr_state"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L124_C8", "label": "mgr.player_color = get()", "type": "assigned_variable", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "vector": [14, 2, 0.5741, 0.0046, 2, 0.7, 0.3636, 133, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "mgr.player_color", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " mgr.player_color = self._player_color.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L125_C8", "label": "mgr.num_players = get()", "type": "assigned_variable", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "vector": [14, 2, 0.5787, 0.0046, 2, 0.7, 0.4545, 778, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "mgr.num_players", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " mgr.num_players = self._num_players.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L126_C8", "label": "mgr.model.curr_state.to_move = get()", "type": "assigned_variable", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "vector": [14, 2, 0.5833, 0.0046, 2, 0.7, 0.5455, 236, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "mgr.model.curr_state.to_move", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " mgr.model.curr_state.to_move = self._player_turn.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:If_L129_C8", "label": "if", "type": "if", "loc": [129, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "vector": [4, 2, 0.6458, 0.1019, 2, 0.7, 0.6364, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (sorted(self.wm_list) != sorted(self._orig_white_men) or\n sorted(self.wk_list) != sorted(self._orig_white_kings) or\n sorted(self.bm_list) != sorted(self._orig_black_men) or\n sorted(self.bk_list) != sorted(self._orig_black_kings) or\n self._bsState.get() == 1):\n state.clear()\n sq = state.squares\n for item in self.wm_list:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L134_C12", "label": "clear()", "type": "expression", "loc": [134, 134], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:If_L129_C8", "vector": [8, 3, 0.6204, 0.0046, 3, 0.5, 0.0, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " state.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L135_C12", "label": "sq =", "type": "assigned_variable", "loc": [135, 135], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:If_L129_C8", "vector": [14, 3, 0.625, 0.0046, 3, 0.5, 0.125, 271, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sq", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sq = state.squares"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:For_L136_C12", "label": "for item", "type": "for", "loc": [136, 138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:If_L129_C8", "vector": [6, 3, 0.6343, 0.0139, 3, 0.5, 0.25, 434, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in self.wm_list:\n idx = squaremap[item]\n sq[idx] = WHITE | MAN"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L137_C16", "label": "idx =", "type": "assigned_variable", "loc": [137, 137], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:For_L136_C12", "vector": [14, 4, 0.6343, 0.0046, 4, 0.7, 0.0, 187, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "idx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " idx = squaremap[item]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L138_C16", "label": "assign", "type": "assigned_variable", "loc": [138, 138], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:For_L136_C12", "vector": [14, 4, 0.6389, 0.0046, 4, 0.7, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sq[idx] = WHITE | MAN"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:For_L139_C12", "label": "for item", "type": "for", "loc": [139, 141], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:If_L129_C8", "vector": [6, 3, 0.6481, 0.0139, 3, 0.5, 0.375, 434, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in self.wk_list:\n idx = squaremap[item]\n sq[idx] = WHITE | KING"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L140_C16", "label": "idx =", "type": "assigned_variable", "loc": [140, 140], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:For_L139_C12", "vector": [14, 4, 0.6481, 0.0046, 4, 0.17, 0.0, 187, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "idx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " idx = squaremap[item]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L141_C16", "label": "assign", "type": "assigned_variable", "loc": [141, 141], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:For_L139_C12", "vector": [14, 4, 0.6528, 0.0046, 4, 0.17, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sq[idx] = WHITE | KING"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:For_L142_C12", "label": "for item", "type": "for", "loc": [142, 144], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:If_L129_C8", "vector": [6, 3, 0.662, 0.0139, 3, 0.5, 0.5, 434, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in self.bm_list:\n idx = squaremap[item]\n sq[idx] = BLACK | MAN"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L143_C16", "label": "idx =", "type": "assigned_variable", "loc": [143, 143], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:For_L142_C12", "vector": [14, 4, 0.662, 0.0046, 4, 0.32, 0.0, 187, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "idx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " idx = squaremap[item]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L144_C16", "label": "assign", "type": "assigned_variable", "loc": [144, 144], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:For_L142_C12", "vector": [14, 4, 0.6667, 0.0046, 4, 0.32, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sq[idx] = BLACK | MAN"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:For_L145_C12", "label": "for item", "type": "for", "loc": [145, 147], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:If_L129_C8", "vector": [6, 3, 0.6759, 0.0139, 3, 0.5, 0.625, 434, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in self.bk_list:\n idx = squaremap[item]\n sq[idx] = BLACK | KING"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L146_C16", "label": "idx =", "type": "assigned_variable", "loc": [146, 146], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:For_L145_C12", "vector": [14, 4, 0.6759, 0.0046, 4, 0.83, 0.0, 187, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "idx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " idx = squaremap[item]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L147_C16", "label": "assign", "type": "assigned_variable", "loc": [147, 147], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:For_L145_C12", "vector": [14, 4, 0.6806, 0.0046, 4, 0.83, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sq[idx] = BLACK | KING"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L148_C12", "label": "state.to_move = get()", "type": "assigned_variable", "loc": [148, 148], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:If_L129_C8", "vector": [14, 3, 0.6852, 0.0046, 3, 0.5, 0.75, 925, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "state.to_move", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " state.to_move = self._player_turn.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L149_C12", "label": "reset_undo()", "type": "expression", "loc": [149, 149], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:If_L129_C8", "vector": [8, 3, 0.6898, 0.0046, 3, 0.5, 0.875, 810, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reset_undo", "arg_names": [], "import_names": [], "rhs_call_name": "reset_undo", "annotation": ""}, "snippet": " state.reset_undo()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L150_C12", "label": "reset_view()", "type": "expression", "loc": [150, 150], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:If_L129_C8", "vector": [8, 3, 0.6944, 0.0046, 3, 0.5, 1.0, 70, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "reset_view", "arg_names": [], "import_names": [], "rhs_call_name": "reset_view", "annotation": ""}, "snippet": " view.reset_view(mgr.model)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:If_L151_C8", "label": "if", "type": "if", "loc": [151, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "vector": [4, 2, 0.7037, 0.0139, 2, 0.7, 0.7273, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._bsState.get() == 1:\n mgr.filename = None\n mgr.parent.set_title_bar_filename()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L152_C12", "label": "mgr.filename =", "type": "assigned_variable", "loc": [152, 152], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:If_L151_C8", "vector": [14, 3, 0.7037, 0.0046, 3, 0.14, 0.0, 731, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "mgr.filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mgr.filename = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L153_C12", "label": "set_title_bar_filename()", "type": "expression", "loc": [153, 153], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:If_L151_C8", "vector": [8, 3, 0.7083, 0.0046, 3, 0.14, 1.0, 437, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "set_title_bar_filename", "arg_names": [], "import_names": [], "rhs_call_name": "set_title_bar_filename", "annotation": ""}, "snippet": " mgr.parent.set_title_bar_filename()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L154_C8", "label": "state.ok_to_move =", "type": "assigned_variable", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "vector": [14, 2, 0.713, 0.0046, 2, 0.7, 0.8182, 123, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "state.ok_to_move", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " state.ok_to_move = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L155_C8", "label": "self.result =", "type": "assigned_variable", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "vector": [14, 2, 0.7176, 0.0046, 2, 0.7, 0.9091, 341, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.result = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L156_C8", "label": "destroy()", "type": "expression", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "vector": [8, 2, 0.7222, 0.0046, 2, 0.7, 1.0, 388, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "destroy", "arg_names": [], "import_names": [], "rhs_call_name": "destroy", "annotation": ""}, "snippet": " self.destroy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L158_C4", "label": "cancel", "type": "function", "loc": [158, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:ClassDef_L6_C0", "vector": [2, 1, 0.7338, 0.0093, 1, 0.5, 0.4444, 732, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "cancel", "arg_names": ["self", "event"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def cancel(self, event=None):\n self.destroy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L159_C8", "label": "destroy()", "type": "expression", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L158_C4", "vector": [8, 2, 0.7361, 0.0046, 2, 0.93, 0.0, 388, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "destroy", "arg_names": [], "import_names": [], "rhs_call_name": "destroy", "annotation": ""}, "snippet": " self.destroy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "label": "_load_entry_box_vars", "type": "function", "loc": [161, 181], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:ClassDef_L6_C0", "vector": [2, 1, 0.7917, 0.0972, 1, 0.5, 0.5556, 766, 0, 1, 0, 0, 0, 0, 30], "semantic": {"name": "_load_entry_box_vars", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _load_entry_box_vars(self):\n self._white_men = StringVar()\n self._white_kings = StringVar()\n self._black_men = StringVar()\n self._black_kings = StringVar()\n self._player_color = IntVar()\n self._player_turn = IntVar()\n self._num_players = IntVar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L162_C8", "label": "self._white_men = StringVar()", "type": "assigned_variable", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "vector": [14, 2, 0.75, 0.0046, 2, 0.85, 0.0, 211, 3, 0, 0, 0, 378, 10, 1], "semantic": {"name": "self._white_men", "arg_names": [], "import_names": [], "rhs_call_name": "StringVar", "annotation": ""}, "snippet": " self._white_men = StringVar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L163_C8", "label": "self._white_kings = StringVar()", "type": "assigned_variable", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "vector": [14, 2, 0.7546, 0.0046, 2, 0.85, 0.0526, 351, 3, 0, 0, 0, 378, 10, 1], "semantic": {"name": "self._white_kings", "arg_names": [], "import_names": [], "rhs_call_name": "StringVar", "annotation": ""}, "snippet": " self._white_kings = StringVar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L164_C8", "label": "self._black_men = StringVar()", "type": "assigned_variable", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "vector": [14, 2, 0.7593, 0.0046, 2, 0.85, 0.1053, 611, 3, 0, 0, 0, 378, 10, 1], "semantic": {"name": "self._black_men", "arg_names": [], "import_names": [], "rhs_call_name": "StringVar", "annotation": ""}, "snippet": " self._black_men = StringVar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L165_C8", "label": "self._black_kings = StringVar()", "type": "assigned_variable", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "vector": [14, 2, 0.7639, 0.0046, 2, 0.85, 0.1579, 542, 3, 0, 0, 0, 378, 10, 1], "semantic": {"name": "self._black_kings", "arg_names": [], "import_names": [], "rhs_call_name": "StringVar", "annotation": ""}, "snippet": " self._black_kings = StringVar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L166_C8", "label": "self._player_color = IntVar()", "type": "assigned_variable", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "vector": [14, 2, 0.7685, 0.0046, 2, 0.85, 0.2105, 971, 3, 0, 0, 0, 198, 10, 1], "semantic": {"name": "self._player_color", "arg_names": [], "import_names": [], "rhs_call_name": "IntVar", "annotation": ""}, "snippet": " self._player_color = IntVar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L167_C8", "label": "self._player_turn = IntVar()", "type": "assigned_variable", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "vector": [14, 2, 0.7731, 0.0046, 2, 0.85, 0.2632, 990, 3, 0, 0, 0, 198, 10, 1], "semantic": {"name": "self._player_turn", "arg_names": [], "import_names": [], "rhs_call_name": "IntVar", "annotation": ""}, "snippet": " self._player_turn = IntVar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L168_C8", "label": "self._num_players = IntVar()", "type": "assigned_variable", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "vector": [14, 2, 0.7778, 0.0046, 2, 0.85, 0.3158, 61, 3, 0, 0, 0, 198, 10, 1], "semantic": {"name": "self._num_players", "arg_names": [], "import_names": [], "rhs_call_name": "IntVar", "annotation": ""}, "snippet": " self._num_players = IntVar()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L169_C8", "label": "set()", "type": "expression", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "vector": [8, 2, 0.7824, 0.0046, 2, 0.85, 0.3684, 21, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " self._player_color.set(self._manager.player_color)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L170_C8", "label": "set()", "type": "expression", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "vector": [8, 2, 0.787, 0.0046, 2, 0.85, 0.4211, 21, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " self._num_players.set(self._manager.num_players)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L171_C8", "label": "model =", "type": "assigned_variable", "loc": [171, 171], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "vector": [14, 2, 0.7917, 0.0046, 2, 0.85, 0.4737, 722, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "model", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " model = self._manager.model"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L172_C8", "label": "set()", "type": "expression", "loc": [172, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "vector": [8, 2, 0.7963, 0.0046, 2, 0.85, 0.5263, 21, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " self._player_turn.set(model.curr_state.to_move)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L173_C8", "label": "view =", "type": "assigned_variable", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "vector": [14, 2, 0.8009, 0.0046, 2, 0.85, 0.5789, 781, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "view", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " view = self._manager.view"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L174_C8", "label": "set()", "type": "expression", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "vector": [8, 2, 0.8056, 0.0046, 2, 0.85, 0.6316, 21, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "set", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " self._white_men.set(', '.join(view.get_positions(WHITE | MAN)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L175_C8", "label": "set()", "type": "expression", "loc": [175, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "vector": [8, 2, 0.8102, 0.0046, 2, 0.85, 0.6842, 21, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "set", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " self._white_kings.set(', '.join(view.get_positions(WHITE | KING)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L176_C8", "label": "set()", "type": "expression", "loc": [176, 176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "vector": [8, 2, 0.8148, 0.0046, 2, 0.85, 0.7368, 21, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "set", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " self._black_men.set(', '.join(view.get_positions(BLACK | MAN)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L177_C8", "label": "set()", "type": "expression", "loc": [177, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "vector": [8, 2, 0.8194, 0.0046, 2, 0.85, 0.7895, 21, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "set", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " self._black_kings.set(', '.join(view.get_positions(BLACK | KING)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L178_C8", "label": "self._orig_white_men = map()", "type": "assigned_variable", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "vector": [14, 2, 0.8241, 0.0046, 2, 0.85, 0.8421, 828, 3, 2, 0, 0, 53, 10, 2], "semantic": {"name": "self._orig_white_men", "arg_names": [], "import_names": [], "rhs_call_name": "map", "annotation": ""}, "snippet": " self._orig_white_men = map(int, view.get_positions(WHITE | MAN))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L179_C8", "label": "self._orig_white_kings = map()", "type": "assigned_variable", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "vector": [14, 2, 0.8287, 0.0046, 2, 0.85, 0.8947, 60, 3, 2, 0, 0, 53, 10, 2], "semantic": {"name": "self._orig_white_kings", "arg_names": [], "import_names": [], "rhs_call_name": "map", "annotation": ""}, "snippet": " self._orig_white_kings = map(int, view.get_positions(WHITE | KING))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L180_C8", "label": "self._orig_black_men = map()", "type": "assigned_variable", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "vector": [14, 2, 0.8333, 0.0046, 2, 0.85, 0.9474, 223, 3, 2, 0, 0, 53, 10, 2], "semantic": {"name": "self._orig_black_men", "arg_names": [], "import_names": [], "rhs_call_name": "map", "annotation": ""}, "snippet": " self._orig_black_men = map(int, view.get_positions(BLACK | MAN))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L181_C8", "label": "self._orig_black_kings = map()", "type": "assigned_variable", "loc": [181, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "vector": [14, 2, 0.838, 0.0046, 2, 0.85, 1.0, 544, 3, 2, 0, 0, 53, 10, 2], "semantic": {"name": "self._orig_black_kings", "arg_names": [], "import_names": [], "rhs_call_name": "map", "annotation": ""}, "snippet": " self._orig_black_kings = map(int, view.get_positions(BLACK | KING))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L183_C4", "label": "_disable_player_color", "type": "function", "loc": [183, 185], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:ClassDef_L6_C0", "vector": [2, 1, 0.8519, 0.0139, 1, 0.5, 0.6667, 30, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "_disable_player_color", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _disable_player_color(self):\n self._rbColor1.configure(state=DISABLED)\n self._rbColor2.configure(state=DISABLED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L184_C8", "label": "configure()", "type": "expression", "loc": [184, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L183_C4", "vector": [8, 2, 0.8519, 0.0046, 2, 0.02, 0.0, 765, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "configure", "arg_names": [], "import_names": [], "rhs_call_name": "configure", "annotation": ""}, "snippet": " self._rbColor1.configure(state=DISABLED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L185_C8", "label": "configure()", "type": "expression", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L183_C4", "vector": [8, 2, 0.8565, 0.0046, 2, 0.02, 1.0, 765, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "configure", "arg_names": [], "import_names": [], "rhs_call_name": "configure", "annotation": ""}, "snippet": " self._rbColor2.configure(state=DISABLED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L187_C4", "label": "_enable_player_color", "type": "function", "loc": [187, 189], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:ClassDef_L6_C0", "vector": [2, 1, 0.8704, 0.0139, 1, 0.5, 0.7778, 50, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "_enable_player_color", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _enable_player_color(self):\n self._rbColor1.configure(state=NORMAL)\n self._rbColor2.configure(state=NORMAL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L188_C8", "label": "configure()", "type": "expression", "loc": [188, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L187_C4", "vector": [8, 2, 0.8704, 0.0046, 2, 0.43, 0.0, 765, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "configure", "arg_names": [], "import_names": [], "rhs_call_name": "configure", "annotation": ""}, "snippet": " self._rbColor1.configure(state=NORMAL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L189_C8", "label": "configure()", "type": "expression", "loc": [189, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L187_C4", "vector": [8, 2, 0.875, 0.0046, 2, 0.43, 1.0, 765, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "configure", "arg_names": [], "import_names": [], "rhs_call_name": "configure", "annotation": ""}, "snippet": " self._rbColor2.configure(state=NORMAL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L191_C4", "label": "_all_unique", "type": "function", "loc": [191, 197], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:ClassDef_L6_C0", "vector": [2, 1, 0.8981, 0.0324, 1, 0.5, 0.8889, 164, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "_all_unique", "arg_names": ["self", "lists"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _all_unique(self, *lists):\n s = set()\n total_list = []\n for i in lists:\n total_list.extend(i)\n s = s.union(i)\n return sorted(total_list) == sorted(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L192_C8", "label": "s = set()", "type": "assigned_variable", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L191_C4", "vector": [14, 2, 0.8889, 0.0046, 2, 0.4, 0.0, 553, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " s = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L193_C8", "label": "total_list =", "type": "assigned_variable", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L191_C4", "vector": [14, 2, 0.8935, 0.0046, 2, 0.4, 0.3333, 154, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "total_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " total_list = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:For_L194_C8", "label": "for i", "type": "for", "loc": [194, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L191_C4", "vector": [6, 2, 0.9028, 0.0139, 2, 0.4, 0.6667, 826, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in lists:\n total_list.extend(i)\n s = s.union(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L195_C12", "label": "extend()", "type": "expression", "loc": [195, 195], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:For_L194_C8", "vector": [8, 3, 0.9028, 0.0046, 3, 0.75, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " total_list.extend(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L196_C12", "label": "s = union()", "type": "assigned_variable", "loc": [196, 196], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:For_L194_C8", "vector": [14, 3, 0.9074, 0.0046, 3, 0.75, 1.0, 553, 3, 1, 0, 0, 140, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "union", "annotation": ""}, "snippet": " s = s.union(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Return_L197_C8", "label": "return", "type": "return", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L191_C4", "vector": [13, 2, 0.912, 0.0046, 2, 0.4, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sorted(total_list) == sorted(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L199_C4", "label": "_parse_int_list", "type": "function", "loc": [199, 216], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:ClassDef_L6_C0", "vector": [2, 1, 0.9606, 0.0833, 1, 0.5, 1.0, 828, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "_parse_int_list", "arg_names": ["self", "parsestr"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _parse_int_list(self, parsestr):\n try:\n lst = parsestr.split(',')\n except AttributeError:\n return None\n\n if lst == ['']:\n return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Try_L200_C8", "label": "try", "type": "try", "loc": [200, 203], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L199_C4", "vector": [7, 2, 0.9329, 0.0185, 2, 0.82, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n lst = parsestr.split(',')\n except AttributeError:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L201_C12", "label": "lst = split()", "type": "assigned_variable", "loc": [201, 201], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:Try_L200_C8", "vector": [14, 3, 0.9306, 0.0046, 3, 0.55, 0.0, 564, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "lst", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " lst = parsestr.split(',')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Return_L203_C12", "label": "return", "type": "return", "loc": [203, 203], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:Try_L200_C8", "vector": [13, 3, 0.9398, 0.0046, 3, 0.55, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:If_L205_C8", "label": "if", "type": "if", "loc": [205, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L199_C4", "vector": [4, 2, 0.9514, 0.0093, 2, 0.82, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lst == ['']:\n return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Return_L206_C12", "label": "return", "type": "return", "loc": [206, 206], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:If_L205_C8", "vector": [13, 3, 0.9537, 0.0046, 3, 0.48, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Try_L208_C8", "label": "try", "type": "try", "loc": [208, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L199_C4", "vector": [7, 2, 0.9699, 0.0185, 2, 0.82, 0.5, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n lst = [int(i) for i in lst]\n except ValueError:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L209_C12", "label": "lst =", "type": "assigned_variable", "loc": [209, 209], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:Try_L208_C8", "vector": [14, 3, 0.9676, 0.0046, 3, 0.1, 0.0, 564, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "lst", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lst = [int(i) for i in lst]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Return_L211_C12", "label": "return", "type": "return", "loc": [211, 211], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:Try_L208_C8", "vector": [13, 3, 0.9769, 0.0046, 3, 0.1, 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_391:If_L213_C8", "label": "if", "type": "if", "loc": [213, 214], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L199_C4", "vector": [4, 2, 0.9884, 0.0093, 2, 0.82, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not all(((x>=1 and x<=MAX_VALID_SQ) for x in lst)):\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Return_L214_C12", "label": "return", "type": "return", "loc": [214, 214], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:If_L213_C8", "vector": [13, 3, 0.9907, 0.0046, 3, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_391:Return_L216_C8", "label": "return", "type": "return", "loc": [216, 216], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L199_C4", "vector": [13, 2, 1.0, 0.0046, 2, 0.82, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return lst"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_391:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:If_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L102_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L104_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:If_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:If_L111_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Return_L113_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:If_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:If_L114_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Return_L116_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Return_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:If_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:If_L129_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L134_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:If_L129_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L135_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:If_L129_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:For_L136_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:For_L136_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L137_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:For_L136_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L138_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:If_L129_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:For_L139_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:For_L139_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L140_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:For_L139_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L141_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:If_L129_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:For_L142_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:For_L142_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L143_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:For_L142_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L144_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:If_L129_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:For_L145_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:For_L145_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L146_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:For_L145_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L147_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:If_L129_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L148_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:If_L129_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L149_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:If_L129_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L150_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:If_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:If_L151_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L152_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:If_L151_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L158_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L158_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L171_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L172_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L173_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L175_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L181_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L183_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L183_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L185_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L187_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L191_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L191_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L191_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L191_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:For_L194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:For_L194_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Expr_L195_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:For_L194_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L196_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L191_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Return_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L199_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Try_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:Try_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L201_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:Try_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Return_L203_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L199_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:If_L205_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:If_L205_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Return_L206_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L199_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Try_L208_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:Try_L208_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Assign_L209_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:Try_L208_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Return_L211_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L199_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:If_L213_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:If_L213_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Return_L214_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_391:FunctionDef_L199_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_391:Return_L216_C8"}] |
from Tkinter import *
class HyperlinkManager(object):
def __init__(self, textWidget, linkFunc):
self.txt = textWidget
self.linkfunc = linkFunc
self.txt.tag_config('hyper', foreground='blue', underline=1)
self.txt.tag_bind('hyper', '<Enter>', self._enter)
self.txt.tag_bind('hyper', '<Leave>', self._leave)
self.txt.tag_bind('hyper', '<Button-1>', self._click)
self.reset()
def reset(self):
self.filenames = {}
def add(self, filename):
# Add a link with associated filename. The link function returns tags
# to use in the associated text widget.
tag = 'hyper-%d' % len(self.filenames)
self.filenames[tag] = filename
return 'hyper', tag
def _enter(self, event):
self.txt.config(cursor='hand2')
def _leave(self, event):
self.txt.config(cursor='')
def _click(self, event):
for tag in self.txt.tag_names(CURRENT):
if tag.startswith('hyper-'):
self.linkfunc(self.filenames[tag])
return
| ajibawa-2023/Python-Code-Large/train/row_392 | 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_392:ImportFrom_L1_C0", "label": "from Tkinter import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0303, 0.0303, 0, 0.66, 0.0, 368, 0, 1, 0, 0, 368, 0, 0], "semantic": {"name": "Tkinter", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from Tkinter import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:ClassDef_L3_C0", "label": "HyperlinkManager", "type": "class", "loc": [3, 33], "level": 0, "parent": null, "vector": [3, 0, 0.5455, 0.9394, 0, 0.66, 1.0, 220, 0, 6, 0, 0, 186, 0, 11], "semantic": {"name": "HyperlinkManager", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class HyperlinkManager(object):\n def __init__(self, textWidget, linkFunc):\n self.txt = textWidget\n self.linkfunc = linkFunc\n self.txt.tag_config('hyper', foreground='blue', underline=1)\n self.txt.tag_bind('hyper', '<Enter>', self._enter)\n self.txt.tag_bind('hyper', '<Leave>', self._leave)\n self.txt.tag_bind('hyper', '<Button-1>', self._click)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L4_C4", "label": "__init__", "type": "function", "loc": [4, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:ClassDef_L3_C0", "vector": [2, 1, 0.2273, 0.2424, 1, 0.7, 0.0, 555, 0, 3, 0, 0, 0, 0, 5], "semantic": {"name": "__init__", "arg_names": ["self", "textWidget", "linkFunc"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, textWidget, linkFunc):\n self.txt = textWidget\n self.linkfunc = linkFunc\n self.txt.tag_config('hyper', foreground='blue', underline=1)\n self.txt.tag_bind('hyper', '<Enter>', self._enter)\n self.txt.tag_bind('hyper', '<Leave>', self._leave)\n self.txt.tag_bind('hyper', '<Button-1>', self._click)\n self.reset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:Assign_L5_C8", "label": "self.txt =", "type": "assigned_variable", "loc": [5, 5], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L4_C4", "vector": [14, 2, 0.1515, 0.0303, 2, 0.88, 0.0, 120, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.txt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.txt = textWidget"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:Assign_L6_C8", "label": "self.linkfunc =", "type": "assigned_variable", "loc": [6, 6], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L4_C4", "vector": [14, 2, 0.1818, 0.0303, 2, 0.88, 0.1667, 282, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.linkfunc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.linkfunc = linkFunc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:Expr_L7_C8", "label": "tag_config()", "type": "expression", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L4_C4", "vector": [8, 2, 0.2121, 0.0303, 2, 0.88, 0.3333, 201, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "tag_config", "arg_names": [], "import_names": [], "rhs_call_name": "tag_config", "annotation": ""}, "snippet": " self.txt.tag_config('hyper', foreground='blue', underline=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:Expr_L8_C8", "label": "tag_bind()", "type": "expression", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L4_C4", "vector": [8, 2, 0.2424, 0.0303, 2, 0.88, 0.5, 813, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "tag_bind", "arg_names": [], "import_names": [], "rhs_call_name": "tag_bind", "annotation": ""}, "snippet": " self.txt.tag_bind('hyper', '<Enter>', self._enter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:Expr_L9_C8", "label": "tag_bind()", "type": "expression", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L4_C4", "vector": [8, 2, 0.2727, 0.0303, 2, 0.88, 0.6667, 813, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "tag_bind", "arg_names": [], "import_names": [], "rhs_call_name": "tag_bind", "annotation": ""}, "snippet": " self.txt.tag_bind('hyper', '<Leave>', self._leave)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:Expr_L10_C8", "label": "tag_bind()", "type": "expression", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L4_C4", "vector": [8, 2, 0.303, 0.0303, 2, 0.88, 0.8333, 813, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "tag_bind", "arg_names": [], "import_names": [], "rhs_call_name": "tag_bind", "annotation": ""}, "snippet": " self.txt.tag_bind('hyper', '<Button-1>', self._click)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:Expr_L11_C8", "label": "reset()", "type": "expression", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L4_C4", "vector": [8, 2, 0.3333, 0.0303, 2, 0.88, 1.0, 944, 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_392:FunctionDef_L13_C4", "label": "reset", "type": "function", "loc": [13, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:ClassDef_L3_C0", "vector": [2, 1, 0.4091, 0.0606, 1, 0.7, 0.2, 944, 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.filenames = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:Assign_L14_C8", "label": "self.filenames =", "type": "assigned_variable", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L13_C4", "vector": [14, 2, 0.4242, 0.0303, 2, 0.15, 0.0, 866, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.filenames", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.filenames = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L16_C4", "label": "add", "type": "function", "loc": [16, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:ClassDef_L3_C0", "vector": [2, 1, 0.5606, 0.1818, 1, 0.7, 0.4, 241, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": ["self", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add(self, filename):\n # Add a link with associated filename. The link function returns tags\n # to use in the associated text widget.\n tag = 'hyper-%d' % len(self.filenames)\n self.filenames[tag] = filename\n return 'hyper', tag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:Assign_L19_C8", "label": "tag =", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L16_C4", "vector": [14, 2, 0.5758, 0.0303, 2, 0.43, 0.0, 732, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'hyper-%d' % len(self.filenames)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:Assign_L20_C8", "label": "assign", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L16_C4", "vector": [14, 2, 0.6061, 0.0303, 2, 0.43, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.filenames[tag] = filename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:Return_L21_C8", "label": "return", "type": "return", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L16_C4", "vector": [13, 2, 0.6364, 0.0303, 2, 0.43, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'hyper', tag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L23_C4", "label": "_enter", "type": "function", "loc": [23, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:ClassDef_L3_C0", "vector": [2, 1, 0.7121, 0.0606, 1, 0.7, 0.6, 922, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_enter", "arg_names": ["self", "event"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _enter(self, event):\n self.txt.config(cursor='hand2')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:Expr_L24_C8", "label": "config()", "type": "expression", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L23_C4", "vector": [8, 2, 0.7273, 0.0303, 2, 0.11, 0.0, 308, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "config", "arg_names": [], "import_names": [], "rhs_call_name": "config", "annotation": ""}, "snippet": " self.txt.config(cursor='hand2')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L26_C4", "label": "_leave", "type": "function", "loc": [26, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:ClassDef_L3_C0", "vector": [2, 1, 0.803, 0.0606, 1, 0.7, 0.8, 620, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_leave", "arg_names": ["self", "event"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _leave(self, event):\n self.txt.config(cursor='')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:Expr_L27_C8", "label": "config()", "type": "expression", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L26_C4", "vector": [8, 2, 0.8182, 0.0303, 2, 0.98, 0.0, 308, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "config", "arg_names": [], "import_names": [], "rhs_call_name": "config", "annotation": ""}, "snippet": " self.txt.config(cursor='')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L29_C4", "label": "_click", "type": "function", "loc": [29, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:ClassDef_L3_C0", "vector": [2, 1, 0.9394, 0.1515, 1, 0.7, 1.0, 947, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "_click", "arg_names": ["self", "event"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _click(self, event):\n for tag in self.txt.tag_names(CURRENT):\n if tag.startswith('hyper-'):\n self.linkfunc(self.filenames[tag])\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:For_L30_C8", "label": "for tag", "type": "for", "loc": [30, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L29_C4", "vector": [6, 2, 0.9545, 0.1212, 2, 0.2, 0.0, 732, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for tag in self.txt.tag_names(CURRENT):\n if tag.startswith('hyper-'):\n self.linkfunc(self.filenames[tag])\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:If_L31_C12", "label": "if", "type": "if", "loc": [31, 33], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:For_L30_C8", "vector": [4, 3, 0.9697, 0.0909, 3, 0.69, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag.startswith('hyper-'):\n self.linkfunc(self.filenames[tag])\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:Expr_L32_C16", "label": "linkfunc()", "type": "expression", "loc": [32, 32], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:If_L31_C12", "vector": [8, 4, 0.9697, 0.0303, 4, 0.3, 0.0, 762, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "linkfunc", "arg_names": [], "import_names": [], "rhs_call_name": "linkfunc", "annotation": ""}, "snippet": " self.linkfunc(self.filenames[tag])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_392:Return_L33_C16", "label": "return", "type": "return", "loc": [33, 33], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_392:If_L31_C12", "vector": [13, 4, 1.0, 0.0303, 4, 0.3, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_392:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_392:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_392:Assign_L6_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_392:Expr_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_392:Expr_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_392:Expr_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_392:Expr_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_392:Expr_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_392:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_392:Assign_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_392:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_392:Assign_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_392:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_392:Return_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_392:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_392:Expr_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_392:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_392:Expr_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_392:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_392:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_392:For_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_392:For_L30_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_392:If_L31_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_392:If_L31_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_392:Expr_L32_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_392:If_L31_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_392:Return_L33_C16"}] |
class DocNode(object):
"""
A node in the document.
"""
def __init__(self, kind='', parent=None, content=None):
self.children = []
self.parent = parent
self.kind = kind
self.content = content
if self.parent is not None:
self.parent.children.append(self)
| ajibawa-2023/Python-Code-Large/train/row_393 | 9 | 12 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_393:ClassDef_L1_C0", "label": "DocNode", "type": "class", "loc": [1, 12], "level": 0, "parent": null, "vector": [3, 0, 0.5417, 1.0, 0, 0.66, 0.0, 61, 0, 1, 0, 0, 186, 0, 1], "semantic": {"name": "DocNode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DocNode(object):\n \"\"\"\n A node in the document.\n \"\"\"\n\n def __init__(self, kind='', parent=None, content=None):\n self.children = []\n self.parent = parent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_393:Expr_L2_C4", "label": "expression", "type": "expression", "loc": [2, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_393:ClassDef_L1_C0", "vector": [8, 1, 0.25, 0.25, 1, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n A node in the document.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_393:FunctionDef_L6_C4", "label": "__init__", "type": "function", "loc": [6, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_393:ClassDef_L1_C0", "vector": [2, 1, 0.75, 0.5833, 1, 0.45, 1.0, 555, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "kind", "parent", "content"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, kind='', parent=None, content=None):\n self.children = []\n self.parent = parent\n self.kind = kind\n self.content = content\n if self.parent is not None:\n self.parent.children.append(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_393:Assign_L7_C8", "label": "self.children =", "type": "assigned_variable", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_393:FunctionDef_L6_C4", "vector": [14, 2, 0.5833, 0.0833, 2, 0.63, 0.0, 278, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.children", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.children = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_393:Assign_L8_C8", "label": "self.parent =", "type": "assigned_variable", "loc": [8, 8], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_393:FunctionDef_L6_C4", "vector": [14, 2, 0.6667, 0.0833, 2, 0.63, 0.25, 428, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.parent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.parent = parent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_393:Assign_L9_C8", "label": "self.kind =", "type": "assigned_variable", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_393:FunctionDef_L6_C4", "vector": [14, 2, 0.75, 0.0833, 2, 0.63, 0.5, 368, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.kind", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.kind = kind"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_393:Assign_L10_C8", "label": "self.content =", "type": "assigned_variable", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_393:FunctionDef_L6_C4", "vector": [14, 2, 0.8333, 0.0833, 2, 0.63, 0.75, 943, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.content = content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_393:If_L11_C8", "label": "if", "type": "if", "loc": [11, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_393:FunctionDef_L6_C4", "vector": [4, 2, 0.9583, 0.1667, 2, 0.63, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.parent is not None:\n self.parent.children.append(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_393:Expr_L12_C12", "label": "append()", "type": "expression", "loc": [12, 12], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_393:If_L11_C8", "vector": [8, 3, 1.0, 0.0833, 3, 0.35, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.parent.children.append(self)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_393:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_393:Expr_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_393:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_393:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_393:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_393:Assign_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_393:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_393:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_393:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_393:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_393:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_393:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_393:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_393:If_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_393:If_L11_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_393:Expr_L12_C12"}] |
#!/usr/bin/env python
"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2010 Frederico Caldeira Knabben
== BEGIN LICENSE ==
Licensed under the terms of any of the following licenses at your
choice:
- GNU General Public License Version 2 or later (the "GPL")
http://www.gnu.org/licenses/gpl.html
- GNU Lesser General Public License Version 2.1 or later (the "LGPL")
http://www.gnu.org/licenses/lgpl.html
- Mozilla Public License Version 1.1 or later (the "MPL")
http://www.mozilla.org/MPL/MPL-1.1.html
== END LICENSE ==
This is the "File Uploader" for Python
"""
import os
from fckutil import *
from fckcommands import * # default command's implementation
from fckconnector import FCKeditorConnectorBase # import base connector
import config as Config
class FCKeditorQuickUpload( FCKeditorConnectorBase,
UploadFileCommandMixin,
BaseHttpMixin, BaseHtmlMixin):
def doResponse(self):
"Main function. Process the request, set headers and return a string as response."
# Check if this connector is disabled
if not(Config.Enabled):
return self.sendUploadResults(1, "This file uploader is disabled. Please check the \"editor/filemanager/connectors/py/config.py\"")
command = 'QuickUpload'
# The file type (from the QueryString, by default 'File').
resourceType = self.request.get('Type','File')
currentFolder = "/"
# Check for invalid paths
if currentFolder is None:
return self.sendUploadResults(102, '', '', "")
# Check if it is an allowed command
if ( not command in Config.ConfigAllowedCommands ):
return self.sendUploadResults( 1, '', '', 'The %s command isn\'t allowed' % command )
if ( not resourceType in Config.ConfigAllowedTypes ):
return self.sendUploadResults( 1, '', '', 'Invalid type specified' )
# Setup paths
self.userFilesFolder = Config.QuickUploadAbsolutePath[resourceType]
self.webUserFilesFolder = Config.QuickUploadPath[resourceType]
if not self.userFilesFolder: # no absolute path given (dangerous...)
self.userFilesFolder = mapServerPath(self.environ,
self.webUserFilesFolder)
# Ensure that the directory exists.
if not os.path.exists(self.userFilesFolder):
try:
self.createServerFoldercreateServerFolder( self.userFilesFolder )
except:
return self.sendError(1, "This connector couldn\'t access to local user\'s files directories. Please check the UserFilesAbsolutePath in \"editor/filemanager/connectors/py/config.py\" and try again. ")
# File upload doesn't have to return XML, so intercept here
return self.uploadFile(resourceType, currentFolder)
# Running from command line (plain old CGI)
if __name__ == '__main__':
try:
# Create a Connector Instance
conn = FCKeditorQuickUpload()
data = conn.doResponse()
for header in conn.headers:
if not header is None:
print '%s: %s' % header
print
print data
except:
print "Content-Type: text/plain"
print
import cgi
cgi.print_exception()
| ajibawa-2023/Python-Code-Large/train/row_394 | 28 | 47 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_394:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0213, 0.0213, 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_394:ImportFrom_L3_C0", "label": "from fckutil import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0638, 0.0213, 0, 0.66, 0.2, 630, 0, 1, 0, 0, 630, 0, 0], "semantic": {"name": "fckutil", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fckutil import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:ImportFrom_L4_C0", "label": "from fckcommands import *", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0851, 0.0213, 0, 0.66, 0.4, 66, 0, 1, 0, 0, 66, 0, 0], "semantic": {"name": "fckcommands", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fckcommands import * \t# default command's implementation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:ImportFrom_L5_C0", "label": "from fckconnector import FCKeditorConnectorBase", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1064, 0.0213, 0, 0.66, 0.6, 725, 0, 1, 0, 0, 725, 0, 0], "semantic": {"name": "fckconnector", "arg_names": [], "import_names": ["FCKeditorConnectorBase"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fckconnector import FCKeditorConnectorBase # import base connector"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:Import_L6_C0", "label": "config import Config", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1277, 0.0213, 0, 0.66, 0.8, 308, 0, 1, 0, 0, 308, 0, 0], "semantic": {"name": "config", "arg_names": [], "import_names": ["Config"], "rhs_call_name": "", "annotation": ""}, "snippet": "import config as Config"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:ClassDef_L8_C0", "label": "FCKeditorQuickUpload", "type": "class", "loc": [8, 46], "level": 0, "parent": null, "vector": [3, 0, 0.5745, 0.8298, 0, 0.66, 1.0, 339, 0, 1, 0, 0, 693, 0, 10], "semantic": {"name": "FCKeditorQuickUpload", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FCKeditorQuickUpload(\tFCKeditorConnectorBase,\n\t\t\t\t\t\t\tUploadFileCommandMixin,\n\t\t\t\t\t\t\tBaseHttpMixin, BaseHtmlMixin):\n\tdef doResponse(self):\n\t\t\"Main function. Process the request, set headers and return a string as response.\"\n\t\t# Check if this connector is disabled\n\t\tif not(Config.Enabled):\n\t\t\treturn self.sendUploadResults(1, \"This file uploader is disabled. Please check the \\\"editor/filemanager/connectors/py/config.py\\\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "label": "doResponse", "type": "function", "loc": [11, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_394:ClassDef_L8_C0", "vector": [2, 1, 0.6064, 0.766, 1, 0.59, 0.0, 492, 0, 1, 1, 0, 0, 0, 10], "semantic": {"name": "doResponse", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef doResponse(self):\n\t\t\"Main function. Process the request, set headers and return a string as response.\"\n\t\t# Check if this connector is disabled\n\t\tif not(Config.Enabled):\n\t\t\treturn self.sendUploadResults(1, \"This file uploader is disabled. Please check the \\\"editor/filemanager/connectors/py/config.py\\\"\")\n\t\tcommand = 'QuickUpload'\n\t\t# The file type (from the QueryString, by default 'File').\n\t\tresourceType = self.request.get('Type','File')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:Expr_L12_C2", "label": "expression", "type": "expression", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "vector": [8, 2, 0.2553, 0.0213, 2, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"Main function. Process the request, set headers and return a string as response.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:If_L14_C2", "label": "if", "type": "if", "loc": [14, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "vector": [4, 2, 0.3085, 0.0426, 2, 0.46, 0.0833, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif not(Config.Enabled):\n\t\t\treturn self.sendUploadResults(1, \"This file uploader is disabled. Please check the \\\"editor/filemanager/connectors/py/config.py\\\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:Return_L15_C3", "label": "return", "type": "return", "loc": [15, 15], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_394:If_L14_C2", "vector": [13, 3, 0.3191, 0.0213, 3, 0.15, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn self.sendUploadResults(1, \"This file uploader is disabled. Please check the \\\"editor/filemanager/connectors/py/config.py\\\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:Assign_L16_C2", "label": "command =", "type": "assigned_variable", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "vector": [14, 2, 0.3404, 0.0213, 2, 0.46, 0.1667, 842, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "command", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tcommand = 'QuickUpload'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:Assign_L18_C2", "label": "resourceType = get()", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "vector": [14, 2, 0.383, 0.0213, 2, 0.46, 0.25, 551, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "resourceType", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": "\t\tresourceType = self.request.get('Type','File')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:Assign_L19_C2", "label": "currentFolder =", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "vector": [14, 2, 0.4043, 0.0213, 2, 0.46, 0.3333, 885, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "currentFolder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tcurrentFolder = \"/\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:If_L21_C2", "label": "if", "type": "if", "loc": [21, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "vector": [4, 2, 0.4574, 0.0426, 2, 0.46, 0.4167, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif currentFolder is None:\n\t\t\treturn self.sendUploadResults(102, '', '', \"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:Return_L22_C3", "label": "return", "type": "return", "loc": [22, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_394:If_L21_C2", "vector": [13, 3, 0.4681, 0.0213, 3, 0.26, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn self.sendUploadResults(102, '', '', \"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:If_L25_C2", "label": "if", "type": "if", "loc": [25, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "vector": [4, 2, 0.5426, 0.0426, 2, 0.46, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif ( not command in Config.ConfigAllowedCommands ):\n\t\t\treturn self.sendUploadResults( 1, '', '', 'The %s command isn\\'t allowed' % command )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:Return_L26_C3", "label": "return", "type": "return", "loc": [26, 26], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_394:If_L25_C2", "vector": [13, 3, 0.5532, 0.0213, 3, 0.12, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn self.sendUploadResults( 1, '', '', 'The %s command isn\\'t allowed' % command )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:If_L28_C2", "label": "if", "type": "if", "loc": [28, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "vector": [4, 2, 0.6064, 0.0426, 2, 0.46, 0.5833, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif ( not resourceType in Config.ConfigAllowedTypes ):\n\t\t\treturn self.sendUploadResults( 1, '', '', 'Invalid type specified' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:Return_L29_C3", "label": "return", "type": "return", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_394:If_L28_C2", "vector": [13, 3, 0.617, 0.0213, 3, 0.02, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn self.sendUploadResults( 1, '', '', 'Invalid type specified' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:Assign_L32_C2", "label": "self.userFilesFolder =", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "vector": [14, 2, 0.6809, 0.0213, 2, 0.46, 0.6667, 308, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.userFilesFolder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.userFilesFolder = Config.QuickUploadAbsolutePath[resourceType]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:Assign_L33_C2", "label": "self.webUserFilesFolder =", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "vector": [14, 2, 0.7021, 0.0213, 2, 0.46, 0.75, 772, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.webUserFilesFolder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.webUserFilesFolder = Config.QuickUploadPath[resourceType]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:If_L34_C2", "label": "if", "type": "if", "loc": [34, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "vector": [4, 2, 0.7447, 0.0638, 2, 0.46, 0.8333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif not self.userFilesFolder: # no absolute path given (dangerous...)\n\t\t\tself.userFilesFolder = mapServerPath(self.environ,\n\t\t\t\t\t\t\t\t\tself.webUserFilesFolder)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:Assign_L35_C3", "label": "self.userFilesFolder = mapServerPath()", "type": "assigned_variable", "loc": [35, 36], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_394:If_L34_C2", "vector": [14, 3, 0.7553, 0.0426, 3, 0.09, 0.0, 308, 3, 2, 0, 0, 872, 10, 1], "semantic": {"name": "self.userFilesFolder", "arg_names": [], "import_names": [], "rhs_call_name": "mapServerPath", "annotation": ""}, "snippet": "\t\t\tself.userFilesFolder = mapServerPath(self.environ,\n\t\t\t\t\t\t\t\t\tself.webUserFilesFolder)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:If_L39_C2", "label": "if", "type": "if", "loc": [39, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "vector": [4, 2, 0.8723, 0.1064, 2, 0.46, 0.9167, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif not os.path.exists(self.userFilesFolder):\n\t\t\ttry:\n\t\t\t\tself.createServerFoldercreateServerFolder( self.userFilesFolder )\n\t\t\texcept:\n\t\t\t\treturn self.sendError(1, \"This connector couldn\\'t access to local user\\'s files directories. Please check the UserFilesAbsolutePath in \\\"editor/filemanager/connectors/py/config.py\\\" and try again. \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:Try_L40_C3", "label": "try", "type": "try", "loc": [40, 43], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_394:If_L39_C2", "vector": [7, 3, 0.883, 0.0851, 3, 0.93, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\ttry:\n\t\t\t\tself.createServerFoldercreateServerFolder( self.userFilesFolder )\n\t\t\texcept:\n\t\t\t\treturn self.sendError(1, \"This connector couldn\\'t access to local user\\'s files directories. Please check the UserFilesAbsolutePath in \\\"editor/filemanager/connectors/py/config.py\\\" and try again. \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:Expr_L41_C4", "label": "createServerFoldercreateServerFolder()", "type": "expression", "loc": [41, 41], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_394:Try_L40_C3", "vector": [8, 4, 0.8723, 0.0213, 4, 0.65, 0.0, 921, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "createServerFoldercreateServerFolder", "arg_names": [], "import_names": [], "rhs_call_name": "createServerFoldercreateServerFolder", "annotation": ""}, "snippet": "\t\t\t\tself.createServerFoldercreateServerFolder( self.userFilesFolder )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:Return_L43_C4", "label": "return", "type": "return", "loc": [43, 43], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_394:Try_L40_C3", "vector": [13, 4, 0.9149, 0.0213, 4, 0.65, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\treturn self.sendError(1, \"This connector couldn\\'t access to local user\\'s files directories. Please check the UserFilesAbsolutePath in \\\"editor/filemanager/connectors/py/config.py\\\" and try again. \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_394:Return_L46_C2", "label": "return", "type": "return", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "vector": [13, 2, 0.9787, 0.0213, 2, 0.46, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.uploadFile(resourceType, currentFolder)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_394:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_394:Expr_L12_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_394:If_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_394:If_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_394:Return_L15_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_394:Assign_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_394:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_394:Assign_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_394:If_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_394:If_L21_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_394:Return_L22_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_394:If_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_394:If_L25_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_394:Return_L26_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_394:If_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_394:If_L28_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_394:Return_L29_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_394:Assign_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_394:Assign_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_394:If_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_394:If_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_394:Assign_L35_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_394:If_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_394:If_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_394:Try_L40_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_394:Try_L40_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_394:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_394:Try_L40_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_394:Return_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_394:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_394:Return_L46_C2"}] |
#!/usr/bin/env python
"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2010 Frederico Caldeira Knabben
== BEGIN LICENSE ==
Licensed under the terms of any of the following licenses at your
choice:
- GNU General Public License Version 2 or later (the "GPL")
http://www.gnu.org/licenses/gpl.html
- GNU Lesser General Public License Version 2.1 or later (the "LGPL")
http://www.gnu.org/licenses/lgpl.html
- Mozilla Public License Version 1.1 or later (the "MPL")
http://www.mozilla.org/MPL/MPL-1.1.html
== END LICENSE ==
Connector for Python (CGI and WSGI).
"""
from time import gmtime, strftime
import string
def escape(text, replace=string.replace):
"""
Converts the special characters '<', '>', and '&'.
RFC 1866 specifies that these characters be represented
in HTML as < > and & respectively. In Python
1.5 we use the new string.replace() function for speed.
"""
text = replace(text, '&', '&') # must be done 1st
text = replace(text, '<', '<')
text = replace(text, '>', '>')
text = replace(text, '"', '"')
return text
def convertToXmlAttribute(value):
if (value is None):
value = ""
return escape(value)
class BaseHttpMixin(object):
def setHttpHeaders(self, content_type='text/xml'):
"Purpose: to prepare the headers for the xml to return"
# Prevent the browser from caching the result.
# Date in the past
self.setHeader('Expires','Mon, 26 Jul 1997 05:00:00 GMT')
# always modified
self.setHeader('Last-Modified',strftime("%a, %d %b %Y %H:%M:%S GMT", gmtime()))
# HTTP/1.1
self.setHeader('Cache-Control','no-store, no-cache, must-revalidate')
self.setHeader('Cache-Control','post-check=0, pre-check=0')
# HTTP/1.0
self.setHeader('Pragma','no-cache')
# Set the response format.
self.setHeader( 'Content-Type', content_type + '; charset=utf-8' )
return
class BaseXmlMixin(object):
def createXmlHeader(self, command, resourceType, currentFolder, url):
"Purpose: returns the xml header"
self.setHttpHeaders()
# Create the XML document header
s = """<?xml version="1.0" encoding="utf-8" ?>"""
# Create the main connector node
s += """<Connector command="%s" resourceType="%s">""" % (
command,
resourceType
)
# Add the current folder node
s += """<CurrentFolder path="%s" url="%s" />""" % (
convertToXmlAttribute(currentFolder),
convertToXmlAttribute(url),
)
return s
def createXmlFooter(self):
"Purpose: returns the xml footer"
return """</Connector>"""
def sendError(self, number, text):
"Purpose: in the event of an error, return an xml based error"
self.setHttpHeaders()
return ("""<?xml version="1.0" encoding="utf-8" ?>""" +
"""<Connector>""" +
self.sendErrorNode (number, text) +
"""</Connector>""" )
def sendErrorNode(self, number, text):
if number != 1:
return """<Error number="%s" />""" % (number)
else:
return """<Error number="%s" text="%s" />""" % (number, convertToXmlAttribute(text))
class BaseHtmlMixin(object):
def sendUploadResults( self, errorNo = 0, fileUrl = '', fileName = '', customMsg = '' ):
self.setHttpHeaders("text/html")
"This is the function that sends the results of the uploading process"
"Minified version of the document.domain automatic fix script (#1919)."
"The original script can be found at _dev/domain_fix_template.js"
return """<script type="text/javascript">
(function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();
window.parent.OnUploadCompleted(%(errorNumber)s,"%(fileUrl)s","%(fileName)s","%(customMsg)s");
</script>""" % {
'errorNumber': errorNo,
'fileUrl': fileUrl.replace ('"', '\\"'),
'fileName': fileName.replace ( '"', '\\"' ) ,
'customMsg': customMsg.replace ( '"', '\\"' ),
}
| ajibawa-2023/Python-Code-Large/train/row_395 | 48 | 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_395:Expr_L3_C0", "label": "expression", "type": "expression", "loc": [3, 25], "level": 0, "parent": null, "vector": [8, 0, 0.1176, 0.1933, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nFCKeditor - The text editor for Internet - http://www.fckeditor.net\nCopyright (C) 2003-2010 Frederico Caldeira Knabben\n\n== BEGIN LICENSE ==\n\nLicensed under the terms of any of the following licenses at your\nchoice:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:ImportFrom_L27_C0", "label": "from time import gmtime, strftime", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.2269, 0.0084, 0, 0.66, 0.1429, 654, 0, 2, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["gmtime", "strftime"], "rhs_call_name": "", "annotation": ""}, "snippet": "from time import gmtime, strftime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Import_L28_C0", "label": "string import string", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.2353, 0.0084, 0, 0.66, 0.2857, 890, 0, 1, 0, 0, 890, 0, 0], "semantic": {"name": "string", "arg_names": [], "import_names": ["string"], "rhs_call_name": "", "annotation": ""}, "snippet": "import string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L30_C0", "label": "escape", "type": "function", "loc": [30, 42], "level": 0, "parent": null, "vector": [2, 0, 0.3025, 0.1092, 0, 0.66, 0.4286, 494, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "escape", "arg_names": ["text", "replace"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def escape(text, replace=string.replace):\n\t\"\"\"\n\tConverts the special characters '<', '>', and '&'.\n\n\tRFC 1866 specifies that these characters be represented\n\tin HTML as < > and & respectively. In Python\n\t1.5 we use the new string.replace() function for speed.\n\t\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L31_C1", "label": "expression", "type": "expression", "loc": [31, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L30_C0", "vector": [8, 1, 0.2857, 0.0588, 1, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\"\"\"\n\tConverts the special characters '<', '>', and '&'.\n\n\tRFC 1866 specifies that these characters be represented\n\tin HTML as < > and & respectively. In Python\n\t1.5 we use the new string.replace() function for speed.\n\t\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Assign_L38_C1", "label": "text = replace()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L30_C0", "vector": [14, 1, 0.3193, 0.0084, 1, 0.2, 0.2, 439, 3, 3, 0, 0, 293, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": "\ttext = replace(text, '&', '&') # must be done 1st"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Assign_L39_C1", "label": "text = replace()", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L30_C0", "vector": [14, 1, 0.3277, 0.0084, 1, 0.2, 0.4, 439, 3, 3, 0, 0, 293, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": "\ttext = replace(text, '<', '<')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Assign_L40_C1", "label": "text = replace()", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L30_C0", "vector": [14, 1, 0.3361, 0.0084, 1, 0.2, 0.6, 439, 3, 3, 0, 0, 293, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": "\ttext = replace(text, '>', '>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Assign_L41_C1", "label": "text = replace()", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L30_C0", "vector": [14, 1, 0.3445, 0.0084, 1, 0.2, 0.8, 439, 3, 3, 0, 0, 293, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": "\ttext = replace(text, '\"', '"')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Return_L42_C1", "label": "return", "type": "return", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L30_C0", "vector": [13, 1, 0.3529, 0.0084, 1, 0.2, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L44_C0", "label": "convertToXmlAttribute", "type": "function", "loc": [44, 47], "level": 0, "parent": null, "vector": [2, 0, 0.3824, 0.0336, 0, 0.66, 0.5714, 746, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "convertToXmlAttribute", "arg_names": ["value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def convertToXmlAttribute(value):\n\tif (value is None):\n\t\tvalue = \"\"\n\treturn escape(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:If_L45_C1", "label": "if", "type": "if", "loc": [45, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L44_C0", "vector": [4, 1, 0.3824, 0.0168, 1, 0.12, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif (value is None):\n\t\tvalue = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Assign_L46_C2", "label": "value =", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:If_L45_C1", "vector": [14, 2, 0.3866, 0.0084, 2, 0.15, 0.0, 441, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tvalue = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Return_L47_C1", "label": "return", "type": "return", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L44_C0", "vector": [13, 1, 0.395, 0.0084, 1, 0.12, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn escape(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:ClassDef_L49_C0", "label": "BaseHttpMixin", "type": "class", "loc": [49, 65], "level": 0, "parent": null, "vector": [3, 0, 0.479, 0.1429, 0, 0.66, 0.7143, 519, 0, 1, 0, 0, 186, 0, 8], "semantic": {"name": "BaseHttpMixin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BaseHttpMixin(object):\n\tdef setHttpHeaders(self, content_type='text/xml'):\n\t\t\"Purpose: to prepare the headers for the xml to return\"\n\t\t# Prevent the browser from caching the result.\n\t\t# Date in the past\n\t\tself.setHeader('Expires','Mon, 26 Jul 1997 05:00:00 GMT')\n\t\t# always modified\n\t\tself.setHeader('Last-Modified',strftime(\"%a, %d %b %Y %H:%M:%S GMT\", gmtime()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L50_C1", "label": "setHttpHeaders", "type": "function", "loc": [50, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:ClassDef_L49_C0", "vector": [2, 1, 0.4832, 0.1345, 1, 0.9, 0.0, 32, 0, 2, 0, 0, 0, 0, 8], "semantic": {"name": "setHttpHeaders", "arg_names": ["self", "content_type"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef setHttpHeaders(self, content_type='text/xml'):\n\t\t\"Purpose: to prepare the headers for the xml to return\"\n\t\t# Prevent the browser from caching the result.\n\t\t# Date in the past\n\t\tself.setHeader('Expires','Mon, 26 Jul 1997 05:00:00 GMT')\n\t\t# always modified\n\t\tself.setHeader('Last-Modified',strftime(\"%a, %d %b %Y %H:%M:%S GMT\", gmtime()))\n\t\t# HTTP/1.1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L51_C2", "label": "expression", "type": "expression", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L50_C1", "vector": [8, 2, 0.4286, 0.0084, 2, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"Purpose: to prepare the headers for the xml to return\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L54_C2", "label": "setHeader()", "type": "expression", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L50_C1", "vector": [8, 2, 0.4538, 0.0084, 2, 0.45, 0.1429, 623, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setHeader", "arg_names": [], "import_names": [], "rhs_call_name": "setHeader", "annotation": ""}, "snippet": "\t\tself.setHeader('Expires','Mon, 26 Jul 1997 05:00:00 GMT')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L56_C2", "label": "setHeader()", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L50_C1", "vector": [8, 2, 0.4706, 0.0084, 2, 0.45, 0.2857, 623, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "setHeader", "arg_names": [], "import_names": [], "rhs_call_name": "setHeader", "annotation": ""}, "snippet": "\t\tself.setHeader('Last-Modified',strftime(\"%a, %d %b %Y %H:%M:%S GMT\", gmtime()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L58_C2", "label": "setHeader()", "type": "expression", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L50_C1", "vector": [8, 2, 0.4874, 0.0084, 2, 0.45, 0.4286, 623, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setHeader", "arg_names": [], "import_names": [], "rhs_call_name": "setHeader", "annotation": ""}, "snippet": "\t\tself.setHeader('Cache-Control','no-store, no-cache, must-revalidate')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L59_C2", "label": "setHeader()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L50_C1", "vector": [8, 2, 0.4958, 0.0084, 2, 0.45, 0.5714, 623, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setHeader", "arg_names": [], "import_names": [], "rhs_call_name": "setHeader", "annotation": ""}, "snippet": "\t\tself.setHeader('Cache-Control','post-check=0, pre-check=0')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L61_C2", "label": "setHeader()", "type": "expression", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L50_C1", "vector": [8, 2, 0.5126, 0.0084, 2, 0.45, 0.7143, 623, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setHeader", "arg_names": [], "import_names": [], "rhs_call_name": "setHeader", "annotation": ""}, "snippet": "\t\tself.setHeader('Pragma','no-cache')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L64_C2", "label": "setHeader()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L50_C1", "vector": [8, 2, 0.5378, 0.0084, 2, 0.45, 0.8571, 623, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setHeader", "arg_names": [], "import_names": [], "rhs_call_name": "setHeader", "annotation": ""}, "snippet": "\t\tself.setHeader( 'Content-Type', content_type + '; charset=utf-8' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Return_L65_C2", "label": "return", "type": "return", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L50_C1", "vector": [13, 2, 0.5462, 0.0084, 2, 0.45, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:ClassDef_L67_C0", "label": "BaseXmlMixin", "type": "class", "loc": [67, 101], "level": 0, "parent": null, "vector": [3, 0, 0.7059, 0.2941, 0, 0.66, 0.8571, 52, 0, 4, 0, 0, 186, 0, 6], "semantic": {"name": "BaseXmlMixin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BaseXmlMixin(object):\n\tdef createXmlHeader(self, command, resourceType, currentFolder, url):\n\t\t\"Purpose: returns the xml header\"\n\t\tself.setHttpHeaders()\n\t\t# Create the XML document header\n\t\ts = \"\"\"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\"\"\"\n\t\t# Create the main connector node\n\t\ts += \"\"\"<Connector command=\"%s\" resourceType=\"%s\">\"\"\" % ("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L68_C1", "label": "createXmlHeader", "type": "function", "loc": [68, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:ClassDef_L67_C0", "vector": [2, 1, 0.6345, 0.1345, 1, 0.48, 0.0, 310, 0, 5, 1, 0, 0, 0, 3], "semantic": {"name": "createXmlHeader", "arg_names": ["self", "command", "resourceType", "currentFolder", "url"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef createXmlHeader(self, command, resourceType, currentFolder, url):\n\t\t\"Purpose: returns the xml header\"\n\t\tself.setHttpHeaders()\n\t\t# Create the XML document header\n\t\ts = \"\"\"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\"\"\"\n\t\t# Create the main connector node\n\t\ts += \"\"\"<Connector command=\"%s\" resourceType=\"%s\">\"\"\" % (\n\t\t\t\tcommand,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L69_C2", "label": "expression", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L68_C1", "vector": [8, 2, 0.5798, 0.0084, 2, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"Purpose: returns the xml header\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L70_C2", "label": "setHttpHeaders()", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L68_C1", "vector": [8, 2, 0.5882, 0.0084, 2, 0.54, 0.3333, 32, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "setHttpHeaders", "arg_names": [], "import_names": [], "rhs_call_name": "setHttpHeaders", "annotation": ""}, "snippet": "\t\tself.setHttpHeaders()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Assign_L72_C2", "label": "s =", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L68_C1", "vector": [14, 2, 0.605, 0.0084, 2, 0.54, 0.6667, 553, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ts = \"\"\"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Return_L83_C2", "label": "return", "type": "return", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L68_C1", "vector": [13, 2, 0.6975, 0.0084, 2, 0.54, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn s"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L85_C1", "label": "createXmlFooter", "type": "function", "loc": [85, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:ClassDef_L67_C0", "vector": [2, 1, 0.7227, 0.0252, 1, 0.48, 0.3333, 453, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "createXmlFooter", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef createXmlFooter(self):\n\t\t\"Purpose: returns the xml footer\"\n\t\treturn \"\"\"</Connector>\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L86_C2", "label": "expression", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L85_C1", "vector": [8, 2, 0.7227, 0.0084, 2, 0.48, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"Purpose: returns the xml footer\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Return_L87_C2", "label": "return", "type": "return", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L85_C1", "vector": [13, 2, 0.7311, 0.0084, 2, 0.48, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn \"\"\"</Connector>\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L89_C1", "label": "sendError", "type": "function", "loc": [89, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:ClassDef_L67_C0", "vector": [2, 1, 0.7731, 0.0588, 1, 0.48, 0.6667, 543, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "sendError", "arg_names": ["self", "number", "text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef sendError(self, number, text):\n\t\t\"Purpose: in the event of an error, return an xml based error\"\n\t\tself.setHttpHeaders()\n\t\treturn (\"\"\"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\"\"\" +\n\t\t\t\t\"\"\"<Connector>\"\"\" +\n\t\t\t\tself.sendErrorNode (number, text) +\n\t\t\t\t\"\"\"</Connector>\"\"\" )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L90_C2", "label": "expression", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L89_C1", "vector": [8, 2, 0.7563, 0.0084, 2, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"Purpose: in the event of an error, return an xml based error\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L91_C2", "label": "setHttpHeaders()", "type": "expression", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L89_C1", "vector": [8, 2, 0.7647, 0.0084, 2, 0.43, 0.5, 32, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "setHttpHeaders", "arg_names": [], "import_names": [], "rhs_call_name": "setHttpHeaders", "annotation": ""}, "snippet": "\t\tself.setHttpHeaders()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Return_L92_C2", "label": "return", "type": "return", "loc": [92, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L89_C1", "vector": [13, 2, 0.7857, 0.0336, 2, 0.43, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn (\"\"\"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\"\"\" +\n\t\t\t\t\"\"\"<Connector>\"\"\" +\n\t\t\t\tself.sendErrorNode (number, text) +\n\t\t\t\t\"\"\"</Connector>\"\"\" )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L97_C1", "label": "sendErrorNode", "type": "function", "loc": [97, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:ClassDef_L67_C0", "vector": [2, 1, 0.8319, 0.042, 1, 0.48, 1.0, 516, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "sendErrorNode", "arg_names": ["self", "number", "text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef sendErrorNode(self, number, text):\n\t\tif number != 1:\n\t\t\treturn \"\"\"<Error number=\"%s\" />\"\"\" % (number)\n\t\telse:\n\t\t\treturn \"\"\"<Error number=\"%s\" text=\"%s\" />\"\"\" % (number, convertToXmlAttribute(text))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:If_L98_C2", "label": "if", "type": "if", "loc": [98, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L97_C1", "vector": [4, 2, 0.8361, 0.0336, 2, 0.17, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif number != 1:\n\t\t\treturn \"\"\"<Error number=\"%s\" />\"\"\" % (number)\n\t\telse:\n\t\t\treturn \"\"\"<Error number=\"%s\" text=\"%s\" />\"\"\" % (number, convertToXmlAttribute(text))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Return_L99_C3", "label": "return", "type": "return", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:If_L98_C2", "vector": [13, 3, 0.8319, 0.0084, 3, 0.88, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn \"\"\"<Error number=\"%s\" />\"\"\" % (number)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Return_L101_C3", "label": "return", "type": "return", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:If_L98_C2", "vector": [13, 3, 0.8487, 0.0084, 3, 0.88, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn \"\"\"<Error number=\"%s\" text=\"%s\" />\"\"\" % (number, convertToXmlAttribute(text))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:ClassDef_L103_C0", "label": "BaseHtmlMixin", "type": "class", "loc": [103, 119], "level": 0, "parent": null, "vector": [3, 0, 0.9328, 0.1429, 0, 0.66, 1.0, 166, 0, 1, 0, 0, 186, 0, 4], "semantic": {"name": "BaseHtmlMixin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BaseHtmlMixin(object):\n\tdef sendUploadResults( self, errorNo = 0, fileUrl = '', fileName = '', customMsg = '' ):\n\t\tself.setHttpHeaders(\"text/html\")\n\t\t\"This is the function that sends the results of the uploading process\"\n\n\t\t\"Minified version of the document.domain automatic fix script (#1919).\"\n\t\t\"The original script can be found at _dev/domain_fix_template.js\"\n\t\treturn \"\"\"<script type=\"text/javascript\">"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L104_C1", "label": "sendUploadResults", "type": "function", "loc": [104, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:ClassDef_L103_C0", "vector": [2, 1, 0.937, 0.1345, 1, 0.29, 0.0, 110, 0, 5, 1, 0, 0, 0, 4], "semantic": {"name": "sendUploadResults", "arg_names": ["self", "errorNo", "fileUrl", "fileName", "customMsg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef sendUploadResults( self, errorNo = 0, fileUrl = '', fileName = '', customMsg = '' ):\n\t\tself.setHttpHeaders(\"text/html\")\n\t\t\"This is the function that sends the results of the uploading process\"\n\n\t\t\"Minified version of the document.domain automatic fix script (#1919).\"\n\t\t\"The original script can be found at _dev/domain_fix_template.js\"\n\t\treturn \"\"\"<script type=\"text/javascript\">\n\t\t\t(function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L105_C2", "label": "setHttpHeaders()", "type": "expression", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L104_C1", "vector": [8, 2, 0.8824, 0.0084, 2, 0.74, 0.0, 32, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setHttpHeaders", "arg_names": [], "import_names": [], "rhs_call_name": "setHttpHeaders", "annotation": ""}, "snippet": "\t\tself.setHttpHeaders(\"text/html\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L106_C2", "label": "expression", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L104_C1", "vector": [8, 2, 0.8908, 0.0084, 2, 0.74, 0.25, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"This is the function that sends the results of the uploading process\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L108_C2", "label": "expression", "type": "expression", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L104_C1", "vector": [8, 2, 0.9076, 0.0084, 2, 0.74, 0.5, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"Minified version of the document.domain automatic fix script (#1919).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L109_C2", "label": "expression", "type": "expression", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L104_C1", "vector": [8, 2, 0.916, 0.0084, 2, 0.74, 0.75, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"The original script can be found at _dev/domain_fix_template.js\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_395:Return_L110_C2", "label": "return", "type": "return", "loc": [110, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L104_C1", "vector": [13, 2, 0.9622, 0.084, 2, 0.74, 1.0, 0, 4, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn \"\"\"<script type=\"text/javascript\">\n\t\t\t(function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();\n\n\t\t\twindow.parent.OnUploadCompleted(%(errorNumber)s,\"%(fileUrl)s\",\"%(fileName)s\",\"%(customMsg)s\");\n\t\t\t</script>\"\"\" % {\n\t\t\t'errorNumber': errorNo,\n\t\t\t'fileUrl': fileUrl.replace ('\"', '\\\\\"'),\n\t\t\t'fileName': fileName.replace ( '\"', '\\\\\"' ) ,"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L31_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Assign_L38_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Assign_L39_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Assign_L40_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Assign_L41_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Return_L42_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_395:If_L45_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:If_L45_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Assign_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Return_L47_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:ClassDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L50_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L50_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L50_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L50_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L50_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L50_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L50_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L50_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L50_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Return_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L68_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L68_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L68_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L68_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Assign_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L68_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Return_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L85_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L85_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L86_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L85_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Return_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L89_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L89_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L89_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L89_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Return_L92_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L97_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L97_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:If_L98_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:If_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Return_L99_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:If_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Return_L101_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:ClassDef_L103_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L104_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L104_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L105_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L104_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L106_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L104_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L108_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L104_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Expr_L109_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_395:FunctionDef_L104_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_395:Return_L110_C2"}] |
#!/usr/bin/env python
"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2010 Frederico Caldeira Knabben
== BEGIN LICENSE ==
Licensed under the terms of any of the following licenses at your
choice:
- GNU General Public License Version 2 or later (the "GPL")
http://www.gnu.org/licenses/gpl.html
- GNU Lesser General Public License Version 2.1 or later (the "LGPL")
http://www.gnu.org/licenses/lgpl.html
- Mozilla Public License Version 1.1 or later (the "MPL")
http://www.mozilla.org/MPL/MPL-1.1.html
== END LICENSE ==
This is the "File Uploader" for Python
"""
import os
from fckutil import *
from fckcommands import * # default command's implementation
from fckconnector import FCKeditorConnectorBase # import base connector
import config as Config
class FCKeditorQuickUpload( FCKeditorConnectorBase,
UploadFileCommandMixin,
BaseHttpMixin, BaseHtmlMixin):
def doResponse(self):
"Main function. Process the request, set headers and return a string as response."
# Check if this connector is disabled
if not(Config.Enabled):
return self.sendUploadResults(1, "This file uploader is disabled. Please check the \"editor/filemanager/connectors/py/config.py\"")
command = 'QuickUpload'
# The file type (from the QueryString, by default 'File').
resourceType = self.request.get('Type','File')
currentFolder = "/"
# Check for invalid paths
if currentFolder is None:
return self.sendUploadResults(102, '', '', "")
# Check if it is an allowed command
if ( not command in Config.ConfigAllowedCommands ):
return self.sendUploadResults( 1, '', '', 'The %s command isn\'t allowed' % command )
if ( not resourceType in Config.ConfigAllowedTypes ):
return self.sendUploadResults( 1, '', '', 'Invalid type specified' )
# Setup paths
self.userFilesFolder = Config.QuickUploadAbsolutePath[resourceType]
self.webUserFilesFolder = Config.QuickUploadPath[resourceType]
if not self.userFilesFolder: # no absolute path given (dangerous...)
self.userFilesFolder = mapServerPath(self.environ,
self.webUserFilesFolder)
# Ensure that the directory exists.
if not os.path.exists(self.userFilesFolder):
try:
self.createServerFoldercreateServerFolder( self.userFilesFolder )
except:
return self.sendError(1, "This connector couldn\'t access to local user\'s files directories. Please check the UserFilesAbsolutePath in \"editor/filemanager/connectors/py/config.py\" and try again. ")
# File upload doesn't have to return XML, so intercept here
return self.uploadFile(resourceType, currentFolder)
# Running from command line (plain old CGI)
if __name__ == '__main__':
try:
# Create a Connector Instance
conn = FCKeditorQuickUpload()
data = conn.doResponse()
for header in conn.headers:
if not header is None:
print '%s: %s' % header
print
print data
except:
print "Content-Type: text/plain"
print
import cgi
cgi.print_exception()
| ajibawa-2023/Python-Code-Large/train/row_397 | 28 | 47 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_397:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0213, 0.0213, 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_397:ImportFrom_L3_C0", "label": "from fckutil import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0638, 0.0213, 0, 0.66, 0.2, 630, 0, 1, 0, 0, 630, 0, 0], "semantic": {"name": "fckutil", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fckutil import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:ImportFrom_L4_C0", "label": "from fckcommands import *", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0851, 0.0213, 0, 0.66, 0.4, 66, 0, 1, 0, 0, 66, 0, 0], "semantic": {"name": "fckcommands", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fckcommands import * \t# default command's implementation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:ImportFrom_L5_C0", "label": "from fckconnector import FCKeditorConnectorBase", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1064, 0.0213, 0, 0.66, 0.6, 725, 0, 1, 0, 0, 725, 0, 0], "semantic": {"name": "fckconnector", "arg_names": [], "import_names": ["FCKeditorConnectorBase"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fckconnector import FCKeditorConnectorBase # import base connector"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:Import_L6_C0", "label": "config import Config", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1277, 0.0213, 0, 0.66, 0.8, 308, 0, 1, 0, 0, 308, 0, 0], "semantic": {"name": "config", "arg_names": [], "import_names": ["Config"], "rhs_call_name": "", "annotation": ""}, "snippet": "import config as Config"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:ClassDef_L8_C0", "label": "FCKeditorQuickUpload", "type": "class", "loc": [8, 46], "level": 0, "parent": null, "vector": [3, 0, 0.5745, 0.8298, 0, 0.66, 1.0, 339, 0, 1, 0, 0, 693, 0, 10], "semantic": {"name": "FCKeditorQuickUpload", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FCKeditorQuickUpload(\tFCKeditorConnectorBase,\n\t\t\t\t\t\t\tUploadFileCommandMixin,\n\t\t\t\t\t\t\tBaseHttpMixin, BaseHtmlMixin):\n\tdef doResponse(self):\n\t\t\"Main function. Process the request, set headers and return a string as response.\"\n\t\t# Check if this connector is disabled\n\t\tif not(Config.Enabled):\n\t\t\treturn self.sendUploadResults(1, \"This file uploader is disabled. Please check the \\\"editor/filemanager/connectors/py/config.py\\\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "label": "doResponse", "type": "function", "loc": [11, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_397:ClassDef_L8_C0", "vector": [2, 1, 0.6064, 0.766, 1, 0.78, 0.0, 492, 0, 1, 1, 0, 0, 0, 10], "semantic": {"name": "doResponse", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef doResponse(self):\n\t\t\"Main function. Process the request, set headers and return a string as response.\"\n\t\t# Check if this connector is disabled\n\t\tif not(Config.Enabled):\n\t\t\treturn self.sendUploadResults(1, \"This file uploader is disabled. Please check the \\\"editor/filemanager/connectors/py/config.py\\\"\")\n\t\tcommand = 'QuickUpload'\n\t\t# The file type (from the QueryString, by default 'File').\n\t\tresourceType = self.request.get('Type','File')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:Expr_L12_C2", "label": "expression", "type": "expression", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "vector": [8, 2, 0.2553, 0.0213, 2, 0.63, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"Main function. Process the request, set headers and return a string as response.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:If_L14_C2", "label": "if", "type": "if", "loc": [14, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "vector": [4, 2, 0.3085, 0.0426, 2, 0.63, 0.0833, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif not(Config.Enabled):\n\t\t\treturn self.sendUploadResults(1, \"This file uploader is disabled. Please check the \\\"editor/filemanager/connectors/py/config.py\\\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:Return_L15_C3", "label": "return", "type": "return", "loc": [15, 15], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_397:If_L14_C2", "vector": [13, 3, 0.3191, 0.0213, 3, 0.73, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn self.sendUploadResults(1, \"This file uploader is disabled. Please check the \\\"editor/filemanager/connectors/py/config.py\\\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:Assign_L16_C2", "label": "command =", "type": "assigned_variable", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "vector": [14, 2, 0.3404, 0.0213, 2, 0.63, 0.1667, 842, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "command", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tcommand = 'QuickUpload'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:Assign_L18_C2", "label": "resourceType = get()", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "vector": [14, 2, 0.383, 0.0213, 2, 0.63, 0.25, 551, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "resourceType", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": "\t\tresourceType = self.request.get('Type','File')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:Assign_L19_C2", "label": "currentFolder =", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "vector": [14, 2, 0.4043, 0.0213, 2, 0.63, 0.3333, 885, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "currentFolder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tcurrentFolder = \"/\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:If_L21_C2", "label": "if", "type": "if", "loc": [21, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "vector": [4, 2, 0.4574, 0.0426, 2, 0.63, 0.4167, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif currentFolder is None:\n\t\t\treturn self.sendUploadResults(102, '', '', \"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:Return_L22_C3", "label": "return", "type": "return", "loc": [22, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_397:If_L21_C2", "vector": [13, 3, 0.4681, 0.0213, 3, 0.23, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn self.sendUploadResults(102, '', '', \"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:If_L25_C2", "label": "if", "type": "if", "loc": [25, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "vector": [4, 2, 0.5426, 0.0426, 2, 0.63, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif ( not command in Config.ConfigAllowedCommands ):\n\t\t\treturn self.sendUploadResults( 1, '', '', 'The %s command isn\\'t allowed' % command )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:Return_L26_C3", "label": "return", "type": "return", "loc": [26, 26], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_397:If_L25_C2", "vector": [13, 3, 0.5532, 0.0213, 3, 0.53, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn self.sendUploadResults( 1, '', '', 'The %s command isn\\'t allowed' % command )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:If_L28_C2", "label": "if", "type": "if", "loc": [28, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "vector": [4, 2, 0.6064, 0.0426, 2, 0.63, 0.5833, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif ( not resourceType in Config.ConfigAllowedTypes ):\n\t\t\treturn self.sendUploadResults( 1, '', '', 'Invalid type specified' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:Return_L29_C3", "label": "return", "type": "return", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_397:If_L28_C2", "vector": [13, 3, 0.617, 0.0213, 3, 0.86, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn self.sendUploadResults( 1, '', '', 'Invalid type specified' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:Assign_L32_C2", "label": "self.userFilesFolder =", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "vector": [14, 2, 0.6809, 0.0213, 2, 0.63, 0.6667, 308, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.userFilesFolder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.userFilesFolder = Config.QuickUploadAbsolutePath[resourceType]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:Assign_L33_C2", "label": "self.webUserFilesFolder =", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "vector": [14, 2, 0.7021, 0.0213, 2, 0.63, 0.75, 772, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.webUserFilesFolder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.webUserFilesFolder = Config.QuickUploadPath[resourceType]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:If_L34_C2", "label": "if", "type": "if", "loc": [34, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "vector": [4, 2, 0.7447, 0.0638, 2, 0.63, 0.8333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif not self.userFilesFolder: # no absolute path given (dangerous...)\n\t\t\tself.userFilesFolder = mapServerPath(self.environ,\n\t\t\t\t\t\t\t\t\tself.webUserFilesFolder)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:Assign_L35_C3", "label": "self.userFilesFolder = mapServerPath()", "type": "assigned_variable", "loc": [35, 36], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_397:If_L34_C2", "vector": [14, 3, 0.7553, 0.0426, 3, 0.31, 0.0, 308, 3, 2, 0, 0, 872, 10, 1], "semantic": {"name": "self.userFilesFolder", "arg_names": [], "import_names": [], "rhs_call_name": "mapServerPath", "annotation": ""}, "snippet": "\t\t\tself.userFilesFolder = mapServerPath(self.environ,\n\t\t\t\t\t\t\t\t\tself.webUserFilesFolder)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:If_L39_C2", "label": "if", "type": "if", "loc": [39, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "vector": [4, 2, 0.8723, 0.1064, 2, 0.63, 0.9167, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif not os.path.exists(self.userFilesFolder):\n\t\t\ttry:\n\t\t\t\tself.createServerFoldercreateServerFolder( self.userFilesFolder )\n\t\t\texcept:\n\t\t\t\treturn self.sendError(1, \"This connector couldn\\'t access to local user\\'s files directories. Please check the UserFilesAbsolutePath in \\\"editor/filemanager/connectors/py/config.py\\\" and try again. \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:Try_L40_C3", "label": "try", "type": "try", "loc": [40, 43], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_397:If_L39_C2", "vector": [7, 3, 0.883, 0.0851, 3, 0.32, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\ttry:\n\t\t\t\tself.createServerFoldercreateServerFolder( self.userFilesFolder )\n\t\t\texcept:\n\t\t\t\treturn self.sendError(1, \"This connector couldn\\'t access to local user\\'s files directories. Please check the UserFilesAbsolutePath in \\\"editor/filemanager/connectors/py/config.py\\\" and try again. \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:Expr_L41_C4", "label": "createServerFoldercreateServerFolder()", "type": "expression", "loc": [41, 41], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_397:Try_L40_C3", "vector": [8, 4, 0.8723, 0.0213, 4, 0.96, 0.0, 921, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "createServerFoldercreateServerFolder", "arg_names": [], "import_names": [], "rhs_call_name": "createServerFoldercreateServerFolder", "annotation": ""}, "snippet": "\t\t\t\tself.createServerFoldercreateServerFolder( self.userFilesFolder )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:Return_L43_C4", "label": "return", "type": "return", "loc": [43, 43], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_397:Try_L40_C3", "vector": [13, 4, 0.9149, 0.0213, 4, 0.96, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\treturn self.sendError(1, \"This connector couldn\\'t access to local user\\'s files directories. Please check the UserFilesAbsolutePath in \\\"editor/filemanager/connectors/py/config.py\\\" and try again. \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_397:Return_L46_C2", "label": "return", "type": "return", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "vector": [13, 2, 0.9787, 0.0213, 2, 0.63, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.uploadFile(resourceType, currentFolder)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_397:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_397:Expr_L12_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_397:If_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_397:If_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_397:Return_L15_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_397:Assign_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_397:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_397:Assign_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_397:If_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_397:If_L21_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_397:Return_L22_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_397:If_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_397:If_L25_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_397:Return_L26_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_397:If_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_397:If_L28_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_397:Return_L29_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_397:Assign_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_397:Assign_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_397:If_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_397:If_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_397:Assign_L35_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_397:If_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_397:If_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_397:Try_L40_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_397:Try_L40_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_397:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_397:Try_L40_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_397:Return_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_397:FunctionDef_L11_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_397:Return_L46_C2"}] |
#!/usr/bin/env python
"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2010 Frederico Caldeira Knabben
== BEGIN LICENSE ==
Licensed under the terms of any of the following licenses at your
choice:
- GNU General Public License Version 2 or later (the "GPL")
http://www.gnu.org/licenses/gpl.html
- GNU Lesser General Public License Version 2.1 or later (the "LGPL")
http://www.gnu.org/licenses/lgpl.html
- Mozilla Public License Version 1.1 or later (the "MPL")
http://www.mozilla.org/MPL/MPL-1.1.html
== END LICENSE ==
Base Connector for Python (CGI and WSGI).
See config.py for configuration settings
"""
import cgi, os
from fckutil import *
from fckcommands import * # default command's implementation
from fckoutput import * # base http, xml and html output mixins
import config as Config
class FCKeditorConnectorBase( object ):
"The base connector class. Subclass it to extend functionality (see Zope example)"
def __init__(self, environ=None):
"Constructor: Here you should parse request fields, initialize variables, etc."
self.request = FCKeditorRequest(environ) # Parse request
self.headers = [] # Clean Headers
if environ:
self.environ = environ
else:
self.environ = os.environ
# local functions
def setHeader(self, key, value):
self.headers.append ((key, value))
return
class FCKeditorRequest(object):
"A wrapper around the request object"
def __init__(self, environ):
if environ: # WSGI
self.request = cgi.FieldStorage(fp=environ['wsgi.input'],
environ=environ,
keep_blank_values=1)
self.environ = environ
else: # plain old cgi
self.environ = os.environ
self.request = cgi.FieldStorage()
if 'REQUEST_METHOD' in self.environ and 'QUERY_STRING' in self.environ:
if self.environ['REQUEST_METHOD'].upper()=='POST':
# we are in a POST, but GET query_string exists
# cgi parses by default POST data, so parse GET QUERY_STRING too
self.get_request = cgi.FieldStorage(fp=None,
environ={
'REQUEST_METHOD':'GET',
'QUERY_STRING':self.environ['QUERY_STRING'],
},
)
else:
self.get_request={}
def has_key(self, key):
return self.request.has_key(key) or self.get_request.has_key(key)
def get(self, key, default=None):
if key in self.request.keys():
field = self.request[key]
elif key in self.get_request.keys():
field = self.get_request[key]
else:
return default
if hasattr(field,"filename") and field.filename: #file upload, do not convert return value
return field
else:
return field.value
| ajibawa-2023/Python-Code-Large/train/row_398 | 41 | 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_398:Expr_L3_C0", "label": "expression", "type": "expression", "loc": [3, 27], "level": 0, "parent": null, "vector": [8, 0, 0.1667, 0.2778, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nFCKeditor - The text editor for Internet - http://www.fckeditor.net\nCopyright (C) 2003-2010 Frederico Caldeira Knabben\n\n== BEGIN LICENSE ==\n\nLicensed under the terms of any of the following licenses at your\nchoice:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Import_L28_C0", "label": "cgi import cgi, os", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.3111, 0.0111, 0, 0.66, 0.1429, 934, 0, 2, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi", "os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cgi, os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:ImportFrom_L30_C0", "label": "from fckutil import *", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.0111, 0, 0.66, 0.2857, 630, 0, 1, 0, 0, 630, 0, 0], "semantic": {"name": "fckutil", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fckutil import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:ImportFrom_L31_C0", "label": "from fckcommands import *", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.3444, 0.0111, 0, 0.66, 0.4286, 66, 0, 1, 0, 0, 66, 0, 0], "semantic": {"name": "fckcommands", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fckcommands import * \t# default command's implementation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:ImportFrom_L32_C0", "label": "from fckoutput import *", "type": "import", "loc": [32, 32], "level": 0, "parent": null, "vector": [1, 0, 0.3556, 0.0111, 0, 0.66, 0.5714, 314, 0, 1, 0, 0, 314, 0, 0], "semantic": {"name": "fckoutput", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fckoutput import * \t# base http, xml and html output mixins"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Import_L33_C0", "label": "config import Config", "type": "import", "loc": [33, 33], "level": 0, "parent": null, "vector": [1, 0, 0.3667, 0.0111, 0, 0.66, 0.7143, 308, 0, 1, 0, 0, 308, 0, 0], "semantic": {"name": "config", "arg_names": [], "import_names": ["Config"], "rhs_call_name": "", "annotation": ""}, "snippet": "import config as Config"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:ClassDef_L35_C0", "label": "FCKeditorConnectorBase", "type": "class", "loc": [35, 51], "level": 0, "parent": null, "vector": [3, 0, 0.4778, 0.1889, 0, 0.66, 0.8571, 693, 0, 2, 0, 0, 186, 0, 2], "semantic": {"name": "FCKeditorConnectorBase", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FCKeditorConnectorBase( object ):\n\t\"The base connector class. Subclass it to extend functionality (see Zope example)\"\n\n\tdef __init__(self, environ=None):\n\t\t\"Constructor: Here you should parse request fields, initialize variables, etc.\"\n\t\tself.request = FCKeditorRequest(environ) # Parse request\n\t\tself.headers = []\t\t\t\t\t\t# Clean Headers\n\t\tif environ:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Expr_L36_C1", "label": "expression", "type": "expression", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:ClassDef_L35_C0", "vector": [8, 1, 0.4, 0.0111, 1, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\"The base connector class. Subclass it to extend functionality (see Zope example)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L38_C1", "label": "__init__", "type": "function", "loc": [38, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:ClassDef_L35_C0", "vector": [2, 1, 0.4611, 0.0889, 1, 0.18, 0.5, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "environ"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef __init__(self, environ=None):\n\t\t\"Constructor: Here you should parse request fields, initialize variables, etc.\"\n\t\tself.request = FCKeditorRequest(environ) # Parse request\n\t\tself.headers = []\t\t\t\t\t\t# Clean Headers\n\t\tif environ:\n\t\t\tself.environ = environ\n\t\telse:\n\t\t\tself.environ = os.environ"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Expr_L39_C2", "label": "expression", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L38_C1", "vector": [8, 2, 0.4333, 0.0111, 2, 0.27, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"Constructor: Here you should parse request fields, initialize variables, etc.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L40_C2", "label": "self.request = FCKeditorRequest()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L38_C1", "vector": [14, 2, 0.4444, 0.0111, 2, 0.27, 0.3333, 952, 3, 1, 0, 0, 272, 10, 1], "semantic": {"name": "self.request", "arg_names": [], "import_names": [], "rhs_call_name": "FCKeditorRequest", "annotation": ""}, "snippet": "\t\tself.request = FCKeditorRequest(environ) # Parse request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L41_C2", "label": "self.headers =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L38_C1", "vector": [14, 2, 0.4556, 0.0111, 2, 0.27, 0.6667, 131, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.headers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.headers = []\t\t\t\t\t\t# Clean Headers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:If_L42_C2", "label": "if", "type": "if", "loc": [42, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L38_C1", "vector": [4, 2, 0.4833, 0.0444, 2, 0.27, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif environ:\n\t\t\tself.environ = environ\n\t\telse:\n\t\t\tself.environ = os.environ"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L43_C3", "label": "self.environ =", "type": "assigned_variable", "loc": [43, 43], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:If_L42_C2", "vector": [14, 3, 0.4778, 0.0111, 3, 0.42, 0.0, 50, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.environ", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tself.environ = environ"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L45_C3", "label": "self.environ =", "type": "assigned_variable", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:If_L42_C2", "vector": [14, 3, 0.5, 0.0111, 3, 0.42, 1.0, 50, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.environ", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tself.environ = os.environ"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L49_C1", "label": "setHeader", "type": "function", "loc": [49, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:ClassDef_L35_C0", "vector": [2, 1, 0.5556, 0.0333, 1, 0.18, 1.0, 623, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setHeader", "arg_names": ["self", "key", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef setHeader(self, key, value):\n\t\tself.headers.append ((key, value))\n\t\treturn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Expr_L50_C2", "label": "append()", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L49_C1", "vector": [8, 2, 0.5556, 0.0111, 2, 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": "\t\tself.headers.append ((key, value))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Return_L51_C2", "label": "return", "type": "return", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L49_C1", "vector": [13, 2, 0.5667, 0.0111, 2, 0.0, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:ClassDef_L53_C0", "label": "FCKeditorRequest", "type": "class", "loc": [53, 90], "level": 0, "parent": null, "vector": [3, 0, 0.7944, 0.4222, 0, 0.66, 1.0, 272, 0, 3, 0, 0, 186, 0, 9], "semantic": {"name": "FCKeditorRequest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FCKeditorRequest(object):\n\t\"A wrapper around the request object\"\n\tdef __init__(self, environ):\n\t\tif environ: # WSGI\n\t\t\tself.request = cgi.FieldStorage(fp=environ['wsgi.input'],\n\t\t\t\t\t\t\tenviron=environ,\n\t\t\t\t\t\t\tkeep_blank_values=1)\n\t\t\tself.environ = environ"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Expr_L54_C1", "label": "expression", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:ClassDef_L53_C0", "vector": [8, 1, 0.6, 0.0111, 1, 0.8, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\"A wrapper around the request object\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L55_C1", "label": "__init__", "type": "function", "loc": [55, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:ClassDef_L53_C0", "vector": [2, 1, 0.7222, 0.2333, 1, 0.8, 0.3333, 555, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "environ"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef __init__(self, environ):\n\t\tif environ: # WSGI\n\t\t\tself.request = cgi.FieldStorage(fp=environ['wsgi.input'],\n\t\t\t\t\t\t\tenviron=environ,\n\t\t\t\t\t\t\tkeep_blank_values=1)\n\t\t\tself.environ = environ\n\t\telse: # plain old cgi\n\t\t\tself.environ = os.environ"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:If_L56_C2", "label": "if", "type": "if", "loc": [56, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L55_C1", "vector": [4, 2, 0.6611, 0.0889, 2, 0.95, 0.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif environ: # WSGI\n\t\t\tself.request = cgi.FieldStorage(fp=environ['wsgi.input'],\n\t\t\t\t\t\t\tenviron=environ,\n\t\t\t\t\t\t\tkeep_blank_values=1)\n\t\t\tself.environ = environ\n\t\telse: # plain old cgi\n\t\t\tself.environ = os.environ\n\t\t\tself.request = cgi.FieldStorage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L57_C3", "label": "self.request = FieldStorage()", "type": "assigned_variable", "loc": [57, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:If_L56_C2", "vector": [14, 3, 0.6444, 0.0333, 3, 0.76, 0.0, 952, 3, 3, 0, 0, 892, 10, 1], "semantic": {"name": "self.request", "arg_names": [], "import_names": [], "rhs_call_name": "FieldStorage", "annotation": ""}, "snippet": "\t\t\tself.request = cgi.FieldStorage(fp=environ['wsgi.input'],\n\t\t\t\t\t\t\tenviron=environ,\n\t\t\t\t\t\t\tkeep_blank_values=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L60_C3", "label": "self.environ =", "type": "assigned_variable", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:If_L56_C2", "vector": [14, 3, 0.6667, 0.0111, 3, 0.76, 0.3333, 50, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.environ", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tself.environ = environ"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L62_C3", "label": "self.environ =", "type": "assigned_variable", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:If_L56_C2", "vector": [14, 3, 0.6889, 0.0111, 3, 0.76, 0.6667, 50, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.environ", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tself.environ = os.environ"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L63_C3", "label": "self.request = FieldStorage()", "type": "assigned_variable", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:If_L56_C2", "vector": [14, 3, 0.7, 0.0111, 3, 0.76, 1.0, 952, 3, 0, 0, 0, 892, 10, 1], "semantic": {"name": "self.request", "arg_names": [], "import_names": [], "rhs_call_name": "FieldStorage", "annotation": ""}, "snippet": "\t\t\tself.request = cgi.FieldStorage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:If_L64_C2", "label": "if", "type": "if", "loc": [64, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L55_C1", "vector": [4, 2, 0.7722, 0.1333, 2, 0.95, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif 'REQUEST_METHOD' in self.environ and 'QUERY_STRING' in self.environ:\n\t\t\tif self.environ['REQUEST_METHOD'].upper()=='POST':\n\t\t\t\t# we are in a POST, but GET query_string exists\n\t\t\t\t# cgi parses by default POST data, so parse GET QUERY_STRING too\n\t\t\t\tself.get_request = cgi.FieldStorage(fp=None,\n\t\t\t\t\t\t\tenviron={\n\t\t\t\t\t\t\t'REQUEST_METHOD':'GET',\n\t\t\t\t\t\t\t'QUERY_STRING':self.environ['QUERY_STRING'],"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:If_L65_C3", "label": "if", "type": "if", "loc": [65, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:If_L64_C2", "vector": [4, 3, 0.7667, 0.1, 3, 0.15, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif self.environ['REQUEST_METHOD'].upper()=='POST':\n\t\t\t\t# we are in a POST, but GET query_string exists\n\t\t\t\t# cgi parses by default POST data, so parse GET QUERY_STRING too\n\t\t\t\tself.get_request = cgi.FieldStorage(fp=None,\n\t\t\t\t\t\t\tenviron={\n\t\t\t\t\t\t\t'REQUEST_METHOD':'GET',\n\t\t\t\t\t\t\t'QUERY_STRING':self.environ['QUERY_STRING'],\n\t\t\t\t\t\t\t},"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L68_C4", "label": "self.get_request = FieldStorage()", "type": "assigned_variable", "loc": [68, 73], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:If_L65_C3", "vector": [14, 4, 0.7833, 0.0667, 4, 0.97, 0.0, 565, 3, 2, 0, 0, 892, 10, 1], "semantic": {"name": "self.get_request", "arg_names": [], "import_names": [], "rhs_call_name": "FieldStorage", "annotation": ""}, "snippet": "\t\t\t\tself.get_request = cgi.FieldStorage(fp=None,\n\t\t\t\t\t\t\tenviron={\n\t\t\t\t\t\t\t'REQUEST_METHOD':'GET',\n\t\t\t\t\t\t\t'QUERY_STRING':self.environ['QUERY_STRING'],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L75_C3", "label": "self.get_request =", "type": "assigned_variable", "loc": [75, 75], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:If_L64_C2", "vector": [14, 3, 0.8333, 0.0111, 3, 0.15, 1.0, 565, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.get_request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tself.get_request={}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L77_C1", "label": "has_key", "type": "function", "loc": [77, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:ClassDef_L53_C0", "vector": [2, 1, 0.8611, 0.0222, 1, 0.8, 0.6667, 882, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "has_key", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef has_key(self, key):\n\t\treturn self.request.has_key(key) or self.get_request.has_key(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Return_L78_C2", "label": "return", "type": "return", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L77_C1", "vector": [13, 2, 0.8667, 0.0111, 2, 0.14, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.request.has_key(key) or self.get_request.has_key(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L80_C1", "label": "get", "type": "function", "loc": [80, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:ClassDef_L53_C0", "vector": [2, 1, 0.9444, 0.1222, 1, 0.8, 1.0, 607, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "get", "arg_names": ["self", "key", "default"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef get(self, key, default=None):\n\t\tif key in self.request.keys():\n\t\t\tfield = self.request[key]\n\t\telif key in self.get_request.keys():\n\t\t\tfield = self.get_request[key]\n\t\telse:\n\t\t\treturn default\n\t\tif hasattr(field,\"filename\") and field.filename: #file upload, do not convert return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:If_L81_C2", "label": "if", "type": "if", "loc": [81, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L80_C1", "vector": [4, 2, 0.9278, 0.0667, 2, 0.01, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif key in self.request.keys():\n\t\t\tfield = self.request[key]\n\t\telif key in self.get_request.keys():\n\t\t\tfield = self.get_request[key]\n\t\telse:\n\t\t\treturn default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L82_C3", "label": "field =", "type": "assigned_variable", "loc": [82, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:If_L81_C2", "vector": [14, 3, 0.9111, 0.0111, 3, 0.65, 0.0, 480, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tfield = self.request[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:If_L83_C2", "label": "if", "type": "if", "loc": [83, 86], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:If_L81_C2", "vector": [4, 3, 0.9389, 0.0444, 3, 0.65, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif key in self.get_request.keys():\n\t\t\tfield = self.get_request[key]\n\t\telse:\n\t\t\treturn default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L84_C3", "label": "field =", "type": "assigned_variable", "loc": [84, 84], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:If_L83_C2", "vector": [14, 4, 0.9333, 0.0111, 4, 0.98, 0.0, 480, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tfield = self.get_request[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Return_L86_C3", "label": "return", "type": "return", "loc": [86, 86], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:If_L83_C2", "vector": [13, 4, 0.9556, 0.0111, 4, 0.98, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:If_L87_C2", "label": "if", "type": "if", "loc": [87, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L80_C1", "vector": [4, 2, 0.9833, 0.0444, 2, 0.01, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif hasattr(field,\"filename\") and field.filename: #file upload, do not convert return value\n\t\t\treturn field\n\t\telse:\n\t\t\treturn field.value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Return_L88_C3", "label": "return", "type": "return", "loc": [88, 88], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:If_L87_C2", "vector": [13, 3, 0.9778, 0.0111, 3, 0.34, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn field"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_398:Return_L90_C3", "label": "return", "type": "return", "loc": [90, 90], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_398:If_L87_C2", "vector": [13, 3, 1.0, 0.0111, 3, 0.34, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn field.value"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_398:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_398:Expr_L36_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L38_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L38_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_398:Expr_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L38_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L38_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L38_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_398:If_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:If_L42_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L43_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:If_L42_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L45_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L49_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L49_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_398:Expr_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L49_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_398:Return_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_398:Expr_L54_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L55_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L55_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_398:If_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:If_L56_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L57_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:If_L56_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L60_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:If_L56_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L62_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:If_L56_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L63_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L55_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_398:If_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:If_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_398:If_L65_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:If_L65_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:If_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L75_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L77_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L77_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_398:Return_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L80_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L80_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_398:If_L81_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:If_L81_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L82_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:If_L81_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_398:If_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_398:Assign_L84_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_398:Return_L86_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:FunctionDef_L80_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_398:If_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:If_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_398:Return_L88_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_398:If_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_398:Return_L90_C3"}] |
#!/usr/bin/env python
"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2010 Frederico Caldeira Knabben
== BEGIN LICENSE ==
Licensed under the terms of any of the following licenses at your
choice:
- GNU General Public License Version 2 or later (the "GPL")
http://www.gnu.org/licenses/gpl.html
- GNU Lesser General Public License Version 2.1 or later (the "LGPL")
http://www.gnu.org/licenses/lgpl.html
- Mozilla Public License Version 1.1 or later (the "MPL")
http://www.mozilla.org/MPL/MPL-1.1.html
== END LICENSE ==
Connector/QuickUpload for Python (WSGI wrapper).
See config.py for configuration settings
"""
from connector import FCKeditorConnector
from upload import FCKeditorQuickUpload
import cgitb
from cStringIO import StringIO
# Running from WSGI capable server (recomended)
def App(environ, start_response):
"WSGI entry point. Run the connector"
if environ['SCRIPT_NAME'].endswith("connector.py"):
conn = FCKeditorConnector(environ)
elif environ['SCRIPT_NAME'].endswith("upload.py"):
conn = FCKeditorQuickUpload(environ)
else:
start_response ("200 Ok", [('Content-Type','text/html')])
yield "Unknown page requested: "
yield environ['SCRIPT_NAME']
return
try:
# run the connector
data = conn.doResponse()
# Start WSGI response:
start_response ("200 Ok", conn.headers)
# Send response text
yield data
except:
start_response("500 Internal Server Error",[("Content-type","text/html")])
file = StringIO()
cgitb.Hook(file = file).handle()
yield file.getvalue()
| ajibawa-2023/Python-Code-Large/train/row_399 | 23 | 58 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_399:Expr_L3_C0", "label": "expression", "type": "expression", "loc": [3, 27], "level": 0, "parent": null, "vector": [8, 0, 0.2586, 0.431, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nFCKeditor - The text editor for Internet - http://www.fckeditor.net\nCopyright (C) 2003-2010 Frederico Caldeira Knabben\n\n== BEGIN LICENSE ==\n\nLicensed under the terms of any of the following licenses at your\nchoice:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_399:ImportFrom_L29_C0", "label": "from connector import FCKeditorConnector", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.0172, 0, 0.66, 0.2, 385, 0, 1, 0, 0, 385, 0, 0], "semantic": {"name": "connector", "arg_names": [], "import_names": ["FCKeditorConnector"], "rhs_call_name": "", "annotation": ""}, "snippet": "from connector import FCKeditorConnector"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_399:ImportFrom_L30_C0", "label": "from upload import FCKeditorQuickUpload", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.5172, 0.0172, 0, 0.66, 0.4, 920, 0, 1, 0, 0, 920, 0, 0], "semantic": {"name": "upload", "arg_names": [], "import_names": ["FCKeditorQuickUpload"], "rhs_call_name": "", "annotation": ""}, "snippet": "from upload import FCKeditorQuickUpload"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_399:Import_L32_C0", "label": "cgitb import cgitb", "type": "import", "loc": [32, 32], "level": 0, "parent": null, "vector": [1, 0, 0.5517, 0.0172, 0, 0.66, 0.6, 691, 0, 1, 0, 0, 691, 0, 0], "semantic": {"name": "cgitb", "arg_names": [], "import_names": ["cgitb"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cgitb"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_399:ImportFrom_L33_C0", "label": "from cStringIO import StringIO", "type": "import", "loc": [33, 33], "level": 0, "parent": null, "vector": [1, 0, 0.569, 0.0172, 0, 0.66, 0.8, 764, 0, 1, 0, 0, 764, 0, 0], "semantic": {"name": "cStringIO", "arg_names": [], "import_names": ["StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": "from cStringIO import StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_399:FunctionDef_L36_C0", "label": "App", "type": "function", "loc": [36, 58], "level": 0, "parent": null, "vector": [2, 0, 0.8103, 0.3966, 0, 0.66, 1.0, 789, 0, 2, 0, 0, 0, 0, 12], "semantic": {"name": "App", "arg_names": ["environ", "start_response"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def App(environ, start_response):\n\t\"WSGI entry point. Run the connector\"\n\tif environ['SCRIPT_NAME'].endswith(\"connector.py\"):\n\t\tconn = FCKeditorConnector(environ)\n\telif environ['SCRIPT_NAME'].endswith(\"upload.py\"):\n\t\tconn = FCKeditorQuickUpload(environ)\n\telse:\n\t\tstart_response (\"200 Ok\", [('Content-Type','text/html')])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_399:Expr_L37_C1", "label": "expression", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_399:FunctionDef_L36_C0", "vector": [8, 1, 0.6379, 0.0172, 1, 0.87, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\"WSGI entry point. Run the connector\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_399:If_L38_C1", "label": "if", "type": "if", "loc": [38, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_399:FunctionDef_L36_C0", "vector": [4, 1, 0.7241, 0.1552, 1, 0.87, 0.5, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif environ['SCRIPT_NAME'].endswith(\"connector.py\"):\n\t\tconn = FCKeditorConnector(environ)\n\telif environ['SCRIPT_NAME'].endswith(\"upload.py\"):\n\t\tconn = FCKeditorQuickUpload(environ)\n\telse:\n\t\tstart_response (\"200 Ok\", [('Content-Type','text/html')])\n\t\tyield \"Unknown page requested: \"\n\t\tyield environ['SCRIPT_NAME']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_399:Assign_L39_C2", "label": "conn = FCKeditorConnector()", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_399:If_L38_C1", "vector": [14, 2, 0.6724, 0.0172, 2, 0.42, 0.0, 345, 3, 1, 0, 0, 439, 10, 1], "semantic": {"name": "conn", "arg_names": [], "import_names": [], "rhs_call_name": "FCKeditorConnector", "annotation": ""}, "snippet": "\t\tconn = FCKeditorConnector(environ)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_399:If_L40_C1", "label": "if", "type": "if", "loc": [40, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_399:If_L38_C1", "vector": [4, 2, 0.7414, 0.1207, 2, 0.42, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\telif environ['SCRIPT_NAME'].endswith(\"upload.py\"):\n\t\tconn = FCKeditorQuickUpload(environ)\n\telse:\n\t\tstart_response (\"200 Ok\", [('Content-Type','text/html')])\n\t\tyield \"Unknown page requested: \"\n\t\tyield environ['SCRIPT_NAME']\n\t\treturn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_399:Assign_L41_C2", "label": "conn = FCKeditorQuickUpload()", "type": "assigned_variable", "loc": [41, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_399:If_L40_C1", "vector": [14, 3, 0.7069, 0.0172, 3, 0.07, 0.0, 345, 3, 1, 0, 0, 339, 10, 1], "semantic": {"name": "conn", "arg_names": [], "import_names": [], "rhs_call_name": "FCKeditorQuickUpload", "annotation": ""}, "snippet": "\t\tconn = FCKeditorQuickUpload(environ)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_399:Expr_L43_C2", "label": "start_response()", "type": "expression", "loc": [43, 43], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_399:If_L40_C1", "vector": [8, 3, 0.7414, 0.0172, 3, 0.07, 0.25, 638, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "start_response", "arg_names": [], "import_names": [], "rhs_call_name": "start_response", "annotation": ""}, "snippet": "\t\tstart_response (\"200 Ok\", [('Content-Type','text/html')])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_399:Expr_L44_C2", "label": "expression", "type": "expression", "loc": [44, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_399:If_L40_C1", "vector": [8, 3, 0.7586, 0.0172, 3, 0.07, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tyield \"Unknown page requested: \""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_399:Expr_L45_C2", "label": "expression", "type": "expression", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_399:If_L40_C1", "vector": [8, 3, 0.7759, 0.0172, 3, 0.07, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tyield environ['SCRIPT_NAME']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_399:Return_L46_C2", "label": "return", "type": "return", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_399:If_L40_C1", "vector": [13, 3, 0.7931, 0.0172, 3, 0.07, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_399:Try_L47_C1", "label": "try", "type": "try", "loc": [47, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_399:FunctionDef_L36_C0", "vector": [7, 1, 0.9052, 0.2069, 1, 0.87, 1.0, 0, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ttry:\n\t\t# run the connector\n\t\tdata = conn.doResponse()\n\t\t# Start WSGI response:\n\t\tstart_response (\"200 Ok\", conn.headers)\n\t\t# Send response text\n\t\tyield data\n\texcept:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_399:Assign_L49_C2", "label": "data = doResponse()", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_399:Try_L47_C1", "vector": [14, 2, 0.8448, 0.0172, 2, 0.99, 0.0, 929, 3, 0, 0, 0, 492, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "doResponse", "annotation": ""}, "snippet": "\t\tdata = conn.doResponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_399:Expr_L51_C2", "label": "start_response()", "type": "expression", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_399:Try_L47_C1", "vector": [8, 2, 0.8793, 0.0172, 2, 0.99, 0.5, 638, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "start_response", "arg_names": [], "import_names": [], "rhs_call_name": "start_response", "annotation": ""}, "snippet": "\t\tstart_response (\"200 Ok\", conn.headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_399:Expr_L53_C2", "label": "expression", "type": "expression", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_399:Try_L47_C1", "vector": [8, 2, 0.9138, 0.0172, 2, 0.99, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tyield data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_399:Expr_L55_C2", "label": "start_response()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_399:Try_L47_C1", "vector": [8, 2, 0.9483, 0.0172, 2, 0.99, 0.0, 638, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "start_response", "arg_names": [], "import_names": [], "rhs_call_name": "start_response", "annotation": ""}, "snippet": "\t\tstart_response(\"500 Internal Server Error\",[(\"Content-type\",\"text/html\")])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_399:Assign_L56_C2", "label": "file = StringIO()", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_399:Try_L47_C1", "vector": [14, 2, 0.9655, 0.0172, 2, 0.99, 0.3333, 107, 3, 0, 0, 0, 609, 10, 1], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": "\t\tfile = StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_399:Expr_L57_C2", "label": "handle()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_399:Try_L47_C1", "vector": [8, 2, 0.9828, 0.0172, 2, 0.99, 0.6667, 346, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "handle", "arg_names": [], "import_names": [], "rhs_call_name": "handle", "annotation": ""}, "snippet": "\t\tcgitb.Hook(file = file).handle()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_399:Expr_L58_C2", "label": "expression", "type": "expression", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_399:Try_L47_C1", "vector": [8, 2, 1.0, 0.0172, 2, 0.99, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tyield file.getvalue()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_399:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_399:Expr_L37_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_399:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_399:If_L38_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_399:If_L38_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_399:Assign_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_399:If_L38_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_399:If_L40_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_399:If_L40_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_399:Assign_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_399:If_L40_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_399:Expr_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_399:If_L40_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_399:Expr_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_399:If_L40_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_399:Expr_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_399:If_L40_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_399:Return_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_399:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_399:Try_L47_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_399:Try_L47_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_399:Assign_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_399:Try_L47_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_399:Expr_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_399:Try_L47_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_399:Expr_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_399:Try_L47_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_399:Expr_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_399:Try_L47_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_399:Assign_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_399:Try_L47_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_399:Expr_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_399:Try_L47_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_399:Expr_L58_C2"}] |
#!/usr/bin/env python
"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2010 Frederico Caldeira Knabben
== BEGIN LICENSE ==
Licensed under the terms of any of the following licenses at your
choice:
- GNU General Public License Version 2 or later (the "GPL")
http://www.gnu.org/licenses/gpl.html
- GNU Lesser General Public License Version 2.1 or later (the "LGPL")
http://www.gnu.org/licenses/lgpl.html
- Mozilla Public License Version 1.1 or later (the "MPL")
http://www.mozilla.org/MPL/MPL-1.1.html
== END LICENSE ==
Connector for Python (CGI and WSGI).
See config.py for configuration settings
"""
import os
from fckutil import *
from fckcommands import * # default command's implementation
from fckoutput import * # base http, xml and html output mixins
from fckconnector import FCKeditorConnectorBase # import base connector
import config as Config
class FCKeditorConnector( FCKeditorConnectorBase,
GetFoldersCommandMixin,
GetFoldersAndFilesCommandMixin,
CreateFolderCommandMixin,
UploadFileCommandMixin,
BaseHttpMixin, BaseXmlMixin, BaseHtmlMixin ):
"The Standard connector class."
def doResponse(self):
"Main function. Process the request, set headers and return a string as response."
s = ""
# Check if this connector is disabled
if not(Config.Enabled):
return self.sendError(1, "This connector is disabled. Please check the connector configurations in \"editor/filemanager/connectors/py/config.py\" and try again.")
# Make sure we have valid inputs
for key in ("Command","Type","CurrentFolder"):
if not self.request.has_key (key):
return
# Get command, resource type and current folder
command = self.request.get("Command")
resourceType = self.request.get("Type")
currentFolder = getCurrentFolder(self.request.get("CurrentFolder"))
# Check for invalid paths
if currentFolder is None:
if (command == "FileUpload"):
return self.sendUploadResults( errorNo = 102, customMsg = "" )
else:
return self.sendError(102, "")
# Check if it is an allowed command
if ( not command in Config.ConfigAllowedCommands ):
return self.sendError( 1, 'The %s command isn\'t allowed' % command )
if ( not resourceType in Config.ConfigAllowedTypes ):
return self.sendError( 1, 'Invalid type specified' )
# Setup paths
if command == "QuickUpload":
self.userFilesFolder = Config.QuickUploadAbsolutePath[resourceType]
self.webUserFilesFolder = Config.QuickUploadPath[resourceType]
else:
self.userFilesFolder = Config.FileTypesAbsolutePath[resourceType]
self.webUserFilesFolder = Config.FileTypesPath[resourceType]
if not self.userFilesFolder: # no absolute path given (dangerous...)
self.userFilesFolder = mapServerPath(self.environ,
self.webUserFilesFolder)
# Ensure that the directory exists.
if not os.path.exists(self.userFilesFolder):
try:
self.createServerFolder( self.userFilesFolder )
except:
return self.sendError(1, "This connector couldn\'t access to local user\'s files directories. Please check the UserFilesAbsolutePath in \"editor/filemanager/connectors/py/config.py\" and try again. ")
# File upload doesn't have to return XML, so intercept here
if (command == "FileUpload"):
return self.uploadFile(resourceType, currentFolder)
# Create Url
url = combinePaths( self.webUserFilesFolder, currentFolder )
# Begin XML
s += self.createXmlHeader(command, resourceType, currentFolder, url)
# Execute the command
selector = {"GetFolders": self.getFolders,
"GetFoldersAndFiles": self.getFoldersAndFiles,
"CreateFolder": self.createFolder,
}
s += selector[command](resourceType, currentFolder)
s += self.createXmlFooter()
return s
# Running from command line (plain old CGI)
if __name__ == '__main__':
try:
# Create a Connector Instance
conn = FCKeditorConnector()
data = conn.doResponse()
for header in conn.headers:
print '%s: %s' % header
print
print data
except:
print "Content-Type: text/plain"
print
import cgi
cgi.print_exception()
| ajibawa-2023/Python-Code-Large/train/row_401 | 43 | 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_401:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0127, 0.0127, 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_401:ImportFrom_L3_C0", "label": "from fckutil import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.038, 0.0127, 0, 0.66, 0.1667, 630, 0, 1, 0, 0, 630, 0, 0], "semantic": {"name": "fckutil", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fckutil import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:ImportFrom_L4_C0", "label": "from fckcommands import *", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0506, 0.0127, 0, 0.66, 0.3333, 66, 0, 1, 0, 0, 66, 0, 0], "semantic": {"name": "fckcommands", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fckcommands import * \t# default command's implementation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:ImportFrom_L5_C0", "label": "from fckoutput import *", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0633, 0.0127, 0, 0.66, 0.5, 314, 0, 1, 0, 0, 314, 0, 0], "semantic": {"name": "fckoutput", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fckoutput import * \t# base http, xml and html output mixins"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:ImportFrom_L6_C0", "label": "from fckconnector import FCKeditorConnectorBase", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0759, 0.0127, 0, 0.66, 0.6667, 725, 0, 1, 0, 0, 725, 0, 0], "semantic": {"name": "fckconnector", "arg_names": [], "import_names": ["FCKeditorConnectorBase"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fckconnector import FCKeditorConnectorBase # import base connector"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Import_L7_C0", "label": "config import Config", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0886, 0.0127, 0, 0.66, 0.8333, 308, 0, 1, 0, 0, 308, 0, 0], "semantic": {"name": "config", "arg_names": [], "import_names": ["Config"], "rhs_call_name": "", "annotation": ""}, "snippet": "import config as Config"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:ClassDef_L9_C0", "label": "FCKeditorConnector", "type": "class", "loc": [9, 78], "level": 0, "parent": null, "vector": [3, 0, 0.5506, 0.8861, 0, 0.66, 1.0, 439, 0, 1, 0, 0, 693, 0, 19], "semantic": {"name": "FCKeditorConnector", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FCKeditorConnector(\tFCKeditorConnectorBase,\n\t\t\t\t\t\t\tGetFoldersCommandMixin,\n\t\t\t\t\t\t\tGetFoldersAndFilesCommandMixin,\n\t\t\t\t\t\t\tCreateFolderCommandMixin,\n\t\t\t\t\t\t\tUploadFileCommandMixin,\n\t\t\t\t\t\t\tBaseHttpMixin, BaseXmlMixin, BaseHtmlMixin ):\n\t\"The Standard connector class.\"\n\tdef doResponse(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Expr_L15_C1", "label": "expression", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:ClassDef_L9_C0", "vector": [8, 1, 0.1899, 0.0127, 1, 0.08, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\"The Standard connector class.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "label": "doResponse", "type": "function", "loc": [16, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:ClassDef_L9_C0", "vector": [2, 1, 0.5949, 0.7975, 1, 0.08, 1.0, 492, 0, 1, 1, 0, 0, 0, 19], "semantic": {"name": "doResponse", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef doResponse(self):\n\t\t\"Main function. Process the request, set headers and return a string as response.\"\n\t\ts = \"\"\n\t\t# Check if this connector is disabled\n\t\tif not(Config.Enabled):\n\t\t\treturn self.sendError(1, \"This connector is disabled. Please check the connector configurations in \\\"editor/filemanager/connectors/py/config.py\\\" and try again.\")\n\t\t# Make sure we have valid inputs\n\t\tfor key in (\"Command\",\"Type\",\"CurrentFolder\"):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Expr_L17_C2", "label": "expression", "type": "expression", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "vector": [8, 2, 0.2152, 0.0127, 2, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"Main function. Process the request, set headers and return a string as response.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Assign_L18_C2", "label": "s =", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "vector": [14, 2, 0.2278, 0.0127, 2, 0.49, 0.0625, 553, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ts = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:If_L20_C2", "label": "if", "type": "if", "loc": [20, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "vector": [4, 2, 0.2595, 0.0253, 2, 0.49, 0.125, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif not(Config.Enabled):\n\t\t\treturn self.sendError(1, \"This connector is disabled. Please check the connector configurations in \\\"editor/filemanager/connectors/py/config.py\\\" and try again.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Return_L21_C3", "label": "return", "type": "return", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:If_L20_C2", "vector": [13, 3, 0.2658, 0.0127, 3, 0.44, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn self.sendError(1, \"This connector is disabled. Please check the connector configurations in \\\"editor/filemanager/connectors/py/config.py\\\" and try again.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:For_L23_C2", "label": "for key", "type": "for", "loc": [23, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "vector": [6, 2, 0.3038, 0.038, 2, 0.49, 0.1875, 230, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tfor key in (\"Command\",\"Type\",\"CurrentFolder\"):\n\t\t\tif not self.request.has_key (key):\n\t\t\t\treturn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:If_L24_C3", "label": "if", "type": "if", "loc": [24, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:For_L23_C2", "vector": [4, 3, 0.3101, 0.0253, 3, 0.71, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif not self.request.has_key (key):\n\t\t\t\treturn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Return_L25_C4", "label": "return", "type": "return", "loc": [25, 25], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:If_L24_C3", "vector": [13, 4, 0.3165, 0.0127, 4, 0.41, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\treturn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Assign_L27_C2", "label": "command = get()", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "vector": [14, 2, 0.3418, 0.0127, 2, 0.49, 0.25, 842, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "command", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": "\t\tcommand = self.request.get(\"Command\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Assign_L28_C2", "label": "resourceType = get()", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "vector": [14, 2, 0.3544, 0.0127, 2, 0.49, 0.3125, 551, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "resourceType", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": "\t\tresourceType = self.request.get(\"Type\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Assign_L29_C2", "label": "currentFolder = getCurrentFolder()", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "vector": [14, 2, 0.3671, 0.0127, 2, 0.49, 0.375, 885, 3, 1, 0, 0, 970, 10, 2], "semantic": {"name": "currentFolder", "arg_names": [], "import_names": [], "rhs_call_name": "getCurrentFolder", "annotation": ""}, "snippet": "\t\tcurrentFolder = getCurrentFolder(self.request.get(\"CurrentFolder\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:If_L31_C2", "label": "if", "type": "if", "loc": [31, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "vector": [4, 2, 0.4177, 0.0633, 2, 0.49, 0.4375, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif currentFolder is None:\n\t\t\tif (command == \"FileUpload\"):\n\t\t\t\treturn self.sendUploadResults( errorNo = 102, customMsg = \"\" )\n\t\t\telse:\n\t\t\t\treturn self.sendError(102, \"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:If_L32_C3", "label": "if", "type": "if", "loc": [32, 35], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:If_L31_C2", "vector": [4, 3, 0.4241, 0.0506, 3, 0.48, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif (command == \"FileUpload\"):\n\t\t\t\treturn self.sendUploadResults( errorNo = 102, customMsg = \"\" )\n\t\t\telse:\n\t\t\t\treturn self.sendError(102, \"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Return_L33_C4", "label": "return", "type": "return", "loc": [33, 33], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:If_L32_C3", "vector": [13, 4, 0.4177, 0.0127, 4, 0.61, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\treturn self.sendUploadResults( errorNo = 102, customMsg = \"\" )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Return_L35_C4", "label": "return", "type": "return", "loc": [35, 35], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:If_L32_C3", "vector": [13, 4, 0.443, 0.0127, 4, 0.61, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\treturn self.sendError(102, \"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:If_L38_C2", "label": "if", "type": "if", "loc": [38, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "vector": [4, 2, 0.4873, 0.0253, 2, 0.49, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif ( not command in Config.ConfigAllowedCommands ):\n\t\t\treturn self.sendError( 1, 'The %s command isn\\'t allowed' % command )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Return_L39_C3", "label": "return", "type": "return", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:If_L38_C2", "vector": [13, 3, 0.4937, 0.0127, 3, 0.46, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn self.sendError( 1, 'The %s command isn\\'t allowed' % command )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:If_L41_C2", "label": "if", "type": "if", "loc": [41, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "vector": [4, 2, 0.5253, 0.0253, 2, 0.49, 0.5625, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif ( not resourceType in Config.ConfigAllowedTypes ):\n\t\t\treturn self.sendError( 1, 'Invalid type specified' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Return_L42_C3", "label": "return", "type": "return", "loc": [42, 42], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:If_L41_C2", "vector": [13, 3, 0.5316, 0.0127, 3, 0.82, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn self.sendError( 1, 'Invalid type specified' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:If_L45_C2", "label": "if", "type": "if", "loc": [45, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "vector": [4, 2, 0.6013, 0.0759, 2, 0.49, 0.625, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif command == \"QuickUpload\":\n\t\t\tself.userFilesFolder = Config.QuickUploadAbsolutePath[resourceType]\n\t\t\tself.webUserFilesFolder = Config.QuickUploadPath[resourceType]\n\t\telse:\n\t\t\tself.userFilesFolder = Config.FileTypesAbsolutePath[resourceType]\n\t\t\tself.webUserFilesFolder = Config.FileTypesPath[resourceType]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Assign_L46_C3", "label": "self.userFilesFolder =", "type": "assigned_variable", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:If_L45_C2", "vector": [14, 3, 0.5823, 0.0127, 3, 0.37, 0.0, 308, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.userFilesFolder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tself.userFilesFolder = Config.QuickUploadAbsolutePath[resourceType]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Assign_L47_C3", "label": "self.webUserFilesFolder =", "type": "assigned_variable", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:If_L45_C2", "vector": [14, 3, 0.5949, 0.0127, 3, 0.37, 0.3333, 772, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.webUserFilesFolder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tself.webUserFilesFolder = Config.QuickUploadPath[resourceType]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Assign_L49_C3", "label": "self.userFilesFolder =", "type": "assigned_variable", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:If_L45_C2", "vector": [14, 3, 0.6203, 0.0127, 3, 0.37, 0.6667, 308, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.userFilesFolder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tself.userFilesFolder = Config.FileTypesAbsolutePath[resourceType]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Assign_L50_C3", "label": "self.webUserFilesFolder =", "type": "assigned_variable", "loc": [50, 50], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:If_L45_C2", "vector": [14, 3, 0.6329, 0.0127, 3, 0.37, 1.0, 772, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.webUserFilesFolder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tself.webUserFilesFolder = Config.FileTypesPath[resourceType]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:If_L52_C2", "label": "if", "type": "if", "loc": [52, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "vector": [4, 2, 0.6709, 0.038, 2, 0.49, 0.6875, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif not self.userFilesFolder: # no absolute path given (dangerous...)\n\t\t\tself.userFilesFolder = mapServerPath(self.environ,\n\t\t\t\t\t\t\t\t\tself.webUserFilesFolder)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Assign_L53_C3", "label": "self.userFilesFolder = mapServerPath()", "type": "assigned_variable", "loc": [53, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:If_L52_C2", "vector": [14, 3, 0.6772, 0.0253, 3, 0.39, 0.0, 308, 3, 2, 0, 0, 872, 10, 1], "semantic": {"name": "self.userFilesFolder", "arg_names": [], "import_names": [], "rhs_call_name": "mapServerPath", "annotation": ""}, "snippet": "\t\t\tself.userFilesFolder = mapServerPath(self.environ,\n\t\t\t\t\t\t\t\t\tself.webUserFilesFolder)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:If_L56_C2", "label": "if", "type": "if", "loc": [56, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "vector": [4, 2, 0.7342, 0.0633, 2, 0.49, 0.75, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif not os.path.exists(self.userFilesFolder):\n\t\t\ttry:\n\t\t\t\tself.createServerFolder( self.userFilesFolder )\n\t\t\texcept:\n\t\t\t\treturn self.sendError(1, \"This connector couldn\\'t access to local user\\'s files directories. Please check the UserFilesAbsolutePath in \\\"editor/filemanager/connectors/py/config.py\\\" and try again. \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Try_L57_C3", "label": "try", "type": "try", "loc": [57, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:If_L56_C2", "vector": [7, 3, 0.7405, 0.0506, 3, 0.27, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\ttry:\n\t\t\t\tself.createServerFolder( self.userFilesFolder )\n\t\t\texcept:\n\t\t\t\treturn self.sendError(1, \"This connector couldn\\'t access to local user\\'s files directories. Please check the UserFilesAbsolutePath in \\\"editor/filemanager/connectors/py/config.py\\\" and try again. \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Expr_L58_C4", "label": "createServerFolder()", "type": "expression", "loc": [58, 58], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:Try_L57_C3", "vector": [8, 4, 0.7342, 0.0127, 4, 0.6, 0.0, 611, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "createServerFolder", "arg_names": [], "import_names": [], "rhs_call_name": "createServerFolder", "annotation": ""}, "snippet": "\t\t\t\tself.createServerFolder( self.userFilesFolder )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Return_L60_C4", "label": "return", "type": "return", "loc": [60, 60], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:Try_L57_C3", "vector": [13, 4, 0.7595, 0.0127, 4, 0.6, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\treturn self.sendError(1, \"This connector couldn\\'t access to local user\\'s files directories. Please check the UserFilesAbsolutePath in \\\"editor/filemanager/connectors/py/config.py\\\" and try again. \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:If_L63_C2", "label": "if", "type": "if", "loc": [63, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "vector": [4, 2, 0.8038, 0.0253, 2, 0.49, 0.8125, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif (command == \"FileUpload\"):\n\t\t\treturn self.uploadFile(resourceType, currentFolder)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Return_L64_C3", "label": "return", "type": "return", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:If_L63_C2", "vector": [13, 3, 0.8101, 0.0127, 3, 0.19, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn self.uploadFile(resourceType, currentFolder)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Assign_L67_C2", "label": "url = combinePaths()", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "vector": [14, 2, 0.8481, 0.0127, 2, 0.49, 0.875, 789, 3, 2, 0, 0, 334, 10, 1], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "combinePaths", "annotation": ""}, "snippet": "\t\turl = combinePaths( self.webUserFilesFolder, currentFolder )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Assign_L72_C2", "label": "selector =", "type": "assigned_variable", "loc": [72, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "vector": [14, 2, 0.9304, 0.0506, 2, 0.49, 0.9375, 542, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "selector", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tselector = {\"GetFolders\": self.getFolders,\n\t\t\t\t\t\"GetFoldersAndFiles\": self.getFoldersAndFiles,\n\t\t\t\t\t\"CreateFolder\": self.createFolder,\n\t\t\t\t\t}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_401:Return_L78_C2", "label": "return", "type": "return", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "vector": [13, 2, 0.9873, 0.0127, 2, 0.49, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn s"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_401:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Expr_L15_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Expr_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_401:If_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:If_L20_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Return_L21_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_401:For_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:For_L23_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_401:If_L24_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:If_L24_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Return_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Assign_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Assign_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Assign_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_401:If_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:If_L31_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_401:If_L32_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:If_L32_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Return_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:If_L32_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Return_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_401:If_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:If_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Return_L39_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_401:If_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:If_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Return_L42_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_401:If_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:If_L45_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Assign_L46_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:If_L45_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Assign_L47_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:If_L45_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Assign_L49_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:If_L45_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Assign_L50_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_401:If_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:If_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Assign_L53_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_401:If_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:If_L56_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Try_L57_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:Try_L57_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:Try_L57_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Return_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_401:If_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:If_L63_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Return_L64_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Assign_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Assign_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_401:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_401:Return_L78_C2"}] |
#!/usr/bin/env python
"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2010 Frederico Caldeira Knabben
== BEGIN LICENSE ==
Licensed under the terms of any of the following licenses at your
choice:
- GNU General Public License Version 2 or later (the "GPL")
http://www.gnu.org/licenses/gpl.html
- GNU Lesser General Public License Version 2.1 or later (the "LGPL")
http://www.gnu.org/licenses/lgpl.html
- Mozilla Public License Version 1.1 or later (the "MPL")
http://www.mozilla.org/MPL/MPL-1.1.html
== END LICENSE ==
Connector for Python (CGI and WSGI).
"""
from time import gmtime, strftime
import string
def escape(text, replace=string.replace):
"""
Converts the special characters '<', '>', and '&'.
RFC 1866 specifies that these characters be represented
in HTML as < > and & respectively. In Python
1.5 we use the new string.replace() function for speed.
"""
text = replace(text, '&', '&') # must be done 1st
text = replace(text, '<', '<')
text = replace(text, '>', '>')
text = replace(text, '"', '"')
return text
def convertToXmlAttribute(value):
if (value is None):
value = ""
return escape(value)
class BaseHttpMixin(object):
def setHttpHeaders(self, content_type='text/xml'):
"Purpose: to prepare the headers for the xml to return"
# Prevent the browser from caching the result.
# Date in the past
self.setHeader('Expires','Mon, 26 Jul 1997 05:00:00 GMT')
# always modified
self.setHeader('Last-Modified',strftime("%a, %d %b %Y %H:%M:%S GMT", gmtime()))
# HTTP/1.1
self.setHeader('Cache-Control','no-store, no-cache, must-revalidate')
self.setHeader('Cache-Control','post-check=0, pre-check=0')
# HTTP/1.0
self.setHeader('Pragma','no-cache')
# Set the response format.
self.setHeader( 'Content-Type', content_type + '; charset=utf-8' )
return
class BaseXmlMixin(object):
def createXmlHeader(self, command, resourceType, currentFolder, url):
"Purpose: returns the xml header"
self.setHttpHeaders()
# Create the XML document header
s = """<?xml version="1.0" encoding="utf-8" ?>"""
# Create the main connector node
s += """<Connector command="%s" resourceType="%s">""" % (
command,
resourceType
)
# Add the current folder node
s += """<CurrentFolder path="%s" url="%s" />""" % (
convertToXmlAttribute(currentFolder),
convertToXmlAttribute(url),
)
return s
def createXmlFooter(self):
"Purpose: returns the xml footer"
return """</Connector>"""
def sendError(self, number, text):
"Purpose: in the event of an error, return an xml based error"
self.setHttpHeaders()
return ("""<?xml version="1.0" encoding="utf-8" ?>""" +
"""<Connector>""" +
self.sendErrorNode (number, text) +
"""</Connector>""" )
def sendErrorNode(self, number, text):
if number != 1:
return """<Error number="%s" />""" % (number)
else:
return """<Error number="%s" text="%s" />""" % (number, convertToXmlAttribute(text))
class BaseHtmlMixin(object):
def sendUploadResults( self, errorNo = 0, fileUrl = '', fileName = '', customMsg = '' ):
self.setHttpHeaders("text/html")
"This is the function that sends the results of the uploading process"
"Minified version of the document.domain automatic fix script (#1919)."
"The original script can be found at _dev/domain_fix_template.js"
return """<script type="text/javascript">
(function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();
window.parent.OnUploadCompleted(%(errorNumber)s,"%(fileUrl)s","%(fileName)s","%(customMsg)s");
</script>""" % {
'errorNumber': errorNo,
'fileUrl': fileUrl.replace ('"', '\\"'),
'fileName': fileName.replace ( '"', '\\"' ) ,
'customMsg': customMsg.replace ( '"', '\\"' ),
}
| ajibawa-2023/Python-Code-Large/train/row_404 | 48 | 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_404:Expr_L3_C0", "label": "expression", "type": "expression", "loc": [3, 25], "level": 0, "parent": null, "vector": [8, 0, 0.1176, 0.1933, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nFCKeditor - The text editor for Internet - http://www.fckeditor.net\nCopyright (C) 2003-2010 Frederico Caldeira Knabben\n\n== BEGIN LICENSE ==\n\nLicensed under the terms of any of the following licenses at your\nchoice:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:ImportFrom_L27_C0", "label": "from time import gmtime, strftime", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.2269, 0.0084, 0, 0.66, 0.1429, 654, 0, 2, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["gmtime", "strftime"], "rhs_call_name": "", "annotation": ""}, "snippet": "from time import gmtime, strftime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Import_L28_C0", "label": "string import string", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.2353, 0.0084, 0, 0.66, 0.2857, 890, 0, 1, 0, 0, 890, 0, 0], "semantic": {"name": "string", "arg_names": [], "import_names": ["string"], "rhs_call_name": "", "annotation": ""}, "snippet": "import string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L30_C0", "label": "escape", "type": "function", "loc": [30, 42], "level": 0, "parent": null, "vector": [2, 0, 0.3025, 0.1092, 0, 0.66, 0.4286, 494, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "escape", "arg_names": ["text", "replace"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def escape(text, replace=string.replace):\n\t\"\"\"\n\tConverts the special characters '<', '>', and '&'.\n\n\tRFC 1866 specifies that these characters be represented\n\tin HTML as < > and & respectively. In Python\n\t1.5 we use the new string.replace() function for speed.\n\t\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L31_C1", "label": "expression", "type": "expression", "loc": [31, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L30_C0", "vector": [8, 1, 0.2857, 0.0588, 1, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\"\"\"\n\tConverts the special characters '<', '>', and '&'.\n\n\tRFC 1866 specifies that these characters be represented\n\tin HTML as < > and & respectively. In Python\n\t1.5 we use the new string.replace() function for speed.\n\t\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Assign_L38_C1", "label": "text = replace()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L30_C0", "vector": [14, 1, 0.3193, 0.0084, 1, 0.44, 0.2, 439, 3, 3, 0, 0, 293, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": "\ttext = replace(text, '&', '&') # must be done 1st"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Assign_L39_C1", "label": "text = replace()", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L30_C0", "vector": [14, 1, 0.3277, 0.0084, 1, 0.44, 0.4, 439, 3, 3, 0, 0, 293, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": "\ttext = replace(text, '<', '<')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Assign_L40_C1", "label": "text = replace()", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L30_C0", "vector": [14, 1, 0.3361, 0.0084, 1, 0.44, 0.6, 439, 3, 3, 0, 0, 293, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": "\ttext = replace(text, '>', '>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Assign_L41_C1", "label": "text = replace()", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L30_C0", "vector": [14, 1, 0.3445, 0.0084, 1, 0.44, 0.8, 439, 3, 3, 0, 0, 293, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": "\ttext = replace(text, '\"', '"')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Return_L42_C1", "label": "return", "type": "return", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L30_C0", "vector": [13, 1, 0.3529, 0.0084, 1, 0.44, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L44_C0", "label": "convertToXmlAttribute", "type": "function", "loc": [44, 47], "level": 0, "parent": null, "vector": [2, 0, 0.3824, 0.0336, 0, 0.66, 0.5714, 746, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "convertToXmlAttribute", "arg_names": ["value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def convertToXmlAttribute(value):\n\tif (value is None):\n\t\tvalue = \"\"\n\treturn escape(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:If_L45_C1", "label": "if", "type": "if", "loc": [45, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L44_C0", "vector": [4, 1, 0.3824, 0.0168, 1, 0.08, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif (value is None):\n\t\tvalue = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Assign_L46_C2", "label": "value =", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:If_L45_C1", "vector": [14, 2, 0.3866, 0.0084, 2, 0.06, 0.0, 441, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tvalue = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Return_L47_C1", "label": "return", "type": "return", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L44_C0", "vector": [13, 1, 0.395, 0.0084, 1, 0.08, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn escape(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:ClassDef_L49_C0", "label": "BaseHttpMixin", "type": "class", "loc": [49, 65], "level": 0, "parent": null, "vector": [3, 0, 0.479, 0.1429, 0, 0.66, 0.7143, 519, 0, 1, 0, 0, 186, 0, 8], "semantic": {"name": "BaseHttpMixin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BaseHttpMixin(object):\n\tdef setHttpHeaders(self, content_type='text/xml'):\n\t\t\"Purpose: to prepare the headers for the xml to return\"\n\t\t# Prevent the browser from caching the result.\n\t\t# Date in the past\n\t\tself.setHeader('Expires','Mon, 26 Jul 1997 05:00:00 GMT')\n\t\t# always modified\n\t\tself.setHeader('Last-Modified',strftime(\"%a, %d %b %Y %H:%M:%S GMT\", gmtime()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L50_C1", "label": "setHttpHeaders", "type": "function", "loc": [50, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:ClassDef_L49_C0", "vector": [2, 1, 0.4832, 0.1345, 1, 0.16, 0.0, 32, 0, 2, 0, 0, 0, 0, 8], "semantic": {"name": "setHttpHeaders", "arg_names": ["self", "content_type"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef setHttpHeaders(self, content_type='text/xml'):\n\t\t\"Purpose: to prepare the headers for the xml to return\"\n\t\t# Prevent the browser from caching the result.\n\t\t# Date in the past\n\t\tself.setHeader('Expires','Mon, 26 Jul 1997 05:00:00 GMT')\n\t\t# always modified\n\t\tself.setHeader('Last-Modified',strftime(\"%a, %d %b %Y %H:%M:%S GMT\", gmtime()))\n\t\t# HTTP/1.1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L51_C2", "label": "expression", "type": "expression", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L50_C1", "vector": [8, 2, 0.4286, 0.0084, 2, 0.24, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"Purpose: to prepare the headers for the xml to return\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L54_C2", "label": "setHeader()", "type": "expression", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L50_C1", "vector": [8, 2, 0.4538, 0.0084, 2, 0.24, 0.1429, 623, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setHeader", "arg_names": [], "import_names": [], "rhs_call_name": "setHeader", "annotation": ""}, "snippet": "\t\tself.setHeader('Expires','Mon, 26 Jul 1997 05:00:00 GMT')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L56_C2", "label": "setHeader()", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L50_C1", "vector": [8, 2, 0.4706, 0.0084, 2, 0.24, 0.2857, 623, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "setHeader", "arg_names": [], "import_names": [], "rhs_call_name": "setHeader", "annotation": ""}, "snippet": "\t\tself.setHeader('Last-Modified',strftime(\"%a, %d %b %Y %H:%M:%S GMT\", gmtime()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L58_C2", "label": "setHeader()", "type": "expression", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L50_C1", "vector": [8, 2, 0.4874, 0.0084, 2, 0.24, 0.4286, 623, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setHeader", "arg_names": [], "import_names": [], "rhs_call_name": "setHeader", "annotation": ""}, "snippet": "\t\tself.setHeader('Cache-Control','no-store, no-cache, must-revalidate')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L59_C2", "label": "setHeader()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L50_C1", "vector": [8, 2, 0.4958, 0.0084, 2, 0.24, 0.5714, 623, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setHeader", "arg_names": [], "import_names": [], "rhs_call_name": "setHeader", "annotation": ""}, "snippet": "\t\tself.setHeader('Cache-Control','post-check=0, pre-check=0')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L61_C2", "label": "setHeader()", "type": "expression", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L50_C1", "vector": [8, 2, 0.5126, 0.0084, 2, 0.24, 0.7143, 623, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setHeader", "arg_names": [], "import_names": [], "rhs_call_name": "setHeader", "annotation": ""}, "snippet": "\t\tself.setHeader('Pragma','no-cache')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L64_C2", "label": "setHeader()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L50_C1", "vector": [8, 2, 0.5378, 0.0084, 2, 0.24, 0.8571, 623, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setHeader", "arg_names": [], "import_names": [], "rhs_call_name": "setHeader", "annotation": ""}, "snippet": "\t\tself.setHeader( 'Content-Type', content_type + '; charset=utf-8' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Return_L65_C2", "label": "return", "type": "return", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L50_C1", "vector": [13, 2, 0.5462, 0.0084, 2, 0.24, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:ClassDef_L67_C0", "label": "BaseXmlMixin", "type": "class", "loc": [67, 101], "level": 0, "parent": null, "vector": [3, 0, 0.7059, 0.2941, 0, 0.66, 0.8571, 52, 0, 4, 0, 0, 186, 0, 6], "semantic": {"name": "BaseXmlMixin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BaseXmlMixin(object):\n\tdef createXmlHeader(self, command, resourceType, currentFolder, url):\n\t\t\"Purpose: returns the xml header\"\n\t\tself.setHttpHeaders()\n\t\t# Create the XML document header\n\t\ts = \"\"\"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\"\"\"\n\t\t# Create the main connector node\n\t\ts += \"\"\"<Connector command=\"%s\" resourceType=\"%s\">\"\"\" % ("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L68_C1", "label": "createXmlHeader", "type": "function", "loc": [68, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:ClassDef_L67_C0", "vector": [2, 1, 0.6345, 0.1345, 1, 0.98, 0.0, 310, 0, 5, 1, 0, 0, 0, 3], "semantic": {"name": "createXmlHeader", "arg_names": ["self", "command", "resourceType", "currentFolder", "url"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef createXmlHeader(self, command, resourceType, currentFolder, url):\n\t\t\"Purpose: returns the xml header\"\n\t\tself.setHttpHeaders()\n\t\t# Create the XML document header\n\t\ts = \"\"\"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\"\"\"\n\t\t# Create the main connector node\n\t\ts += \"\"\"<Connector command=\"%s\" resourceType=\"%s\">\"\"\" % (\n\t\t\t\tcommand,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L69_C2", "label": "expression", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L68_C1", "vector": [8, 2, 0.5798, 0.0084, 2, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"Purpose: returns the xml header\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L70_C2", "label": "setHttpHeaders()", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L68_C1", "vector": [8, 2, 0.5882, 0.0084, 2, 0.4, 0.3333, 32, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "setHttpHeaders", "arg_names": [], "import_names": [], "rhs_call_name": "setHttpHeaders", "annotation": ""}, "snippet": "\t\tself.setHttpHeaders()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Assign_L72_C2", "label": "s =", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L68_C1", "vector": [14, 2, 0.605, 0.0084, 2, 0.4, 0.6667, 553, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ts = \"\"\"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Return_L83_C2", "label": "return", "type": "return", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L68_C1", "vector": [13, 2, 0.6975, 0.0084, 2, 0.4, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn s"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L85_C1", "label": "createXmlFooter", "type": "function", "loc": [85, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:ClassDef_L67_C0", "vector": [2, 1, 0.7227, 0.0252, 1, 0.98, 0.3333, 453, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "createXmlFooter", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef createXmlFooter(self):\n\t\t\"Purpose: returns the xml footer\"\n\t\treturn \"\"\"</Connector>\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L86_C2", "label": "expression", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L85_C1", "vector": [8, 2, 0.7227, 0.0084, 2, 0.99, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"Purpose: returns the xml footer\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Return_L87_C2", "label": "return", "type": "return", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L85_C1", "vector": [13, 2, 0.7311, 0.0084, 2, 0.99, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn \"\"\"</Connector>\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L89_C1", "label": "sendError", "type": "function", "loc": [89, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:ClassDef_L67_C0", "vector": [2, 1, 0.7731, 0.0588, 1, 0.98, 0.6667, 543, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "sendError", "arg_names": ["self", "number", "text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef sendError(self, number, text):\n\t\t\"Purpose: in the event of an error, return an xml based error\"\n\t\tself.setHttpHeaders()\n\t\treturn (\"\"\"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\"\"\" +\n\t\t\t\t\"\"\"<Connector>\"\"\" +\n\t\t\t\tself.sendErrorNode (number, text) +\n\t\t\t\t\"\"\"</Connector>\"\"\" )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L90_C2", "label": "expression", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L89_C1", "vector": [8, 2, 0.7563, 0.0084, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"Purpose: in the event of an error, return an xml based error\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L91_C2", "label": "setHttpHeaders()", "type": "expression", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L89_C1", "vector": [8, 2, 0.7647, 0.0084, 2, 0.88, 0.5, 32, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "setHttpHeaders", "arg_names": [], "import_names": [], "rhs_call_name": "setHttpHeaders", "annotation": ""}, "snippet": "\t\tself.setHttpHeaders()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Return_L92_C2", "label": "return", "type": "return", "loc": [92, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L89_C1", "vector": [13, 2, 0.7857, 0.0336, 2, 0.88, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn (\"\"\"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\"\"\" +\n\t\t\t\t\"\"\"<Connector>\"\"\" +\n\t\t\t\tself.sendErrorNode (number, text) +\n\t\t\t\t\"\"\"</Connector>\"\"\" )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L97_C1", "label": "sendErrorNode", "type": "function", "loc": [97, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:ClassDef_L67_C0", "vector": [2, 1, 0.8319, 0.042, 1, 0.98, 1.0, 516, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "sendErrorNode", "arg_names": ["self", "number", "text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef sendErrorNode(self, number, text):\n\t\tif number != 1:\n\t\t\treturn \"\"\"<Error number=\"%s\" />\"\"\" % (number)\n\t\telse:\n\t\t\treturn \"\"\"<Error number=\"%s\" text=\"%s\" />\"\"\" % (number, convertToXmlAttribute(text))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:If_L98_C2", "label": "if", "type": "if", "loc": [98, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L97_C1", "vector": [4, 2, 0.8361, 0.0336, 2, 0.32, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif number != 1:\n\t\t\treturn \"\"\"<Error number=\"%s\" />\"\"\" % (number)\n\t\telse:\n\t\t\treturn \"\"\"<Error number=\"%s\" text=\"%s\" />\"\"\" % (number, convertToXmlAttribute(text))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Return_L99_C3", "label": "return", "type": "return", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:If_L98_C2", "vector": [13, 3, 0.8319, 0.0084, 3, 0.91, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn \"\"\"<Error number=\"%s\" />\"\"\" % (number)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Return_L101_C3", "label": "return", "type": "return", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:If_L98_C2", "vector": [13, 3, 0.8487, 0.0084, 3, 0.91, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn \"\"\"<Error number=\"%s\" text=\"%s\" />\"\"\" % (number, convertToXmlAttribute(text))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:ClassDef_L103_C0", "label": "BaseHtmlMixin", "type": "class", "loc": [103, 119], "level": 0, "parent": null, "vector": [3, 0, 0.9328, 0.1429, 0, 0.66, 1.0, 166, 0, 1, 0, 0, 186, 0, 4], "semantic": {"name": "BaseHtmlMixin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BaseHtmlMixin(object):\n\tdef sendUploadResults( self, errorNo = 0, fileUrl = '', fileName = '', customMsg = '' ):\n\t\tself.setHttpHeaders(\"text/html\")\n\t\t\"This is the function that sends the results of the uploading process\"\n\n\t\t\"Minified version of the document.domain automatic fix script (#1919).\"\n\t\t\"The original script can be found at _dev/domain_fix_template.js\"\n\t\treturn \"\"\"<script type=\"text/javascript\">"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L104_C1", "label": "sendUploadResults", "type": "function", "loc": [104, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:ClassDef_L103_C0", "vector": [2, 1, 0.937, 0.1345, 1, 0.91, 0.0, 110, 0, 5, 1, 0, 0, 0, 4], "semantic": {"name": "sendUploadResults", "arg_names": ["self", "errorNo", "fileUrl", "fileName", "customMsg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef sendUploadResults( self, errorNo = 0, fileUrl = '', fileName = '', customMsg = '' ):\n\t\tself.setHttpHeaders(\"text/html\")\n\t\t\"This is the function that sends the results of the uploading process\"\n\n\t\t\"Minified version of the document.domain automatic fix script (#1919).\"\n\t\t\"The original script can be found at _dev/domain_fix_template.js\"\n\t\treturn \"\"\"<script type=\"text/javascript\">\n\t\t\t(function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L105_C2", "label": "setHttpHeaders()", "type": "expression", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L104_C1", "vector": [8, 2, 0.8824, 0.0084, 2, 0.71, 0.0, 32, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setHttpHeaders", "arg_names": [], "import_names": [], "rhs_call_name": "setHttpHeaders", "annotation": ""}, "snippet": "\t\tself.setHttpHeaders(\"text/html\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L106_C2", "label": "expression", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L104_C1", "vector": [8, 2, 0.8908, 0.0084, 2, 0.71, 0.25, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"This is the function that sends the results of the uploading process\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L108_C2", "label": "expression", "type": "expression", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L104_C1", "vector": [8, 2, 0.9076, 0.0084, 2, 0.71, 0.5, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"Minified version of the document.domain automatic fix script (#1919).\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L109_C2", "label": "expression", "type": "expression", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L104_C1", "vector": [8, 2, 0.916, 0.0084, 2, 0.71, 0.75, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"The original script can be found at _dev/domain_fix_template.js\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_404:Return_L110_C2", "label": "return", "type": "return", "loc": [110, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L104_C1", "vector": [13, 2, 0.9622, 0.084, 2, 0.71, 1.0, 0, 4, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn \"\"\"<script type=\"text/javascript\">\n\t\t\t(function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();\n\n\t\t\twindow.parent.OnUploadCompleted(%(errorNumber)s,\"%(fileUrl)s\",\"%(fileName)s\",\"%(customMsg)s\");\n\t\t\t</script>\"\"\" % {\n\t\t\t'errorNumber': errorNo,\n\t\t\t'fileUrl': fileUrl.replace ('\"', '\\\\\"'),\n\t\t\t'fileName': fileName.replace ( '\"', '\\\\\"' ) ,"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L31_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Assign_L38_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Assign_L39_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Assign_L40_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Assign_L41_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Return_L42_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_404:If_L45_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:If_L45_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Assign_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Return_L47_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:ClassDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L50_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L50_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L50_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L50_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L50_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L50_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L50_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L50_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L50_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Return_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L68_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L68_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L68_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L68_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Assign_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L68_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Return_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L85_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L85_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L86_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L85_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Return_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L89_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L89_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L89_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L89_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Return_L92_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:ClassDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L97_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L97_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:If_L98_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:If_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Return_L99_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:If_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Return_L101_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:ClassDef_L103_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L104_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L104_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L105_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L104_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L106_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L104_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L108_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L104_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Expr_L109_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_404:FunctionDef_L104_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_404:Return_L110_C2"}] |
#!/usr/bin/env python
"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2010 Frederico Caldeira Knabben
== BEGIN LICENSE ==
Licensed under the terms of any of the following licenses at your
choice:
- GNU General Public License Version 2 or later (the "GPL")
http://www.gnu.org/licenses/gpl.html
- GNU Lesser General Public License Version 2.1 or later (the "LGPL")
http://www.gnu.org/licenses/lgpl.html
- Mozilla Public License Version 1.1 or later (the "MPL")
http://www.mozilla.org/MPL/MPL-1.1.html
== END LICENSE ==
Base Connector for Python (CGI and WSGI).
See config.py for configuration settings
"""
import cgi, os
from fckutil import *
from fckcommands import * # default command's implementation
from fckoutput import * # base http, xml and html output mixins
import config as Config
class FCKeditorConnectorBase( object ):
"The base connector class. Subclass it to extend functionality (see Zope example)"
def __init__(self, environ=None):
"Constructor: Here you should parse request fields, initialize variables, etc."
self.request = FCKeditorRequest(environ) # Parse request
self.headers = [] # Clean Headers
if environ:
self.environ = environ
else:
self.environ = os.environ
# local functions
def setHeader(self, key, value):
self.headers.append ((key, value))
return
class FCKeditorRequest(object):
"A wrapper around the request object"
def __init__(self, environ):
if environ: # WSGI
self.request = cgi.FieldStorage(fp=environ['wsgi.input'],
environ=environ,
keep_blank_values=1)
self.environ = environ
else: # plain old cgi
self.environ = os.environ
self.request = cgi.FieldStorage()
if 'REQUEST_METHOD' in self.environ and 'QUERY_STRING' in self.environ:
if self.environ['REQUEST_METHOD'].upper()=='POST':
# we are in a POST, but GET query_string exists
# cgi parses by default POST data, so parse GET QUERY_STRING too
self.get_request = cgi.FieldStorage(fp=None,
environ={
'REQUEST_METHOD':'GET',
'QUERY_STRING':self.environ['QUERY_STRING'],
},
)
else:
self.get_request={}
def has_key(self, key):
return self.request.has_key(key) or self.get_request.has_key(key)
def get(self, key, default=None):
if key in self.request.keys():
field = self.request[key]
elif key in self.get_request.keys():
field = self.get_request[key]
else:
return default
if hasattr(field,"filename") and field.filename: #file upload, do not convert return value
return field
else:
return field.value
| ajibawa-2023/Python-Code-Large/train/row_407 | 41 | 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_407:Expr_L3_C0", "label": "expression", "type": "expression", "loc": [3, 27], "level": 0, "parent": null, "vector": [8, 0, 0.1667, 0.2778, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nFCKeditor - The text editor for Internet - http://www.fckeditor.net\nCopyright (C) 2003-2010 Frederico Caldeira Knabben\n\n== BEGIN LICENSE ==\n\nLicensed under the terms of any of the following licenses at your\nchoice:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Import_L28_C0", "label": "cgi import cgi, os", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.3111, 0.0111, 0, 0.66, 0.1429, 934, 0, 2, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi", "os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cgi, os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:ImportFrom_L30_C0", "label": "from fckutil import *", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.0111, 0, 0.66, 0.2857, 630, 0, 1, 0, 0, 630, 0, 0], "semantic": {"name": "fckutil", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fckutil import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:ImportFrom_L31_C0", "label": "from fckcommands import *", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.3444, 0.0111, 0, 0.66, 0.4286, 66, 0, 1, 0, 0, 66, 0, 0], "semantic": {"name": "fckcommands", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fckcommands import * \t# default command's implementation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:ImportFrom_L32_C0", "label": "from fckoutput import *", "type": "import", "loc": [32, 32], "level": 0, "parent": null, "vector": [1, 0, 0.3556, 0.0111, 0, 0.66, 0.5714, 314, 0, 1, 0, 0, 314, 0, 0], "semantic": {"name": "fckoutput", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fckoutput import * \t# base http, xml and html output mixins"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Import_L33_C0", "label": "config import Config", "type": "import", "loc": [33, 33], "level": 0, "parent": null, "vector": [1, 0, 0.3667, 0.0111, 0, 0.66, 0.7143, 308, 0, 1, 0, 0, 308, 0, 0], "semantic": {"name": "config", "arg_names": [], "import_names": ["Config"], "rhs_call_name": "", "annotation": ""}, "snippet": "import config as Config"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:ClassDef_L35_C0", "label": "FCKeditorConnectorBase", "type": "class", "loc": [35, 51], "level": 0, "parent": null, "vector": [3, 0, 0.4778, 0.1889, 0, 0.66, 0.8571, 693, 0, 2, 0, 0, 186, 0, 2], "semantic": {"name": "FCKeditorConnectorBase", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FCKeditorConnectorBase( object ):\n\t\"The base connector class. Subclass it to extend functionality (see Zope example)\"\n\n\tdef __init__(self, environ=None):\n\t\t\"Constructor: Here you should parse request fields, initialize variables, etc.\"\n\t\tself.request = FCKeditorRequest(environ) # Parse request\n\t\tself.headers = []\t\t\t\t\t\t# Clean Headers\n\t\tif environ:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Expr_L36_C1", "label": "expression", "type": "expression", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:ClassDef_L35_C0", "vector": [8, 1, 0.4, 0.0111, 1, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\"The base connector class. Subclass it to extend functionality (see Zope example)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L38_C1", "label": "__init__", "type": "function", "loc": [38, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:ClassDef_L35_C0", "vector": [2, 1, 0.4611, 0.0889, 1, 0.85, 0.5, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "environ"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef __init__(self, environ=None):\n\t\t\"Constructor: Here you should parse request fields, initialize variables, etc.\"\n\t\tself.request = FCKeditorRequest(environ) # Parse request\n\t\tself.headers = []\t\t\t\t\t\t# Clean Headers\n\t\tif environ:\n\t\t\tself.environ = environ\n\t\telse:\n\t\t\tself.environ = os.environ"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Expr_L39_C2", "label": "expression", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L38_C1", "vector": [8, 2, 0.4333, 0.0111, 2, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"Constructor: Here you should parse request fields, initialize variables, etc.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L40_C2", "label": "self.request = FCKeditorRequest()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L38_C1", "vector": [14, 2, 0.4444, 0.0111, 2, 0.79, 0.3333, 952, 3, 1, 0, 0, 272, 10, 1], "semantic": {"name": "self.request", "arg_names": [], "import_names": [], "rhs_call_name": "FCKeditorRequest", "annotation": ""}, "snippet": "\t\tself.request = FCKeditorRequest(environ) # Parse request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L41_C2", "label": "self.headers =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L38_C1", "vector": [14, 2, 0.4556, 0.0111, 2, 0.79, 0.6667, 131, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.headers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.headers = []\t\t\t\t\t\t# Clean Headers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:If_L42_C2", "label": "if", "type": "if", "loc": [42, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L38_C1", "vector": [4, 2, 0.4833, 0.0444, 2, 0.79, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif environ:\n\t\t\tself.environ = environ\n\t\telse:\n\t\t\tself.environ = os.environ"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L43_C3", "label": "self.environ =", "type": "assigned_variable", "loc": [43, 43], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:If_L42_C2", "vector": [14, 3, 0.4778, 0.0111, 3, 0.84, 0.0, 50, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.environ", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tself.environ = environ"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L45_C3", "label": "self.environ =", "type": "assigned_variable", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:If_L42_C2", "vector": [14, 3, 0.5, 0.0111, 3, 0.84, 1.0, 50, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.environ", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tself.environ = os.environ"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L49_C1", "label": "setHeader", "type": "function", "loc": [49, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:ClassDef_L35_C0", "vector": [2, 1, 0.5556, 0.0333, 1, 0.85, 1.0, 623, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setHeader", "arg_names": ["self", "key", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef setHeader(self, key, value):\n\t\tself.headers.append ((key, value))\n\t\treturn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Expr_L50_C2", "label": "append()", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L49_C1", "vector": [8, 2, 0.5556, 0.0111, 2, 0.04, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\t\tself.headers.append ((key, value))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Return_L51_C2", "label": "return", "type": "return", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L49_C1", "vector": [13, 2, 0.5667, 0.0111, 2, 0.04, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:ClassDef_L53_C0", "label": "FCKeditorRequest", "type": "class", "loc": [53, 90], "level": 0, "parent": null, "vector": [3, 0, 0.7944, 0.4222, 0, 0.66, 1.0, 272, 0, 3, 0, 0, 186, 0, 9], "semantic": {"name": "FCKeditorRequest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FCKeditorRequest(object):\n\t\"A wrapper around the request object\"\n\tdef __init__(self, environ):\n\t\tif environ: # WSGI\n\t\t\tself.request = cgi.FieldStorage(fp=environ['wsgi.input'],\n\t\t\t\t\t\t\tenviron=environ,\n\t\t\t\t\t\t\tkeep_blank_values=1)\n\t\t\tself.environ = environ"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Expr_L54_C1", "label": "expression", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:ClassDef_L53_C0", "vector": [8, 1, 0.6, 0.0111, 1, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\"A wrapper around the request object\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L55_C1", "label": "__init__", "type": "function", "loc": [55, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:ClassDef_L53_C0", "vector": [2, 1, 0.7222, 0.2333, 1, 0.81, 0.3333, 555, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "environ"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef __init__(self, environ):\n\t\tif environ: # WSGI\n\t\t\tself.request = cgi.FieldStorage(fp=environ['wsgi.input'],\n\t\t\t\t\t\t\tenviron=environ,\n\t\t\t\t\t\t\tkeep_blank_values=1)\n\t\t\tself.environ = environ\n\t\telse: # plain old cgi\n\t\t\tself.environ = os.environ"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:If_L56_C2", "label": "if", "type": "if", "loc": [56, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L55_C1", "vector": [4, 2, 0.6611, 0.0889, 2, 0.01, 0.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif environ: # WSGI\n\t\t\tself.request = cgi.FieldStorage(fp=environ['wsgi.input'],\n\t\t\t\t\t\t\tenviron=environ,\n\t\t\t\t\t\t\tkeep_blank_values=1)\n\t\t\tself.environ = environ\n\t\telse: # plain old cgi\n\t\t\tself.environ = os.environ\n\t\t\tself.request = cgi.FieldStorage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L57_C3", "label": "self.request = FieldStorage()", "type": "assigned_variable", "loc": [57, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:If_L56_C2", "vector": [14, 3, 0.6444, 0.0333, 3, 0.46, 0.0, 952, 3, 3, 0, 0, 892, 10, 1], "semantic": {"name": "self.request", "arg_names": [], "import_names": [], "rhs_call_name": "FieldStorage", "annotation": ""}, "snippet": "\t\t\tself.request = cgi.FieldStorage(fp=environ['wsgi.input'],\n\t\t\t\t\t\t\tenviron=environ,\n\t\t\t\t\t\t\tkeep_blank_values=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L60_C3", "label": "self.environ =", "type": "assigned_variable", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:If_L56_C2", "vector": [14, 3, 0.6667, 0.0111, 3, 0.46, 0.3333, 50, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.environ", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tself.environ = environ"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L62_C3", "label": "self.environ =", "type": "assigned_variable", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:If_L56_C2", "vector": [14, 3, 0.6889, 0.0111, 3, 0.46, 0.6667, 50, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.environ", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tself.environ = os.environ"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L63_C3", "label": "self.request = FieldStorage()", "type": "assigned_variable", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:If_L56_C2", "vector": [14, 3, 0.7, 0.0111, 3, 0.46, 1.0, 952, 3, 0, 0, 0, 892, 10, 1], "semantic": {"name": "self.request", "arg_names": [], "import_names": [], "rhs_call_name": "FieldStorage", "annotation": ""}, "snippet": "\t\t\tself.request = cgi.FieldStorage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:If_L64_C2", "label": "if", "type": "if", "loc": [64, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L55_C1", "vector": [4, 2, 0.7722, 0.1333, 2, 0.01, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif 'REQUEST_METHOD' in self.environ and 'QUERY_STRING' in self.environ:\n\t\t\tif self.environ['REQUEST_METHOD'].upper()=='POST':\n\t\t\t\t# we are in a POST, but GET query_string exists\n\t\t\t\t# cgi parses by default POST data, so parse GET QUERY_STRING too\n\t\t\t\tself.get_request = cgi.FieldStorage(fp=None,\n\t\t\t\t\t\t\tenviron={\n\t\t\t\t\t\t\t'REQUEST_METHOD':'GET',\n\t\t\t\t\t\t\t'QUERY_STRING':self.environ['QUERY_STRING'],"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:If_L65_C3", "label": "if", "type": "if", "loc": [65, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:If_L64_C2", "vector": [4, 3, 0.7667, 0.1, 3, 0.77, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif self.environ['REQUEST_METHOD'].upper()=='POST':\n\t\t\t\t# we are in a POST, but GET query_string exists\n\t\t\t\t# cgi parses by default POST data, so parse GET QUERY_STRING too\n\t\t\t\tself.get_request = cgi.FieldStorage(fp=None,\n\t\t\t\t\t\t\tenviron={\n\t\t\t\t\t\t\t'REQUEST_METHOD':'GET',\n\t\t\t\t\t\t\t'QUERY_STRING':self.environ['QUERY_STRING'],\n\t\t\t\t\t\t\t},"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L68_C4", "label": "self.get_request = FieldStorage()", "type": "assigned_variable", "loc": [68, 73], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:If_L65_C3", "vector": [14, 4, 0.7833, 0.0667, 4, 0.01, 0.0, 565, 3, 2, 0, 0, 892, 10, 1], "semantic": {"name": "self.get_request", "arg_names": [], "import_names": [], "rhs_call_name": "FieldStorage", "annotation": ""}, "snippet": "\t\t\t\tself.get_request = cgi.FieldStorage(fp=None,\n\t\t\t\t\t\t\tenviron={\n\t\t\t\t\t\t\t'REQUEST_METHOD':'GET',\n\t\t\t\t\t\t\t'QUERY_STRING':self.environ['QUERY_STRING'],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L75_C3", "label": "self.get_request =", "type": "assigned_variable", "loc": [75, 75], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:If_L64_C2", "vector": [14, 3, 0.8333, 0.0111, 3, 0.77, 1.0, 565, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.get_request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tself.get_request={}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L77_C1", "label": "has_key", "type": "function", "loc": [77, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:ClassDef_L53_C0", "vector": [2, 1, 0.8611, 0.0222, 1, 0.81, 0.6667, 882, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "has_key", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef has_key(self, key):\n\t\treturn self.request.has_key(key) or self.get_request.has_key(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Return_L78_C2", "label": "return", "type": "return", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L77_C1", "vector": [13, 2, 0.8667, 0.0111, 2, 0.68, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.request.has_key(key) or self.get_request.has_key(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L80_C1", "label": "get", "type": "function", "loc": [80, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:ClassDef_L53_C0", "vector": [2, 1, 0.9444, 0.1222, 1, 0.81, 1.0, 607, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "get", "arg_names": ["self", "key", "default"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef get(self, key, default=None):\n\t\tif key in self.request.keys():\n\t\t\tfield = self.request[key]\n\t\telif key in self.get_request.keys():\n\t\t\tfield = self.get_request[key]\n\t\telse:\n\t\t\treturn default\n\t\tif hasattr(field,\"filename\") and field.filename: #file upload, do not convert return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:If_L81_C2", "label": "if", "type": "if", "loc": [81, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L80_C1", "vector": [4, 2, 0.9278, 0.0667, 2, 0.64, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif key in self.request.keys():\n\t\t\tfield = self.request[key]\n\t\telif key in self.get_request.keys():\n\t\t\tfield = self.get_request[key]\n\t\telse:\n\t\t\treturn default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L82_C3", "label": "field =", "type": "assigned_variable", "loc": [82, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:If_L81_C2", "vector": [14, 3, 0.9111, 0.0111, 3, 0.98, 0.0, 480, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tfield = self.request[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:If_L83_C2", "label": "if", "type": "if", "loc": [83, 86], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:If_L81_C2", "vector": [4, 3, 0.9389, 0.0444, 3, 0.98, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif key in self.get_request.keys():\n\t\t\tfield = self.get_request[key]\n\t\telse:\n\t\t\treturn default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L84_C3", "label": "field =", "type": "assigned_variable", "loc": [84, 84], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:If_L83_C2", "vector": [14, 4, 0.9333, 0.0111, 4, 0.38, 0.0, 480, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tfield = self.get_request[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Return_L86_C3", "label": "return", "type": "return", "loc": [86, 86], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:If_L83_C2", "vector": [13, 4, 0.9556, 0.0111, 4, 0.38, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:If_L87_C2", "label": "if", "type": "if", "loc": [87, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L80_C1", "vector": [4, 2, 0.9833, 0.0444, 2, 0.64, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif hasattr(field,\"filename\") and field.filename: #file upload, do not convert return value\n\t\t\treturn field\n\t\telse:\n\t\t\treturn field.value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Return_L88_C3", "label": "return", "type": "return", "loc": [88, 88], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:If_L87_C2", "vector": [13, 3, 0.9778, 0.0111, 3, 0.07, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn field"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_407:Return_L90_C3", "label": "return", "type": "return", "loc": [90, 90], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_407:If_L87_C2", "vector": [13, 3, 1.0, 0.0111, 3, 0.07, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn field.value"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_407:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_407:Expr_L36_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L38_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L38_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_407:Expr_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L38_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L38_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L38_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_407:If_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:If_L42_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L43_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:If_L42_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L45_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L49_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L49_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_407:Expr_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L49_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_407:Return_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_407:Expr_L54_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L55_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L55_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_407:If_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:If_L56_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L57_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:If_L56_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L60_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:If_L56_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L62_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:If_L56_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L63_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L55_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_407:If_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:If_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_407:If_L65_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:If_L65_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:If_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L75_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L77_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L77_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_407:Return_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:ClassDef_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L80_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L80_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_407:If_L81_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:If_L81_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L82_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:If_L81_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_407:If_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_407:Assign_L84_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_407:Return_L86_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:FunctionDef_L80_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_407:If_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:If_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_407:Return_L88_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_407:If_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_407:Return_L90_C3"}] |
#!/usr/bin/env python
"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2010 Frederico Caldeira Knabben
== BEGIN LICENSE ==
Licensed under the terms of any of the following licenses at your
choice:
- GNU General Public License Version 2 or later (the "GPL")
http://www.gnu.org/licenses/gpl.html
- GNU Lesser General Public License Version 2.1 or later (the "LGPL")
http://www.gnu.org/licenses/lgpl.html
- Mozilla Public License Version 1.1 or later (the "MPL")
http://www.mozilla.org/MPL/MPL-1.1.html
== END LICENSE ==
Connector/QuickUpload for Python (WSGI wrapper).
See config.py for configuration settings
"""
from connector import FCKeditorConnector
from upload import FCKeditorQuickUpload
import cgitb
from cStringIO import StringIO
# Running from WSGI capable server (recomended)
def App(environ, start_response):
"WSGI entry point. Run the connector"
if environ['SCRIPT_NAME'].endswith("connector.py"):
conn = FCKeditorConnector(environ)
elif environ['SCRIPT_NAME'].endswith("upload.py"):
conn = FCKeditorQuickUpload(environ)
else:
start_response ("200 Ok", [('Content-Type','text/html')])
yield "Unknown page requested: "
yield environ['SCRIPT_NAME']
return
try:
# run the connector
data = conn.doResponse()
# Start WSGI response:
start_response ("200 Ok", conn.headers)
# Send response text
yield data
except:
start_response("500 Internal Server Error",[("Content-type","text/html")])
file = StringIO()
cgitb.Hook(file = file).handle()
yield file.getvalue()
| ajibawa-2023/Python-Code-Large/train/row_409 | 23 | 58 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_409:Expr_L3_C0", "label": "expression", "type": "expression", "loc": [3, 27], "level": 0, "parent": null, "vector": [8, 0, 0.2586, 0.431, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nFCKeditor - The text editor for Internet - http://www.fckeditor.net\nCopyright (C) 2003-2010 Frederico Caldeira Knabben\n\n== BEGIN LICENSE ==\n\nLicensed under the terms of any of the following licenses at your\nchoice:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_409:ImportFrom_L29_C0", "label": "from connector import FCKeditorConnector", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.0172, 0, 0.66, 0.2, 385, 0, 1, 0, 0, 385, 0, 0], "semantic": {"name": "connector", "arg_names": [], "import_names": ["FCKeditorConnector"], "rhs_call_name": "", "annotation": ""}, "snippet": "from connector import FCKeditorConnector"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_409:ImportFrom_L30_C0", "label": "from upload import FCKeditorQuickUpload", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.5172, 0.0172, 0, 0.66, 0.4, 920, 0, 1, 0, 0, 920, 0, 0], "semantic": {"name": "upload", "arg_names": [], "import_names": ["FCKeditorQuickUpload"], "rhs_call_name": "", "annotation": ""}, "snippet": "from upload import FCKeditorQuickUpload"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_409:Import_L32_C0", "label": "cgitb import cgitb", "type": "import", "loc": [32, 32], "level": 0, "parent": null, "vector": [1, 0, 0.5517, 0.0172, 0, 0.66, 0.6, 691, 0, 1, 0, 0, 691, 0, 0], "semantic": {"name": "cgitb", "arg_names": [], "import_names": ["cgitb"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cgitb"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_409:ImportFrom_L33_C0", "label": "from cStringIO import StringIO", "type": "import", "loc": [33, 33], "level": 0, "parent": null, "vector": [1, 0, 0.569, 0.0172, 0, 0.66, 0.8, 764, 0, 1, 0, 0, 764, 0, 0], "semantic": {"name": "cStringIO", "arg_names": [], "import_names": ["StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": "from cStringIO import StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_409:FunctionDef_L36_C0", "label": "App", "type": "function", "loc": [36, 58], "level": 0, "parent": null, "vector": [2, 0, 0.8103, 0.3966, 0, 0.66, 1.0, 789, 0, 2, 0, 0, 0, 0, 12], "semantic": {"name": "App", "arg_names": ["environ", "start_response"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def App(environ, start_response):\n\t\"WSGI entry point. Run the connector\"\n\tif environ['SCRIPT_NAME'].endswith(\"connector.py\"):\n\t\tconn = FCKeditorConnector(environ)\n\telif environ['SCRIPT_NAME'].endswith(\"upload.py\"):\n\t\tconn = FCKeditorQuickUpload(environ)\n\telse:\n\t\tstart_response (\"200 Ok\", [('Content-Type','text/html')])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_409:Expr_L37_C1", "label": "expression", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_409:FunctionDef_L36_C0", "vector": [8, 1, 0.6379, 0.0172, 1, 0.5, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\"WSGI entry point. Run the connector\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_409:If_L38_C1", "label": "if", "type": "if", "loc": [38, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_409:FunctionDef_L36_C0", "vector": [4, 1, 0.7241, 0.1552, 1, 0.5, 0.5, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif environ['SCRIPT_NAME'].endswith(\"connector.py\"):\n\t\tconn = FCKeditorConnector(environ)\n\telif environ['SCRIPT_NAME'].endswith(\"upload.py\"):\n\t\tconn = FCKeditorQuickUpload(environ)\n\telse:\n\t\tstart_response (\"200 Ok\", [('Content-Type','text/html')])\n\t\tyield \"Unknown page requested: \"\n\t\tyield environ['SCRIPT_NAME']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_409:Assign_L39_C2", "label": "conn = FCKeditorConnector()", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_409:If_L38_C1", "vector": [14, 2, 0.6724, 0.0172, 2, 0.42, 0.0, 345, 3, 1, 0, 0, 439, 10, 1], "semantic": {"name": "conn", "arg_names": [], "import_names": [], "rhs_call_name": "FCKeditorConnector", "annotation": ""}, "snippet": "\t\tconn = FCKeditorConnector(environ)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_409:If_L40_C1", "label": "if", "type": "if", "loc": [40, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_409:If_L38_C1", "vector": [4, 2, 0.7414, 0.1207, 2, 0.42, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\telif environ['SCRIPT_NAME'].endswith(\"upload.py\"):\n\t\tconn = FCKeditorQuickUpload(environ)\n\telse:\n\t\tstart_response (\"200 Ok\", [('Content-Type','text/html')])\n\t\tyield \"Unknown page requested: \"\n\t\tyield environ['SCRIPT_NAME']\n\t\treturn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_409:Assign_L41_C2", "label": "conn = FCKeditorQuickUpload()", "type": "assigned_variable", "loc": [41, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_409:If_L40_C1", "vector": [14, 3, 0.7069, 0.0172, 3, 0.92, 0.0, 345, 3, 1, 0, 0, 339, 10, 1], "semantic": {"name": "conn", "arg_names": [], "import_names": [], "rhs_call_name": "FCKeditorQuickUpload", "annotation": ""}, "snippet": "\t\tconn = FCKeditorQuickUpload(environ)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_409:Expr_L43_C2", "label": "start_response()", "type": "expression", "loc": [43, 43], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_409:If_L40_C1", "vector": [8, 3, 0.7414, 0.0172, 3, 0.92, 0.25, 638, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "start_response", "arg_names": [], "import_names": [], "rhs_call_name": "start_response", "annotation": ""}, "snippet": "\t\tstart_response (\"200 Ok\", [('Content-Type','text/html')])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_409:Expr_L44_C2", "label": "expression", "type": "expression", "loc": [44, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_409:If_L40_C1", "vector": [8, 3, 0.7586, 0.0172, 3, 0.92, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tyield \"Unknown page requested: \""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_409:Expr_L45_C2", "label": "expression", "type": "expression", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_409:If_L40_C1", "vector": [8, 3, 0.7759, 0.0172, 3, 0.92, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tyield environ['SCRIPT_NAME']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_409:Return_L46_C2", "label": "return", "type": "return", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_409:If_L40_C1", "vector": [13, 3, 0.7931, 0.0172, 3, 0.92, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_409:Try_L47_C1", "label": "try", "type": "try", "loc": [47, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_409:FunctionDef_L36_C0", "vector": [7, 1, 0.9052, 0.2069, 1, 0.5, 1.0, 0, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ttry:\n\t\t# run the connector\n\t\tdata = conn.doResponse()\n\t\t# Start WSGI response:\n\t\tstart_response (\"200 Ok\", conn.headers)\n\t\t# Send response text\n\t\tyield data\n\texcept:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_409:Assign_L49_C2", "label": "data = doResponse()", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_409:Try_L47_C1", "vector": [14, 2, 0.8448, 0.0172, 2, 0.89, 0.0, 929, 3, 0, 0, 0, 492, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "doResponse", "annotation": ""}, "snippet": "\t\tdata = conn.doResponse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_409:Expr_L51_C2", "label": "start_response()", "type": "expression", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_409:Try_L47_C1", "vector": [8, 2, 0.8793, 0.0172, 2, 0.89, 0.5, 638, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "start_response", "arg_names": [], "import_names": [], "rhs_call_name": "start_response", "annotation": ""}, "snippet": "\t\tstart_response (\"200 Ok\", conn.headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_409:Expr_L53_C2", "label": "expression", "type": "expression", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_409:Try_L47_C1", "vector": [8, 2, 0.9138, 0.0172, 2, 0.89, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tyield data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_409:Expr_L55_C2", "label": "start_response()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_409:Try_L47_C1", "vector": [8, 2, 0.9483, 0.0172, 2, 0.89, 0.0, 638, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "start_response", "arg_names": [], "import_names": [], "rhs_call_name": "start_response", "annotation": ""}, "snippet": "\t\tstart_response(\"500 Internal Server Error\",[(\"Content-type\",\"text/html\")])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_409:Assign_L56_C2", "label": "file = StringIO()", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_409:Try_L47_C1", "vector": [14, 2, 0.9655, 0.0172, 2, 0.89, 0.3333, 107, 3, 0, 0, 0, 609, 10, 1], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": "\t\tfile = StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_409:Expr_L57_C2", "label": "handle()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_409:Try_L47_C1", "vector": [8, 2, 0.9828, 0.0172, 2, 0.89, 0.6667, 346, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "handle", "arg_names": [], "import_names": [], "rhs_call_name": "handle", "annotation": ""}, "snippet": "\t\tcgitb.Hook(file = file).handle()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_409:Expr_L58_C2", "label": "expression", "type": "expression", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_409:Try_L47_C1", "vector": [8, 2, 1.0, 0.0172, 2, 0.89, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tyield file.getvalue()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_409:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_409:Expr_L37_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_409:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_409:If_L38_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_409:If_L38_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_409:Assign_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_409:If_L38_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_409:If_L40_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_409:If_L40_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_409:Assign_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_409:If_L40_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_409:Expr_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_409:If_L40_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_409:Expr_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_409:If_L40_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_409:Expr_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_409:If_L40_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_409:Return_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_409:FunctionDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_409:Try_L47_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_409:Try_L47_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_409:Assign_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_409:Try_L47_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_409:Expr_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_409:Try_L47_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_409:Expr_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_409:Try_L47_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_409:Expr_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_409:Try_L47_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_409:Assign_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_409:Try_L47_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_409:Expr_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_409:Try_L47_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_409:Expr_L58_C2"}] |
#!/usr/bin/env python
"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2010 Frederico Caldeira Knabben
== BEGIN LICENSE ==
Licensed under the terms of any of the following licenses at your
choice:
- GNU General Public License Version 2 or later (the "GPL")
http://www.gnu.org/licenses/gpl.html
- GNU Lesser General Public License Version 2.1 or later (the "LGPL")
http://www.gnu.org/licenses/lgpl.html
- Mozilla Public License Version 1.1 or later (the "MPL")
http://www.mozilla.org/MPL/MPL-1.1.html
== END LICENSE ==
Connector for Python (CGI and WSGI).
See config.py for configuration settings
"""
import os
from fckutil import *
from fckcommands import * # default command's implementation
from fckoutput import * # base http, xml and html output mixins
from fckconnector import FCKeditorConnectorBase # import base connector
import config as Config
class FCKeditorConnector( FCKeditorConnectorBase,
GetFoldersCommandMixin,
GetFoldersAndFilesCommandMixin,
CreateFolderCommandMixin,
UploadFileCommandMixin,
BaseHttpMixin, BaseXmlMixin, BaseHtmlMixin ):
"The Standard connector class."
def doResponse(self):
"Main function. Process the request, set headers and return a string as response."
s = ""
# Check if this connector is disabled
if not(Config.Enabled):
return self.sendError(1, "This connector is disabled. Please check the connector configurations in \"editor/filemanager/connectors/py/config.py\" and try again.")
# Make sure we have valid inputs
for key in ("Command","Type","CurrentFolder"):
if not self.request.has_key (key):
return
# Get command, resource type and current folder
command = self.request.get("Command")
resourceType = self.request.get("Type")
currentFolder = getCurrentFolder(self.request.get("CurrentFolder"))
# Check for invalid paths
if currentFolder is None:
if (command == "FileUpload"):
return self.sendUploadResults( errorNo = 102, customMsg = "" )
else:
return self.sendError(102, "")
# Check if it is an allowed command
if ( not command in Config.ConfigAllowedCommands ):
return self.sendError( 1, 'The %s command isn\'t allowed' % command )
if ( not resourceType in Config.ConfigAllowedTypes ):
return self.sendError( 1, 'Invalid type specified' )
# Setup paths
if command == "QuickUpload":
self.userFilesFolder = Config.QuickUploadAbsolutePath[resourceType]
self.webUserFilesFolder = Config.QuickUploadPath[resourceType]
else:
self.userFilesFolder = Config.FileTypesAbsolutePath[resourceType]
self.webUserFilesFolder = Config.FileTypesPath[resourceType]
if not self.userFilesFolder: # no absolute path given (dangerous...)
self.userFilesFolder = mapServerPath(self.environ,
self.webUserFilesFolder)
# Ensure that the directory exists.
if not os.path.exists(self.userFilesFolder):
try:
self.createServerFolder( self.userFilesFolder )
except:
return self.sendError(1, "This connector couldn\'t access to local user\'s files directories. Please check the UserFilesAbsolutePath in \"editor/filemanager/connectors/py/config.py\" and try again. ")
# File upload doesn't have to return XML, so intercept here
if (command == "FileUpload"):
return self.uploadFile(resourceType, currentFolder)
# Create Url
url = combinePaths( self.webUserFilesFolder, currentFolder )
# Begin XML
s += self.createXmlHeader(command, resourceType, currentFolder, url)
# Execute the command
selector = {"GetFolders": self.getFolders,
"GetFoldersAndFiles": self.getFoldersAndFiles,
"CreateFolder": self.createFolder,
}
s += selector[command](resourceType, currentFolder)
s += self.createXmlFooter()
return s
# Running from command line (plain old CGI)
if __name__ == '__main__':
try:
# Create a Connector Instance
conn = FCKeditorConnector()
data = conn.doResponse()
for header in conn.headers:
print '%s: %s' % header
print
print data
except:
print "Content-Type: text/plain"
print
import cgi
cgi.print_exception()
| ajibawa-2023/Python-Code-Large/train/row_410 | 43 | 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_410:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0127, 0.0127, 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_410:ImportFrom_L3_C0", "label": "from fckutil import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.038, 0.0127, 0, 0.66, 0.1667, 630, 0, 1, 0, 0, 630, 0, 0], "semantic": {"name": "fckutil", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fckutil import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:ImportFrom_L4_C0", "label": "from fckcommands import *", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0506, 0.0127, 0, 0.66, 0.3333, 66, 0, 1, 0, 0, 66, 0, 0], "semantic": {"name": "fckcommands", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fckcommands import * \t# default command's implementation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:ImportFrom_L5_C0", "label": "from fckoutput import *", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0633, 0.0127, 0, 0.66, 0.5, 314, 0, 1, 0, 0, 314, 0, 0], "semantic": {"name": "fckoutput", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fckoutput import * \t# base http, xml and html output mixins"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:ImportFrom_L6_C0", "label": "from fckconnector import FCKeditorConnectorBase", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0759, 0.0127, 0, 0.66, 0.6667, 725, 0, 1, 0, 0, 725, 0, 0], "semantic": {"name": "fckconnector", "arg_names": [], "import_names": ["FCKeditorConnectorBase"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fckconnector import FCKeditorConnectorBase # import base connector"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Import_L7_C0", "label": "config import Config", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0886, 0.0127, 0, 0.66, 0.8333, 308, 0, 1, 0, 0, 308, 0, 0], "semantic": {"name": "config", "arg_names": [], "import_names": ["Config"], "rhs_call_name": "", "annotation": ""}, "snippet": "import config as Config"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:ClassDef_L9_C0", "label": "FCKeditorConnector", "type": "class", "loc": [9, 78], "level": 0, "parent": null, "vector": [3, 0, 0.5506, 0.8861, 0, 0.66, 1.0, 439, 0, 1, 0, 0, 693, 0, 19], "semantic": {"name": "FCKeditorConnector", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FCKeditorConnector(\tFCKeditorConnectorBase,\n\t\t\t\t\t\t\tGetFoldersCommandMixin,\n\t\t\t\t\t\t\tGetFoldersAndFilesCommandMixin,\n\t\t\t\t\t\t\tCreateFolderCommandMixin,\n\t\t\t\t\t\t\tUploadFileCommandMixin,\n\t\t\t\t\t\t\tBaseHttpMixin, BaseXmlMixin, BaseHtmlMixin ):\n\t\"The Standard connector class.\"\n\tdef doResponse(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Expr_L15_C1", "label": "expression", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:ClassDef_L9_C0", "vector": [8, 1, 0.1899, 0.0127, 1, 0.52, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\"The Standard connector class.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "label": "doResponse", "type": "function", "loc": [16, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:ClassDef_L9_C0", "vector": [2, 1, 0.5949, 0.7975, 1, 0.52, 1.0, 492, 0, 1, 1, 0, 0, 0, 19], "semantic": {"name": "doResponse", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef doResponse(self):\n\t\t\"Main function. Process the request, set headers and return a string as response.\"\n\t\ts = \"\"\n\t\t# Check if this connector is disabled\n\t\tif not(Config.Enabled):\n\t\t\treturn self.sendError(1, \"This connector is disabled. Please check the connector configurations in \\\"editor/filemanager/connectors/py/config.py\\\" and try again.\")\n\t\t# Make sure we have valid inputs\n\t\tfor key in (\"Command\",\"Type\",\"CurrentFolder\"):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Expr_L17_C2", "label": "expression", "type": "expression", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "vector": [8, 2, 0.2152, 0.0127, 2, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"Main function. Process the request, set headers and return a string as response.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Assign_L18_C2", "label": "s =", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "vector": [14, 2, 0.2278, 0.0127, 2, 0.97, 0.0625, 553, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ts = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:If_L20_C2", "label": "if", "type": "if", "loc": [20, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "vector": [4, 2, 0.2595, 0.0253, 2, 0.97, 0.125, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif not(Config.Enabled):\n\t\t\treturn self.sendError(1, \"This connector is disabled. Please check the connector configurations in \\\"editor/filemanager/connectors/py/config.py\\\" and try again.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Return_L21_C3", "label": "return", "type": "return", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:If_L20_C2", "vector": [13, 3, 0.2658, 0.0127, 3, 0.11, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn self.sendError(1, \"This connector is disabled. Please check the connector configurations in \\\"editor/filemanager/connectors/py/config.py\\\" and try again.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:For_L23_C2", "label": "for key", "type": "for", "loc": [23, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "vector": [6, 2, 0.3038, 0.038, 2, 0.97, 0.1875, 230, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tfor key in (\"Command\",\"Type\",\"CurrentFolder\"):\n\t\t\tif not self.request.has_key (key):\n\t\t\t\treturn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:If_L24_C3", "label": "if", "type": "if", "loc": [24, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:For_L23_C2", "vector": [4, 3, 0.3101, 0.0253, 3, 0.22, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif not self.request.has_key (key):\n\t\t\t\treturn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Return_L25_C4", "label": "return", "type": "return", "loc": [25, 25], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:If_L24_C3", "vector": [13, 4, 0.3165, 0.0127, 4, 0.29, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\treturn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Assign_L27_C2", "label": "command = get()", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "vector": [14, 2, 0.3418, 0.0127, 2, 0.97, 0.25, 842, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "command", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": "\t\tcommand = self.request.get(\"Command\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Assign_L28_C2", "label": "resourceType = get()", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "vector": [14, 2, 0.3544, 0.0127, 2, 0.97, 0.3125, 551, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "resourceType", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": "\t\tresourceType = self.request.get(\"Type\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Assign_L29_C2", "label": "currentFolder = getCurrentFolder()", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "vector": [14, 2, 0.3671, 0.0127, 2, 0.97, 0.375, 885, 3, 1, 0, 0, 970, 10, 2], "semantic": {"name": "currentFolder", "arg_names": [], "import_names": [], "rhs_call_name": "getCurrentFolder", "annotation": ""}, "snippet": "\t\tcurrentFolder = getCurrentFolder(self.request.get(\"CurrentFolder\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:If_L31_C2", "label": "if", "type": "if", "loc": [31, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "vector": [4, 2, 0.4177, 0.0633, 2, 0.97, 0.4375, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif currentFolder is None:\n\t\t\tif (command == \"FileUpload\"):\n\t\t\t\treturn self.sendUploadResults( errorNo = 102, customMsg = \"\" )\n\t\t\telse:\n\t\t\t\treturn self.sendError(102, \"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:If_L32_C3", "label": "if", "type": "if", "loc": [32, 35], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:If_L31_C2", "vector": [4, 3, 0.4241, 0.0506, 3, 0.39, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif (command == \"FileUpload\"):\n\t\t\t\treturn self.sendUploadResults( errorNo = 102, customMsg = \"\" )\n\t\t\telse:\n\t\t\t\treturn self.sendError(102, \"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Return_L33_C4", "label": "return", "type": "return", "loc": [33, 33], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:If_L32_C3", "vector": [13, 4, 0.4177, 0.0127, 4, 0.65, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\treturn self.sendUploadResults( errorNo = 102, customMsg = \"\" )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Return_L35_C4", "label": "return", "type": "return", "loc": [35, 35], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:If_L32_C3", "vector": [13, 4, 0.443, 0.0127, 4, 0.65, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\treturn self.sendError(102, \"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:If_L38_C2", "label": "if", "type": "if", "loc": [38, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "vector": [4, 2, 0.4873, 0.0253, 2, 0.97, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif ( not command in Config.ConfigAllowedCommands ):\n\t\t\treturn self.sendError( 1, 'The %s command isn\\'t allowed' % command )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Return_L39_C3", "label": "return", "type": "return", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:If_L38_C2", "vector": [13, 3, 0.4937, 0.0127, 3, 0.34, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn self.sendError( 1, 'The %s command isn\\'t allowed' % command )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:If_L41_C2", "label": "if", "type": "if", "loc": [41, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "vector": [4, 2, 0.5253, 0.0253, 2, 0.97, 0.5625, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif ( not resourceType in Config.ConfigAllowedTypes ):\n\t\t\treturn self.sendError( 1, 'Invalid type specified' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Return_L42_C3", "label": "return", "type": "return", "loc": [42, 42], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:If_L41_C2", "vector": [13, 3, 0.5316, 0.0127, 3, 0.69, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn self.sendError( 1, 'Invalid type specified' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:If_L45_C2", "label": "if", "type": "if", "loc": [45, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "vector": [4, 2, 0.6013, 0.0759, 2, 0.97, 0.625, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif command == \"QuickUpload\":\n\t\t\tself.userFilesFolder = Config.QuickUploadAbsolutePath[resourceType]\n\t\t\tself.webUserFilesFolder = Config.QuickUploadPath[resourceType]\n\t\telse:\n\t\t\tself.userFilesFolder = Config.FileTypesAbsolutePath[resourceType]\n\t\t\tself.webUserFilesFolder = Config.FileTypesPath[resourceType]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Assign_L46_C3", "label": "self.userFilesFolder =", "type": "assigned_variable", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:If_L45_C2", "vector": [14, 3, 0.5823, 0.0127, 3, 0.73, 0.0, 308, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.userFilesFolder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tself.userFilesFolder = Config.QuickUploadAbsolutePath[resourceType]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Assign_L47_C3", "label": "self.webUserFilesFolder =", "type": "assigned_variable", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:If_L45_C2", "vector": [14, 3, 0.5949, 0.0127, 3, 0.73, 0.3333, 772, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.webUserFilesFolder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tself.webUserFilesFolder = Config.QuickUploadPath[resourceType]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Assign_L49_C3", "label": "self.userFilesFolder =", "type": "assigned_variable", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:If_L45_C2", "vector": [14, 3, 0.6203, 0.0127, 3, 0.73, 0.6667, 308, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.userFilesFolder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tself.userFilesFolder = Config.FileTypesAbsolutePath[resourceType]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Assign_L50_C3", "label": "self.webUserFilesFolder =", "type": "assigned_variable", "loc": [50, 50], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:If_L45_C2", "vector": [14, 3, 0.6329, 0.0127, 3, 0.73, 1.0, 772, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.webUserFilesFolder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tself.webUserFilesFolder = Config.FileTypesPath[resourceType]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:If_L52_C2", "label": "if", "type": "if", "loc": [52, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "vector": [4, 2, 0.6709, 0.038, 2, 0.97, 0.6875, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif not self.userFilesFolder: # no absolute path given (dangerous...)\n\t\t\tself.userFilesFolder = mapServerPath(self.environ,\n\t\t\t\t\t\t\t\t\tself.webUserFilesFolder)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Assign_L53_C3", "label": "self.userFilesFolder = mapServerPath()", "type": "assigned_variable", "loc": [53, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:If_L52_C2", "vector": [14, 3, 0.6772, 0.0253, 3, 0.69, 0.0, 308, 3, 2, 0, 0, 872, 10, 1], "semantic": {"name": "self.userFilesFolder", "arg_names": [], "import_names": [], "rhs_call_name": "mapServerPath", "annotation": ""}, "snippet": "\t\t\tself.userFilesFolder = mapServerPath(self.environ,\n\t\t\t\t\t\t\t\t\tself.webUserFilesFolder)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:If_L56_C2", "label": "if", "type": "if", "loc": [56, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "vector": [4, 2, 0.7342, 0.0633, 2, 0.97, 0.75, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif not os.path.exists(self.userFilesFolder):\n\t\t\ttry:\n\t\t\t\tself.createServerFolder( self.userFilesFolder )\n\t\t\texcept:\n\t\t\t\treturn self.sendError(1, \"This connector couldn\\'t access to local user\\'s files directories. Please check the UserFilesAbsolutePath in \\\"editor/filemanager/connectors/py/config.py\\\" and try again. \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Try_L57_C3", "label": "try", "type": "try", "loc": [57, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:If_L56_C2", "vector": [7, 3, 0.7405, 0.0506, 3, 0.06, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\ttry:\n\t\t\t\tself.createServerFolder( self.userFilesFolder )\n\t\t\texcept:\n\t\t\t\treturn self.sendError(1, \"This connector couldn\\'t access to local user\\'s files directories. Please check the UserFilesAbsolutePath in \\\"editor/filemanager/connectors/py/config.py\\\" and try again. \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Expr_L58_C4", "label": "createServerFolder()", "type": "expression", "loc": [58, 58], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:Try_L57_C3", "vector": [8, 4, 0.7342, 0.0127, 4, 0.86, 0.0, 611, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "createServerFolder", "arg_names": [], "import_names": [], "rhs_call_name": "createServerFolder", "annotation": ""}, "snippet": "\t\t\t\tself.createServerFolder( self.userFilesFolder )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Return_L60_C4", "label": "return", "type": "return", "loc": [60, 60], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:Try_L57_C3", "vector": [13, 4, 0.7595, 0.0127, 4, 0.86, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\treturn self.sendError(1, \"This connector couldn\\'t access to local user\\'s files directories. Please check the UserFilesAbsolutePath in \\\"editor/filemanager/connectors/py/config.py\\\" and try again. \")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:If_L63_C2", "label": "if", "type": "if", "loc": [63, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "vector": [4, 2, 0.8038, 0.0253, 2, 0.97, 0.8125, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif (command == \"FileUpload\"):\n\t\t\treturn self.uploadFile(resourceType, currentFolder)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Return_L64_C3", "label": "return", "type": "return", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:If_L63_C2", "vector": [13, 3, 0.8101, 0.0127, 3, 0.47, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn self.uploadFile(resourceType, currentFolder)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Assign_L67_C2", "label": "url = combinePaths()", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "vector": [14, 2, 0.8481, 0.0127, 2, 0.97, 0.875, 789, 3, 2, 0, 0, 334, 10, 1], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "combinePaths", "annotation": ""}, "snippet": "\t\turl = combinePaths( self.webUserFilesFolder, currentFolder )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Assign_L72_C2", "label": "selector =", "type": "assigned_variable", "loc": [72, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "vector": [14, 2, 0.9304, 0.0506, 2, 0.97, 0.9375, 542, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "selector", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tselector = {\"GetFolders\": self.getFolders,\n\t\t\t\t\t\"GetFoldersAndFiles\": self.getFoldersAndFiles,\n\t\t\t\t\t\"CreateFolder\": self.createFolder,\n\t\t\t\t\t}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_410:Return_L78_C2", "label": "return", "type": "return", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "vector": [13, 2, 0.9873, 0.0127, 2, 0.97, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn s"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_410:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Expr_L15_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Expr_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_410:If_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:If_L20_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Return_L21_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_410:For_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:For_L23_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_410:If_L24_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:If_L24_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Return_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Assign_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Assign_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Assign_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_410:If_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:If_L31_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_410:If_L32_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:If_L32_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Return_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:If_L32_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Return_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_410:If_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:If_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Return_L39_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_410:If_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:If_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Return_L42_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_410:If_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:If_L45_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Assign_L46_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:If_L45_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Assign_L47_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:If_L45_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Assign_L49_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:If_L45_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Assign_L50_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_410:If_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:If_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Assign_L53_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_410:If_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:If_L56_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Try_L57_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:Try_L57_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:Try_L57_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Return_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_410:If_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:If_L63_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Return_L64_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Assign_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Assign_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_410:FunctionDef_L16_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_410:Return_L78_C2"}] |
#!/usr/bin/env python
"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2010 Frederico Caldeira Knabben
== BEGIN LICENSE ==
Licensed under the terms of any of the following licenses at your
choice:
- GNU General Public License Version 2 or later (the "GPL")
http://www.gnu.org/licenses/gpl.html
- GNU Lesser General Public License Version 2.1 or later (the "LGPL")
http://www.gnu.org/licenses/lgpl.html
- Mozilla Public License Version 1.1 or later (the "MPL")
http://www.mozilla.org/MPL/MPL-1.1.html
== END LICENSE ==
This page lists the data posted by a form.
"""
import cgi
import os
# Tell the browser to render html
print "Content-Type: text/html"
print ""
try:
# Create a cgi object
form = cgi.FieldStorage()
except Exception, e:
print e
# Document header
print """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>FCKeditor - Samples - Posted Data</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<link href="../sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
"""
# This is the real work
print """
<h1>FCKeditor - Samples - Posted Data</h1>
This page lists all data posted by the form.
<hr>
<table border="1" cellspacing="0" id="outputSample">
<colgroup><col width="80"><col></colgroup>
<thead>
<tr>
<th>Field Name</th>
<th>Value</th>
</tr>
</thead>
"""
for key in form.keys():
try:
value = form[key].value
print """
<tr>
<th>%s</th>
<td><pre>%s</pre></td>
</tr>
""" % (cgi.escape(key), cgi.escape(value))
except Exception, e:
print e
print "</table>"
# For testing your environments
#print "<hr>"
#for key in os.environ.keys():
# print "%s: %s<br>" % (key, os.environ.get(key, ""))
#print "<hr>"
# Document footer
print """
</body>
</html>
"""
| ajibawa-2023/Python-Code-Large/train/row_412 | 2 | 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_412:Import_L1_C0", "label": "cgi import cgi", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.3333, 0, 0.66, 0.0, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_412:Import_L2_C0", "label": "os import os", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.6667, 0.3333, 0, 0.66, 1.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}] | [] |
#!/usr/bin/env python
"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2010 Frederico Caldeira Knabben
== BEGIN LICENSE ==
Licensed under the terms of any of the following licenses at your
choice:
- GNU General Public License Version 2 or later (the "GPL")
http://www.gnu.org/licenses/gpl.html
- GNU Lesser General Public License Version 2.1 or later (the "LGPL")
http://www.gnu.org/licenses/lgpl.html
- Mozilla Public License Version 1.1 or later (the "MPL")
http://www.mozilla.org/MPL/MPL-1.1.html
== END LICENSE ==
Sample page.
"""
import cgi
import os
# Ensure that the fckeditor.py is included in your classpath
import fckeditor
# Tell the browser to render html
print "Content-Type: text/html"
print ""
# Document header
print """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>FCKeditor - Sample</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<link href="../sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>FCKeditor - Python - Sample 1</h1>
This sample displays a normal HTML form with an FCKeditor with full features
enabled.
<hr>
<form action="sampleposteddata.py" method="post" target="_blank">
"""
# This is the real work
try:
sBasePath = os.environ.get("SCRIPT_NAME")
sBasePath = sBasePath[0:sBasePath.find("_samples")]
oFCKeditor = fckeditor.FCKeditor('FCKeditor1')
oFCKeditor.BasePath = sBasePath
oFCKeditor.Value = """<p>This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor</a>.</p>"""
print oFCKeditor.Create()
except Exception, e:
print e
print """
<br>
<input type="submit" value="Submit">
</form>
"""
# For testing your environments
#print "<hr>"
#for key in os.environ.keys():
# print "%s: %s<br>" % (key, os.environ.get(key, ""))
#print "<hr>"
# Document footer
print """
</body>
</html>
"""
| ajibawa-2023/Python-Code-Large/train/row_413 | 3 | 5 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_413:Import_L1_C0", "label": "cgi import cgi", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.2, 0, 0.66, 0.0, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_413:Import_L2_C0", "label": "os import os", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.4, 0.2, 0, 0.66, 0.5, 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_413:Import_L4_C0", "label": "fckeditor import fckeditor", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.8, 0.2, 0, 0.66, 1.0, 669, 0, 1, 0, 0, 669, 0, 0], "semantic": {"name": "fckeditor", "arg_names": [], "import_names": ["fckeditor"], "rhs_call_name": "", "annotation": ""}, "snippet": "import fckeditor"}] | [] |
#!/usr/bin/env python
"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2010 Frederico Caldeira Knabben
== BEGIN LICENSE ==
Licensed under the terms of any of the following licenses at your
choice:
- GNU General Public License Version 2 or later (the "GPL")
http://www.gnu.org/licenses/gpl.html
- GNU Lesser General Public License Version 2.1 or later (the "LGPL")
http://www.gnu.org/licenses/lgpl.html
- Mozilla Public License Version 1.1 or later (the "MPL")
http://www.mozilla.org/MPL/MPL-1.1.html
== END LICENSE ==
This page lists the data posted by a form.
"""
import cgi
import os
# Tell the browser to render html
print "Content-Type: text/html"
print ""
try:
# Create a cgi object
form = cgi.FieldStorage()
except Exception, e:
print e
# Document header
print """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>FCKeditor - Samples - Posted Data</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<link href="../sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
"""
# This is the real work
print """
<h1>FCKeditor - Samples - Posted Data</h1>
This page lists all data posted by the form.
<hr>
<table border="1" cellspacing="0" id="outputSample">
<colgroup><col width="80"><col></colgroup>
<thead>
<tr>
<th>Field Name</th>
<th>Value</th>
</tr>
</thead>
"""
for key in form.keys():
try:
value = form[key].value
print """
<tr>
<th>%s</th>
<td><pre>%s</pre></td>
</tr>
""" % (cgi.escape(key), cgi.escape(value))
except Exception, e:
print e
print "</table>"
# For testing your environments
#print "<hr>"
#for key in os.environ.keys():
# print "%s: %s<br>" % (key, os.environ.get(key, ""))
#print "<hr>"
# Document footer
print """
</body>
</html>
"""
| ajibawa-2023/Python-Code-Large/train/row_414 | 2 | 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_414:Import_L1_C0", "label": "cgi import cgi", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.3333, 0, 0.66, 0.0, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_414:Import_L2_C0", "label": "os import os", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.6667, 0.3333, 0, 0.66, 1.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}] | [] |
#!/usr/bin/env python
"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2010 Frederico Caldeira Knabben
== BEGIN LICENSE ==
Licensed under the terms of any of the following licenses at your
choice:
- GNU General Public License Version 2 or later (the "GPL")
http://www.gnu.org/licenses/gpl.html
- GNU Lesser General Public License Version 2.1 or later (the "LGPL")
http://www.gnu.org/licenses/lgpl.html
- Mozilla Public License Version 1.1 or later (the "MPL")
http://www.mozilla.org/MPL/MPL-1.1.html
== END LICENSE ==
Sample page.
"""
import cgi
import os
# Ensure that the fckeditor.py is included in your classpath
import fckeditor
# Tell the browser to render html
print "Content-Type: text/html"
print ""
# Document header
print """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>FCKeditor - Sample</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex, nofollow">
<link href="../sample.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>FCKeditor - Python - Sample 1</h1>
This sample displays a normal HTML form with an FCKeditor with full features
enabled.
<hr>
<form action="sampleposteddata.py" method="post" target="_blank">
"""
# This is the real work
try:
sBasePath = os.environ.get("SCRIPT_NAME")
sBasePath = sBasePath[0:sBasePath.find("_samples")]
oFCKeditor = fckeditor.FCKeditor('FCKeditor1')
oFCKeditor.BasePath = sBasePath
oFCKeditor.Value = """<p>This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor</a>.</p>"""
print oFCKeditor.Create()
except Exception, e:
print e
print """
<br>
<input type="submit" value="Submit">
</form>
"""
# For testing your environments
#print "<hr>"
#for key in os.environ.keys():
# print "%s: %s<br>" % (key, os.environ.get(key, ""))
#print "<hr>"
# Document footer
print """
</body>
</html>
"""
| ajibawa-2023/Python-Code-Large/train/row_415 | 3 | 5 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_415:Import_L1_C0", "label": "cgi import cgi", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.2, 0, 0.66, 0.0, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_415:Import_L2_C0", "label": "os import os", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.4, 0.2, 0, 0.66, 0.5, 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_415:Import_L4_C0", "label": "fckeditor import fckeditor", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.8, 0.2, 0, 0.66, 1.0, 669, 0, 1, 0, 0, 669, 0, 0], "semantic": {"name": "fckeditor", "arg_names": [], "import_names": ["fckeditor"], "rhs_call_name": "", "annotation": ""}, "snippet": "import fckeditor"}] | [] |
"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2010 Frederico Caldeira Knabben
== BEGIN LICENSE ==
Licensed under the terms of any of the following licenses at your
choice:
- GNU General Public License Version 2 or later (the "GPL")
http://www.gnu.org/licenses/gpl.html
- GNU Lesser General Public License Version 2.1 or later (the "LGPL")
http://www.gnu.org/licenses/lgpl.html
- Mozilla Public License Version 1.1 or later (the "MPL")
http://www.mozilla.org/MPL/MPL-1.1.html
== END LICENSE ==
This is the integration file for Python.
"""
import cgi
import os
import re
import string
def escape(text, replace=string.replace):
"""Converts the special characters '<', '>', and '&'.
RFC 1866 specifies that these characters be represented
in HTML as < > and & respectively. In Python
1.5 we use the new string.replace() function for speed.
"""
text = replace(text, '&', '&') # must be done 1st
text = replace(text, '<', '<')
text = replace(text, '>', '>')
text = replace(text, '"', '"')
text = replace(text, "'", ''')
return text
# The FCKeditor class
class FCKeditor(object):
def __init__(self, instanceName):
self.InstanceName = instanceName
self.BasePath = '/fckeditor/'
self.Width = '100%'
self.Height = '200'
self.ToolbarSet = 'Default'
self.Value = '';
self.Config = {}
def Create(self):
return self.CreateHtml()
def CreateHtml(self):
HtmlValue = escape(self.Value)
Html = ""
if (self.IsCompatible()):
File = "fckeditor.html"
Link = "%seditor/%s?InstanceName=%s" % (
self.BasePath,
File,
self.InstanceName
)
if (self.ToolbarSet is not None):
Link += "&Toolbar=%s" % self.ToolbarSet
# Render the linked hidden field
Html += "<input type=\"hidden\" id=\"%s\" name=\"%s\" value=\"%s\" style=\"display:none\" />" % (
self.InstanceName,
self.InstanceName,
HtmlValue
)
# Render the configurations hidden field
Html += "<input type=\"hidden\" id=\"%s___Config\" value=\"%s\" style=\"display:none\" />" % (
self.InstanceName,
self.GetConfigFieldString()
)
# Render the editor iframe
Html += "<iframe id=\"%s\__Frame\" src=\"%s\" width=\"%s\" height=\"%s\" frameborder=\"0\" scrolling=\"no\"></iframe>" % (
self.InstanceName,
Link,
self.Width,
self.Height
)
else:
if (self.Width.find("%%") < 0):
WidthCSS = "%spx" % self.Width
else:
WidthCSS = self.Width
if (self.Height.find("%%") < 0):
HeightCSS = "%spx" % self.Height
else:
HeightCSS = self.Height
Html += "<textarea name=\"%s\" rows=\"4\" cols=\"40\" style=\"width: %s; height: %s;\" wrap=\"virtual\">%s</textarea>" % (
self.InstanceName,
WidthCSS,
HeightCSS,
HtmlValue
)
return Html
def IsCompatible(self):
if (os.environ.has_key("HTTP_USER_AGENT")):
sAgent = os.environ.get("HTTP_USER_AGENT", "")
else:
sAgent = ""
if (sAgent.find("MSIE") >= 0) and (sAgent.find("mac") < 0) and (sAgent.find("Opera") < 0):
i = sAgent.find("MSIE")
iVersion = float(sAgent[i+5:i+5+3])
if (iVersion >= 5.5):
return True
return False
elif (sAgent.find("Gecko/") >= 0):
i = sAgent.find("Gecko/")
iVersion = int(sAgent[i+6:i+6+8])
if (iVersion >= 20030210):
return True
return False
elif (sAgent.find("Opera/") >= 0):
i = sAgent.find("Opera/")
iVersion = float(sAgent[i+6:i+6+4])
if (iVersion >= 9.5):
return True
return False
elif (sAgent.find("AppleWebKit/") >= 0):
p = re.compile('AppleWebKit\/(\d+)', re.IGNORECASE)
m = p.search(sAgent)
if (m.group(1) >= 522):
return True
return False
else:
return False
def GetConfigFieldString(self):
sParams = ""
bFirst = True
for sKey in self.Config.keys():
sValue = self.Config[sKey]
if (not bFirst):
sParams += "&"
else:
bFirst = False
if (sValue):
k = escape(sKey)
v = escape(sValue)
if (sValue == "true"):
sParams += "%s=true" % k
elif (sValue == "false"):
sParams += "%s=false" % k
else:
sParams += "%s=%s" % (k, v)
return sParams
| ajibawa-2023/Python-Code-Large/train/row_416 | 80 | 160 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_416:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 22], "level": 0, "parent": null, "vector": [8, 0, 0.0719, 0.1375, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nFCKeditor - The text editor for Internet - http://www.fckeditor.net\nCopyright (C) 2003-2010 Frederico Caldeira Knabben\n\n== BEGIN LICENSE ==\n\nLicensed under the terms of any of the following licenses at your\nchoice:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Import_L24_C0", "label": "cgi import cgi", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.15, 0.0063, 0, 0.66, 0.1667, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Import_L25_C0", "label": "os import os", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.1562, 0.0063, 0, 0.66, 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_416:Import_L26_C0", "label": "re import re", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.1625, 0.0063, 0, 0.66, 0.5, 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_416:Import_L27_C0", "label": "string import string", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.1688, 0.0063, 0, 0.66, 0.6667, 890, 0, 1, 0, 0, 890, 0, 0], "semantic": {"name": "string", "arg_names": [], "import_names": ["string"], "rhs_call_name": "", "annotation": ""}, "snippet": "import string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L29_C0", "label": "escape", "type": "function", "loc": [29, 41], "level": 0, "parent": null, "vector": [2, 0, 0.2188, 0.0813, 0, 0.66, 0.8333, 494, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "escape", "arg_names": ["text", "replace"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def escape(text, replace=string.replace):\n \"\"\"Converts the special characters '<', '>', and '&'.\n\n RFC 1866 specifies that these characters be represented\n in HTML as < > and & respectively. In Python\n 1.5 we use the new string.replace() function for speed.\n \"\"\"\n text = replace(text, '&', '&') # must be done 1st"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Expr_L30_C4", "label": "expression", "type": "expression", "loc": [30, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L29_C0", "vector": [8, 1, 0.2031, 0.0375, 1, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Converts the special characters '<', '>', and '&'.\n\n RFC 1866 specifies that these characters be represented\n in HTML as < > and & respectively. In Python\n 1.5 we use the new string.replace() function for speed.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L36_C4", "label": "text = replace()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L29_C0", "vector": [14, 1, 0.225, 0.0063, 1, 0.26, 0.1667, 439, 3, 3, 0, 0, 293, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " text = replace(text, '&', '&') # must be done 1st"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L37_C4", "label": "text = replace()", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L29_C0", "vector": [14, 1, 0.2313, 0.0063, 1, 0.26, 0.3333, 439, 3, 3, 0, 0, 293, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " text = replace(text, '<', '<')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L38_C4", "label": "text = replace()", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L29_C0", "vector": [14, 1, 0.2375, 0.0063, 1, 0.26, 0.5, 439, 3, 3, 0, 0, 293, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " text = replace(text, '>', '>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L39_C4", "label": "text = replace()", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L29_C0", "vector": [14, 1, 0.2437, 0.0063, 1, 0.26, 0.6667, 439, 3, 3, 0, 0, 293, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " text = replace(text, '\"', '"')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L40_C4", "label": "text = replace()", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L29_C0", "vector": [14, 1, 0.25, 0.0063, 1, 0.26, 0.8333, 439, 3, 3, 0, 0, 293, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " text = replace(text, \"'\", ''')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L41_C4", "label": "return", "type": "return", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L29_C0", "vector": [13, 1, 0.2562, 0.0063, 1, 0.26, 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_416:ClassDef_L44_C0", "label": "FCKeditor", "type": "class", "loc": [44, 160], "level": 0, "parent": null, "vector": [3, 0, 0.6375, 0.7312, 0, 0.66, 1.0, 443, 0, 5, 0, 0, 186, 0, 26], "semantic": {"name": "FCKeditor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FCKeditor(object):\n\tdef __init__(self, instanceName):\n\t\tself.InstanceName = instanceName\n\t\tself.BasePath = '/fckeditor/'\n\t\tself.Width = '100%'\n\t\tself.Height = '200'\n\t\tself.ToolbarSet = 'Default'\n\t\tself.Value = '';"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L45_C1", "label": "__init__", "type": "function", "loc": [45, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:ClassDef_L44_C0", "vector": [2, 1, 0.3063, 0.0563, 1, 0.21, 0.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "instanceName"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef __init__(self, instanceName):\n\t\tself.InstanceName = instanceName\n\t\tself.BasePath = '/fckeditor/'\n\t\tself.Width = '100%'\n\t\tself.Height = '200'\n\t\tself.ToolbarSet = 'Default'\n\t\tself.Value = '';\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L46_C2", "label": "self.InstanceName =", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L45_C1", "vector": [14, 2, 0.2875, 0.0063, 2, 0.88, 0.0, 169, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.InstanceName", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.InstanceName = instanceName"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L47_C2", "label": "self.BasePath =", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L45_C1", "vector": [14, 2, 0.2938, 0.0063, 2, 0.88, 0.1667, 43, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.BasePath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.BasePath = '/fckeditor/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L48_C2", "label": "self.Width =", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L45_C1", "vector": [14, 2, 0.3, 0.0063, 2, 0.88, 0.3333, 907, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.Width", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.Width = '100%'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L49_C2", "label": "self.Height =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L45_C1", "vector": [14, 2, 0.3063, 0.0063, 2, 0.88, 0.5, 660, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.Height", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.Height = '200'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L50_C2", "label": "self.ToolbarSet =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L45_C1", "vector": [14, 2, 0.3125, 0.0063, 2, 0.88, 0.6667, 964, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.ToolbarSet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.ToolbarSet = 'Default'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L51_C2", "label": "self.Value =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L45_C1", "vector": [14, 2, 0.3187, 0.0063, 2, 0.88, 0.8333, 946, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.Value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.Value = '';"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L53_C2", "label": "self.Config =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L45_C1", "vector": [14, 2, 0.3312, 0.0063, 2, 0.88, 1.0, 410, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.Config", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.Config = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L55_C1", "label": "Create", "type": "function", "loc": [55, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:ClassDef_L44_C0", "vector": [2, 1, 0.3469, 0.0125, 1, 0.21, 0.25, 86, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "Create", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef Create(self):\n\t\treturn self.CreateHtml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L56_C2", "label": "return", "type": "return", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L55_C1", "vector": [13, 2, 0.35, 0.0063, 2, 0.35, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.CreateHtml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L58_C1", "label": "CreateHtml", "type": "function", "loc": [58, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:ClassDef_L44_C0", "vector": [2, 1, 0.5188, 0.3187, 1, 0.21, 0.5, 341, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "CreateHtml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef CreateHtml(self):\n\t\tHtmlValue = escape(self.Value)\n\t\tHtml = \"\"\n\n\t\tif (self.IsCompatible()):\n\t\t\tFile = \"fckeditor.html\"\n\t\t\tLink = \"%seditor/%s?InstanceName=%s\" % (\n\t\t\t\t\tself.BasePath,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L59_C2", "label": "HtmlValue = escape()", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L58_C1", "vector": [14, 2, 0.3688, 0.0063, 2, 0.74, 0.0, 247, 3, 1, 0, 0, 494, 10, 1], "semantic": {"name": "HtmlValue", "arg_names": [], "import_names": [], "rhs_call_name": "escape", "annotation": ""}, "snippet": "\t\tHtmlValue = escape(self.Value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L60_C2", "label": "Html =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L58_C1", "vector": [14, 2, 0.375, 0.0063, 2, 0.74, 0.3333, 800, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "Html", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tHtml = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:If_L62_C2", "label": "if", "type": "if", "loc": [62, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L58_C1", "vector": [4, 2, 0.5281, 0.2875, 2, 0.74, 0.6667, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif (self.IsCompatible()):\n\t\t\tFile = \"fckeditor.html\"\n\t\t\tLink = \"%seditor/%s?InstanceName=%s\" % (\n\t\t\t\t\tself.BasePath,\n\t\t\t\t\tFile,\n\t\t\t\t\tself.InstanceName\n\t\t\t\t\t)\n\t\t\tif (self.ToolbarSet is not None):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L63_C3", "label": "File =", "type": "assigned_variable", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L62_C2", "vector": [14, 3, 0.3937, 0.0063, 3, 0.68, 0.0, 491, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "File", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tFile = \"fckeditor.html\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L64_C3", "label": "Link =", "type": "assigned_variable", "loc": [64, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L62_C2", "vector": [14, 3, 0.4125, 0.0312, 3, 0.68, 0.25, 72, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Link", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tLink = \"%seditor/%s?InstanceName=%s\" % (\n\t\t\t\t\tself.BasePath,\n\t\t\t\t\tFile,\n\t\t\t\t\tself.InstanceName\n\t\t\t\t\t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:If_L69_C3", "label": "if", "type": "if", "loc": [69, 70], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L62_C2", "vector": [4, 3, 0.4344, 0.0125, 3, 0.68, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif (self.ToolbarSet is not None):\n\t\t\t\tLink += \"&Toolbar=%s\" % self.ToolbarSet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:If_L93_C3", "label": "if", "type": "if", "loc": [93, 96], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L62_C2", "vector": [4, 3, 0.5906, 0.025, 3, 0.68, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif (self.Width.find(\"%%\") < 0):\n\t\t\t\tWidthCSS = \"%spx\" % self.Width\n\t\t\telse:\n\t\t\t\tWidthCSS = self.Width"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L94_C4", "label": "WidthCSS =", "type": "assigned_variable", "loc": [94, 94], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L93_C3", "vector": [14, 4, 0.5875, 0.0063, 4, 0.88, 0.0, 445, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "WidthCSS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tWidthCSS = \"%spx\" % self.Width"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L96_C4", "label": "WidthCSS =", "type": "assigned_variable", "loc": [96, 96], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L93_C3", "vector": [14, 4, 0.6, 0.0063, 4, 0.88, 1.0, 445, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "WidthCSS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tWidthCSS = self.Width"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:If_L97_C3", "label": "if", "type": "if", "loc": [97, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L62_C2", "vector": [4, 3, 0.6156, 0.025, 3, 0.68, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif (self.Height.find(\"%%\") < 0):\n\t\t\t\tHeightCSS = \"%spx\" % self.Height\n\t\t\telse:\n\t\t\t\tHeightCSS = self.Height"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L98_C4", "label": "HeightCSS =", "type": "assigned_variable", "loc": [98, 98], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L97_C3", "vector": [14, 4, 0.6125, 0.0063, 4, 0.11, 0.0, 273, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "HeightCSS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tHeightCSS = \"%spx\" % self.Height"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L100_C4", "label": "HeightCSS =", "type": "assigned_variable", "loc": [100, 100], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L97_C3", "vector": [14, 4, 0.625, 0.0063, 4, 0.11, 1.0, 273, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "HeightCSS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tHeightCSS = self.Height"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L108_C2", "label": "return", "type": "return", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L58_C1", "vector": [13, 2, 0.675, 0.0063, 2, 0.74, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn Html"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L110_C1", "label": "IsCompatible", "type": "function", "loc": [110, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:ClassDef_L44_C0", "vector": [2, 1, 0.7812, 0.1938, 1, 0.21, 0.75, 587, 0, 1, 1, 0, 0, 0, 17], "semantic": {"name": "IsCompatible", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef IsCompatible(self):\n\t\tif (os.environ.has_key(\"HTTP_USER_AGENT\")):\n\t\t\tsAgent = os.environ.get(\"HTTP_USER_AGENT\", \"\")\n\t\telse:\n\t\t\tsAgent = \"\"\n\t\tif (sAgent.find(\"MSIE\") >= 0) and (sAgent.find(\"mac\") < 0) and (sAgent.find(\"Opera\") < 0):\n\t\t\ti = sAgent.find(\"MSIE\")\n\t\t\tiVersion = float(sAgent[i+5:i+5+3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:If_L111_C2", "label": "if", "type": "if", "loc": [111, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L110_C1", "vector": [4, 2, 0.7031, 0.025, 2, 0.09, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif (os.environ.has_key(\"HTTP_USER_AGENT\")):\n\t\t\tsAgent = os.environ.get(\"HTTP_USER_AGENT\", \"\")\n\t\telse:\n\t\t\tsAgent = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L112_C3", "label": "sAgent = get()", "type": "assigned_variable", "loc": [112, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L111_C2", "vector": [14, 3, 0.7, 0.0063, 3, 0.42, 0.0, 211, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "sAgent", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": "\t\t\tsAgent = os.environ.get(\"HTTP_USER_AGENT\", \"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L114_C3", "label": "sAgent =", "type": "assigned_variable", "loc": [114, 114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L111_C2", "vector": [14, 3, 0.7125, 0.0063, 3, 0.42, 1.0, 211, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sAgent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tsAgent = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:If_L115_C2", "label": "if", "type": "if", "loc": [115, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L110_C1", "vector": [4, 2, 0.7969, 0.1625, 2, 0.09, 1.0, 0, 0, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif (sAgent.find(\"MSIE\") >= 0) and (sAgent.find(\"mac\") < 0) and (sAgent.find(\"Opera\") < 0):\n\t\t\ti = sAgent.find(\"MSIE\")\n\t\t\tiVersion = float(sAgent[i+5:i+5+3])\n\t\t\tif (iVersion >= 5.5):\n\t\t\t\treturn True\n\t\t\treturn False\n\t\telif (sAgent.find(\"Gecko/\") >= 0):\n\t\t\ti = sAgent.find(\"Gecko/\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L116_C3", "label": "i = find()", "type": "assigned_variable", "loc": [116, 116], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L115_C2", "vector": [14, 3, 0.725, 0.0063, 3, 0.62, 0.0, 826, 3, 1, 0, 0, 340, 10, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "find", "annotation": ""}, "snippet": "\t\t\ti = sAgent.find(\"MSIE\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L117_C3", "label": "iVersion = float()", "type": "assigned_variable", "loc": [117, 117], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L115_C2", "vector": [14, 3, 0.7312, 0.0063, 3, 0.62, 0.25, 94, 3, 1, 0, 0, 639, 10, 1], "semantic": {"name": "iVersion", "arg_names": [], "import_names": [], "rhs_call_name": "float", "annotation": ""}, "snippet": "\t\t\tiVersion = float(sAgent[i+5:i+5+3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:If_L118_C3", "label": "if", "type": "if", "loc": [118, 119], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L115_C2", "vector": [4, 3, 0.7406, 0.0125, 3, 0.62, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif (iVersion >= 5.5):\n\t\t\t\treturn True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L119_C4", "label": "return", "type": "return", "loc": [119, 119], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L118_C3", "vector": [13, 4, 0.7438, 0.0063, 4, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\treturn True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L120_C3", "label": "return", "type": "return", "loc": [120, 120], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L115_C2", "vector": [13, 3, 0.75, 0.0063, 3, 0.62, 0.75, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:If_L121_C2", "label": "if", "type": "if", "loc": [121, 140], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L115_C2", "vector": [4, 3, 0.8156, 0.125, 3, 0.62, 1.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif (sAgent.find(\"Gecko/\") >= 0):\n\t\t\ti = sAgent.find(\"Gecko/\")\n\t\t\tiVersion = int(sAgent[i+6:i+6+8])\n\t\t\tif (iVersion >= 20030210):\n\t\t\t\treturn True\n\t\t\treturn False\n\t\telif (sAgent.find(\"Opera/\") >= 0):\n\t\t\ti = sAgent.find(\"Opera/\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L122_C3", "label": "i = find()", "type": "assigned_variable", "loc": [122, 122], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L121_C2", "vector": [14, 4, 0.7625, 0.0063, 4, 0.81, 0.0, 826, 3, 1, 0, 0, 340, 10, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "find", "annotation": ""}, "snippet": "\t\t\ti = sAgent.find(\"Gecko/\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L123_C3", "label": "iVersion = int()", "type": "assigned_variable", "loc": [123, 123], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L121_C2", "vector": [14, 4, 0.7688, 0.0063, 4, 0.81, 0.25, 94, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "iVersion", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": "\t\t\tiVersion = int(sAgent[i+6:i+6+8])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:If_L124_C3", "label": "if", "type": "if", "loc": [124, 125], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L121_C2", "vector": [4, 4, 0.7781, 0.0125, 4, 0.81, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif (iVersion >= 20030210):\n\t\t\t\treturn True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L125_C4", "label": "return", "type": "return", "loc": [125, 125], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L124_C3", "vector": [13, 5, 0.7812, 0.0063, 5, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\treturn True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L126_C3", "label": "return", "type": "return", "loc": [126, 126], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L121_C2", "vector": [13, 4, 0.7875, 0.0063, 4, 0.81, 0.75, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:If_L127_C2", "label": "if", "type": "if", "loc": [127, 140], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L121_C2", "vector": [4, 4, 0.8344, 0.0875, 4, 0.81, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif (sAgent.find(\"Opera/\") >= 0):\n\t\t\ti = sAgent.find(\"Opera/\")\n\t\t\tiVersion = float(sAgent[i+6:i+6+4])\n\t\t\tif (iVersion >= 9.5):\n\t\t\t\treturn True\n\t\t\treturn False\n\t\telif (sAgent.find(\"AppleWebKit/\") >= 0):\n\t\t\tp = re.compile('AppleWebKit\\/(\\d+)', re.IGNORECASE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L128_C3", "label": "i = find()", "type": "assigned_variable", "loc": [128, 128], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L127_C2", "vector": [14, 5, 0.8, 0.0063, 5, 0.34, 0.0, 826, 3, 1, 0, 0, 340, 10, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "find", "annotation": ""}, "snippet": "\t\t\ti = sAgent.find(\"Opera/\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L129_C3", "label": "iVersion = float()", "type": "assigned_variable", "loc": [129, 129], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L127_C2", "vector": [14, 5, 0.8063, 0.0063, 5, 0.34, 0.25, 94, 3, 1, 0, 0, 639, 10, 1], "semantic": {"name": "iVersion", "arg_names": [], "import_names": [], "rhs_call_name": "float", "annotation": ""}, "snippet": "\t\t\tiVersion = float(sAgent[i+6:i+6+4])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:If_L130_C3", "label": "if", "type": "if", "loc": [130, 131], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L127_C2", "vector": [4, 5, 0.8156, 0.0125, 5, 0.34, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif (iVersion >= 9.5):\n\t\t\t\treturn True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L131_C4", "label": "return", "type": "return", "loc": [131, 131], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L130_C3", "vector": [13, 6, 0.8187, 0.0063, 6, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\treturn True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L132_C3", "label": "return", "type": "return", "loc": [132, 132], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L127_C2", "vector": [13, 5, 0.825, 0.0063, 5, 0.34, 0.75, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:If_L133_C2", "label": "if", "type": "if", "loc": [133, 140], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L127_C2", "vector": [4, 5, 0.8531, 0.05, 5, 0.34, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif (sAgent.find(\"AppleWebKit/\") >= 0):\n\t\t\tp = re.compile('AppleWebKit\\/(\\d+)', re.IGNORECASE)\n\t\t\tm = p.search(sAgent)\n\t\t\tif (m.group(1) >= 522):\n\t\t\t\treturn True\n\t\t\treturn False\n\t\telse:\n\t\t\treturn False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L134_C3", "label": "p = compile()", "type": "assigned_variable", "loc": [134, 134], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L133_C2", "vector": [14, 6, 0.8375, 0.0063, 6, 0.47, 0.0, 491, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "\t\t\tp = re.compile('AppleWebKit\\/(\\d+)', re.IGNORECASE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L135_C3", "label": "m = search()", "type": "assigned_variable", "loc": [135, 135], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L133_C2", "vector": [14, 6, 0.8438, 0.0063, 6, 0.47, 0.25, 711, 3, 1, 0, 0, 163, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "search", "annotation": ""}, "snippet": "\t\t\tm = p.search(sAgent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:If_L136_C3", "label": "if", "type": "if", "loc": [136, 137], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L133_C2", "vector": [4, 6, 0.8531, 0.0125, 6, 0.47, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif (m.group(1) >= 522):\n\t\t\t\treturn True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L137_C4", "label": "return", "type": "return", "loc": [137, 137], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L136_C3", "vector": [13, 7, 0.8562, 0.0063, 7, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\treturn True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L138_C3", "label": "return", "type": "return", "loc": [138, 138], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L133_C2", "vector": [13, 6, 0.8625, 0.0063, 6, 0.47, 0.75, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L140_C3", "label": "return", "type": "return", "loc": [140, 140], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L133_C2", "vector": [13, 6, 0.875, 0.0063, 6, 0.47, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L142_C1", "label": "GetConfigFieldString", "type": "function", "loc": [142, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:ClassDef_L44_C0", "vector": [2, 1, 0.9437, 0.1187, 1, 0.21, 1.0, 936, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "GetConfigFieldString", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef GetConfigFieldString(self):\n\t\tsParams = \"\"\n\t\tbFirst = True\n\t\tfor sKey in self.Config.keys():\n\t\t\tsValue = self.Config[sKey]\n\t\t\tif (not bFirst):\n\t\t\t\tsParams += \"&\"\n\t\t\telse:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L143_C2", "label": "sParams =", "type": "assigned_variable", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L142_C1", "vector": [14, 2, 0.8938, 0.0063, 2, 0.41, 0.0, 651, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "sParams", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tsParams = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L144_C2", "label": "bFirst =", "type": "assigned_variable", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L142_C1", "vector": [14, 2, 0.9, 0.0063, 2, 0.41, 0.3333, 190, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "bFirst", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tbFirst = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:For_L145_C2", "label": "for sKey", "type": "for", "loc": [145, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L142_C1", "vector": [6, 2, 0.95, 0.0938, 2, 0.41, 0.6667, 119, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "sKey", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tfor sKey in self.Config.keys():\n\t\t\tsValue = self.Config[sKey]\n\t\t\tif (not bFirst):\n\t\t\t\tsParams += \"&\"\n\t\t\telse:\n\t\t\t\tbFirst = False\n\t\t\tif (sValue):\n\t\t\t\tk = escape(sKey)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L146_C3", "label": "sValue =", "type": "assigned_variable", "loc": [146, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:For_L145_C2", "vector": [14, 3, 0.9125, 0.0063, 3, 0.91, 0.0, 881, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sValue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tsValue = self.Config[sKey]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:If_L147_C3", "label": "if", "type": "if", "loc": [147, 150], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:For_L145_C2", "vector": [4, 3, 0.9281, 0.025, 3, 0.91, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif (not bFirst):\n\t\t\t\tsParams += \"&\"\n\t\t\telse:\n\t\t\t\tbFirst = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L150_C4", "label": "bFirst =", "type": "assigned_variable", "loc": [150, 150], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L147_C3", "vector": [14, 4, 0.9375, 0.0063, 4, 0.74, 0.0, 190, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "bFirst", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tbFirst = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:If_L151_C3", "label": "if", "type": "if", "loc": [151, 159], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:For_L145_C2", "vector": [4, 3, 0.9688, 0.0563, 3, 0.91, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif (sValue):\n\t\t\t\tk = escape(sKey)\n\t\t\t\tv = escape(sValue)\n\t\t\t\tif (sValue == \"true\"):\n\t\t\t\t\tsParams += \"%s=true\" % k\n\t\t\t\telif (sValue == \"false\"):\n\t\t\t\t\tsParams += \"%s=false\" % k\n\t\t\t\telse:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L152_C4", "label": "k = escape()", "type": "assigned_variable", "loc": [152, 152], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L151_C3", "vector": [14, 4, 0.95, 0.0063, 4, 0.5, 0.0, 954, 3, 1, 0, 0, 494, 10, 1], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "escape", "annotation": ""}, "snippet": "\t\t\t\tk = escape(sKey)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L153_C4", "label": "v = escape()", "type": "assigned_variable", "loc": [153, 153], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L151_C3", "vector": [14, 4, 0.9563, 0.0063, 4, 0.5, 0.5, 553, 3, 1, 0, 0, 494, 10, 1], "semantic": {"name": "v", "arg_names": [], "import_names": [], "rhs_call_name": "escape", "annotation": ""}, "snippet": "\t\t\t\tv = escape(sValue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:If_L154_C4", "label": "if", "type": "if", "loc": [154, 159], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L151_C3", "vector": [4, 4, 0.9781, 0.0375, 4, 0.5, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tif (sValue == \"true\"):\n\t\t\t\t\tsParams += \"%s=true\" % k\n\t\t\t\telif (sValue == \"false\"):\n\t\t\t\t\tsParams += \"%s=false\" % k\n\t\t\t\telse:\n\t\t\t\t\tsParams += \"%s=%s\" % (k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:If_L156_C4", "label": "if", "type": "if", "loc": [156, 159], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:If_L154_C4", "vector": [4, 5, 0.9844, 0.025, 5, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\telif (sValue == \"false\"):\n\t\t\t\t\tsParams += \"%s=false\" % k\n\t\t\t\telse:\n\t\t\t\t\tsParams += \"%s=%s\" % (k, v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L160_C2", "label": "return", "type": "return", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L142_C1", "vector": [13, 2, 1.0, 0.0063, 2, 0.41, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn sParams"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Expr_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L45_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L45_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L45_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L45_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L45_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L45_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L45_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L45_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L55_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L55_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L58_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L58_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L58_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L58_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_416:If_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L63_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L64_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:If_L69_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:If_L93_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L93_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L93_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:If_L97_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L97_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L97_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L58_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L108_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L110_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L110_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_416:If_L111_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L111_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L112_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L111_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L114_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L110_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_416:If_L115_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L115_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L116_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L115_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L117_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L115_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:If_L118_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L118_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L115_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L120_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L115_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:If_L121_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L121_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L122_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L121_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L123_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L121_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:If_L124_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L124_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L121_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L126_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L121_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:If_L127_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L127_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L128_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L127_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L129_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L127_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:If_L130_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L130_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L127_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L132_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L127_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:If_L133_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L133_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L134_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L133_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L135_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L133_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:If_L136_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L136_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L133_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L138_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L133_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L140_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L142_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L142_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L143_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L142_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L144_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L142_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_416:For_L145_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:For_L145_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L146_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:For_L145_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:If_L147_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L147_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:For_L145_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_416:If_L151_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L151_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L151_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Assign_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L151_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_416:If_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:If_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_416:If_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_416:FunctionDef_L142_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_416:Return_L160_C2"}] |
#!/usr/bin/python
# Copyright 2011 Google, Inc. All Rights Reserved.
# simple script to walk source tree looking for third-party licenses
# dumps resulting html page to stdout
import os, re, mimetypes, sys
# read source directories to scan from command line
SOURCE = sys.argv[1:]
# regex to find /* */ style comment blocks
COMMENT_BLOCK = re.compile(r"(/\*.+?\*/)", re.MULTILINE | re.DOTALL)
# regex used to detect if comment block is a license
COMMENT_LICENSE = re.compile(r"(license)", re.IGNORECASE)
COMMENT_COPYRIGHT = re.compile(r"(copyright)", re.IGNORECASE)
EXCLUDE_TYPES = [
"application/xml",
"image/png",
]
# list of known licenses; keys are derived by stripping all whitespace and
# forcing to lowercase to help combine multiple files that have same license.
KNOWN_LICENSES = {}
class License:
def __init__(self, license_text):
self.license_text = license_text
self.filenames = []
# add filename to the list of files that have the same license text
def add_file(self, filename):
if filename not in self.filenames:
self.filenames.append(filename)
LICENSE_KEY = re.compile(r"[^\w]")
def find_license(license_text):
# TODO(alice): a lot these licenses are almost identical Apache licenses.
# Most of them differ in origin/modifications. Consider combining similar
# licenses.
license_key = LICENSE_KEY.sub("", license_text).lower()
if license_key not in KNOWN_LICENSES:
KNOWN_LICENSES[license_key] = License(license_text)
return KNOWN_LICENSES[license_key]
def discover_license(exact_path, filename):
# when filename ends with LICENSE, assume applies to filename prefixed
if filename.endswith("LICENSE"):
with open(exact_path) as file:
license_text = file.read()
target_filename = filename[:-len("LICENSE")]
if target_filename.endswith("."): target_filename = target_filename[:-1]
find_license(license_text).add_file(target_filename)
return None
# try searching for license blocks in raw file
mimetype = mimetypes.guess_type(filename)
if mimetype in EXCLUDE_TYPES: return None
with open(exact_path) as file:
raw_file = file.read()
# include comments that have both "license" and "copyright" in the text
for comment in COMMENT_BLOCK.finditer(raw_file):
comment = comment.group(1)
if COMMENT_LICENSE.search(comment) is None: continue
if COMMENT_COPYRIGHT.search(comment) is None: continue
find_license(comment).add_file(filename)
for source in SOURCE:
for root, dirs, files in os.walk(source):
for name in files:
discover_license(os.path.join(root, name), name)
print "<html><head><style> body { font-family: sans-serif; } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; } </style></head><body>"
for license in KNOWN_LICENSES.values():
print "<h3>Notices for files:</h3><ul>"
filenames = license.filenames
filenames.sort()
for filename in filenames:
print "<li>%s</li>" % (filename)
print "</ul>"
print "<pre>%s</pre>" % license.license_text
print "</body></html>"
| ajibawa-2023/Python-Code-Large/train/row_417 | 51 | 98 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_417:Import_L8_C0", "label": "os import os, re, mimetypes\u2026", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0816, 0.0102, 0, 0.66, 0.0, 688, 0, 4, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "re", "mimetypes", "sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os, re, mimetypes, sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L12_C0", "label": "SOURCE =", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.1224, 0.0102, 0, 0.66, 0.0714, 792, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "SOURCE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SOURCE = sys.argv[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L15_C0", "label": "COMMENT_BLOCK = compile()", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.1531, 0.0102, 0, 0.66, 0.1429, 629, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "COMMENT_BLOCK", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "COMMENT_BLOCK = re.compile(r\"(/\\*.+?\\*/)\", re.MULTILINE | re.DOTALL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L17_C0", "label": "COMMENT_LICENSE = compile()", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.1735, 0.0102, 0, 0.66, 0.2143, 929, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "COMMENT_LICENSE", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "COMMENT_LICENSE = re.compile(r\"(license)\", re.IGNORECASE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L18_C0", "label": "COMMENT_COPYRIGHT = compile()", "type": "assigned_variable", "loc": [18, 18], "level": 0, "parent": null, "vector": [14, 0, 0.1837, 0.0102, 0, 0.66, 0.2857, 407, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "COMMENT_COPYRIGHT", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "COMMENT_COPYRIGHT = re.compile(r\"(copyright)\", re.IGNORECASE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L20_C0", "label": "EXCLUDE_TYPES =", "type": "assigned_variable", "loc": [20, 23], "level": 0, "parent": null, "vector": [14, 0, 0.2194, 0.0408, 0, 0.66, 0.3571, 265, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "EXCLUDE_TYPES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "EXCLUDE_TYPES = [\n \"application/xml\",\n \"image/png\",\n]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L28_C0", "label": "KNOWN_LICENSES =", "type": "assigned_variable", "loc": [28, 28], "level": 0, "parent": null, "vector": [14, 0, 0.2857, 0.0102, 0, 0.66, 0.4286, 144, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "KNOWN_LICENSES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "KNOWN_LICENSES = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:ClassDef_L31_C0", "label": "License", "type": "class", "loc": [31, 39], "level": 0, "parent": null, "vector": [3, 0, 0.3571, 0.0918, 0, 0.66, 0.5, 338, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "License", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class License:\n def __init__(self, license_text):\n self.license_text = license_text\n self.filenames = []\n\n # add filename to the list of files that have the same license text\n def add_file(self, filename):\n if filename not in self.filenames:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L32_C4", "label": "__init__", "type": "function", "loc": [32, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:ClassDef_L31_C0", "vector": [2, 1, 0.3367, 0.0306, 1, 0.9, 0.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "license_text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, license_text):\n self.license_text = license_text\n self.filenames = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L33_C8", "label": "self.license_text =", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L32_C4", "vector": [14, 2, 0.3367, 0.0102, 2, 0.38, 0.0, 103, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.license_text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.license_text = license_text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L34_C8", "label": "self.filenames =", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L32_C4", "vector": [14, 2, 0.3469, 0.0102, 2, 0.38, 1.0, 866, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.filenames", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.filenames = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L37_C4", "label": "add_file", "type": "function", "loc": [37, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:ClassDef_L31_C0", "vector": [2, 1, 0.3878, 0.0306, 1, 0.9, 1.0, 369, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "add_file", "arg_names": ["self", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_file(self, filename):\n if filename not in self.filenames:\n self.filenames.append(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:If_L38_C8", "label": "if", "type": "if", "loc": [38, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L37_C4", "vector": [4, 2, 0.3929, 0.0204, 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 filename not in self.filenames:\n self.filenames.append(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Expr_L39_C12", "label": "append()", "type": "expression", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:If_L38_C8", "vector": [8, 3, 0.398, 0.0102, 3, 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": " self.filenames.append(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L42_C0", "label": "LICENSE_KEY = compile()", "type": "assigned_variable", "loc": [42, 42], "level": 0, "parent": null, "vector": [14, 0, 0.4286, 0.0102, 0, 0.66, 0.5714, 222, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "LICENSE_KEY", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "LICENSE_KEY = re.compile(r\"[^\\w]\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L44_C0", "label": "find_license", "type": "function", "loc": [44, 51], "level": 0, "parent": null, "vector": [2, 0, 0.4847, 0.0816, 0, 0.66, 0.6429, 149, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "find_license", "arg_names": ["license_text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def find_license(license_text):\n # TODO(alice): a lot these licenses are almost identical Apache licenses.\n # Most of them differ in origin/modifications. Consider combining similar\n # licenses.\n license_key = LICENSE_KEY.sub(\"\", license_text).lower()\n if license_key not in KNOWN_LICENSES:\n KNOWN_LICENSES[license_key] = License(license_text)\n return KNOWN_LICENSES[license_key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L48_C4", "label": "license_key = lower()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L44_C0", "vector": [14, 1, 0.4898, 0.0102, 1, 0.12, 0.0, 374, 3, 0, 0, 0, 432, 10, 2], "semantic": {"name": "license_key", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " license_key = LICENSE_KEY.sub(\"\", license_text).lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:If_L49_C4", "label": "if", "type": "if", "loc": [49, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L44_C0", "vector": [4, 1, 0.5051, 0.0204, 1, 0.12, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if license_key not in KNOWN_LICENSES:\n KNOWN_LICENSES[license_key] = License(license_text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L50_C8", "label": " = License()", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:If_L49_C4", "vector": [14, 2, 0.5102, 0.0102, 2, 0.15, 0.0, 0, 3, 1, 0, 0, 338, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "License", "annotation": ""}, "snippet": " KNOWN_LICENSES[license_key] = License(license_text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Return_L51_C4", "label": "return", "type": "return", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L44_C0", "vector": [13, 1, 0.5204, 0.0102, 1, 0.12, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return KNOWN_LICENSES[license_key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L55_C0", "label": "discover_license", "type": "function", "loc": [55, 77], "level": 0, "parent": null, "vector": [2, 0, 0.6735, 0.2347, 0, 0.66, 0.7143, 17, 0, 2, 1, 0, 0, 0, 16], "semantic": {"name": "discover_license", "arg_names": ["exact_path", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def discover_license(exact_path, filename):\n # when filename ends with LICENSE, assume applies to filename prefixed\n if filename.endswith(\"LICENSE\"):\n with open(exact_path) as file:\n license_text = file.read()\n target_filename = filename[:-len(\"LICENSE\")]\n if target_filename.endswith(\".\"): target_filename = target_filename[:-1]\n find_license(license_text).add_file(target_filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:If_L57_C4", "label": "if", "type": "if", "loc": [57, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L55_C0", "vector": [4, 1, 0.6122, 0.0714, 1, 0.68, 0.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if filename.endswith(\"LICENSE\"):\n with open(exact_path) as file:\n license_text = file.read()\n target_filename = filename[:-len(\"LICENSE\")]\n if target_filename.endswith(\".\"): target_filename = target_filename[:-1]\n find_license(license_text).add_file(target_filename)\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L59_C12", "label": "license_text = read()", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:If_L57_C4", "vector": [14, 2, 0.602, 0.0102, 2, 0.42, 0.0, 550, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "license_text", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " license_text = file.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L60_C8", "label": "target_filename =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:If_L57_C4", "vector": [14, 2, 0.6122, 0.0102, 2, 0.42, 0.0, 439, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "target_filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " target_filename = filename[:-len(\"LICENSE\")]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:If_L61_C8", "label": "if", "type": "if", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:If_L57_C4", "vector": [4, 2, 0.6224, 0.0102, 2, 0.42, 0.3333, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if target_filename.endswith(\".\"): target_filename = target_filename[:-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L61_C42", "label": "target_filename =", "type": "assigned_variable", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:If_L61_C8", "vector": [14, 3, 0.6224, 0.0102, 3, 0.34, 0.0, 439, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "target_filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if target_filename.endswith(\".\"): target_filename = target_filename[:-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Expr_L62_C8", "label": "add_file()", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:If_L57_C4", "vector": [8, 2, 0.6327, 0.0102, 2, 0.42, 0.6667, 369, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "add_file", "arg_names": [], "import_names": [], "rhs_call_name": "add_file", "annotation": ""}, "snippet": " find_license(license_text).add_file(target_filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Return_L63_C8", "label": "return", "type": "return", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:If_L57_C4", "vector": [13, 2, 0.6429, 0.0102, 2, 0.42, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L66_C4", "label": "mimetype = guess_type()", "type": "assigned_variable", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L55_C0", "vector": [14, 1, 0.6735, 0.0102, 1, 0.68, 0.3333, 290, 3, 1, 0, 0, 213, 10, 1], "semantic": {"name": "mimetype", "arg_names": [], "import_names": [], "rhs_call_name": "guess_type", "annotation": ""}, "snippet": " mimetype = mimetypes.guess_type(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:If_L67_C4", "label": "if", "type": "if", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L55_C0", "vector": [4, 1, 0.6837, 0.0102, 1, 0.68, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if mimetype in EXCLUDE_TYPES: return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Return_L67_C34", "label": "return", "type": "return", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:If_L67_C4", "vector": [13, 2, 0.6837, 0.0102, 2, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if mimetype in EXCLUDE_TYPES: return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L70_C8", "label": "raw_file = read()", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L55_C0", "vector": [14, 1, 0.7143, 0.0102, 1, 0.68, 0.0, 1, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "raw_file", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " raw_file = file.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:For_L73_C4", "label": "for comment", "type": "for", "loc": [73, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L55_C0", "vector": [6, 1, 0.7653, 0.051, 1, 0.68, 1.0, 34, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "comment", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for comment in COMMENT_BLOCK.finditer(raw_file):\n comment = comment.group(1)\n if COMMENT_LICENSE.search(comment) is None: continue\n if COMMENT_COPYRIGHT.search(comment) is None: continue\n find_license(comment).add_file(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L74_C8", "label": "comment = group()", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:For_L73_C4", "vector": [14, 2, 0.7551, 0.0102, 2, 0.88, 0.0, 34, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "comment", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": " comment = comment.group(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:If_L75_C8", "label": "if", "type": "if", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:For_L73_C4", "vector": [4, 2, 0.7653, 0.0102, 2, 0.88, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if COMMENT_LICENSE.search(comment) is None: continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:If_L76_C8", "label": "if", "type": "if", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:For_L73_C4", "vector": [4, 2, 0.7755, 0.0102, 2, 0.88, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if COMMENT_COPYRIGHT.search(comment) is None: continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Expr_L77_C8", "label": "add_file()", "type": "expression", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:For_L73_C4", "vector": [8, 2, 0.7857, 0.0102, 2, 0.88, 1.0, 369, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "add_file", "arg_names": [], "import_names": [], "rhs_call_name": "add_file", "annotation": ""}, "snippet": " find_license(comment).add_file(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:For_L80_C0", "label": "for source", "type": "for", "loc": [80, 83], "level": 0, "parent": null, "vector": [6, 0, 0.8316, 0.0408, 0, 0.66, 0.7857, 703, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "source", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for source in SOURCE:\n for root, dirs, files in os.walk(source):\n for name in files:\n discover_license(os.path.join(root, name), name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:For_L81_C4", "label": "for root, dirs, files", "type": "for", "loc": [81, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:For_L80_C0", "vector": [6, 1, 0.8367, 0.0306, 1, 0.94, 0.0, 129, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "root, dirs, files", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for root, dirs, files in os.walk(source):\n for name in files:\n discover_license(os.path.join(root, name), name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:For_L82_C8", "label": "for name", "type": "for", "loc": [82, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:For_L81_C4", "vector": [6, 2, 0.8418, 0.0204, 2, 0.5, 0.0, 57, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for name in files:\n discover_license(os.path.join(root, name), name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Expr_L83_C12", "label": "discover_license()", "type": "expression", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:For_L82_C8", "vector": [8, 3, 0.8469, 0.0102, 3, 0.05, 0.0, 17, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "discover_license", "arg_names": [], "import_names": [], "rhs_call_name": "discover_license", "annotation": ""}, "snippet": " discover_license(os.path.join(root, name), name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Expr_L86_C0", "label": "print()", "type": "expression", "loc": [86, 86], "level": 0, "parent": null, "vector": [8, 0, 0.8776, 0.0102, 0, 0.66, 0.8571, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"<html><head><style> body { font-family: sans-serif; } pre { background-color: #eeeeee; padding: 1em; white-space: pre-wrap; } </style></head><body>\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:For_L88_C0", "label": "for license", "type": "for", "loc": [88, 96], "level": 0, "parent": null, "vector": [6, 0, 0.9388, 0.0918, 0, 0.66, 0.9286, 365, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "license", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for license in KNOWN_LICENSES.values():\n\n print(\"<h3>Notices for files:</h3><ul>\")\n filenames = license.filenames\n filenames.sort()\n for filename in filenames:\n print(\"<li>%s</li>\" % (filename))\n print(\"</ul>\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Expr_L90_C4", "label": "print()", "type": "expression", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:For_L88_C0", "vector": [8, 1, 0.9184, 0.0102, 1, 0.57, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"<h3>Notices for files:</h3><ul>\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L91_C4", "label": "filenames =", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:For_L88_C0", "vector": [14, 1, 0.9286, 0.0102, 1, 0.57, 0.2, 94, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "filenames", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filenames = license.filenames"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Expr_L92_C4", "label": "sort()", "type": "expression", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:For_L88_C0", "vector": [8, 1, 0.9388, 0.0102, 1, 0.57, 0.4, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " filenames.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:For_L93_C4", "label": "for filename", "type": "for", "loc": [93, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:For_L88_C0", "vector": [6, 1, 0.9541, 0.0204, 1, 0.57, 0.6, 275, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for filename in filenames:\n print(\"<li>%s</li>\" % (filename))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Expr_L94_C8", "label": "print()", "type": "expression", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:For_L93_C4", "vector": [8, 2, 0.9592, 0.0102, 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(\"<li>%s</li>\" % (filename))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Expr_L95_C4", "label": "print()", "type": "expression", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:For_L88_C0", "vector": [8, 1, 0.9694, 0.0102, 1, 0.57, 0.8, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"</ul>\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Expr_L96_C4", "label": "print()", "type": "expression", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_417:For_L88_C0", "vector": [8, 1, 0.9796, 0.0102, 1, 0.57, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"<pre>%s</pre>\" % license.license_text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_417:Expr_L98_C0", "label": "print()", "type": "expression", "loc": [98, 98], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0102, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"</body></html>\")"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_417:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_417:If_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:If_L38_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Expr_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_417:If_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:If_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Return_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_417:If_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_417:If_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L61_C42"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Expr_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Return_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_417:If_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:If_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Return_L67_C34"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_417:For_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:For_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:For_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_417:If_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:For_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_417:If_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:For_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Expr_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:For_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_417:For_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:For_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_417:For_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:For_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Expr_L83_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:For_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:For_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:For_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:For_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_417:For_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:For_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Expr_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:For_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_417:For_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_417:Expr_L96_C4"}] |
# Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'includes': [
'build_angle.gypi',
],
}
# Local Variables:
# tab-width:2
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=2 shiftwidth=2:
| ajibawa-2023/Python-Code-Large/train/row_418 | 1 | 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_418:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 9], "level": 0, "parent": null, "vector": [8, 0, 0.4667, 0.3333, 0, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "{\n 'includes': [\n 'build_angle.gypi',\n ],\n}"}] | [] |
# Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'angle_code': 1,
},
'target_defaults': {
'defines': [
'ANGLE_DISABLE_TRACE',
'ANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1',
'ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES={ TEXT("d3dcompiler_46.dll"), TEXT("d3dcompiler_43.dll") }',
],
},
'targets': [
{
'target_name': 'preprocessor',
'type': 'static_library',
'include_dirs': [
],
'sources': [
'compiler/preprocessor/DiagnosticsBase.cpp',
'compiler/preprocessor/DiagnosticsBase.h',
'compiler/preprocessor/DirectiveHandlerBase.cpp',
'compiler/preprocessor/DirectiveHandlerBase.h',
'compiler/preprocessor/DirectiveParser.cpp',
'compiler/preprocessor/DirectiveParser.h',
'compiler/preprocessor/ExpressionParser.cpp',
'compiler/preprocessor/ExpressionParser.h',
'compiler/preprocessor/Input.cpp',
'compiler/preprocessor/Input.h',
'compiler/preprocessor/length_limits.h',
'compiler/preprocessor/Lexer.cpp',
'compiler/preprocessor/Lexer.h',
'compiler/preprocessor/Macro.cpp',
'compiler/preprocessor/Macro.h',
'compiler/preprocessor/MacroExpander.cpp',
'compiler/preprocessor/MacroExpander.h',
'compiler/preprocessor/numeric_lex.h',
'compiler/preprocessor/pp_utils.h',
'compiler/preprocessor/Preprocessor.cpp',
'compiler/preprocessor/Preprocessor.h',
'compiler/preprocessor/SourceLocation.h',
'compiler/preprocessor/Token.cpp',
'compiler/preprocessor/Token.h',
'compiler/preprocessor/Tokenizer.cpp',
'compiler/preprocessor/Tokenizer.h',
],
# TODO(jschuh): http://crbug.com/167187
'msvs_disabled_warnings': [
4267,
],
},
{
'target_name': 'translator_common',
'type': 'static_library',
'dependencies': ['preprocessor'],
'include_dirs': [
'.',
'../include',
],
'defines': [
'COMPILER_IMPLEMENTATION',
],
'sources': [
'compiler/BaseTypes.h',
'compiler/BuiltInFunctionEmulator.cpp',
'compiler/BuiltInFunctionEmulator.h',
'compiler/Common.h',
'compiler/Compiler.cpp',
'compiler/ConstantUnion.h',
'compiler/debug.cpp',
'compiler/debug.h',
'compiler/DetectCallDepth.cpp',
'compiler/DetectCallDepth.h',
'compiler/Diagnostics.h',
'compiler/Diagnostics.cpp',
'compiler/DirectiveHandler.h',
'compiler/DirectiveHandler.cpp',
'compiler/ExtensionBehavior.h',
'compiler/ForLoopUnroll.cpp',
'compiler/ForLoopUnroll.h',
'compiler/glslang.h',
'compiler/glslang_lex.cpp',
'compiler/glslang_tab.cpp',
'compiler/glslang_tab.h',
'compiler/HashNames.h',
'compiler/InfoSink.cpp',
'compiler/InfoSink.h',
'compiler/Initialize.cpp',
'compiler/Initialize.h',
'compiler/InitializeDll.cpp',
'compiler/InitializeDll.h',
'compiler/InitializeGlobals.h',
'compiler/InitializeParseContext.cpp',
'compiler/InitializeParseContext.h',
'compiler/Intermediate.cpp',
'compiler/intermediate.h',
'compiler/intermOut.cpp',
'compiler/IntermTraverse.cpp',
'compiler/localintermediate.h',
'compiler/MapLongVariableNames.cpp',
'compiler/MapLongVariableNames.h',
'compiler/MMap.h',
'compiler/osinclude.h',
'compiler/parseConst.cpp',
'compiler/ParseHelper.cpp',
'compiler/ParseHelper.h',
'compiler/PoolAlloc.cpp',
'compiler/PoolAlloc.h',
'compiler/QualifierAlive.cpp',
'compiler/QualifierAlive.h',
'compiler/RemoveTree.cpp',
'compiler/RemoveTree.h',
'compiler/RenameFunction.h',
'compiler/ShHandle.h',
'compiler/SymbolTable.cpp',
'compiler/SymbolTable.h',
'compiler/Types.h',
'compiler/Uniform.cpp',
'compiler/Uniform.h',
'compiler/util.cpp',
'compiler/util.h',
'compiler/ValidateLimitations.cpp',
'compiler/ValidateLimitations.h',
'compiler/VariableInfo.cpp',
'compiler/VariableInfo.h',
'compiler/VariablePacker.cpp',
'compiler/VariablePacker.h',
# Dependency graph
'compiler/depgraph/DependencyGraph.cpp',
'compiler/depgraph/DependencyGraph.h',
'compiler/depgraph/DependencyGraphBuilder.cpp',
'compiler/depgraph/DependencyGraphBuilder.h',
'compiler/depgraph/DependencyGraphOutput.cpp',
'compiler/depgraph/DependencyGraphOutput.h',
'compiler/depgraph/DependencyGraphTraverse.cpp',
# Timing restrictions
'compiler/timing/RestrictFragmentShaderTiming.cpp',
'compiler/timing/RestrictFragmentShaderTiming.h',
'compiler/timing/RestrictVertexShaderTiming.cpp',
'compiler/timing/RestrictVertexShaderTiming.h',
'third_party/compiler/ArrayBoundsClamper.cpp',
'third_party/compiler/ArrayBoundsClamper.h',
],
'conditions': [
['OS=="win"', {
# TODO(jschuh): http://crbug.com/167187 size_t -> int
'msvs_disabled_warnings': [ 4267 ],
'sources': ['compiler/ossource_win.cpp'],
}, { # else: posix
'sources': ['compiler/ossource_posix.cpp'],
}],
],
},
{
'target_name': 'translator_glsl',
'type': '<(component)',
'dependencies': ['translator_common'],
'include_dirs': [
'.',
'../include',
],
'defines': [
'COMPILER_IMPLEMENTATION',
],
'sources': [
'compiler/CodeGenGLSL.cpp',
'compiler/OutputESSL.cpp',
'compiler/OutputESSL.h',
'compiler/OutputGLSLBase.cpp',
'compiler/OutputGLSLBase.h',
'compiler/OutputGLSL.cpp',
'compiler/OutputGLSL.h',
'compiler/ShaderLang.cpp',
'compiler/TranslatorESSL.cpp',
'compiler/TranslatorESSL.h',
'compiler/TranslatorGLSL.cpp',
'compiler/TranslatorGLSL.h',
'compiler/VersionGLSL.cpp',
'compiler/VersionGLSL.h',
],
# TODO(jschuh): http://crbug.com/167187 size_t -> int
'msvs_disabled_warnings': [ 4267 ],
},
],
'conditions': [
['OS=="win"', {
'targets': [
{
'target_name': 'translator_hlsl',
'type': '<(component)',
'dependencies': ['translator_common'],
'include_dirs': [
'.',
'../include',
],
'defines': [
'COMPILER_IMPLEMENTATION',
],
'sources': [
'compiler/ShaderLang.cpp',
'compiler/DetectDiscontinuity.cpp',
'compiler/DetectDiscontinuity.h',
'compiler/CodeGenHLSL.cpp',
'compiler/OutputHLSL.cpp',
'compiler/OutputHLSL.h',
'compiler/TranslatorHLSL.cpp',
'compiler/TranslatorHLSL.h',
'compiler/UnfoldShortCircuit.cpp',
'compiler/UnfoldShortCircuit.h',
'compiler/SearchSymbol.cpp',
'compiler/SearchSymbol.h',
],
# TODO(jschuh): http://crbug.com/167187 size_t -> int
'msvs_disabled_warnings': [ 4267 ],
},
{
'target_name': 'libGLESv2',
'type': 'shared_library',
'dependencies': ['translator_hlsl'],
'include_dirs': [
'.',
'../include',
'libGLESv2',
],
'sources': [
'third_party/murmurhash/MurmurHash3.h',
'third_party/murmurhash/MurmurHash3.cpp',
'common/angleutils.h',
'common/debug.cpp',
'common/debug.h',
'common/RefCountObject.cpp',
'common/RefCountObject.h',
'common/version.h',
'libGLESv2/precompiled.h',
'libGLESv2/precompiled.cpp',
'libGLESv2/BinaryStream.h',
'libGLESv2/Buffer.cpp',
'libGLESv2/Buffer.h',
'libGLESv2/constants.h',
'libGLESv2/Context.cpp',
'libGLESv2/Context.h',
'libGLESv2/angletypes.h',
'libGLESv2/Fence.cpp',
'libGLESv2/Fence.h',
'libGLESv2/Float16ToFloat32.cpp',
'libGLESv2/Framebuffer.cpp',
'libGLESv2/Framebuffer.h',
'libGLESv2/HandleAllocator.cpp',
'libGLESv2/HandleAllocator.h',
'libGLESv2/libGLESv2.cpp',
'libGLESv2/libGLESv2.def',
'libGLESv2/libGLESv2.rc',
'libGLESv2/main.cpp',
'libGLESv2/main.h',
'libGLESv2/mathutil.h',
'libGLESv2/Program.cpp',
'libGLESv2/Program.h',
'libGLESv2/ProgramBinary.cpp',
'libGLESv2/ProgramBinary.h',
'libGLESv2/Query.h',
'libGLESv2/Query.cpp',
'libGLESv2/Renderbuffer.cpp',
'libGLESv2/Renderbuffer.h',
'libGLESv2/renderer/Blit.cpp',
'libGLESv2/renderer/Blit.h',
'libGLESv2/renderer/BufferStorage.h',
'libGLESv2/renderer/BufferStorage.cpp',
'libGLESv2/renderer/BufferStorage9.cpp',
'libGLESv2/renderer/BufferStorage9.h',
'libGLESv2/renderer/BufferStorage11.cpp',
'libGLESv2/renderer/BufferStorage11.h',
'libGLESv2/renderer/FenceImpl.h',
'libGLESv2/renderer/Fence9.cpp',
'libGLESv2/renderer/Fence9.h',
'libGLESv2/renderer/Fence11.cpp',
'libGLESv2/renderer/Fence11.h',
'libGLESv2/renderer/generatemip.h',
'libGLESv2/renderer/Image.cpp',
'libGLESv2/renderer/Image.h',
'libGLESv2/renderer/Image11.cpp',
'libGLESv2/renderer/Image11.h',
'libGLESv2/renderer/Image9.cpp',
'libGLESv2/renderer/Image9.h',
'libGLESv2/renderer/ImageSSE2.cpp',
'libGLESv2/renderer/IndexBuffer.cpp',
'libGLESv2/renderer/IndexBuffer.h',
'libGLESv2/renderer/IndexBuffer9.cpp',
'libGLESv2/renderer/IndexBuffer9.h',
'libGLESv2/renderer/IndexBuffer11.cpp',
'libGLESv2/renderer/IndexBuffer11.h',
'libGLESv2/renderer/IndexDataManager.cpp',
'libGLESv2/renderer/IndexDataManager.h',
'libGLESv2/renderer/InputLayoutCache.cpp',
'libGLESv2/renderer/InputLayoutCache.h',
'libGLESv2/renderer/QueryImpl.h',
'libGLESv2/renderer/Query9.cpp',
'libGLESv2/renderer/Query9.h',
'libGLESv2/renderer/Query11.cpp',
'libGLESv2/renderer/Query11.h',
'libGLESv2/renderer/Renderer.cpp',
'libGLESv2/renderer/Renderer.h',
'libGLESv2/renderer/Renderer11.cpp',
'libGLESv2/renderer/Renderer11.h',
'libGLESv2/renderer/renderer11_utils.cpp',
'libGLESv2/renderer/renderer11_utils.h',
'libGLESv2/renderer/Renderer9.cpp',
'libGLESv2/renderer/Renderer9.h',
'libGLESv2/renderer/renderer9_utils.cpp',
'libGLESv2/renderer/renderer9_utils.h',
'libGLESv2/renderer/RenderStateCache.cpp',
'libGLESv2/renderer/RenderStateCache.h',
'libGLESv2/renderer/RenderTarget.h',
'libGLESv2/renderer/RenderTarget11.h',
'libGLESv2/renderer/RenderTarget11.cpp',
'libGLESv2/renderer/RenderTarget9.h',
'libGLESv2/renderer/RenderTarget9.cpp',
'libGLESv2/renderer/ShaderCache.h',
'libGLESv2/renderer/ShaderExecutable.h',
'libGLESv2/renderer/ShaderExecutable9.cpp',
'libGLESv2/renderer/ShaderExecutable9.h',
'libGLESv2/renderer/ShaderExecutable11.cpp',
'libGLESv2/renderer/ShaderExecutable11.h',
'libGLESv2/renderer/SwapChain.h',
'libGLESv2/renderer/SwapChain9.cpp',
'libGLESv2/renderer/SwapChain9.h',
'libGLESv2/renderer/SwapChain11.cpp',
'libGLESv2/renderer/SwapChain11.h',
'libGLESv2/renderer/TextureStorage.cpp',
'libGLESv2/renderer/TextureStorage.h',
'libGLESv2/renderer/TextureStorage11.cpp',
'libGLESv2/renderer/TextureStorage11.h',
'libGLESv2/renderer/TextureStorage9.cpp',
'libGLESv2/renderer/TextureStorage9.h',
'libGLESv2/renderer/VertexBuffer.cpp',
'libGLESv2/renderer/VertexBuffer.h',
'libGLESv2/renderer/VertexBuffer9.cpp',
'libGLESv2/renderer/VertexBuffer9.h',
'libGLESv2/renderer/VertexBuffer11.cpp',
'libGLESv2/renderer/VertexBuffer11.h',
'libGLESv2/renderer/vertexconversion.h',
'libGLESv2/renderer/VertexDataManager.cpp',
'libGLESv2/renderer/VertexDataManager.h',
'libGLESv2/renderer/VertexDeclarationCache.cpp',
'libGLESv2/renderer/VertexDeclarationCache.h',
'libGLESv2/ResourceManager.cpp',
'libGLESv2/ResourceManager.h',
'libGLESv2/Shader.cpp',
'libGLESv2/Shader.h',
'libGLESv2/Texture.cpp',
'libGLESv2/Texture.h',
'libGLESv2/Uniform.cpp',
'libGLESv2/Uniform.h',
'libGLESv2/utilities.cpp',
'libGLESv2/utilities.h',
],
# TODO(jschuh): http://crbug.com/167187 size_t -> int
'msvs_disabled_warnings': [ 4267 ],
'msvs_settings': {
'VCLinkerTool': {
'AdditionalDependencies': [
'd3d9.lib',
'dxguid.lib',
],
}
},
},
{
'target_name': 'libEGL',
'type': 'shared_library',
'dependencies': ['libGLESv2'],
'include_dirs': [
'.',
'../include',
'libGLESv2',
],
'sources': [
'common/angleutils.h',
'common/debug.cpp',
'common/debug.h',
'common/RefCountObject.cpp',
'common/RefCountObject.h',
'common/version.h',
'libEGL/Config.cpp',
'libEGL/Config.h',
'libEGL/Display.cpp',
'libEGL/Display.h',
'libEGL/libEGL.cpp',
'libEGL/libEGL.def',
'libEGL/libEGL.rc',
'libEGL/main.cpp',
'libEGL/main.h',
'libEGL/Surface.cpp',
'libEGL/Surface.h',
],
# TODO(jschuh): http://crbug.com/167187 size_t -> int
'msvs_disabled_warnings': [ 4267 ],
'msvs_settings': {
'VCLinkerTool': {
'AdditionalDependencies': [
'd3d9.lib',
],
}
},
},
],
}],
],
}
# Local Variables:
# tab-width:2
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=2 shiftwidth=2:
# Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
| ajibawa-2023/Python-Code-Large/train/row_419 | 1 | 420 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_419:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 411], "level": 0, "parent": null, "vector": [8, 0, 0.4952, 0.969, 0, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "{\n 'variables': {\n 'angle_code': 1,\n },\n 'target_defaults': {\n 'defines': [\n 'ANGLE_DISABLE_TRACE',\n 'ANGLE_COMPILE_OPTIMIZATION_LEVEL=D3DCOMPILE_OPTIMIZATION_LEVEL1',"}] | [] |
# Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# This script generates a function that converts 16-bit precision floating
# point numbers to 32-bit.
# It is based on ftp://ftp.fox-toolkit.org/pub/fasthalffloatconversion.pdf.
def convertMantissa(i):
if i == 0:
return 0
elif i < 1024:
m = i << 13
e = 0
while not (m & 0x00800000):
e -= 0x00800000
m = m << 1
m &= ~0x00800000
e += 0x38800000
return m | e
else:
return 0x38000000 + ((i - 1024) << 13)
def convertExponent(i):
if i == 0:
return 0
elif i in range(1, 31):
return i << 23
elif i == 31:
return 0x47800000
elif i == 32:
return 0x80000000
elif i in range(33, 63):
return 0x80000000 + ((i - 32) << 23)
else:
return 0xC7800000
def convertOffset(i):
if i == 0 or i == 32:
return 0
else:
return 1024
print """//
// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// This file is automatically generated.
namespace gl
{
"""
print "const static unsigned g_mantissa[2048] = {"
for i in range(0, 2048):
print " %#010x," % convertMantissa(i)
print "};\n"
print "const static unsigned g_exponent[64] = {"
for i in range(0, 64):
print " %#010x," % convertExponent(i)
print "};\n"
print "const static unsigned g_offset[64] = {"
for i in range(0, 64):
print " %#010x," % convertOffset(i)
print "};\n"
print """float float16ToFloat32(unsigned short h)
{
unsigned i32 = g_mantissa[g_offset[h >> 10] + (h & 0x3ff)] + g_exponent[h >> 10];
return *(float*) &i32;
}
}
"""
| ajibawa-2023/Python-Code-Large/train/row_420 | 26 | 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_420:FunctionDef_L1_C0", "label": "convertMantissa", "type": "function", "loc": [1, 14], "level": 0, "parent": null, "vector": [2, 0, 0.2143, 0.4, 0, 0.66, 0.0, 107, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "convertMantissa", "arg_names": ["i"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def convertMantissa(i):\n if i == 0:\n return 0\n elif i < 1024:\n m = i << 13\n e = 0\n while not (m & 0x00800000):\n e -= 0x00800000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_420:If_L2_C4", "label": "if", "type": "if", "loc": [2, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:FunctionDef_L1_C0", "vector": [4, 1, 0.2286, 0.3714, 1, 0.68, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i == 0:\n return 0\n elif i < 1024:\n m = i << 13\n e = 0\n while not (m & 0x00800000):\n e -= 0x00800000\n m = m << 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_420:Return_L3_C8", "label": "return", "type": "return", "loc": [3, 3], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:If_L2_C4", "vector": [13, 2, 0.0857, 0.0286, 2, 0.69, 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_420:If_L4_C4", "label": "if", "type": "if", "loc": [4, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:If_L2_C4", "vector": [4, 2, 0.2571, 0.3143, 2, 0.69, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif i < 1024:\n m = i << 13\n e = 0\n while not (m & 0x00800000):\n e -= 0x00800000\n m = m << 1\n m &= ~0x00800000\n e += 0x38800000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_420:Assign_L5_C8", "label": "m =", "type": "assigned_variable", "loc": [5, 5], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:If_L4_C4", "vector": [14, 3, 0.1429, 0.0286, 3, 0.21, 0.0, 711, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " m = i << 13"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_420:Assign_L6_C8", "label": "e =", "type": "assigned_variable", "loc": [6, 6], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:If_L4_C4", "vector": [14, 3, 0.1714, 0.0286, 3, 0.21, 0.25, 175, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "e", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " e = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_420:While_L7_C8", "label": "while", "type": "while", "loc": [7, 9], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:If_L4_C4", "vector": [5, 3, 0.2286, 0.0857, 3, 0.21, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while not (m & 0x00800000):\n e -= 0x00800000\n m = m << 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_420:Assign_L9_C12", "label": "m =", "type": "assigned_variable", "loc": [9, 9], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:While_L7_C8", "vector": [14, 4, 0.2571, 0.0286, 4, 0.11, 0.0, 711, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " m = m << 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_420:Return_L12_C8", "label": "return", "type": "return", "loc": [12, 12], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:If_L4_C4", "vector": [13, 3, 0.3429, 0.0286, 3, 0.21, 0.75, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return m | e"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_420:Return_L14_C8", "label": "return", "type": "return", "loc": [14, 14], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:If_L4_C4", "vector": [13, 3, 0.4, 0.0286, 3, 0.21, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0x38000000 + ((i - 1024) << 13)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_420:FunctionDef_L16_C0", "label": "convertExponent", "type": "function", "loc": [16, 28], "level": 0, "parent": null, "vector": [2, 0, 0.6286, 0.3714, 0, 0.66, 0.5, 61, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "convertExponent", "arg_names": ["i"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def convertExponent(i):\n if i == 0:\n return 0\n elif i in range(1, 31):\n return i << 23\n elif i == 31:\n return 0x47800000\n elif i == 32:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_420:If_L17_C4", "label": "if", "type": "if", "loc": [17, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:FunctionDef_L16_C0", "vector": [4, 1, 0.6429, 0.3429, 1, 0.26, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i == 0:\n return 0\n elif i in range(1, 31):\n return i << 23\n elif i == 31:\n return 0x47800000\n elif i == 32:\n return 0x80000000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_420:Return_L18_C8", "label": "return", "type": "return", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:If_L17_C4", "vector": [13, 2, 0.5143, 0.0286, 2, 0.1, 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_420:If_L19_C4", "label": "if", "type": "if", "loc": [19, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:If_L17_C4", "vector": [4, 2, 0.6714, 0.2857, 2, 0.1, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif i in range(1, 31):\n return i << 23\n elif i == 31:\n return 0x47800000\n elif i == 32:\n return 0x80000000\n elif i in range(33, 63):\n return 0x80000000 + ((i - 32) << 23)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_420:Return_L20_C8", "label": "return", "type": "return", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:If_L19_C4", "vector": [13, 3, 0.5714, 0.0286, 3, 0.1, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return i << 23"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_420:If_L21_C4", "label": "if", "type": "if", "loc": [21, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:If_L19_C4", "vector": [4, 3, 0.7, 0.2286, 3, 0.1, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif i == 31:\n return 0x47800000\n elif i == 32:\n return 0x80000000\n elif i in range(33, 63):\n return 0x80000000 + ((i - 32) << 23)\n else:\n return 0xC7800000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_420:Return_L22_C8", "label": "return", "type": "return", "loc": [22, 22], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:If_L21_C4", "vector": [13, 4, 0.6286, 0.0286, 4, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0x47800000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_420:If_L23_C4", "label": "if", "type": "if", "loc": [23, 28], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:If_L21_C4", "vector": [4, 4, 0.7286, 0.1714, 4, 0.13, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif i == 32:\n return 0x80000000\n elif i in range(33, 63):\n return 0x80000000 + ((i - 32) << 23)\n else:\n return 0xC7800000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_420:Return_L24_C8", "label": "return", "type": "return", "loc": [24, 24], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:If_L23_C4", "vector": [13, 5, 0.6857, 0.0286, 5, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0x80000000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_420:If_L25_C4", "label": "if", "type": "if", "loc": [25, 28], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:If_L23_C4", "vector": [4, 5, 0.7571, 0.1143, 5, 0.15, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif i in range(33, 63):\n return 0x80000000 + ((i - 32) << 23)\n else:\n return 0xC7800000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_420:Return_L26_C8", "label": "return", "type": "return", "loc": [26, 26], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:If_L25_C4", "vector": [13, 6, 0.7429, 0.0286, 6, 0.56, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0x80000000 + ((i - 32) << 23)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_420:Return_L28_C8", "label": "return", "type": "return", "loc": [28, 28], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:If_L25_C4", "vector": [13, 6, 0.8, 0.0286, 6, 0.56, 1.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 0xC7800000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_420:FunctionDef_L30_C0", "label": "convertOffset", "type": "function", "loc": [30, 34], "level": 0, "parent": null, "vector": [2, 0, 0.9143, 0.1429, 0, 0.66, 1.0, 161, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "convertOffset", "arg_names": ["i"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def convertOffset(i):\n if i == 0 or i == 32:\n return 0\n else:\n return 1024"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_420:If_L31_C4", "label": "if", "type": "if", "loc": [31, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:FunctionDef_L30_C0", "vector": [4, 1, 0.9286, 0.1143, 1, 0.46, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i == 0 or i == 32:\n return 0\n else:\n return 1024"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_420:Return_L32_C8", "label": "return", "type": "return", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:If_L31_C4", "vector": [13, 2, 0.9143, 0.0286, 2, 0.87, 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_420:Return_L34_C8", "label": "return", "type": "return", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_420:If_L31_C4", "vector": [13, 2, 0.9714, 0.0286, 2, 0.87, 1.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 1024"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_420:FunctionDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_420:If_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_420:If_L2_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_420:Return_L3_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_420:If_L2_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_420:If_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_420:If_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_420:Assign_L5_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_420:If_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_420:Assign_L6_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_420:If_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_420:While_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_420:While_L7_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_420:Assign_L9_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_420:If_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_420:Return_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_420:If_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_420:Return_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_420:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_420:If_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_420:If_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_420:Return_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_420:If_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_420:If_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_420:If_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_420:Return_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_420:If_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_420:If_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_420:If_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_420:Return_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_420:If_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_420:If_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_420:If_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_420:Return_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_420:If_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_420:If_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_420:If_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_420:Return_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_420:If_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_420:Return_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_420:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_420:If_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_420:If_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_420:Return_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_420:If_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_420:Return_L34_C8"}] |
deps = {
"trunk/third_party/gyp":
"http://gyp.googlecode.com/svn/trunk@1564",
"trunk/third_party/googletest":
"http://googletest.googlecode.com/svn/trunk@573", #release 1.6.0
"trunk/third_party/googlemock":
"http://googlemock.googlecode.com/svn/trunk@387", #release 1.6.0
}
hooks = [
{
# A change to a .gyp, .gypi, or to GYP itself should run the generator.
"pattern": ".",
"action": ["python", "trunk/build/gyp_angle"],
},
]
| ajibawa-2023/Python-Code-Large/train/row_421 | 2 | 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_421:Assign_L1_C0", "label": "deps =", "type": "assigned_variable", "loc": [1, 10], "level": 0, "parent": null, "vector": [14, 0, 0.3056, 0.5556, 0, 0.66, 0.0, 565, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "deps", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "deps = {\n \"trunk/third_party/gyp\":\n \"http://gyp.googlecode.com/svn/trunk@1564\",\n\n \"trunk/third_party/googletest\":\n \"http://googletest.googlecode.com/svn/trunk@573\", #release 1.6.0\n\n \"trunk/third_party/googlemock\":"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_421:Assign_L12_C0", "label": "hooks =", "type": "assigned_variable", "loc": [12, 18], "level": 0, "parent": null, "vector": [14, 0, 0.8333, 0.3889, 0, 0.66, 1.0, 91, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "hooks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "hooks = [\n {\n # A change to a .gyp, .gypi, or to GYP itself should run the generator.\n \"pattern\": \".\",\n \"action\": [\"python\", \"trunk/build/gyp_angle\"],\n },\n]"}] | [] |
# Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'essl_to_glsl',
'type': 'executable',
'dependencies': [
'../src/build_angle.gyp:translator_glsl',
],
'include_dirs': [
'../include',
],
'sources': [
'translator/translator.cpp',
],
},
],
'conditions': [
['OS=="win"', {
'targets': [
{
'target_name': 'essl_to_hlsl',
'type': 'executable',
'dependencies': [
'../src/build_angle.gyp:translator_hlsl',
],
'include_dirs': [
'../include',
'../src',
],
'sources': [
'translator/translator.cpp',
'../src/common/debug.cpp',
],
'msvs_settings': {
'VCLinkerTool': {
'AdditionalDependencies': ['d3d9.lib'],
}
}
},
{
'target_name': 'es_util',
'type': 'static_library',
'dependencies': [
'../src/build_angle.gyp:libEGL',
'../src/build_angle.gyp:libGLESv2',
],
'include_dirs': [
'gles2_book/Common',
'../include',
],
'sources': [
'gles2_book/Common/esShader.c',
'gles2_book/Common/esShapes.c',
'gles2_book/Common/esTransform.c',
'gles2_book/Common/esUtil.c',
'gles2_book/Common/esUtil.h',
'gles2_book/Common/esUtil_win.h',
'gles2_book/Common/Win32/esUtil_TGA.c',
'gles2_book/Common/Win32/esUtil_win32.c',
],
'direct_dependent_settings': {
'include_dirs': [
'gles2_book/Common',
'../include',
],
},
},
{
'target_name': 'hello_triangle',
'type': 'executable',
'dependencies': ['es_util'],
'sources': [
'gles2_book/Hello_Triangle/Hello_Triangle.c',
],
},
{
'target_name': 'mip_map_2d',
'type': 'executable',
'dependencies': ['es_util'],
'sources': [
'gles2_book/MipMap2D/MipMap2D.c',
],
},
{
'target_name': 'multi_texture',
'type': 'executable',
'dependencies': ['es_util'],
'sources': [
'gles2_book/MultiTexture/MultiTexture.c',
],
'copies': [
{
'destination': '<(PRODUCT_DIR)',
'files': [
'gles2_book/MultiTexture/basemap.tga',
'gles2_book/MultiTexture/lightmap.tga',
],
},
],
},
{
'target_name': 'particle_system',
'type': 'executable',
'dependencies': ['es_util'],
'sources': [
'gles2_book/ParticleSystem/ParticleSystem.c',
],
'copies': [
{
'destination': '<(PRODUCT_DIR)',
'files': [
'gles2_book/ParticleSystem/smoke.tga',
],
},
],
},
{
'target_name': 'simple_texture_2d',
'type': 'executable',
'dependencies': ['es_util'],
'sources': [
'gles2_book/Simple_Texture2D/Simple_Texture2D.c',
],
},
{
'target_name': 'simple_texture_cubemap',
'type': 'executable',
'dependencies': ['es_util'],
'sources': [
'gles2_book/Simple_TextureCubemap/Simple_TextureCubemap.c',
],
},
{
'target_name': 'simple_vertex_shader',
'type': 'executable',
'dependencies': ['es_util'],
'sources': [
'gles2_book/Simple_VertexShader/Simple_VertexShader.c',
],
},
{
'target_name': 'stencil_test',
'type': 'executable',
'dependencies': ['es_util'],
'sources': [
'gles2_book/Stencil_Test/Stencil_Test.c',
],
},
{
'target_name': 'texture_wrap',
'type': 'executable',
'dependencies': ['es_util'],
'sources': [
'gles2_book/TextureWrap/TextureWrap.c',
],
},
{
'target_name': 'post_sub_buffer',
'type': 'executable',
'dependencies': ['es_util'],
'sources': [
'gles2_book/PostSubBuffer/PostSubBuffer.c',
],
},
],
}],
],
}
# Local Variables:
# tab-width:2
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=2 shiftwidth=2:
| ajibawa-2023/Python-Code-Large/train/row_422 | 1 | 178 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_422:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 172], "level": 0, "parent": null, "vector": [8, 0, 0.4972, 0.9438, 0, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "{\n 'targets': [\n {\n 'target_name': 'essl_to_glsl',\n 'type': 'executable',\n 'dependencies': [\n '../src/build_angle.gyp:translator_glsl',\n ],"}] | [] |
# Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'gtest',
'type': 'static_library',
'include_dirs': [
'../third_party/googletest',
'../third_party/googletest/include',
],
'sources': [
'../third_party/googletest/src/gtest-all.cc',
],
},
{
'target_name': 'gmock',
'type': 'static_library',
'include_dirs': [
'../third_party/googlemock',
'../third_party/googlemock/include',
'../third_party/googletest/include',
],
'sources': [
'../third_party/googlemock/src/gmock-all.cc',
],
},
{
'target_name': 'preprocessor_tests',
'type': 'executable',
'dependencies': [
'../src/build_angle.gyp:preprocessor',
'gtest',
'gmock',
],
'include_dirs': [
'../src/compiler/preprocessor',
'../third_party/googletest/include',
'../third_party/googlemock/include',
],
'sources': [
'../third_party/googlemock/src/gmock_main.cc',
'preprocessor_tests/char_test.cpp',
'preprocessor_tests/comment_test.cpp',
'preprocessor_tests/define_test.cpp',
'preprocessor_tests/error_test.cpp',
'preprocessor_tests/extension_test.cpp',
'preprocessor_tests/identifier_test.cpp',
'preprocessor_tests/if_test.cpp',
'preprocessor_tests/input_test.cpp',
'preprocessor_tests/location_test.cpp',
'preprocessor_tests/MockDiagnostics.h',
'preprocessor_tests/MockDirectiveHandler.h',
'preprocessor_tests/number_test.cpp',
'preprocessor_tests/operator_test.cpp',
'preprocessor_tests/pragma_test.cpp',
'preprocessor_tests/PreprocessorTest.cpp',
'preprocessor_tests/PreprocessorTest.h',
'preprocessor_tests/space_test.cpp',
'preprocessor_tests/token_test.cpp',
'preprocessor_tests/version_test.cpp',
],
},
{
'target_name': 'compiler_tests',
'type': 'executable',
'dependencies': [
'../src/build_angle.gyp:translator_glsl',
'gtest',
'gmock',
],
'include_dirs': [
'../include',
'../src',
'../third_party/googletest/include',
'../third_party/googlemock/include',
],
'sources': [
'../third_party/googlemock/src/gmock_main.cc',
'compiler_tests/ExpressionLimit_test.cpp',
'compiler_tests/VariablePacker_test.cpp',
],
},
],
}
# Local Variables:
# tab-width:2
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=2 shiftwidth=2:
| ajibawa-2023/Python-Code-Large/train/row_423 | 1 | 93 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_423:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 87], "level": 0, "parent": null, "vector": [8, 0, 0.4946, 0.8925, 0, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "{\n 'targets': [\n {\n 'target_name': 'gtest',\n 'type': 'static_library',\n 'include_dirs': [\n '../third_party/googletest',\n '../third_party/googletest/include',"}] | [] |
#====================================================================
# 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_424 | 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_424: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_424: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_424: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_424: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_424: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_424: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_424: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_424: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_424:Assign_L36_C4", "label": "files = listdir()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:FunctionDef_L35_C0", "vector": [14, 1, 0.4865, 0.0135, 1, 0.8, 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_424:For_L37_C4", "label": "for file", "type": "for", "loc": [37, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:FunctionDef_L35_C0", "vector": [6, 1, 0.5473, 0.1081, 1, 0.8, 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_424:Assign_L38_C8", "label": "f = join()", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:For_L37_C4", "vector": [14, 2, 0.5135, 0.0135, 2, 0.09, 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_424:If_L39_C8", "label": "if", "type": "if", "loc": [39, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:For_L37_C4", "vector": [4, 2, 0.5608, 0.0811, 2, 0.09, 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_424:If_L40_C12", "label": "if", "type": "if", "loc": [40, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:If_L39_C8", "vector": [4, 3, 0.5473, 0.027, 3, 0.38, 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_424:Expr_L41_C16", "label": "process_dir()", "type": "expression", "loc": [41, 41], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:If_L40_C12", "vector": [8, 4, 0.5541, 0.0135, 4, 0.27, 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_424:If_L43_C12", "label": "if", "type": "if", "loc": [43, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:If_L39_C8", "vector": [4, 3, 0.5878, 0.027, 3, 0.38, 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_424:Expr_L44_C16", "label": "process_source()", "type": "expression", "loc": [44, 44], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:If_L43_C12", "vector": [8, 4, 0.5946, 0.0135, 4, 0.74, 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_424: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_424:Assign_L47_C4", "label": "tmp = mkstemp()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:FunctionDef_L46_C0", "vector": [14, 1, 0.6351, 0.0135, 1, 0.45, 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_424:Assign_L48_C4", "label": "tmpfd =", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:FunctionDef_L46_C0", "vector": [14, 1, 0.6486, 0.0135, 1, 0.45, 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_424:Assign_L49_C4", "label": "tmpfile =", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:FunctionDef_L46_C0", "vector": [14, 1, 0.6622, 0.0135, 1, 0.45, 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_424:Try_L50_C4", "label": "try", "type": "try", "loc": [50, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:FunctionDef_L46_C0", "vector": [7, 1, 0.8243, 0.3108, 1, 0.45, 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_424:Assign_L51_C8", "label": "changed =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L50_C4", "vector": [14, 2, 0.6892, 0.0135, 2, 0.13, 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_424:Assign_L52_C8", "label": "dst = fdopen()", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L50_C4", "vector": [14, 2, 0.7027, 0.0135, 2, 0.13, 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_424:Try_L53_C8", "label": "try", "type": "try", "loc": [53, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L50_C4", "vector": [7, 2, 0.7905, 0.1622, 2, 0.13, 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_424:Assign_L54_C12", "label": "src = open()", "type": "assigned_variable", "loc": [54, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L53_C8", "vector": [14, 3, 0.7297, 0.0135, 3, 0.96, 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_424:Try_L55_C12", "label": "try", "type": "try", "loc": [55, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L53_C8", "vector": [7, 3, 0.7905, 0.1081, 3, 0.96, 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_424:For_L56_C16", "label": "for line", "type": "for", "loc": [56, 60], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L55_C12", "vector": [6, 4, 0.7838, 0.0676, 4, 0.17, 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_424:If_L57_C20", "label": "if", "type": "if", "loc": [57, 59], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:For_L56_C16", "vector": [4, 5, 0.7838, 0.0405, 5, 0.98, 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_424:Assign_L58_C24", "label": "changed =", "type": "assigned_variable", "loc": [58, 58], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:If_L57_C20", "vector": [14, 6, 0.7838, 0.0135, 6, 0.68, 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_424:Assign_L59_C24", "label": "line = replace()", "type": "assigned_variable", "loc": [59, 59], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:If_L57_C20", "vector": [14, 6, 0.7973, 0.0135, 6, 0.68, 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_424:Expr_L60_C20", "label": "write()", "type": "expression", "loc": [60, 60], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:For_L56_C16", "vector": [8, 5, 0.8108, 0.0135, 5, 0.98, 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_424:Expr_L62_C15", "label": "close()", "type": "expression", "loc": [62, 62], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L55_C12", "vector": [8, 4, 0.8378, 0.0135, 4, 0.17, 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_424:Expr_L64_C12", "label": "close()", "type": "expression", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L53_C8", "vector": [8, 3, 0.8649, 0.0135, 3, 0.96, 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_424:If_L66_C8", "label": "if", "type": "if", "loc": [66, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L50_C4", "vector": [4, 2, 0.9122, 0.0541, 2, 0.13, 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_424:Expr_L67_C12", "label": "move()", "type": "expression", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:If_L66_C8", "vector": [8, 3, 0.9054, 0.0135, 3, 0.13, 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_424:Expr_L69_C12", "label": "remove()", "type": "expression", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:If_L66_C8", "vector": [8, 3, 0.9324, 0.0135, 3, 0.13, 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_424:Expr_L72_C8", "label": "remove()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L50_C4", "vector": [8, 2, 0.973, 0.0135, 2, 0.13, 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_424: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_424:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_424:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_424:For_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:For_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_424:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:For_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_424:If_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_424:If_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:If_L40_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_424:Expr_L41_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_424:If_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:If_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_424:Expr_L44_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_424:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_424:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_424:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_424:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_424:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_424:Assign_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L55_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_424:For_L56_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:For_L56_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_424:If_L57_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:If_L57_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_424:Assign_L58_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:If_L57_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_424:Assign_L59_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:For_L56_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_424:Expr_L60_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L55_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_424:Expr_L62_C15"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_424:Expr_L64_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_424:If_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_424:Expr_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_424:Expr_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_424:Try_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_424:Expr_L72_C8"}] |
#!/usr/bin/env python
from os import mkdir, makedirs, environ, chdir, getcwd, system, listdir
from os.path import join
from shutil import copy, copytree, move, rmtree
# Usage
def Usage():
return 'Usage: createversion.py <version>'
# Run Xcode
def RunXcode(project, target):
system('/usr/bin/xcodebuild -project "%s" -target "%s" -configuration Release clean build' % (project, target))
# Get version from args
import sys
if len(sys.argv) <= 1:
print Usage()
exit(1)
version = sys.argv[1]
# Change to root dir of Core Plot
chdir('..')
projectRoot = getcwd()
# Remove old docset files
frameworkDir = join(projectRoot, 'framework')
rmtree(join(frameworkDir, 'CorePlotDocs.docset'), True)
rmtree(join(frameworkDir, 'CorePlotTouchDocs.docset'), True)
# Remove old build directories
rmtree(join(frameworkDir, 'build'), True)
examples = listdir('examples')
for ex in examples:
exampleDir = join('examples', ex)
rmtree(join(exampleDir, 'build'), True)
# Make directory bundle
desktopDir = join(environ['HOME'], 'Desktop')
releaseRootDir = join(desktopDir, 'CorePlot_' + version)
mkdir(releaseRootDir)
# Copy license and READMEs
copy('License.txt', releaseRootDir)
copytree('READMEs', join(releaseRootDir, 'READMEs'))
# Add source code
sourceDir = join(releaseRootDir, 'Source')
copytree('framework', join(sourceDir, 'framework'))
copytree('examples', join(sourceDir, 'examples'))
copy('License.txt', sourceDir)
# Binaries
binariesDir = join(releaseRootDir, 'Binaries')
macosDir = join(binariesDir, 'MacOS')
iosDir = join(binariesDir, 'iOS')
makedirs(macosDir)
mkdir(iosDir)
# Build Mac Framework
chdir('framework')
RunXcode('CorePlot.xcodeproj', 'CorePlot')
macProductsDir = join(projectRoot, 'build/Release')
macFramework = join(macProductsDir, 'CorePlot.framework')
copytree(macFramework, join(macosDir, 'CorePlot.framework'))
# Build iOS SDK
RunXcode('CorePlot-CocoaTouch.xcodeproj', 'Build SDK')
sdkZipFile = join(desktopDir, 'CorePlot.zip')
move(sdkZipFile, iosDir)
# Build Docs
RunXcode('CorePlot.xcodeproj', 'Documentation')
RunXcode('CorePlot-CocoaTouch.xcodeproj', 'Documentation')
# Copy Docs
docDir = join(releaseRootDir, 'Documentation')
copytree(join(projectRoot, 'documentation'), docDir)
homeDir = environ['HOME']
docsetsDir = join(homeDir, 'Library/Developer/Shared/Documentation/DocSets')
copytree(join(docsetsDir, 'com.CorePlot.Framework.docset'), join(docDir, 'com.CorePlot.Framework.docset'))
copytree(join(docsetsDir, 'com.CorePlotTouch.Framework.docset'), join(docDir, 'com.CorePlotTouch.Framework.docset'))
| ajibawa-2023/Python-Code-Large/train/row_425 | 52 | 84 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_425:ImportFrom_L3_C0", "label": "from os import mkdir, makedirs, environ\u2026", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0357, 0.0119, 0, 0.66, 0.0, 688, 0, 7, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["mkdir", "makedirs", "environ", "chdir", "getcwd", "system", "listdir"], "rhs_call_name": "", "annotation": ""}, "snippet": "from os import mkdir, makedirs, environ, chdir, getcwd, system, listdir"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:ImportFrom_L4_C0", "label": "from os.path import join", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0476, 0.0119, 0, 0.66, 0.0222, 79, 0, 1, 0, 0, 79, 0, 0], "semantic": {"name": "os.path", "arg_names": [], "import_names": ["join"], "rhs_call_name": "", "annotation": ""}, "snippet": "from os.path import join"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:ImportFrom_L5_C0", "label": "from shutil import copy, copytree, move\u2026", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0595, 0.0119, 0, 0.66, 0.0444, 614, 0, 4, 0, 0, 614, 0, 0], "semantic": {"name": "shutil", "arg_names": [], "import_names": ["copy", "copytree", "move", "rmtree"], "rhs_call_name": "", "annotation": ""}, "snippet": "from shutil import copy, copytree, move, rmtree"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:FunctionDef_L8_C0", "label": "Usage", "type": "function", "loc": [8, 9], "level": 0, "parent": null, "vector": [2, 0, 0.1012, 0.0238, 0, 0.66, 0.0667, 208, 0, 0, 1, 0, 0, 0, 0], "semantic": {"name": "Usage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Usage():\n return 'Usage: createversion.py <version>'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Return_L9_C4", "label": "return", "type": "return", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_425:FunctionDef_L8_C0", "vector": [13, 1, 0.1071, 0.0119, 1, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'Usage: createversion.py <version>'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:FunctionDef_L12_C0", "label": "RunXcode", "type": "function", "loc": [12, 13], "level": 0, "parent": null, "vector": [2, 0, 0.1488, 0.0238, 0, 0.66, 0.0889, 67, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "RunXcode", "arg_names": ["project", "target"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def RunXcode(project, target):\n system('/usr/bin/xcodebuild -project \"%s\" -target \"%s\" -configuration Release clean build' % (project, target))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L13_C4", "label": "system()", "type": "expression", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_425:FunctionDef_L12_C0", "vector": [8, 1, 0.1548, 0.0119, 1, 0.93, 0.0, 856, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "system", "arg_names": [], "import_names": [], "rhs_call_name": "system", "annotation": ""}, "snippet": " system('/usr/bin/xcodebuild -project \"%s\" -target \"%s\" -configuration Release clean build' % (project, target))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Import_L17_C0", "label": "sys import sys", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.2024, 0.0119, 0, 0.66, 0.1111, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:If_L18_C0", "label": "if", "type": "if", "loc": [18, 20], "level": 0, "parent": null, "vector": [4, 0, 0.2262, 0.0357, 0, 0.66, 0.1333, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if len(sys.argv) <= 1: \n print(Usage())\n exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L19_C4", "label": "print()", "type": "expression", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_425:If_L18_C0", "vector": [8, 1, 0.2262, 0.0119, 1, 0.36, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(Usage())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L20_C4", "label": "exit()", "type": "expression", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_425:If_L18_C0", "vector": [8, 1, 0.2381, 0.0119, 1, 0.36, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Assign_L21_C0", "label": "version =", "type": "assigned_variable", "loc": [21, 21], "level": 0, "parent": null, "vector": [14, 0, 0.25, 0.0119, 0, 0.66, 0.1556, 623, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "version = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L24_C0", "label": "chdir()", "type": "expression", "loc": [24, 24], "level": 0, "parent": null, "vector": [8, 0, 0.2857, 0.0119, 0, 0.66, 0.1778, 122, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "chdir", "arg_names": [], "import_names": [], "rhs_call_name": "chdir", "annotation": ""}, "snippet": "chdir('..')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Assign_L25_C0", "label": "projectRoot = getcwd()", "type": "assigned_variable", "loc": [25, 25], "level": 0, "parent": null, "vector": [14, 0, 0.2976, 0.0119, 0, 0.66, 0.2, 554, 3, 0, 0, 0, 320, 10, 1], "semantic": {"name": "projectRoot", "arg_names": [], "import_names": [], "rhs_call_name": "getcwd", "annotation": ""}, "snippet": "projectRoot = getcwd()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Assign_L28_C0", "label": "frameworkDir = join()", "type": "assigned_variable", "loc": [28, 28], "level": 0, "parent": null, "vector": [14, 0, 0.3333, 0.0119, 0, 0.66, 0.2222, 451, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "frameworkDir", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "frameworkDir = join(projectRoot, 'framework')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L29_C0", "label": "rmtree()", "type": "expression", "loc": [29, 29], "level": 0, "parent": null, "vector": [8, 0, 0.3452, 0.0119, 0, 0.66, 0.2444, 317, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "rmtree", "arg_names": [], "import_names": [], "rhs_call_name": "rmtree", "annotation": ""}, "snippet": "rmtree(join(frameworkDir, 'CorePlotDocs.docset'), True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L30_C0", "label": "rmtree()", "type": "expression", "loc": [30, 30], "level": 0, "parent": null, "vector": [8, 0, 0.3571, 0.0119, 0, 0.66, 0.2667, 317, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "rmtree", "arg_names": [], "import_names": [], "rhs_call_name": "rmtree", "annotation": ""}, "snippet": "rmtree(join(frameworkDir, 'CorePlotTouchDocs.docset'), True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L33_C0", "label": "rmtree()", "type": "expression", "loc": [33, 33], "level": 0, "parent": null, "vector": [8, 0, 0.3929, 0.0119, 0, 0.66, 0.2889, 317, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "rmtree", "arg_names": [], "import_names": [], "rhs_call_name": "rmtree", "annotation": ""}, "snippet": "rmtree(join(frameworkDir, 'build'), True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Assign_L34_C0", "label": "examples = listdir()", "type": "assigned_variable", "loc": [34, 34], "level": 0, "parent": null, "vector": [14, 0, 0.4048, 0.0119, 0, 0.66, 0.3111, 163, 3, 1, 0, 0, 551, 10, 1], "semantic": {"name": "examples", "arg_names": [], "import_names": [], "rhs_call_name": "listdir", "annotation": ""}, "snippet": "examples = listdir('examples')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:For_L35_C0", "label": "for ex", "type": "for", "loc": [35, 37], "level": 0, "parent": null, "vector": [6, 0, 0.4286, 0.0357, 0, 0.66, 0.3333, 212, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "ex", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for ex in examples:\n exampleDir = join('examples', ex)\n rmtree(join(exampleDir, 'build'), True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Assign_L36_C4", "label": "exampleDir = join()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_425:For_L35_C0", "vector": [14, 1, 0.4286, 0.0119, 1, 0.74, 0.0, 764, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "exampleDir", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " exampleDir = join('examples', ex)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L37_C4", "label": "rmtree()", "type": "expression", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_425:For_L35_C0", "vector": [8, 1, 0.4405, 0.0119, 1, 0.74, 1.0, 317, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "rmtree", "arg_names": [], "import_names": [], "rhs_call_name": "rmtree", "annotation": ""}, "snippet": " rmtree(join(exampleDir, 'build'), True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Assign_L40_C0", "label": "desktopDir = join()", "type": "assigned_variable", "loc": [40, 40], "level": 0, "parent": null, "vector": [14, 0, 0.4762, 0.0119, 0, 0.66, 0.3556, 470, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "desktopDir", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "desktopDir = join(environ['HOME'], 'Desktop')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Assign_L41_C0", "label": "releaseRootDir = join()", "type": "assigned_variable", "loc": [41, 41], "level": 0, "parent": null, "vector": [14, 0, 0.4881, 0.0119, 0, 0.66, 0.3778, 168, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "releaseRootDir", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "releaseRootDir = join(desktopDir, 'CorePlot_' + version)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L42_C0", "label": "mkdir()", "type": "expression", "loc": [42, 42], "level": 0, "parent": null, "vector": [8, 0, 0.5, 0.0119, 0, 0.66, 0.4, 853, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "mkdir", "arg_names": [], "import_names": [], "rhs_call_name": "mkdir", "annotation": ""}, "snippet": "mkdir(releaseRootDir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L45_C0", "label": "copy()", "type": "expression", "loc": [45, 45], "level": 0, "parent": null, "vector": [8, 0, 0.5357, 0.0119, 0, 0.66, 0.4222, 739, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "copy", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": "copy('License.txt', releaseRootDir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L46_C0", "label": "copytree()", "type": "expression", "loc": [46, 46], "level": 0, "parent": null, "vector": [8, 0, 0.5476, 0.0119, 0, 0.66, 0.4444, 739, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "copytree", "arg_names": [], "import_names": [], "rhs_call_name": "copytree", "annotation": ""}, "snippet": "copytree('READMEs', join(releaseRootDir, 'READMEs'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Assign_L49_C0", "label": "sourceDir = join()", "type": "assigned_variable", "loc": [49, 49], "level": 0, "parent": null, "vector": [14, 0, 0.5833, 0.0119, 0, 0.66, 0.4667, 169, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "sourceDir", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "sourceDir = join(releaseRootDir, 'Source')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L50_C0", "label": "copytree()", "type": "expression", "loc": [50, 50], "level": 0, "parent": null, "vector": [8, 0, 0.5952, 0.0119, 0, 0.66, 0.4889, 739, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "copytree", "arg_names": [], "import_names": [], "rhs_call_name": "copytree", "annotation": ""}, "snippet": "copytree('framework', join(sourceDir, 'framework'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L51_C0", "label": "copytree()", "type": "expression", "loc": [51, 51], "level": 0, "parent": null, "vector": [8, 0, 0.6071, 0.0119, 0, 0.66, 0.5111, 739, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "copytree", "arg_names": [], "import_names": [], "rhs_call_name": "copytree", "annotation": ""}, "snippet": "copytree('examples', join(sourceDir, 'examples'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L52_C0", "label": "copy()", "type": "expression", "loc": [52, 52], "level": 0, "parent": null, "vector": [8, 0, 0.619, 0.0119, 0, 0.66, 0.5333, 739, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "copy", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": "copy('License.txt', sourceDir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Assign_L55_C0", "label": "binariesDir = join()", "type": "assigned_variable", "loc": [55, 55], "level": 0, "parent": null, "vector": [14, 0, 0.6548, 0.0119, 0, 0.66, 0.5556, 430, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "binariesDir", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "binariesDir = join(releaseRootDir, 'Binaries')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Assign_L56_C0", "label": "macosDir = join()", "type": "assigned_variable", "loc": [56, 56], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.0119, 0, 0.66, 0.5778, 453, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "macosDir", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "macosDir = join(binariesDir, 'MacOS')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Assign_L57_C0", "label": "iosDir = join()", "type": "assigned_variable", "loc": [57, 57], "level": 0, "parent": null, "vector": [14, 0, 0.6786, 0.0119, 0, 0.66, 0.6, 272, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "iosDir", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "iosDir = join(binariesDir, 'iOS')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L58_C0", "label": "makedirs()", "type": "expression", "loc": [58, 58], "level": 0, "parent": null, "vector": [8, 0, 0.6905, 0.0119, 0, 0.66, 0.6222, 349, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "makedirs", "arg_names": [], "import_names": [], "rhs_call_name": "makedirs", "annotation": ""}, "snippet": "makedirs(macosDir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L59_C0", "label": "mkdir()", "type": "expression", "loc": [59, 59], "level": 0, "parent": null, "vector": [8, 0, 0.7024, 0.0119, 0, 0.66, 0.6444, 853, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "mkdir", "arg_names": [], "import_names": [], "rhs_call_name": "mkdir", "annotation": ""}, "snippet": "mkdir(iosDir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L62_C0", "label": "chdir()", "type": "expression", "loc": [62, 62], "level": 0, "parent": null, "vector": [8, 0, 0.7381, 0.0119, 0, 0.66, 0.6667, 122, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "chdir", "arg_names": [], "import_names": [], "rhs_call_name": "chdir", "annotation": ""}, "snippet": "chdir('framework')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L63_C0", "label": "RunXcode()", "type": "expression", "loc": [63, 63], "level": 0, "parent": null, "vector": [8, 0, 0.75, 0.0119, 0, 0.66, 0.6889, 67, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "RunXcode", "arg_names": [], "import_names": [], "rhs_call_name": "RunXcode", "annotation": ""}, "snippet": "RunXcode('CorePlot.xcodeproj', 'CorePlot')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Assign_L64_C0", "label": "macProductsDir = join()", "type": "assigned_variable", "loc": [64, 64], "level": 0, "parent": null, "vector": [14, 0, 0.7619, 0.0119, 0, 0.66, 0.7111, 786, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "macProductsDir", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "macProductsDir = join(projectRoot, 'build/Release')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Assign_L65_C0", "label": "macFramework = join()", "type": "assigned_variable", "loc": [65, 65], "level": 0, "parent": null, "vector": [14, 0, 0.7738, 0.0119, 0, 0.66, 0.7333, 126, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "macFramework", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "macFramework = join(macProductsDir, 'CorePlot.framework')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L66_C0", "label": "copytree()", "type": "expression", "loc": [66, 66], "level": 0, "parent": null, "vector": [8, 0, 0.7857, 0.0119, 0, 0.66, 0.7556, 739, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "copytree", "arg_names": [], "import_names": [], "rhs_call_name": "copytree", "annotation": ""}, "snippet": "copytree(macFramework, join(macosDir, 'CorePlot.framework'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L69_C0", "label": "RunXcode()", "type": "expression", "loc": [69, 69], "level": 0, "parent": null, "vector": [8, 0, 0.8214, 0.0119, 0, 0.66, 0.7778, 67, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "RunXcode", "arg_names": [], "import_names": [], "rhs_call_name": "RunXcode", "annotation": ""}, "snippet": "RunXcode('CorePlot-CocoaTouch.xcodeproj', 'Build SDK')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Assign_L70_C0", "label": "sdkZipFile = join()", "type": "assigned_variable", "loc": [70, 70], "level": 0, "parent": null, "vector": [14, 0, 0.8333, 0.0119, 0, 0.66, 0.8, 355, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "sdkZipFile", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "sdkZipFile = join(desktopDir, 'CorePlot.zip')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L71_C0", "label": "move()", "type": "expression", "loc": [71, 71], "level": 0, "parent": null, "vector": [8, 0, 0.8452, 0.0119, 0, 0.66, 0.8222, 856, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "move", "arg_names": [], "import_names": [], "rhs_call_name": "move", "annotation": ""}, "snippet": "move(sdkZipFile, iosDir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L74_C0", "label": "RunXcode()", "type": "expression", "loc": [74, 74], "level": 0, "parent": null, "vector": [8, 0, 0.881, 0.0119, 0, 0.66, 0.8444, 67, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "RunXcode", "arg_names": [], "import_names": [], "rhs_call_name": "RunXcode", "annotation": ""}, "snippet": "RunXcode('CorePlot.xcodeproj', 'Documentation')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L75_C0", "label": "RunXcode()", "type": "expression", "loc": [75, 75], "level": 0, "parent": null, "vector": [8, 0, 0.8929, 0.0119, 0, 0.66, 0.8667, 67, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "RunXcode", "arg_names": [], "import_names": [], "rhs_call_name": "RunXcode", "annotation": ""}, "snippet": "RunXcode('CorePlot-CocoaTouch.xcodeproj', 'Documentation')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Assign_L78_C0", "label": "docDir = join()", "type": "assigned_variable", "loc": [78, 78], "level": 0, "parent": null, "vector": [14, 0, 0.9286, 0.0119, 0, 0.66, 0.8889, 127, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "docDir", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "docDir = join(releaseRootDir, 'Documentation')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L79_C0", "label": "copytree()", "type": "expression", "loc": [79, 79], "level": 0, "parent": null, "vector": [8, 0, 0.9405, 0.0119, 0, 0.66, 0.9111, 739, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "copytree", "arg_names": [], "import_names": [], "rhs_call_name": "copytree", "annotation": ""}, "snippet": "copytree(join(projectRoot, 'documentation'), docDir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Assign_L80_C0", "label": "homeDir =", "type": "assigned_variable", "loc": [80, 80], "level": 0, "parent": null, "vector": [14, 0, 0.9524, 0.0119, 0, 0.66, 0.9333, 866, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "homeDir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "homeDir = environ['HOME']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Assign_L81_C0", "label": "docsetsDir = join()", "type": "assigned_variable", "loc": [81, 81], "level": 0, "parent": null, "vector": [14, 0, 0.9643, 0.0119, 0, 0.66, 0.9556, 781, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "docsetsDir", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "docsetsDir = join(homeDir, 'Library/Developer/Shared/Documentation/DocSets')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L82_C0", "label": "copytree()", "type": "expression", "loc": [82, 82], "level": 0, "parent": null, "vector": [8, 0, 0.9762, 0.0119, 0, 0.66, 0.9778, 739, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "copytree", "arg_names": [], "import_names": [], "rhs_call_name": "copytree", "annotation": ""}, "snippet": "copytree(join(docsetsDir, 'com.CorePlot.Framework.docset'), join(docDir, 'com.CorePlot.Framework.docset'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L83_C0", "label": "copytree()", "type": "expression", "loc": [83, 83], "level": 0, "parent": null, "vector": [8, 0, 0.9881, 0.0119, 0, 0.66, 1.0, 739, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "copytree", "arg_names": [], "import_names": [], "rhs_call_name": "copytree", "annotation": ""}, "snippet": "copytree(join(docsetsDir, 'com.CorePlotTouch.Framework.docset'), join(docDir, 'com.CorePlotTouch.Framework.docset'))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_425:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_425:Return_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_425:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_425:If_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_425:If_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_425:For_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_425:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_425:For_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_425:Expr_L37_C4"}] |
dataTypes = ["CPUndefinedDataType", "CPIntegerDataType", "CPUnsignedIntegerDataType", "CPFloatingPointDataType", "CPComplexFloatingPointDataType", "CPDecimalDataType"]
types = { "CPUndefinedDataType" : [],
"CPIntegerDataType" : ["int8_t", "int16_t", "int32_t", "int64_t"],
"CPUnsignedIntegerDataType" : ["uint8_t", "uint16_t", "uint32_t", "uint64_t"],
"CPFloatingPointDataType" : ["float", "double"],
"CPComplexFloatingPointDataType" : ["float complex", "double complex"],
"CPDecimalDataType" : ["NSDecimal"] }
nsnumber_factory = { "int8_t" : "Char",
"int16_t" : "Short",
"int32_t" : "Long",
"int64_t" : "LongLong",
"uint8_t" : "UnsignedChar",
"uint16_t" : "UnsignedShort",
"uint32_t" : "UnsignedLong",
"uint64_t" : "UnsignedLongLong",
"float" : "Float",
"double" : "Double",
"float complex" : "Float",
"double complex" : "Double",
"NSDecimal" : "Decimal"
}
nsnumber_methods = { "int8_t" : "char",
"int16_t" : "short",
"int32_t" : "long",
"int64_t" : "longLong",
"uint8_t" : "unsignedChar",
"uint16_t" : "unsignedShort",
"uint32_t" : "unsignedLong",
"uint64_t" : "unsignedLongLong",
"float" : "float",
"double" : "double",
"float complex" : "float",
"double complex" : "double",
"NSDecimal" : "decimal"
}
null_values = { "int8_t" : "0",
"int16_t" : "0",
"int32_t" : "0",
"int64_t" : "0",
"uint8_t" : "0",
"uint16_t" : "0",
"uint32_t" : "0",
"uint64_t" : "0",
"float" : "NAN",
"double" : "NAN",
"float complex" : "NAN",
"double complex" : "NAN",
"NSDecimal" : "CPDecimalNaN()"
}
print "[CPNumericData sampleValue:]"
print ""
print "switch ( self.dataTypeFormat ) {"
for dt in dataTypes:
print "\tcase %s:" % dt
if ( len(types[dt]) == 0 ):
print '\t\t[NSException raise:NSInvalidArgumentException format:@"Unsupported data type (%s)"];' % (dt)
else:
print "\t\tswitch ( self.sampleBytes ) {"
for t in types[dt]:
print "\t\t\tcase sizeof(%s):" % t
if ( t == "NSDecimal" ):
number_class = "NSDecimalNumber"
number_method = "decimalNumber"
else:
number_class = "NSNumber"
number_method = "number"
print "\t\t\t\tresult = [%s %sWith%s:*(%s *)[self samplePointer:sample]];" % (number_class, number_method, nsnumber_factory[t], t)
print "\t\t\t\tbreak;"
print "\t\t}"
print "\t\tbreak;"
print "}"
print "\n\n"
print "---------------"
print "\n\n"
print "[CPNumericData dataFromArray:dataType:]"
print ""
print "switch ( newDataType.dataTypeFormat ) {"
for dt in dataTypes:
print "\tcase %s:" % dt
if ( len(types[dt]) == 0 ):
print "\t\t// Unsupported"
else:
print "\t\tswitch ( newDataType.sampleBytes ) {"
for t in types[dt]:
print "\t\t\tcase sizeof(%s): {" % t
print "\t\t\t\t%s *toBytes = (%s *)sampleData.mutableBytes;" % (t, t)
print "\t\t\t\tfor ( id sample in newData ) {"
print "\t\t\t\t\tif ( [sample respondsToSelector:@selector(%sValue)] ) {" % nsnumber_methods[t]
print "\t\t\t\t\t\t*toBytes++ = (%s)[(NSNumber *)sample %sValue];" % (t, nsnumber_methods[t])
print "\t\t\t\t\t}"
print "\t\t\t\t\telse {"
print "\t\t\t\t\t\t*toBytes++ = %s;" % null_values[t]
print "\t\t\t\t\t}"
print "\t\t\t\t}"
print "\t\t\t}"
print "\t\t\t\tbreak;"
print "\t\t}"
print "\t\tbreak;"
print "}"
print "\n\n"
print "---------------"
print "\n\n"
print "[CPNumericData convertData:dataType:toData:dataType:]"
print ""
print "switch ( sourceDataType->dataTypeFormat ) {"
for dt in dataTypes:
print "\tcase %s:" % dt
if ( len(types[dt]) > 0 ):
print "\t\tswitch ( sourceDataType->sampleBytes ) {"
for t in types[dt]:
print "\t\t\tcase sizeof(%s):" % t
print "\t\t\t\tswitch ( destDataType->dataTypeFormat ) {"
for ndt in dataTypes:
print "\t\t\t\t\tcase %s:" % ndt
if ( len(types[ndt]) > 0 ):
print "\t\t\t\t\t\tswitch ( destDataType->sampleBytes ) {"
for nt in types[ndt]:
print "\t\t\t\t\t\t\tcase sizeof(%s): { // %s -> %s" % (nt, t, nt)
if ( t == nt ):
print "\t\t\t\t\t\t\t\t\tmemcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(%s));" % t
else:
print "\t\t\t\t\t\t\t\t\tconst %s *fromBytes = (%s *)sourceData.bytes;" % (t, t)
print "\t\t\t\t\t\t\t\t\tconst %s *lastSample = fromBytes + sampleCount;" % t
print "\t\t\t\t\t\t\t\t\t%s *toBytes = (%s *)destData.mutableBytes;" % (nt, nt)
if ( t == "NSDecimal" ):
print "\t\t\t\t\t\t\t\t\twhile ( fromBytes < lastSample ) *toBytes++ = CPDecimal%sValue(*fromBytes++);" % nsnumber_factory[nt]
elif ( nt == "NSDecimal" ):
print "\t\t\t\t\t\t\t\t\twhile ( fromBytes < lastSample ) *toBytes++ = CPDecimalFrom%s(*fromBytes++);" % nsnumber_factory[t]
else:
print "\t\t\t\t\t\t\t\t\twhile ( fromBytes < lastSample ) *toBytes++ = (%s)*fromBytes++;" % nt
print "\t\t\t\t\t\t\t\t}"
print "\t\t\t\t\t\t\t\tbreak;"
print "\t\t\t\t\t\t}"
print "\t\t\t\t\t\tbreak;"
print "\t\t\t\t}"
print "\t\t\t\tbreak;"
print "\t\t}"
print "\t\tbreak;"
print "}"
| ajibawa-2023/Python-Code-Large/train/row_426 | 90 | 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_426:Assign_L1_C0", "label": "dataTypes =", "type": "assigned_variable", "loc": [1, 1], "level": 0, "parent": null, "vector": [14, 0, 0.0068, 0.0068, 0, 0.66, 0.0, 302, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "dataTypes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "dataTypes = [\"CPUndefinedDataType\", \"CPIntegerDataType\", \"CPUnsignedIntegerDataType\", \"CPFloatingPointDataType\", \"CPComplexFloatingPointDataType\", \"CPDecimalDataType\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Assign_L3_C0", "label": "types =", "type": "assigned_variable", "loc": [3, 8], "level": 0, "parent": null, "vector": [14, 0, 0.0372, 0.0405, 0, 0.66, 0.04, 209, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "types", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "types = { \"CPUndefinedDataType\" : [],\n \"CPIntegerDataType\" : [\"int8_t\", \"int16_t\", \"int32_t\", \"int64_t\"],\n \"CPUnsignedIntegerDataType\" : [\"uint8_t\", \"uint16_t\", \"uint32_t\", \"uint64_t\"],\n \"CPFloatingPointDataType\" : [\"float\", \"double\"],\n \"CPComplexFloatingPointDataType\" : [\"float complex\", \"double complex\"],\n \"CPDecimalDataType\" : [\"NSDecimal\"] }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Assign_L10_C0", "label": "nsnumber_factory =", "type": "assigned_variable", "loc": [10, 23], "level": 0, "parent": null, "vector": [14, 0, 0.1115, 0.0946, 0, 0.66, 0.08, 485, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "nsnumber_factory", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "nsnumber_factory = { \"int8_t\" : \"Char\",\n\t\t\t\t\t\"int16_t\" : \"Short\",\n\t\t\t\t\t\"int32_t\" : \"Long\",\n\t\t\t\t\t\"int64_t\" : \"LongLong\",\n\t\t\t\t\t\"uint8_t\" : \"UnsignedChar\",\n\t\t\t\t \"uint16_t\" : \"UnsignedShort\",\n\t\t\t\t \"uint32_t\" : \"UnsignedLong\",\n\t\t\t\t \"uint64_t\" : \"UnsignedLongLong\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Assign_L25_C0", "label": "nsnumber_methods =", "type": "assigned_variable", "loc": [25, 38], "level": 0, "parent": null, "vector": [14, 0, 0.2128, 0.0946, 0, 0.66, 0.12, 222, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "nsnumber_methods", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "nsnumber_methods = { \"int8_t\" : \"char\",\n\t\t\t\t\t\"int16_t\" : \"short\",\n\t\t\t\t\t\"int32_t\" : \"long\",\n\t\t\t\t\t\"int64_t\" : \"longLong\",\n\t\t\t\t\t\"uint8_t\" : \"unsignedChar\",\n\t\t\t\t \"uint16_t\" : \"unsignedShort\",\n\t\t\t\t \"uint32_t\" : \"unsignedLong\",\n\t\t\t\t \"uint64_t\" : \"unsignedLongLong\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Assign_L40_C0", "label": "null_values =", "type": "assigned_variable", "loc": [40, 53], "level": 0, "parent": null, "vector": [14, 0, 0.3142, 0.0946, 0, 0.66, 0.16, 317, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "null_values", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "null_values = { \"int8_t\" : \"0\",\n\t\t\t \"int16_t\" : \"0\",\n\t\t\t \"int32_t\" : \"0\",\n\t\t\t \"int64_t\" : \"0\",\n\t\t\t \"uint8_t\" : \"0\",\n\t\t\t \"uint16_t\" : \"0\",\n\t\t\t \"uint32_t\" : \"0\",\n\t\t\t \"uint64_t\" : \"0\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L55_C0", "label": "print()", "type": "expression", "loc": [55, 55], "level": 0, "parent": null, "vector": [8, 0, 0.3716, 0.0068, 0, 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(\"[CPNumericData sampleValue:]\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L56_C0", "label": "print()", "type": "expression", "loc": [56, 56], "level": 0, "parent": null, "vector": [8, 0, 0.3784, 0.0068, 0, 0.66, 0.24, 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_426:Expr_L57_C0", "label": "print()", "type": "expression", "loc": [57, 57], "level": 0, "parent": null, "vector": [8, 0, 0.3851, 0.0068, 0, 0.66, 0.28, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"switch ( self.dataTypeFormat ) {\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:For_L58_C0", "label": "for dt", "type": "for", "loc": [58, 75], "level": 0, "parent": null, "vector": [6, 0, 0.4493, 0.1216, 0, 0.66, 0.32, 455, 2, 0, 0, 0, 0, 0, 9], "semantic": {"name": "dt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for dt in dataTypes:\n print(\"\\tcase %s:\" % dt)\n if ( len(types[dt]) == 0 ):\n print('\\t\\t[NSException raise:NSInvalidArgumentException format:@\"Unsupported data type (%s)\"];' % (dt))\n else:\n print(\"\\t\\tswitch ( self.sampleBytes ) {\")\n for t in types[dt]:\n print(\"\\t\\t\\tcase sizeof(%s):\" % t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L59_C4", "label": "print()", "type": "expression", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L58_C0", "vector": [8, 1, 0.3986, 0.0068, 1, 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(\"\\tcase %s:\" % dt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:If_L60_C4", "label": "if", "type": "if", "loc": [60, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L58_C0", "vector": [4, 1, 0.4527, 0.1014, 1, 0.9, 0.5, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ( len(types[dt]) == 0 ):\n print('\\t\\t[NSException raise:NSInvalidArgumentException format:@\"Unsupported data type (%s)\"];' % (dt))\n else:\n print(\"\\t\\tswitch ( self.sampleBytes ) {\")\n for t in types[dt]:\n print(\"\\t\\t\\tcase sizeof(%s):\" % t)\n if ( t == \"NSDecimal\" ):\n number_class = \"NSDecimalNumber\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L61_C8", "label": "print()", "type": "expression", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L60_C4", "vector": [8, 2, 0.4122, 0.0068, 2, 0.0, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\t\\t[NSException raise:NSInvalidArgumentException format:@\"Unsupported data type (%s)\"];' % (dt))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L63_C8", "label": "print()", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L60_C4", "vector": [8, 2, 0.4257, 0.0068, 2, 0.0, 0.3333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\tswitch ( self.sampleBytes ) {\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:For_L64_C8", "label": "for t", "type": "for", "loc": [64, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L60_C4", "vector": [6, 2, 0.4628, 0.0676, 2, 0.0, 0.6667, 15, 6, 0, 0, 0, 0, 0, 3], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for t in types[dt]:\n print(\"\\t\\t\\tcase sizeof(%s):\" % t)\n if ( t == \"NSDecimal\" ):\n number_class = \"NSDecimalNumber\"\n number_method = \"decimalNumber\"\n else:\n number_class = \"NSNumber\"\n number_method = \"number\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L65_C12", "label": "print()", "type": "expression", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L64_C8", "vector": [8, 3, 0.4392, 0.0068, 3, 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(\"\\t\\t\\tcase sizeof(%s):\" % t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:If_L66_C12", "label": "if", "type": "if", "loc": [66, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L64_C8", "vector": [4, 3, 0.4628, 0.0405, 3, 0.96, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ( t == \"NSDecimal\" ):\n number_class = \"NSDecimalNumber\"\n number_method = \"decimalNumber\"\n else:\n number_class = \"NSNumber\"\n number_method = \"number\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Assign_L67_C16", "label": "number_class =", "type": "assigned_variable", "loc": [67, 67], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L66_C12", "vector": [14, 4, 0.4527, 0.0068, 4, 0.46, 0.0, 731, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "number_class", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " number_class = \"NSDecimalNumber\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Assign_L68_C16", "label": "number_method =", "type": "assigned_variable", "loc": [68, 68], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L66_C12", "vector": [14, 4, 0.4595, 0.0068, 4, 0.46, 0.3333, 245, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "number_method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " number_method = \"decimalNumber\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Assign_L70_C16", "label": "number_class =", "type": "assigned_variable", "loc": [70, 70], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L66_C12", "vector": [14, 4, 0.473, 0.0068, 4, 0.46, 0.6667, 731, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "number_class", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " number_class = \"NSNumber\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Assign_L71_C16", "label": "number_method =", "type": "assigned_variable", "loc": [71, 71], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L66_C12", "vector": [14, 4, 0.4797, 0.0068, 4, 0.46, 1.0, 245, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "number_method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " number_method = \"number\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L72_C12", "label": "print()", "type": "expression", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L64_C8", "vector": [8, 3, 0.4865, 0.0068, 3, 0.96, 0.6667, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\tresult = [%s %sWith%s:*(%s *)[self samplePointer:sample]];\" % (number_class, number_method, nsnumber_factory[t], t))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L73_C12", "label": "print()", "type": "expression", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L64_C8", "vector": [8, 3, 0.4932, 0.0068, 3, 0.96, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\tbreak;\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L74_C8", "label": "print()", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L60_C4", "vector": [8, 2, 0.5, 0.0068, 2, 0.0, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t}\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L75_C4", "label": "print()", "type": "expression", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L58_C0", "vector": [8, 1, 0.5068, 0.0068, 1, 0.9, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\tbreak;\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L76_C0", "label": "print()", "type": "expression", "loc": [76, 76], "level": 0, "parent": null, "vector": [8, 0, 0.5135, 0.0068, 0, 0.66, 0.36, 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_426:Expr_L78_C0", "label": "print()", "type": "expression", "loc": [78, 78], "level": 0, "parent": null, "vector": [8, 0, 0.527, 0.0068, 0, 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(\"\\n\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L79_C0", "label": "print()", "type": "expression", "loc": [79, 79], "level": 0, "parent": null, "vector": [8, 0, 0.5338, 0.0068, 0, 0.66, 0.44, 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_426:Expr_L80_C0", "label": "print()", "type": "expression", "loc": [80, 80], "level": 0, "parent": null, "vector": [8, 0, 0.5405, 0.0068, 0, 0.66, 0.48, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"\\n\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L82_C0", "label": "print()", "type": "expression", "loc": [82, 82], "level": 0, "parent": null, "vector": [8, 0, 0.5541, 0.0068, 0, 0.66, 0.52, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"[CPNumericData dataFromArray:dataType:]\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L83_C0", "label": "print()", "type": "expression", "loc": [83, 83], "level": 0, "parent": null, "vector": [8, 0, 0.5608, 0.0068, 0, 0.66, 0.56, 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_426:Expr_L84_C0", "label": "print()", "type": "expression", "loc": [84, 84], "level": 0, "parent": null, "vector": [8, 0, 0.5676, 0.0068, 0, 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(\"switch ( newDataType.dataTypeFormat ) {\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:For_L85_C0", "label": "for dt", "type": "for", "loc": [85, 105], "level": 0, "parent": null, "vector": [6, 0, 0.6419, 0.1419, 0, 0.66, 0.64, 455, 2, 0, 0, 0, 0, 0, 18], "semantic": {"name": "dt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for dt in dataTypes:\n print(\"\\tcase %s:\" % dt)\n if ( len(types[dt]) == 0 ):\n print(\"\\t\\t// Unsupported\")\n else:\n print(\"\\t\\tswitch ( newDataType.sampleBytes ) {\")\n for t in types[dt]:\n print(\"\\t\\t\\tcase sizeof(%s): {\" % t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L86_C4", "label": "print()", "type": "expression", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L85_C0", "vector": [8, 1, 0.5811, 0.0068, 1, 0.48, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\tcase %s:\" % dt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:If_L87_C4", "label": "if", "type": "if", "loc": [87, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L85_C0", "vector": [4, 1, 0.6453, 0.1216, 1, 0.48, 0.5, 0, 0, 0, 0, 0, 0, 0, 16], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ( len(types[dt]) == 0 ):\n print(\"\\t\\t// Unsupported\")\n else:\n print(\"\\t\\tswitch ( newDataType.sampleBytes ) {\")\n for t in types[dt]:\n print(\"\\t\\t\\tcase sizeof(%s): {\" % t)\n print(\"\\t\\t\\t\\t%s *toBytes = (%s *)sampleData.mutableBytes;\" % (t, t))\n print(\"\\t\\t\\t\\tfor ( id sample in newData ) {\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L88_C8", "label": "print()", "type": "expression", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L87_C4", "vector": [8, 2, 0.5946, 0.0068, 2, 0.43, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t// Unsupported\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L90_C8", "label": "print()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L87_C4", "vector": [8, 2, 0.6081, 0.0068, 2, 0.43, 0.3333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\tswitch ( newDataType.sampleBytes ) {\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "label": "for t", "type": "for", "loc": [91, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L87_C4", "vector": [6, 2, 0.6554, 0.0878, 2, 0.43, 0.6667, 15, 6, 0, 0, 0, 0, 0, 12], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for t in types[dt]:\n print(\"\\t\\t\\tcase sizeof(%s): {\" % t)\n print(\"\\t\\t\\t\\t%s *toBytes = (%s *)sampleData.mutableBytes;\" % (t, t))\n print(\"\\t\\t\\t\\tfor ( id sample in newData ) {\")\n print(\"\\t\\t\\t\\t\\tif ( [sample respondsToSelector:@selector(%sValue)] ) {\" % nsnumber_methods[t])\n print(\"\\t\\t\\t\\t\\t\\t*toBytes++ = (%s)[(NSNumber *)sample %sValue];\" % (t, nsnumber_methods[t]))\n print(\"\\t\\t\\t\\t\\t}\")\n print(\"\\t\\t\\t\\t\\telse {\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L92_C12", "label": "print()", "type": "expression", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "vector": [8, 3, 0.6216, 0.0068, 3, 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(\"\\t\\t\\tcase sizeof(%s): {\" % t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L93_C12", "label": "print()", "type": "expression", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "vector": [8, 3, 0.6284, 0.0068, 3, 0.55, 0.0909, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\t%s *toBytes = (%s *)sampleData.mutableBytes;\" % (t, t))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L94_C12", "label": "print()", "type": "expression", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "vector": [8, 3, 0.6351, 0.0068, 3, 0.55, 0.1818, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\tfor ( id sample in newData ) {\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L95_C12", "label": "print()", "type": "expression", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "vector": [8, 3, 0.6419, 0.0068, 3, 0.55, 0.2727, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\t\\tif ( [sample respondsToSelector:@selector(%sValue)] ) {\" % nsnumber_methods[t])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L96_C12", "label": "print()", "type": "expression", "loc": [96, 96], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "vector": [8, 3, 0.6486, 0.0068, 3, 0.55, 0.3636, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\t\\t\\t*toBytes++ = (%s)[(NSNumber *)sample %sValue];\" % (t, nsnumber_methods[t]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L97_C12", "label": "print()", "type": "expression", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "vector": [8, 3, 0.6554, 0.0068, 3, 0.55, 0.4545, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\t\\t}\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L98_C12", "label": "print()", "type": "expression", "loc": [98, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "vector": [8, 3, 0.6622, 0.0068, 3, 0.55, 0.5455, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\t\\telse {\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L99_C12", "label": "print()", "type": "expression", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "vector": [8, 3, 0.6689, 0.0068, 3, 0.55, 0.6364, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\t\\t\\t*toBytes++ = %s;\" % null_values[t])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L100_C12", "label": "print()", "type": "expression", "loc": [100, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "vector": [8, 3, 0.6757, 0.0068, 3, 0.55, 0.7273, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\t\\t}\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L101_C12", "label": "print()", "type": "expression", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "vector": [8, 3, 0.6824, 0.0068, 3, 0.55, 0.8182, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\t}\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L102_C12", "label": "print()", "type": "expression", "loc": [102, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "vector": [8, 3, 0.6892, 0.0068, 3, 0.55, 0.9091, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t}\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L103_C12", "label": "print()", "type": "expression", "loc": [103, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "vector": [8, 3, 0.6959, 0.0068, 3, 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(\"\\t\\t\\t\\tbreak;\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L104_C8", "label": "print()", "type": "expression", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L87_C4", "vector": [8, 2, 0.7027, 0.0068, 2, 0.43, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t}\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L105_C4", "label": "print()", "type": "expression", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L85_C0", "vector": [8, 1, 0.7095, 0.0068, 1, 0.48, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\tbreak;\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L106_C0", "label": "print()", "type": "expression", "loc": [106, 106], "level": 0, "parent": null, "vector": [8, 0, 0.7162, 0.0068, 0, 0.66, 0.68, 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_426:Expr_L108_C0", "label": "print()", "type": "expression", "loc": [108, 108], "level": 0, "parent": null, "vector": [8, 0, 0.7297, 0.0068, 0, 0.66, 0.72, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"\\n\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L109_C0", "label": "print()", "type": "expression", "loc": [109, 109], "level": 0, "parent": null, "vector": [8, 0, 0.7365, 0.0068, 0, 0.66, 0.76, 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_426:Expr_L110_C0", "label": "print()", "type": "expression", "loc": [110, 110], "level": 0, "parent": null, "vector": [8, 0, 0.7432, 0.0068, 0, 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(\"\\n\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L112_C0", "label": "print()", "type": "expression", "loc": [112, 112], "level": 0, "parent": null, "vector": [8, 0, 0.7568, 0.0068, 0, 0.66, 0.84, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"[CPNumericData convertData:dataType:toData:dataType:]\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L113_C0", "label": "print()", "type": "expression", "loc": [113, 113], "level": 0, "parent": null, "vector": [8, 0, 0.7635, 0.0068, 0, 0.66, 0.88, 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_426:Expr_L114_C0", "label": "print()", "type": "expression", "loc": [114, 114], "level": 0, "parent": null, "vector": [8, 0, 0.7703, 0.0068, 0, 0.66, 0.92, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"switch ( sourceDataType->dataTypeFormat ) {\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:For_L115_C0", "label": "for dt", "type": "for", "loc": [115, 147], "level": 0, "parent": null, "vector": [6, 0, 0.8851, 0.223, 0, 0.66, 0.96, 455, 2, 0, 0, 0, 0, 0, 24], "semantic": {"name": "dt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for dt in dataTypes:\n print(\"\\tcase %s:\" % dt)\n if ( len(types[dt]) > 0 ):\n print(\"\\t\\tswitch ( sourceDataType->sampleBytes ) {\")\n for t in types[dt]:\n print(\"\\t\\t\\tcase sizeof(%s):\" % t)\n print(\"\\t\\t\\t\\tswitch ( destDataType->dataTypeFormat ) {\")\n for ndt in dataTypes:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L116_C4", "label": "print()", "type": "expression", "loc": [116, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L115_C0", "vector": [8, 1, 0.7838, 0.0068, 1, 0.95, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\tcase %s:\" % dt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:If_L117_C4", "label": "if", "type": "if", "loc": [117, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L115_C0", "vector": [4, 1, 0.8885, 0.2027, 1, 0.95, 0.5, 0, 0, 0, 0, 0, 0, 0, 22], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ( len(types[dt]) > 0 ):\n print(\"\\t\\tswitch ( sourceDataType->sampleBytes ) {\")\n for t in types[dt]:\n print(\"\\t\\t\\tcase sizeof(%s):\" % t)\n print(\"\\t\\t\\t\\tswitch ( destDataType->dataTypeFormat ) {\")\n for ndt in dataTypes:\n print(\"\\t\\t\\t\\t\\tcase %s:\" % ndt)\n if ( len(types[ndt]) > 0 ):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L118_C8", "label": "print()", "type": "expression", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L117_C4", "vector": [8, 2, 0.7973, 0.0068, 2, 0.47, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\tswitch ( sourceDataType->sampleBytes ) {\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:For_L119_C8", "label": "for t", "type": "for", "loc": [119, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L117_C4", "vector": [6, 2, 0.8919, 0.1824, 2, 0.47, 0.5, 15, 6, 0, 0, 0, 0, 0, 19], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for t in types[dt]:\n print(\"\\t\\t\\tcase sizeof(%s):\" % t)\n print(\"\\t\\t\\t\\tswitch ( destDataType->dataTypeFormat ) {\")\n for ndt in dataTypes:\n print(\"\\t\\t\\t\\t\\tcase %s:\" % ndt)\n if ( len(types[ndt]) > 0 ):\n print(\"\\t\\t\\t\\t\\t\\tswitch ( destDataType->sampleBytes ) {\")\n for nt in types[ndt]:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L120_C12", "label": "print()", "type": "expression", "loc": [120, 120], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L119_C8", "vector": [8, 3, 0.8108, 0.0068, 3, 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(\"\\t\\t\\tcase sizeof(%s):\" % t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L121_C12", "label": "print()", "type": "expression", "loc": [121, 121], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L119_C8", "vector": [8, 3, 0.8176, 0.0068, 3, 0.33, 0.25, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\tswitch ( destDataType->dataTypeFormat ) {\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:For_L122_C12", "label": "for ndt", "type": "for", "loc": [122, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L119_C8", "vector": [6, 3, 0.8953, 0.1486, 3, 0.33, 0.5, 843, 2, 0, 0, 0, 0, 0, 15], "semantic": {"name": "ndt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for ndt in dataTypes:\n print(\"\\t\\t\\t\\t\\tcase %s:\" % ndt)\n if ( len(types[ndt]) > 0 ):\n print(\"\\t\\t\\t\\t\\t\\tswitch ( destDataType->sampleBytes ) {\")\n for nt in types[ndt]:\n print(\"\\t\\t\\t\\t\\t\\t\\tcase sizeof(%s): { // %s -> %s\" % (nt, t, nt))\n if ( t == nt ):\n print(\"\\t\\t\\t\\t\\t\\t\\t\\t\\tmemcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(%s));\" % t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L123_C16", "label": "print()", "type": "expression", "loc": [123, 123], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L122_C12", "vector": [8, 4, 0.8311, 0.0068, 4, 0.46, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\t\\tcase %s:\" % ndt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:If_L124_C16", "label": "if", "type": "if", "loc": [124, 142], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L122_C12", "vector": [4, 4, 0.8986, 0.1284, 4, 0.46, 0.5, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ( len(types[ndt]) > 0 ):\n print(\"\\t\\t\\t\\t\\t\\tswitch ( destDataType->sampleBytes ) {\")\n for nt in types[ndt]:\n print(\"\\t\\t\\t\\t\\t\\t\\tcase sizeof(%s): { // %s -> %s\" % (nt, t, nt))\n if ( t == nt ):\n print(\"\\t\\t\\t\\t\\t\\t\\t\\t\\tmemcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(%s));\" % t)\n else:\n print(\"\\t\\t\\t\\t\\t\\t\\t\\t\\tconst %s *fromBytes = (%s *)sourceData.bytes;\" % (t, t))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L125_C20", "label": "print()", "type": "expression", "loc": [125, 125], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L124_C16", "vector": [8, 5, 0.8446, 0.0068, 5, 0.97, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\t\\t\\tswitch ( destDataType->sampleBytes ) {\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:For_L126_C20", "label": "for nt", "type": "for", "loc": [126, 141], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L124_C16", "vector": [6, 5, 0.902, 0.1081, 5, 0.97, 0.5, 96, 6, 0, 0, 0, 0, 0, 10], "semantic": {"name": "nt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for nt in types[ndt]:\n print(\"\\t\\t\\t\\t\\t\\t\\tcase sizeof(%s): { // %s -> %s\" % (nt, t, nt))\n if ( t == nt ):\n print(\"\\t\\t\\t\\t\\t\\t\\t\\t\\tmemcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(%s));\" % t)\n else:\n print(\"\\t\\t\\t\\t\\t\\t\\t\\t\\tconst %s *fromBytes = (%s *)sourceData.bytes;\" % (t, t))\n print(\"\\t\\t\\t\\t\\t\\t\\t\\t\\tconst %s *lastSample = fromBytes + sampleCount;\" % t)\n print(\"\\t\\t\\t\\t\\t\\t\\t\\t\\t%s *toBytes = (%s *)destData.mutableBytes;\" % (nt, nt))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L127_C24", "label": "print()", "type": "expression", "loc": [127, 127], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L126_C20", "vector": [8, 6, 0.8581, 0.0068, 6, 0.01, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\t\\t\\t\\tcase sizeof(%s): { // %s -> %s\" % (nt, t, nt))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:If_L128_C24", "label": "if", "type": "if", "loc": [128, 139], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L126_C20", "vector": [4, 6, 0.902, 0.0811, 6, 0.01, 0.3333, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ( t == nt ):\n print(\"\\t\\t\\t\\t\\t\\t\\t\\t\\tmemcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(%s));\" % t)\n else:\n print(\"\\t\\t\\t\\t\\t\\t\\t\\t\\tconst %s *fromBytes = (%s *)sourceData.bytes;\" % (t, t))\n print(\"\\t\\t\\t\\t\\t\\t\\t\\t\\tconst %s *lastSample = fromBytes + sampleCount;\" % t)\n print(\"\\t\\t\\t\\t\\t\\t\\t\\t\\t%s *toBytes = (%s *)destData.mutableBytes;\" % (nt, nt))\n if ( t == \"NSDecimal\" ):\n print(\"\\t\\t\\t\\t\\t\\t\\t\\t\\twhile ( fromBytes < lastSample ) *toBytes++ = CPDecimal%sValue(*fromBytes++);\" % nsnumber_factory[nt])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L129_C28", "label": "print()", "type": "expression", "loc": [129, 129], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L128_C24", "vector": [8, 7, 0.8716, 0.0068, 7, 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(\"\\t\\t\\t\\t\\t\\t\\t\\t\\tmemcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(%s));\" % t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L131_C28", "label": "print()", "type": "expression", "loc": [131, 131], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L128_C24", "vector": [8, 7, 0.8851, 0.0068, 7, 0.65, 0.25, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\t\\t\\t\\t\\t\\tconst %s *fromBytes = (%s *)sourceData.bytes;\" % (t, t))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L132_C28", "label": "print()", "type": "expression", "loc": [132, 132], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L128_C24", "vector": [8, 7, 0.8919, 0.0068, 7, 0.65, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\t\\t\\t\\t\\t\\tconst %s *lastSample = fromBytes + sampleCount;\" % t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L133_C28", "label": "print()", "type": "expression", "loc": [133, 133], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L128_C24", "vector": [8, 7, 0.8986, 0.0068, 7, 0.65, 0.75, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\t\\t\\t\\t\\t\\t%s *toBytes = (%s *)destData.mutableBytes;\" % (nt, nt))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:If_L134_C28", "label": "if", "type": "if", "loc": [134, 139], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L128_C24", "vector": [4, 7, 0.9223, 0.0405, 7, 0.65, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ( t == \"NSDecimal\" ):\n print(\"\\t\\t\\t\\t\\t\\t\\t\\t\\twhile ( fromBytes < lastSample ) *toBytes++ = CPDecimal%sValue(*fromBytes++);\" % nsnumber_factory[nt])\n elif ( nt == \"NSDecimal\" ):\n print(\"\\t\\t\\t\\t\\t\\t\\t\\t\\twhile ( fromBytes < lastSample ) *toBytes++ = CPDecimalFrom%s(*fromBytes++);\" % nsnumber_factory[t])\n else:\n print(\"\\t\\t\\t\\t\\t\\t\\t\\t\\twhile ( fromBytes < lastSample ) *toBytes++ = (%s)*fromBytes++;\" % nt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L135_C32", "label": "print()", "type": "expression", "loc": [135, 135], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L134_C28", "vector": [8, 8, 0.9122, 0.0068, 8, 0.56, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\t\\t\\t\\t\\t\\twhile ( fromBytes < lastSample ) *toBytes++ = CPDecimal%sValue(*fromBytes++);\" % nsnumber_factory[nt])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:If_L136_C28", "label": "if", "type": "if", "loc": [136, 139], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L134_C28", "vector": [4, 8, 0.9291, 0.027, 8, 0.56, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif ( nt == \"NSDecimal\" ):\n print(\"\\t\\t\\t\\t\\t\\t\\t\\t\\twhile ( fromBytes < lastSample ) *toBytes++ = CPDecimalFrom%s(*fromBytes++);\" % nsnumber_factory[t])\n else:\n print(\"\\t\\t\\t\\t\\t\\t\\t\\t\\twhile ( fromBytes < lastSample ) *toBytes++ = (%s)*fromBytes++;\" % nt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L137_C32", "label": "print()", "type": "expression", "loc": [137, 137], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L136_C28", "vector": [8, 9, 0.9257, 0.0068, 9, 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(\"\\t\\t\\t\\t\\t\\t\\t\\t\\twhile ( fromBytes < lastSample ) *toBytes++ = CPDecimalFrom%s(*fromBytes++);\" % nsnumber_factory[t])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L139_C32", "label": "print()", "type": "expression", "loc": [139, 139], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L136_C28", "vector": [8, 9, 0.9392, 0.0068, 9, 0.8, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\t\\t\\t\\t\\t\\twhile ( fromBytes < lastSample ) *toBytes++ = (%s)*fromBytes++;\" % nt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L140_C24", "label": "print()", "type": "expression", "loc": [140, 140], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L126_C20", "vector": [8, 6, 0.9459, 0.0068, 6, 0.01, 0.6667, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\t\\t\\t\\t\\t}\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L141_C24", "label": "print()", "type": "expression", "loc": [141, 141], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L126_C20", "vector": [8, 6, 0.9527, 0.0068, 6, 0.01, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\t\\t\\t\\t\\tbreak;\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L142_C20", "label": "print()", "type": "expression", "loc": [142, 142], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L124_C16", "vector": [8, 5, 0.9595, 0.0068, 5, 0.97, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\t\\t\\t}\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L143_C16", "label": "print()", "type": "expression", "loc": [143, 143], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L122_C12", "vector": [8, 4, 0.9662, 0.0068, 4, 0.46, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\t\\t\\tbreak;\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L144_C12", "label": "print()", "type": "expression", "loc": [144, 144], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L119_C8", "vector": [8, 3, 0.973, 0.0068, 3, 0.33, 0.75, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t\\t\\t}\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L145_C12", "label": "print()", "type": "expression", "loc": [145, 145], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L119_C8", "vector": [8, 3, 0.9797, 0.0068, 3, 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(\"\\t\\t\\t\\tbreak;\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L146_C8", "label": "print()", "type": "expression", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:If_L117_C4", "vector": [8, 2, 0.9865, 0.0068, 2, 0.47, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"\\t\\t}\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L147_C4", "label": "print()", "type": "expression", "loc": [147, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_426:For_L115_C0", "vector": [8, 1, 0.9932, 0.0068, 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(\"\\t\\tbreak;\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L148_C0", "label": "print()", "type": "expression", "loc": [148, 148], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0068, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"}\")"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_426:If_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_426:For_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L64_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L65_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L64_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_426:If_L66_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L66_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Assign_L67_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L66_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Assign_L68_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L66_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Assign_L70_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L66_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Assign_L71_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L64_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L72_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L64_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L73_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L85_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L85_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_426:If_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L92_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L93_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L94_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L95_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L96_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L98_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L99_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L100_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L102_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L103_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L85_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_426:If_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_426:For_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L120_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L121_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_426:For_L122_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L122_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L123_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L122_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_426:If_L124_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L124_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L125_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L124_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_426:For_L126_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L126_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L127_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L126_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_426:If_L128_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L128_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L129_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L128_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L131_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L128_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L132_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L128_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L133_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L128_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_426:If_L134_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L134_C28", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L135_C32"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L134_C28", "t": "ajibawa-2023/Python-Code-Large/train/row_426:If_L136_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L136_C28", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L137_C32"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L136_C28", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L139_C32"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L126_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L140_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L126_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L141_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L124_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L142_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L122_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L143_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L144_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L119_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L145_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:If_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_426:For_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_426:Expr_L147_C4"}] |
#!/usr/bin/env python
"create rootfs"
import sys
import os
import getopt
support_fs_tbl = ["yaffs", "cramfs", "ramfs"]
#line swith char
linesep = os.linesep
#option table
#if option has param,must follow char':' or '=' when long opt
opt_short_tbl = 'hf:v'
opt_long_tbl = ["help", "fstype="]
#usage string for tips
usage_str = '[options] -f fsname' + linesep +\
'\t-f, --fstype=name\tfilesystem types name' + linesep +\
'\t support list:' + str(support_fs_tbl) +linesep +\
'\t-v\t\t\tverbose mode' + linesep +\
'\t-h, --help\t\tprint this message'
#is verbose mode
debug = False
#parse type
fstype = "unsupport"
#my debug fucntion
def mydebug(*arglist, **argdict):
global debug
if not debug:
return 0
for i in arglist:
print i,
print
for i in argdict:
print i, argdict[i],
def yaffs_fs_create():
mydebug('create yaffs')
def ramfs_fs_create():
mydebug('create ramfs')
def cramfs_fs_create():
mydebug('create cramfs')
def usage():
global usage_str
print 'usage:%s %s' % (sys.argv[0], usage_str)
def main():
"main function for rootfs create dispatch"
#print sys.argv
#get argv count
if len(sys.argv) < 2:
print 'no options input.'
usage()
return 2
try:
#parse command line options
opts, args = getopt.getopt(sys.argv[1:],
opt_short_tbl,
opt_long_tbl)
except getopt.GetoptError:
print 'get options error.'
usage()
return 2
else:
global fstype, debug
for o, a in opts:
if o == "-v":
debug = True
if o in ("-h", "--help"):
usage()
sys.exit()
if o in ("-f", "--fstype"):
fstype = a
mydebug('input fstype=', a)
break
if fstype == support_fs_tbl[0]:
yaffs_fs_create()
elif fstype == support_fs_tbl[1]:
cramfs_fs_create()
elif fstype == support_fs_tbl[2]:
ramfs_fs_create()
else:
print 'unsupport fs type:%s.' % (fstype)
usage()
return 0
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_427 | 56 | 105 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L3_C0", "label": "expression", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0286, 0.0095, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"create rootfs\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Import_L5_C0", "label": "sys import sys", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0476, 0.0095, 0, 0.66, 0.0588, 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_427:Import_L6_C0", "label": "os import os", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0571, 0.0095, 0, 0.66, 0.1176, 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_427:Import_L7_C0", "label": "getopt import getopt", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0667, 0.0095, 0, 0.66, 0.1765, 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_427:Assign_L9_C0", "label": "support_fs_tbl =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.0857, 0.0095, 0, 0.66, 0.2353, 927, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "support_fs_tbl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "support_fs_tbl = [\"yaffs\", \"cramfs\", \"ramfs\"] "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Assign_L12_C0", "label": "linesep =", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.1143, 0.0095, 0, 0.66, 0.2941, 776, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "linesep", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "linesep = os.linesep"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Assign_L16_C0", "label": "opt_short_tbl =", "type": "assigned_variable", "loc": [16, 16], "level": 0, "parent": null, "vector": [14, 0, 0.1524, 0.0095, 0, 0.66, 0.3529, 599, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "opt_short_tbl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "opt_short_tbl = 'hf:v'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Assign_L17_C0", "label": "opt_long_tbl =", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.1619, 0.0095, 0, 0.66, 0.4118, 157, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "opt_long_tbl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "opt_long_tbl = [\"help\", \"fstype=\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Assign_L20_C0", "label": "usage_str =", "type": "assigned_variable", "loc": [20, 24], "level": 0, "parent": null, "vector": [14, 0, 0.2095, 0.0476, 0, 0.66, 0.4706, 558, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "usage_str", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "usage_str = '[options] -f fsname' + linesep +\\\n '\\t-f, --fstype=name\\tfilesystem types name' + linesep +\\\n '\\t support list:' + str(support_fs_tbl) +linesep +\\\n '\\t-v\\t\\t\\tverbose mode' + linesep +\\\n '\\t-h, --help\\t\\tprint this message'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Assign_L31_C0", "label": "debug =", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.2952, 0.0095, 0, 0.66, 0.5294, 924, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "debug = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Assign_L34_C0", "label": "fstype =", "type": "assigned_variable", "loc": [34, 34], "level": 0, "parent": null, "vector": [14, 0, 0.3238, 0.0095, 0, 0.66, 0.5882, 193, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "fstype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "fstype = \"unsupport\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L37_C0", "label": "mydebug", "type": "function", "loc": [37, 43], "level": 0, "parent": null, "vector": [2, 0, 0.381, 0.0667, 0, 0.66, 0.6471, 857, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "mydebug", "arg_names": ["arglist", "argdict"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def mydebug(*arglist, **argdict):\n global debug\n if not debug:\n return 0\n for i in arglist:\n print(i,)\n print(i, argdict[i],)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:If_L39_C4", "label": "if", "type": "if", "loc": [39, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L37_C0", "vector": [4, 1, 0.3762, 0.019, 1, 0.53, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not debug:\n return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Return_L40_C8", "label": "return", "type": "return", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:If_L39_C4", "vector": [13, 2, 0.381, 0.0095, 2, 0.19, 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_427:For_L41_C4", "label": "for i", "type": "for", "loc": [41, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L37_C0", "vector": [6, 1, 0.4, 0.0286, 1, 0.53, 1.0, 826, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in arglist:\n print(i,)\n print(i, argdict[i],)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L42_C8", "label": "print()", "type": "expression", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:For_L41_C4", "vector": [8, 2, 0.4, 0.0095, 2, 0.3, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(i,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L43_C8", "label": "print()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:For_L41_C4", "vector": [8, 2, 0.4095, 0.0095, 2, 0.3, 1.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(i, argdict[i],)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L45_C0", "label": "yaffs_fs_create", "type": "function", "loc": [45, 46], "level": 0, "parent": null, "vector": [2, 0, 0.4333, 0.019, 0, 0.66, 0.7059, 772, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "yaffs_fs_create", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def yaffs_fs_create():\n mydebug('create yaffs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L46_C4", "label": "mydebug()", "type": "expression", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L45_C0", "vector": [8, 1, 0.4381, 0.0095, 1, 0.82, 0.0, 857, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "mydebug", "arg_names": [], "import_names": [], "rhs_call_name": "mydebug", "annotation": ""}, "snippet": " mydebug('create yaffs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L49_C0", "label": "ramfs_fs_create", "type": "function", "loc": [49, 50], "level": 0, "parent": null, "vector": [2, 0, 0.4714, 0.019, 0, 0.66, 0.7647, 249, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ramfs_fs_create", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def ramfs_fs_create():\n mydebug('create ramfs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L50_C4", "label": "mydebug()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L49_C0", "vector": [8, 1, 0.4762, 0.0095, 1, 0.21, 0.0, 857, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "mydebug", "arg_names": [], "import_names": [], "rhs_call_name": "mydebug", "annotation": ""}, "snippet": " mydebug('create ramfs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L52_C0", "label": "cramfs_fs_create", "type": "function", "loc": [52, 53], "level": 0, "parent": null, "vector": [2, 0, 0.5, 0.019, 0, 0.66, 0.8235, 794, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "cramfs_fs_create", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def cramfs_fs_create():\n mydebug('create cramfs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L53_C4", "label": "mydebug()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L52_C0", "vector": [8, 1, 0.5048, 0.0095, 1, 0.48, 0.0, 857, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "mydebug", "arg_names": [], "import_names": [], "rhs_call_name": "mydebug", "annotation": ""}, "snippet": " mydebug('create cramfs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L57_C0", "label": "usage", "type": "function", "loc": [57, 59], "level": 0, "parent": null, "vector": [2, 0, 0.5524, 0.0286, 0, 0.66, 0.8824, 129, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "usage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def usage():\n global usage_str\n print('usage:%s %s' % (sys.argv[0], usage_str))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L59_C4", "label": "print()", "type": "expression", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L57_C0", "vector": [8, 1, 0.5619, 0.0095, 1, 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('usage:%s %s' % (sys.argv[0], usage_str))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L62_C0", "label": "main", "type": "function", "loc": [62, 102], "level": 0, "parent": null, "vector": [2, 0, 0.781, 0.3905, 0, 0.66, 0.9412, 624, 0, 0, 1, 0, 0, 0, 14], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n \"main function for rootfs create dispatch\"\n #print sys.argv\n #get argv count\n if len(sys.argv) < 2:\n print('no options input.')\n usage()\n return 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L63_C4", "label": "expression", "type": "expression", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L62_C0", "vector": [8, 1, 0.6, 0.0095, 1, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"main function for rootfs create dispatch\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:If_L66_C4", "label": "if", "type": "if", "loc": [66, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L62_C0", "vector": [4, 1, 0.6429, 0.0381, 1, 0.26, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) < 2:\n print('no options input.')\n usage()\n return 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L67_C8", "label": "print()", "type": "expression", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:If_L66_C4", "vector": [8, 2, 0.6381, 0.0095, 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('no options input.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L68_C8", "label": "usage()", "type": "expression", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:If_L66_C4", "vector": [8, 2, 0.6476, 0.0095, 2, 0.59, 0.5, 129, 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_427:Return_L69_C8", "label": "return", "type": "return", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:If_L66_C4", "vector": [13, 2, 0.6571, 0.0095, 2, 0.59, 1.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Try_L71_C4", "label": "try", "type": "try", "loc": [71, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L62_C0", "vector": [7, 1, 0.8238, 0.3048, 1, 0.26, 1.0, 0, 0, 1, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n #parse command line options\n opts, args = getopt.getopt(sys.argv[1:],\n opt_short_tbl,\n opt_long_tbl)\n except getopt.GetoptError:\n print('get options error.')\n usage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Assign_L73_C8", "label": "opts, args = getopt()", "type": "assigned_variable", "loc": [73, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:Try_L71_C4", "vector": [14, 2, 0.7048, 0.0286, 2, 0.41, 0.0, 616, 3, 3, 0, 0, 588, 10, 1], "semantic": {"name": "opts, args", "arg_names": [], "import_names": [], "rhs_call_name": "getopt", "annotation": ""}, "snippet": " opts, args = getopt.getopt(sys.argv[1:],\n opt_short_tbl,\n opt_long_tbl)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L77_C8", "label": "print()", "type": "expression", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:Try_L71_C4", "vector": [8, 2, 0.7333, 0.0095, 2, 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('get options error.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L78_C8", "label": "usage()", "type": "expression", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:Try_L71_C4", "vector": [8, 2, 0.7429, 0.0095, 2, 0.41, 0.5, 129, 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_427:Return_L79_C8", "label": "return", "type": "return", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:Try_L71_C4", "vector": [13, 2, 0.7524, 0.0095, 2, 0.41, 1.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:For_L82_C8", "label": "for o, a", "type": "for", "loc": [82, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:Try_L71_C4", "vector": [6, 2, 0.8238, 0.0952, 2, 0.41, 0.5, 736, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "o, a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for o, a in opts:\n if o == \"-v\":\n debug = True\n if o in (\"-h\", \"--help\"):\n usage()\n sys.exit()\n if o in (\"-f\", \"--fstype\"):\n fstype = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:If_L83_C12", "label": "if", "type": "if", "loc": [83, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:For_L82_C8", "vector": [4, 3, 0.7952, 0.019, 3, 0.93, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o == \"-v\":\n debug = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Assign_L84_C16", "label": "debug =", "type": "assigned_variable", "loc": [84, 84], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:If_L83_C12", "vector": [14, 4, 0.8, 0.0095, 4, 0.47, 0.0, 924, 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_427:If_L85_C12", "label": "if", "type": "if", "loc": [85, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:For_L82_C8", "vector": [4, 3, 0.819, 0.0286, 3, 0.93, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o in (\"-h\", \"--help\"):\n usage()\n sys.exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L86_C16", "label": "usage()", "type": "expression", "loc": [86, 86], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:If_L85_C12", "vector": [8, 4, 0.819, 0.0095, 4, 0.92, 0.0, 129, 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_427:Expr_L87_C16", "label": "exit()", "type": "expression", "loc": [87, 87], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:If_L85_C12", "vector": [8, 4, 0.8286, 0.0095, 4, 0.92, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:If_L88_C12", "label": "if", "type": "if", "loc": [88, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:For_L82_C8", "vector": [4, 3, 0.8524, 0.0381, 3, 0.93, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o in (\"-f\", \"--fstype\"):\n fstype = a\n mydebug('input fstype=', a)\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Assign_L89_C16", "label": "fstype =", "type": "assigned_variable", "loc": [89, 89], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:If_L88_C12", "vector": [14, 4, 0.8476, 0.0095, 4, 0.15, 0.0, 193, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fstype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fstype = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L90_C16", "label": "mydebug()", "type": "expression", "loc": [90, 90], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:If_L88_C12", "vector": [8, 4, 0.8571, 0.0095, 4, 0.15, 1.0, 857, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "mydebug", "arg_names": [], "import_names": [], "rhs_call_name": "mydebug", "annotation": ""}, "snippet": " mydebug('input fstype=', a)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:If_L93_C8", "label": "if", "type": "if", "loc": [93, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:Try_L71_C4", "vector": [4, 2, 0.9286, 0.0952, 2, 0.41, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if fstype == support_fs_tbl[0]:\n yaffs_fs_create()\n elif fstype == support_fs_tbl[1]:\n cramfs_fs_create()\n elif fstype == support_fs_tbl[2]:\n ramfs_fs_create()\n else:\n print('unsupport fs type:%s.' % (fstype))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L94_C12", "label": "yaffs_fs_create()", "type": "expression", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:If_L93_C8", "vector": [8, 3, 0.8952, 0.0095, 3, 0.59, 0.0, 772, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "yaffs_fs_create", "arg_names": [], "import_names": [], "rhs_call_name": "yaffs_fs_create", "annotation": ""}, "snippet": " yaffs_fs_create()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:If_L95_C8", "label": "if", "type": "if", "loc": [95, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:If_L93_C8", "vector": [4, 3, 0.9381, 0.0762, 3, 0.59, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif fstype == support_fs_tbl[1]:\n cramfs_fs_create()\n elif fstype == support_fs_tbl[2]:\n ramfs_fs_create()\n else:\n print('unsupport fs type:%s.' % (fstype))\n usage()\n return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L96_C12", "label": "cramfs_fs_create()", "type": "expression", "loc": [96, 96], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:If_L95_C8", "vector": [8, 4, 0.9143, 0.0095, 4, 0.73, 0.0, 794, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "cramfs_fs_create", "arg_names": [], "import_names": [], "rhs_call_name": "cramfs_fs_create", "annotation": ""}, "snippet": " cramfs_fs_create()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:If_L97_C8", "label": "if", "type": "if", "loc": [97, 102], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:If_L95_C8", "vector": [4, 4, 0.9476, 0.0571, 4, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif fstype == support_fs_tbl[2]:\n ramfs_fs_create()\n else:\n print('unsupport fs type:%s.' % (fstype))\n usage()\n return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L98_C12", "label": "ramfs_fs_create()", "type": "expression", "loc": [98, 98], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:If_L97_C8", "vector": [8, 5, 0.9333, 0.0095, 5, 0.89, 0.0, 249, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ramfs_fs_create", "arg_names": [], "import_names": [], "rhs_call_name": "ramfs_fs_create", "annotation": ""}, "snippet": " ramfs_fs_create()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L100_C12", "label": "print()", "type": "expression", "loc": [100, 100], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:If_L97_C8", "vector": [8, 5, 0.9524, 0.0095, 5, 0.89, 0.3333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('unsupport fs type:%s.' % (fstype))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L101_C12", "label": "usage()", "type": "expression", "loc": [101, 101], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:If_L97_C8", "vector": [8, 5, 0.9619, 0.0095, 5, 0.89, 0.6667, 129, 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_427:Return_L102_C12", "label": "return", "type": "return", "loc": [102, 102], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:If_L97_C8", "vector": [13, 5, 0.9714, 0.0095, 5, 0.89, 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_427:If_L104_C0", "label": "if", "type": "if", "loc": [104, 105], "level": 0, "parent": null, "vector": [4, 0, 0.9952, 0.019, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L105_C4", "label": "main()", "type": "expression", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_427:If_L104_C0", "vector": [8, 1, 1.0, 0.0095, 1, 0.97, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_427:If_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:If_L39_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Return_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_427:For_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:For_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:For_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_427:If_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:If_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:If_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:If_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Return_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:FunctionDef_L62_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Try_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:Try_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:Try_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:Try_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:Try_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Return_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:Try_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_427:For_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:For_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_427:If_L83_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:If_L83_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Assign_L84_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:For_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_427:If_L85_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:If_L85_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L86_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:If_L85_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L87_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:For_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_427:If_L88_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:If_L88_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Assign_L89_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:If_L88_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L90_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:Try_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_427:If_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:If_L93_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L94_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:If_L93_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_427:If_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:If_L95_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L96_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:If_L95_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_427:If_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:If_L97_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L98_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:If_L97_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L100_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:If_L97_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:If_L97_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Return_L102_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_427:If_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_427:Expr_L105_C4"}] |
#!/usr/bin/env python
"create rootfs"
import sys
import os
import getopt
import time
#line swith char
linesep = os.linesep
#rootfs class, base is object
class CRootFs(object):
"""
rootfs base class
"""
def __init__(self, name, fstype):
global linesep
#time stamp
self.stamp = time.strftime("%Y%m%d%H%M%S")
self.name = fstype
self.path = name + self.stamp + '.' + self.name
mydebug('Init rootfs')
def info(self):
print 'path is: %s%s' % (self.path, linesep)
#yaffs class
class CYaffsFs(CRootFs):
"""
yaffs
"""
def __init__(self, name):
super(CYaffsFs, self).__init__(name, 'yaffs')
mydebug('Init yaffs')
#ramfs class
class CRamFs(CRootFs):
"""
ramfs
"""
def __init__(self, name):
super(CRamFs, self).__init__(name, 'ramfs')
mydebug('Init ramfs')
#cramfs class
class CCramFs(CRootFs):
"""
cramfs
"""
def __init__(self, name):
super(CCramFs, self).__init__(name, 'cramfs')
mydebug('Init cramfs')
#global variables define
support_fs_tbl = {
"yaffs":CYaffsFs,
"ramfs":CRamFs,
"cramfs":CCramFs,
}
#option table
#if option has param,must follow char':' or '=' when long opt
opt_short_tbl = 'hf:v'
opt_long_tbl = ["help", "fstype="]
#usage string for tips
usage_str = '[options] -f fsname' + linesep +\
'\t-f, --fstype=name\tfilesystem types name' + linesep +\
'\t support list:' + str(support_fs_tbl.keys()) +linesep +\
'\t-v\t\t\tverbose mode' + linesep +\
'\t-h, --help\t\tprint this message'
#is verbose mode
debug = False
#my debug fucntion
def mydebug(*arglist, **argdict):
global debug
if not debug:
return 0
for i in arglist:
print i,
print
for i in argdict:
print i, argdict[i],
#virtual rootfs class
class RootFs(object):
"""
rootfs
"""
def __init__(self, key, name):
global support_fs_tbl
self.key = key
self.cls_tab = support_fs_tbl
self.cls_name = self.cls_tab[key];
self.instance = self.cls_name(name)
def dump(self, dump_name):
print dump_name
super(self.cls_name, self.instance).info()
def usage():
global usage_str
print 'usage:%s %s' % (sys.argv[0], usage_str)
def main():
"main function for rootfs create dispatch"
#print sys.argv
#get argv count
if len(sys.argv) < 2:
print 'no options input.'
usage()
return 2
try:
#parse command line options
opts, args = getopt.getopt(sys.argv[1:],
opt_short_tbl,
opt_long_tbl)
except getopt.GetoptError:
print 'get options error.'
usage()
return 2
else:
global debug
fstype = "unsupport"
for o, a in opts:
if o == "-v":
debug = True
elif o in ("-h", "--help"):
usage()
sys.exit()
elif o in ("-f", "--fstype"):
fstype = a
mydebug('input fstype=', a)
else:
pass
if fstype not in support_fs_tbl.keys():
print 'unsupport fs type:%s.' % (fstype)
usage()
return 0
else:
myrootfs = RootFs(fstype, "img")
myrootfs.dump("elvon dump:")
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_428 | 82 | 163 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L3_C0", "label": "expression", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0184, 0.0061, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"create rootfs\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Import_L5_C0", "label": "sys import sys", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0307, 0.0061, 0, 0.66, 0.0526, 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_428:Import_L6_C0", "label": "os import os", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0368, 0.0061, 0, 0.66, 0.1053, 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_428:Import_L7_C0", "label": "getopt import getopt", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0429, 0.0061, 0, 0.66, 0.1579, 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_428:Import_L8_C0", "label": "time import time", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0491, 0.0061, 0, 0.66, 0.2105, 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_428:Assign_L11_C0", "label": "linesep =", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.0675, 0.0061, 0, 0.66, 0.2632, 776, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "linesep", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "linesep = os.linesep"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L15_C0", "label": "CRootFs", "type": "class", "loc": [15, 27], "level": 0, "parent": null, "vector": [3, 0, 0.1288, 0.0798, 0, 0.66, 0.3158, 372, 0, 2, 0, 0, 186, 0, 3], "semantic": {"name": "CRootFs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CRootFs(object):\n \"\"\"\n rootfs base class\n \"\"\"\n def __init__(self, name, fstype):\n global linesep\n #time stamp\n self.stamp = time.strftime(\"%Y%m%d%H%M%S\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L16_C4", "label": "expression", "type": "expression", "loc": [16, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L15_C0", "vector": [8, 1, 0.1043, 0.0184, 1, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n rootfs base class\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L19_C4", "label": "__init__", "type": "function", "loc": [19, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L15_C0", "vector": [2, 1, 0.135, 0.0429, 1, 0.45, 0.5, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "name", "fstype"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name, fstype):\n global linesep\n #time stamp\n self.stamp = time.strftime(\"%Y%m%d%H%M%S\")\n self.name = fstype\n self.path = name + self.stamp + '.' + self.name\n mydebug('Init rootfs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L22_C8", "label": "self.stamp = strftime()", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L19_C4", "vector": [14, 2, 0.135, 0.0061, 2, 0.18, 0.0, 913, 3, 1, 0, 0, 668, 10, 1], "semantic": {"name": "self.stamp", "arg_names": [], "import_names": [], "rhs_call_name": "strftime", "annotation": ""}, "snippet": " self.stamp = time.strftime(\"%Y%m%d%H%M%S\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L23_C8", "label": "self.name =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L19_C4", "vector": [14, 2, 0.1411, 0.0061, 2, 0.18, 0.3333, 689, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.name = fstype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L24_C8", "label": "self.path =", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L19_C4", "vector": [14, 2, 0.1472, 0.0061, 2, 0.18, 0.6667, 425, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.path = name + self.stamp + '.' + self.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L25_C8", "label": "mydebug()", "type": "expression", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L19_C4", "vector": [8, 2, 0.1534, 0.0061, 2, 0.18, 1.0, 857, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "mydebug", "arg_names": [], "import_names": [], "rhs_call_name": "mydebug", "annotation": ""}, "snippet": " mydebug('Init rootfs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L26_C4", "label": "info", "type": "function", "loc": [26, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L15_C0", "vector": [2, 1, 0.1626, 0.0123, 1, 0.45, 1.0, 730, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def info(self):\n print('path is: %s%s' % (self.path, linesep))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L27_C8", "label": "print()", "type": "expression", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L26_C4", "vector": [8, 2, 0.1656, 0.0061, 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('path is: %s%s' % (self.path, linesep))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L30_C0", "label": "CYaffsFs", "type": "class", "loc": [30, 36], "level": 0, "parent": null, "vector": [3, 0, 0.2025, 0.0429, 0, 0.66, 0.3684, 830, 0, 1, 0, 0, 372, 0, 3], "semantic": {"name": "CYaffsFs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CYaffsFs(CRootFs):\n \"\"\"\n yaffs \n \"\"\"\n def __init__(self, name):\n super(CYaffsFs, self).__init__(name, 'yaffs')\n mydebug('Init yaffs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L31_C4", "label": "expression", "type": "expression", "loc": [31, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L30_C0", "vector": [8, 1, 0.1963, 0.0184, 1, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n yaffs \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L34_C4", "label": "__init__", "type": "function", "loc": [34, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L30_C0", "vector": [2, 1, 0.2147, 0.0184, 1, 0.28, 1.0, 555, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name):\n super(CYaffsFs, self).__init__(name, 'yaffs')\n mydebug('Init yaffs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L35_C8", "label": "__init__()", "type": "expression", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L34_C4", "vector": [8, 2, 0.2147, 0.0061, 2, 0.83, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(CYaffsFs, self).__init__(name, 'yaffs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L36_C8", "label": "mydebug()", "type": "expression", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L34_C4", "vector": [8, 2, 0.2209, 0.0061, 2, 0.83, 1.0, 857, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "mydebug", "arg_names": [], "import_names": [], "rhs_call_name": "mydebug", "annotation": ""}, "snippet": " mydebug('Init yaffs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L39_C0", "label": "CRamFs", "type": "class", "loc": [39, 45], "level": 0, "parent": null, "vector": [3, 0, 0.2577, 0.0429, 0, 0.66, 0.4211, 619, 0, 1, 0, 0, 372, 0, 3], "semantic": {"name": "CRamFs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CRamFs(CRootFs):\n \"\"\"\n ramfs \n \"\"\"\n def __init__(self, name):\n super(CRamFs, self).__init__(name, 'ramfs')\n mydebug('Init ramfs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L40_C4", "label": "expression", "type": "expression", "loc": [40, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L39_C0", "vector": [8, 1, 0.2515, 0.0184, 1, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n ramfs \n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L43_C4", "label": "__init__", "type": "function", "loc": [43, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L39_C0", "vector": [2, 1, 0.2699, 0.0184, 1, 0.73, 1.0, 555, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name):\n super(CRamFs, self).__init__(name, 'ramfs')\n mydebug('Init ramfs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L44_C8", "label": "__init__()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L43_C4", "vector": [8, 2, 0.2699, 0.0061, 2, 0.62, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(CRamFs, self).__init__(name, 'ramfs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L45_C8", "label": "mydebug()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L43_C4", "vector": [8, 2, 0.2761, 0.0061, 2, 0.62, 1.0, 857, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "mydebug", "arg_names": [], "import_names": [], "rhs_call_name": "mydebug", "annotation": ""}, "snippet": " mydebug('Init ramfs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L49_C0", "label": "CCramFs", "type": "class", "loc": [49, 55], "level": 0, "parent": null, "vector": [3, 0, 0.319, 0.0429, 0, 0.66, 0.4737, 238, 0, 1, 0, 0, 372, 0, 3], "semantic": {"name": "CCramFs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CCramFs(CRootFs):\n \"\"\"\n cramfs\n \"\"\"\n def __init__(self, name):\n super(CCramFs, self).__init__(name, 'cramfs')\n mydebug('Init cramfs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L50_C4", "label": "expression", "type": "expression", "loc": [50, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L49_C0", "vector": [8, 1, 0.3129, 0.0184, 1, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n cramfs\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L53_C4", "label": "__init__", "type": "function", "loc": [53, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L49_C0", "vector": [2, 1, 0.3313, 0.0184, 1, 0.64, 1.0, 555, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name):\n super(CCramFs, self).__init__(name, 'cramfs')\n mydebug('Init cramfs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L54_C8", "label": "__init__()", "type": "expression", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L53_C4", "vector": [8, 2, 0.3313, 0.0061, 2, 0.94, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(CCramFs, self).__init__(name, 'cramfs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L55_C8", "label": "mydebug()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L53_C4", "vector": [8, 2, 0.3374, 0.0061, 2, 0.94, 1.0, 857, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "mydebug", "arg_names": [], "import_names": [], "rhs_call_name": "mydebug", "annotation": ""}, "snippet": " mydebug('Init cramfs')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L61_C0", "label": "support_fs_tbl =", "type": "assigned_variable", "loc": [61, 65], "level": 0, "parent": null, "vector": [14, 0, 0.3865, 0.0307, 0, 0.66, 0.5263, 927, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "support_fs_tbl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "support_fs_tbl = {\n \"yaffs\":CYaffsFs,\n \"ramfs\":CRamFs,\n \"cramfs\":CCramFs,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L71_C0", "label": "opt_short_tbl =", "type": "assigned_variable", "loc": [71, 71], "level": 0, "parent": null, "vector": [14, 0, 0.4356, 0.0061, 0, 0.66, 0.5789, 599, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "opt_short_tbl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "opt_short_tbl = 'hf:v'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L72_C0", "label": "opt_long_tbl =", "type": "assigned_variable", "loc": [72, 72], "level": 0, "parent": null, "vector": [14, 0, 0.4417, 0.0061, 0, 0.66, 0.6316, 157, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "opt_long_tbl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "opt_long_tbl = [\"help\", \"fstype=\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L75_C0", "label": "usage_str =", "type": "assigned_variable", "loc": [75, 79], "level": 0, "parent": null, "vector": [14, 0, 0.4724, 0.0307, 0, 0.66, 0.6842, 558, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "usage_str", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "usage_str = '[options] -f fsname' + linesep +\\\n '\\t-f, --fstype=name\\tfilesystem types name' + linesep +\\\n '\\t support list:' + str(support_fs_tbl.keys()) +linesep +\\\n '\\t-v\\t\\t\\tverbose mode' + linesep +\\\n '\\t-h, --help\\t\\tprint this message'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L86_C0", "label": "debug =", "type": "assigned_variable", "loc": [86, 86], "level": 0, "parent": null, "vector": [14, 0, 0.5276, 0.0061, 0, 0.66, 0.7368, 924, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "debug = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L89_C0", "label": "mydebug", "type": "function", "loc": [89, 95], "level": 0, "parent": null, "vector": [2, 0, 0.5644, 0.0429, 0, 0.66, 0.7895, 857, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "mydebug", "arg_names": ["arglist", "argdict"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def mydebug(*arglist, **argdict):\n global debug\n if not debug:\n return 0\n for i in arglist:\n print(i,)\n print(i, argdict[i],)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:If_L91_C4", "label": "if", "type": "if", "loc": [91, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L89_C0", "vector": [4, 1, 0.5613, 0.0123, 1, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not debug:\n return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Return_L92_C8", "label": "return", "type": "return", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:If_L91_C4", "vector": [13, 2, 0.5644, 0.0061, 2, 0.39, 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_428:For_L93_C4", "label": "for i", "type": "for", "loc": [93, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L89_C0", "vector": [6, 1, 0.5767, 0.0184, 1, 0.56, 1.0, 826, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in arglist:\n print(i,)\n print(i, argdict[i],)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L94_C8", "label": "print()", "type": "expression", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:For_L93_C4", "vector": [8, 2, 0.5767, 0.0061, 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(i,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L95_C8", "label": "print()", "type": "expression", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:For_L93_C4", "vector": [8, 2, 0.5828, 0.0061, 2, 0.17, 1.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(i, argdict[i],)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L99_C0", "label": "RootFs", "type": "class", "loc": [99, 112], "level": 0, "parent": null, "vector": [3, 0, 0.6472, 0.0859, 0, 0.66, 0.8421, 928, 0, 2, 0, 0, 186, 0, 4], "semantic": {"name": "RootFs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RootFs(object):\n \"\"\"\n rootfs\n \"\"\"\n def __init__(self, key, name):\n global support_fs_tbl\n self.key = key\n self.cls_tab = support_fs_tbl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L100_C4", "label": "expression", "type": "expression", "loc": [100, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L99_C0", "vector": [8, 1, 0.6196, 0.0184, 1, 0.92, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n rootfs\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L103_C4", "label": "__init__", "type": "function", "loc": [103, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L99_C0", "vector": [2, 1, 0.6472, 0.0368, 1, 0.92, 0.5, 555, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "key", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, key, name):\n global support_fs_tbl\n self.key = key\n self.cls_tab = support_fs_tbl\n self.cls_name = self.cls_tab[key];\n self.instance = self.cls_name(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L105_C8", "label": "self.key =", "type": "assigned_variable", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L103_C4", "vector": [14, 2, 0.6442, 0.0061, 2, 0.06, 0.0, 605, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.key = key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L106_C8", "label": "self.cls_tab =", "type": "assigned_variable", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L103_C4", "vector": [14, 2, 0.6503, 0.0061, 2, 0.06, 0.3333, 398, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.cls_tab", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cls_tab = support_fs_tbl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L107_C8", "label": "self.cls_name =", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L103_C4", "vector": [14, 2, 0.6564, 0.0061, 2, 0.06, 0.6667, 487, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.cls_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cls_name = self.cls_tab[key];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L108_C8", "label": "self.instance = cls_name()", "type": "assigned_variable", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L103_C4", "vector": [14, 2, 0.6626, 0.0061, 2, 0.06, 1.0, 330, 3, 1, 0, 0, 546, 10, 1], "semantic": {"name": "self.instance", "arg_names": [], "import_names": [], "rhs_call_name": "cls_name", "annotation": ""}, "snippet": " self.instance = self.cls_name(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L110_C4", "label": "dump", "type": "function", "loc": [110, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L99_C0", "vector": [2, 1, 0.681, 0.0184, 1, 0.92, 1.0, 952, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "dump", "arg_names": ["self", "dump_name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def dump(self, dump_name):\n print(dump_name)\n super(self.cls_name, self.instance).info()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L111_C8", "label": "print()", "type": "expression", "loc": [111, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L110_C4", "vector": [8, 2, 0.681, 0.0061, 2, 0.94, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(dump_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L112_C8", "label": "info()", "type": "expression", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L110_C4", "vector": [8, 2, 0.6871, 0.0061, 2, 0.94, 1.0, 730, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " super(self.cls_name, self.instance).info()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L115_C0", "label": "usage", "type": "function", "loc": [115, 117], "level": 0, "parent": null, "vector": [2, 0, 0.7117, 0.0184, 0, 0.66, 0.8947, 129, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "usage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def usage():\n global usage_str\n print('usage:%s %s' % (sys.argv[0], usage_str))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L117_C4", "label": "print()", "type": "expression", "loc": [117, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L115_C0", "vector": [8, 1, 0.7178, 0.0061, 1, 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('usage:%s %s' % (sys.argv[0], usage_str))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L120_C0", "label": "main", "type": "function", "loc": [120, 159], "level": 0, "parent": null, "vector": [2, 0, 0.8558, 0.2454, 0, 0.66, 0.9474, 624, 0, 0, 1, 0, 0, 0, 14], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n \"main function for rootfs create dispatch\"\n #print sys.argv\n #get argv count\n if len(sys.argv) < 2:\n print('no options input.')\n usage()\n return 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L121_C4", "label": "expression", "type": "expression", "loc": [121, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L120_C0", "vector": [8, 1, 0.7423, 0.0061, 1, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"main function for rootfs create dispatch\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:If_L124_C4", "label": "if", "type": "if", "loc": [124, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L120_C0", "vector": [4, 1, 0.7699, 0.0245, 1, 0.31, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) < 2:\n print('no options input.')\n usage()\n return 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L125_C8", "label": "print()", "type": "expression", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:If_L124_C4", "vector": [8, 2, 0.7669, 0.0061, 2, 0.38, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('no options input.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L126_C8", "label": "usage()", "type": "expression", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:If_L124_C4", "vector": [8, 2, 0.773, 0.0061, 2, 0.38, 0.5, 129, 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_428:Return_L127_C8", "label": "return", "type": "return", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:If_L124_C4", "vector": [13, 2, 0.7791, 0.0061, 2, 0.38, 1.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Try_L129_C4", "label": "try", "type": "try", "loc": [129, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L120_C0", "vector": [7, 1, 0.8834, 0.1902, 1, 0.31, 1.0, 0, 0, 1, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n #parse command line options\n opts, args = getopt.getopt(sys.argv[1:],\n opt_short_tbl,\n opt_long_tbl)\n except getopt.GetoptError:\n print('get options error.')\n usage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L131_C8", "label": "opts, args = getopt()", "type": "assigned_variable", "loc": [131, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:Try_L129_C4", "vector": [14, 2, 0.8098, 0.0184, 2, 0.19, 0.0, 616, 3, 3, 0, 0, 588, 10, 1], "semantic": {"name": "opts, args", "arg_names": [], "import_names": [], "rhs_call_name": "getopt", "annotation": ""}, "snippet": " opts, args = getopt.getopt(sys.argv[1:],\n opt_short_tbl,\n opt_long_tbl)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L135_C8", "label": "print()", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:Try_L129_C4", "vector": [8, 2, 0.8282, 0.0061, 2, 0.19, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('get options error.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L136_C8", "label": "usage()", "type": "expression", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:Try_L129_C4", "vector": [8, 2, 0.8344, 0.0061, 2, 0.19, 0.5, 129, 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_428:Return_L137_C8", "label": "return", "type": "return", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:Try_L129_C4", "vector": [13, 2, 0.8405, 0.0061, 2, 0.19, 1.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L140_C8", "label": "fstype =", "type": "assigned_variable", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:Try_L129_C4", "vector": [14, 2, 0.8589, 0.0061, 2, 0.19, 0.3333, 193, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "fstype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fstype = \"unsupport\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:For_L141_C8", "label": "for o, a", "type": "for", "loc": [141, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:Try_L129_C4", "vector": [6, 2, 0.8957, 0.0675, 2, 0.19, 0.6667, 736, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "o, a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for o, a in opts:\n if o == \"-v\":\n debug = True\n elif o in (\"-h\", \"--help\"):\n usage()\n sys.exit()\n elif o in (\"-f\", \"--fstype\"):\n fstype = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:If_L142_C12", "label": "if", "type": "if", "loc": [142, 151], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:For_L141_C8", "vector": [4, 3, 0.8988, 0.0613, 3, 0.11, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o == \"-v\":\n debug = True\n elif o in (\"-h\", \"--help\"):\n usage()\n sys.exit()\n elif o in (\"-f\", \"--fstype\"):\n fstype = a\n mydebug('input fstype=', a)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L143_C16", "label": "debug =", "type": "assigned_variable", "loc": [143, 143], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:If_L142_C12", "vector": [14, 4, 0.8773, 0.0061, 4, 0.45, 0.0, 924, 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_428:If_L144_C12", "label": "if", "type": "if", "loc": [144, 151], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:If_L142_C12", "vector": [4, 4, 0.9049, 0.0491, 4, 0.45, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o in (\"-h\", \"--help\"):\n usage()\n sys.exit()\n elif o in (\"-f\", \"--fstype\"):\n fstype = a\n mydebug('input fstype=', a)\n else:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L145_C16", "label": "usage()", "type": "expression", "loc": [145, 145], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:If_L144_C12", "vector": [8, 5, 0.8896, 0.0061, 5, 0.86, 0.0, 129, 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_428:Expr_L146_C16", "label": "exit()", "type": "expression", "loc": [146, 146], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:If_L144_C12", "vector": [8, 5, 0.8957, 0.0061, 5, 0.86, 0.5, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:If_L147_C12", "label": "if", "type": "if", "loc": [147, 151], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:If_L144_C12", "vector": [4, 5, 0.9141, 0.0307, 5, 0.86, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o in (\"-f\", \"--fstype\"):\n fstype = a\n mydebug('input fstype=', a)\n else:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L148_C16", "label": "fstype =", "type": "assigned_variable", "loc": [148, 148], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:If_L147_C12", "vector": [14, 6, 0.908, 0.0061, 6, 0.8, 0.0, 193, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fstype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fstype = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L149_C16", "label": "mydebug()", "type": "expression", "loc": [149, 149], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:If_L147_C12", "vector": [8, 6, 0.9141, 0.0061, 6, 0.8, 1.0, 857, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "mydebug", "arg_names": [], "import_names": [], "rhs_call_name": "mydebug", "annotation": ""}, "snippet": " mydebug('input fstype=', a)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:If_L153_C8", "label": "if", "type": "if", "loc": [153, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:Try_L129_C4", "vector": [4, 2, 0.9571, 0.0429, 2, 0.19, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if fstype not in support_fs_tbl.keys():\n print('unsupport fs type:%s.' % (fstype))\n usage()\n return 0\n else:\n myrootfs = RootFs(fstype, \"img\")\n myrootfs.dump(\"elvon dump:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L154_C12", "label": "print()", "type": "expression", "loc": [154, 154], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:If_L153_C8", "vector": [8, 3, 0.9448, 0.0061, 3, 0.69, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('unsupport fs type:%s.' % (fstype))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L155_C12", "label": "usage()", "type": "expression", "loc": [155, 155], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:If_L153_C8", "vector": [8, 3, 0.9509, 0.0061, 3, 0.69, 0.25, 129, 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_428:Return_L156_C12", "label": "return", "type": "return", "loc": [156, 156], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:If_L153_C8", "vector": [13, 3, 0.9571, 0.0061, 3, 0.69, 0.5, 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_428:Assign_L158_C12", "label": "myrootfs = RootFs()", "type": "assigned_variable", "loc": [158, 158], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:If_L153_C8", "vector": [14, 3, 0.9693, 0.0061, 3, 0.69, 0.75, 226, 3, 2, 0, 0, 928, 10, 1], "semantic": {"name": "myrootfs", "arg_names": [], "import_names": [], "rhs_call_name": "RootFs", "annotation": ""}, "snippet": " myrootfs = RootFs(fstype, \"img\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L159_C12", "label": "dump()", "type": "expression", "loc": [159, 159], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:If_L153_C8", "vector": [8, 3, 0.9755, 0.0061, 3, 0.69, 1.0, 952, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " myrootfs.dump(\"elvon dump:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_428:If_L162_C0", "label": "if", "type": "if", "loc": [162, 163], "level": 0, "parent": null, "vector": [4, 0, 0.9969, 0.0123, 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_428:Expr_L163_C4", "label": "main()", "type": "expression", "loc": [163, 163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_428:If_L162_C0", "vector": [8, 1, 1.0, 0.0061, 1, 0.46, 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_428:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_428:If_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:If_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Return_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_428:For_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:For_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:For_L93_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_428:If_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:If_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:If_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:If_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Return_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:FunctionDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Try_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:Try_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:Try_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:Try_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:Try_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Return_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:Try_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:Try_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:For_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:For_L141_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_428:If_L142_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:If_L142_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L143_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:If_L142_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_428:If_L144_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:If_L144_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L145_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:If_L144_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L146_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:If_L144_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_428:If_L147_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:If_L147_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L148_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:If_L147_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L149_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:Try_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_428:If_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:If_L153_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L154_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:If_L153_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L155_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:If_L153_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Return_L156_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:If_L153_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Assign_L158_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:If_L153_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L159_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_428:If_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_428:Expr_L163_C4"}] |
#!/usr/bin/env python
i = 1 + 2 * 4
print i,
print 'test raw input'
i = raw_input('pls input:\n')
print int(i)
print 'test while'
count = 0
while count <= 10:
print count
count += 1
print 'test for'
for i in range(11):
print i
print 'test if elif else'
i = int(raw_input('input num\n'))
if i > 0:
print 'sign is +'
elif i < 0:
print 'sign is -'
else:
print 'num is 0'
print 'test list OR array'
numset = [1,2,3,4,5]
total = 0
for i in range(5):
total += numset[i]
print 'total is', total
for i in range(5):
numset[i] = int(raw_input('pls input ' + str(i+1) + ' number\n'))
print 'sum is', sum(numset)
print 'average is', float(sum(numset))/5
print 'test x < y < x'
while 1:
if 1 <= int(raw_input('input a num between 1 - 100\n')) <= 100:
break
else:
print 'error'
print 'test sort'
i = int(raw_input('input num 1\n'))
j = int(raw_input('input num 2\n'))
k = int(raw_input('input num 3\n'))
count = 0
for count in range(2):
if i > j:
tmp = i
i = j
j = tmp
if j > k:
tmp = j
j = k
k = tmp
print i, j, k
print 'test Tkinter'
import Tkinter
top = Tkinter.Tk()
hello = Tkinter.Label(top, text='hello world')
hello.pack()
quit = Tkinter.Button(top, text='Quit',
command=top.quit, bg='red', fg='white')
quit.pack(fill=Tkinter.X, expand=1)
Tkinter.mainloop()
| ajibawa-2023/Python-Code-Large/train/row_429 | 55 | 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_429:Assign_L2_C0", "label": "i =", "type": "assigned_variable", "loc": [2, 2], "level": 0, "parent": null, "vector": [14, 0, 0.027, 0.0135, 0, 0.66, 0.0, 826, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "i = 1 + 2 * 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L3_C0", "label": "print()", "type": "expression", "loc": [3, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0405, 0.0135, 0, 0.66, 0.027, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(i,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L5_C0", "label": "print()", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0676, 0.0135, 0, 0.66, 0.0541, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('test raw input')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L6_C0", "label": "i = raw_input()", "type": "assigned_variable", "loc": [6, 6], "level": 0, "parent": null, "vector": [14, 0, 0.0811, 0.0135, 0, 0.66, 0.0811, 826, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "raw_input", "annotation": ""}, "snippet": "i = raw_input('pls input:\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L7_C0", "label": "print()", "type": "expression", "loc": [7, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0946, 0.0135, 0, 0.66, 0.1081, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(int(i))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L9_C0", "label": "print()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.1216, 0.0135, 0, 0.66, 0.1351, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('test while')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L10_C0", "label": "count =", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.1351, 0.0135, 0, 0.66, 0.1622, 778, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:While_L11_C0", "label": "while", "type": "while", "loc": [11, 13], "level": 0, "parent": null, "vector": [5, 0, 0.1622, 0.0405, 0, 0.66, 0.1892, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "while count <= 10:\n print(count)\n count += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L12_C4", "label": "print()", "type": "expression", "loc": [12, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_429:While_L11_C0", "vector": [8, 1, 0.1622, 0.0135, 1, 0.67, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(count)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L15_C0", "label": "print()", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 0.2027, 0.0135, 0, 0.66, 0.2162, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('test for')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:For_L16_C0", "label": "for i", "type": "for", "loc": [16, 17], "level": 0, "parent": null, "vector": [6, 0, 0.223, 0.027, 0, 0.66, 0.2432, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(11):\n print(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L17_C4", "label": "print()", "type": "expression", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_429:For_L16_C0", "vector": [8, 1, 0.2297, 0.0135, 1, 0.21, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L19_C0", "label": "print()", "type": "expression", "loc": [19, 19], "level": 0, "parent": null, "vector": [8, 0, 0.2568, 0.0135, 0, 0.66, 0.2703, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('test if elif else')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L20_C0", "label": "i = int()", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.2703, 0.0135, 0, 0.66, 0.2973, 826, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": "i = int(raw_input('input num\\n'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:If_L21_C0", "label": "if", "type": "if", "loc": [21, 26], "level": 0, "parent": null, "vector": [4, 0, 0.3176, 0.0811, 0, 0.66, 0.3243, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if i > 0:\n print('sign is +')\nelif i < 0:\n print('sign is -')\nelse:\n print('num is 0')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L22_C4", "label": "print()", "type": "expression", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_429:If_L21_C0", "vector": [8, 1, 0.2973, 0.0135, 1, 0.17, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('sign is +')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:If_L23_C0", "label": "if", "type": "if", "loc": [23, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_429:If_L21_C0", "vector": [4, 1, 0.3311, 0.0541, 1, 0.17, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "elif i < 0:\n print('sign is -')\nelse:\n print('num is 0')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L24_C4", "label": "print()", "type": "expression", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_429:If_L23_C0", "vector": [8, 2, 0.3243, 0.0135, 2, 0.43, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('sign is -')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L26_C4", "label": "print()", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_429:If_L23_C0", "vector": [8, 2, 0.3514, 0.0135, 2, 0.43, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('num is 0')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L28_C0", "label": "print()", "type": "expression", "loc": [28, 28], "level": 0, "parent": null, "vector": [8, 0, 0.3784, 0.0135, 0, 0.66, 0.3514, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('test list OR array')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L29_C0", "label": "numset =", "type": "assigned_variable", "loc": [29, 29], "level": 0, "parent": null, "vector": [14, 0, 0.3919, 0.0135, 0, 0.66, 0.3784, 260, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "numset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "numset = [1,2,3,4,5]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L30_C0", "label": "total =", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.4054, 0.0135, 0, 0.66, 0.4054, 878, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "total", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "total = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:For_L31_C0", "label": "for i", "type": "for", "loc": [31, 32], "level": 0, "parent": null, "vector": [6, 0, 0.4257, 0.027, 0, 0.66, 0.4324, 826, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(5):\n total += numset[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L33_C0", "label": "print()", "type": "expression", "loc": [33, 33], "level": 0, "parent": null, "vector": [8, 0, 0.4459, 0.0135, 0, 0.66, 0.4595, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('total is', total)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:For_L35_C0", "label": "for i", "type": "for", "loc": [35, 36], "level": 0, "parent": null, "vector": [6, 0, 0.4797, 0.027, 0, 0.66, 0.4865, 826, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(5):\n numset[i] = int(raw_input('pls input ' + str(i+1) + ' number\\n'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L36_C4", "label": " = int()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_429:For_L35_C0", "vector": [14, 1, 0.4865, 0.0135, 1, 0.66, 0.0, 0, 3, 1, 0, 0, 901, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " numset[i] = int(raw_input('pls input ' + str(i+1) + ' number\\n'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L37_C0", "label": "print()", "type": "expression", "loc": [37, 37], "level": 0, "parent": null, "vector": [8, 0, 0.5, 0.0135, 0, 0.66, 0.5135, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('sum is', sum(numset))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L38_C0", "label": "print()", "type": "expression", "loc": [38, 38], "level": 0, "parent": null, "vector": [8, 0, 0.5135, 0.0135, 0, 0.66, 0.5405, 535, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('average is', float(sum(numset))/5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L40_C0", "label": "print()", "type": "expression", "loc": [40, 40], "level": 0, "parent": null, "vector": [8, 0, 0.5405, 0.0135, 0, 0.66, 0.5676, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('test x < y < x')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:While_L41_C0", "label": "while", "type": "while", "loc": [41, 45], "level": 0, "parent": null, "vector": [5, 0, 0.5811, 0.0676, 0, 0.66, 0.5946, 0, 1, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "while 1:\n if 1 <= int(raw_input('input a num between 1 - 100\\n')) <= 100:\n break\n else:\n print('error')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:If_L42_C4", "label": "if", "type": "if", "loc": [42, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_429:While_L41_C0", "vector": [4, 1, 0.5878, 0.0541, 1, 0.25, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 1 <= int(raw_input('input a num between 1 - 100\\n')) <= 100:\n break\n else:\n print('error')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L45_C8", "label": "print()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_429:If_L42_C4", "vector": [8, 2, 0.6081, 0.0135, 2, 0.54, 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')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L47_C0", "label": "print()", "type": "expression", "loc": [47, 47], "level": 0, "parent": null, "vector": [8, 0, 0.6351, 0.0135, 0, 0.66, 0.6216, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('test sort')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L48_C0", "label": "i = int()", "type": "assigned_variable", "loc": [48, 48], "level": 0, "parent": null, "vector": [14, 0, 0.6486, 0.0135, 0, 0.66, 0.6486, 826, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": "i = int(raw_input('input num 1\\n'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L49_C0", "label": "j = int()", "type": "assigned_variable", "loc": [49, 49], "level": 0, "parent": null, "vector": [14, 0, 0.6622, 0.0135, 0, 0.66, 0.6757, 100, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": "j = int(raw_input('input num 2\\n'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L50_C0", "label": "k = int()", "type": "assigned_variable", "loc": [50, 50], "level": 0, "parent": null, "vector": [14, 0, 0.6757, 0.0135, 0, 0.66, 0.7027, 954, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": "k = int(raw_input('input num 3\\n'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L52_C0", "label": "count =", "type": "assigned_variable", "loc": [52, 52], "level": 0, "parent": null, "vector": [14, 0, 0.7027, 0.0135, 0, 0.66, 0.7297, 778, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:For_L53_C0", "label": "for count", "type": "for", "loc": [53, 61], "level": 0, "parent": null, "vector": [6, 0, 0.7703, 0.1216, 0, 0.66, 0.7568, 778, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for count in range(2):\n if i > j:\n tmp = i\n i = j\n j = tmp\n if j > k:\n tmp = j\n j = k"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:If_L54_C4", "label": "if", "type": "if", "loc": [54, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_429:For_L53_C0", "vector": [4, 1, 0.75, 0.0541, 1, 0.53, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i > j:\n tmp = i\n i = j\n j = tmp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L55_C8", "label": "tmp =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_429:If_L54_C4", "vector": [14, 2, 0.7432, 0.0135, 2, 0.39, 0.0, 517, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tmp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tmp = i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L56_C8", "label": "i =", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_429:If_L54_C4", "vector": [14, 2, 0.7568, 0.0135, 2, 0.39, 0.5, 826, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i = j"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L57_C8", "label": "j =", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_429:If_L54_C4", "vector": [14, 2, 0.7703, 0.0135, 2, 0.39, 1.0, 100, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " j = tmp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:If_L58_C4", "label": "if", "type": "if", "loc": [58, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_429:For_L53_C0", "vector": [4, 1, 0.8041, 0.0541, 1, 0.53, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if j > k:\n tmp = j\n j = k\n k = tmp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L59_C8", "label": "tmp =", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_429:If_L58_C4", "vector": [14, 2, 0.7973, 0.0135, 2, 0.87, 0.0, 517, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tmp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tmp = j"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L60_C8", "label": "j =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_429:If_L58_C4", "vector": [14, 2, 0.8108, 0.0135, 2, 0.87, 0.5, 100, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " j = k"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L61_C8", "label": "k =", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_429:If_L58_C4", "vector": [14, 2, 0.8243, 0.0135, 2, 0.87, 1.0, 954, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " k = tmp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L62_C0", "label": "print()", "type": "expression", "loc": [62, 62], "level": 0, "parent": null, "vector": [8, 0, 0.8378, 0.0135, 0, 0.66, 0.7838, 535, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(i, j, k)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L64_C0", "label": "print()", "type": "expression", "loc": [64, 64], "level": 0, "parent": null, "vector": [8, 0, 0.8649, 0.0135, 0, 0.66, 0.8108, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('test Tkinter')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Import_L65_C0", "label": "Tkinter import Tkinter", "type": "import", "loc": [65, 65], "level": 0, "parent": null, "vector": [1, 0, 0.8784, 0.0135, 0, 0.66, 0.8378, 368, 0, 1, 0, 0, 368, 0, 0], "semantic": {"name": "Tkinter", "arg_names": [], "import_names": ["Tkinter"], "rhs_call_name": "", "annotation": ""}, "snippet": "import Tkinter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L66_C0", "label": "top = Tk()", "type": "assigned_variable", "loc": [66, 66], "level": 0, "parent": null, "vector": [14, 0, 0.8919, 0.0135, 0, 0.66, 0.8649, 208, 3, 0, 0, 0, 309, 10, 1], "semantic": {"name": "top", "arg_names": [], "import_names": [], "rhs_call_name": "Tk", "annotation": ""}, "snippet": "top = Tkinter.Tk()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L67_C0", "label": "hello = Label()", "type": "assigned_variable", "loc": [67, 67], "level": 0, "parent": null, "vector": [14, 0, 0.9054, 0.0135, 0, 0.66, 0.8919, 6, 3, 2, 0, 0, 413, 10, 1], "semantic": {"name": "hello", "arg_names": [], "import_names": [], "rhs_call_name": "Label", "annotation": ""}, "snippet": "hello = Tkinter.Label(top, text='hello world')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L68_C0", "label": "pack()", "type": "expression", "loc": [68, 68], "level": 0, "parent": null, "vector": [8, 0, 0.9189, 0.0135, 0, 0.66, 0.9189, 742, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": "hello.pack()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L70_C0", "label": "quit = Button()", "type": "assigned_variable", "loc": [70, 71], "level": 0, "parent": null, "vector": [14, 0, 0.9527, 0.027, 0, 0.66, 0.9459, 219, 3, 5, 0, 0, 608, 10, 1], "semantic": {"name": "quit", "arg_names": [], "import_names": [], "rhs_call_name": "Button", "annotation": ""}, "snippet": "quit = Tkinter.Button(top, text='Quit',\n command=top.quit, bg='red', fg='white')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L72_C0", "label": "pack()", "type": "expression", "loc": [72, 72], "level": 0, "parent": null, "vector": [8, 0, 0.973, 0.0135, 0, 0.66, 0.973, 742, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": "quit.pack(fill=Tkinter.X, expand=1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L74_C0", "label": "mainloop()", "type": "expression", "loc": [74, 74], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0135, 0, 0.66, 1.0, 192, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "mainloop", "arg_names": [], "import_names": [], "rhs_call_name": "mainloop", "annotation": ""}, "snippet": "Tkinter.mainloop()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_429:While_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_429:For_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_429:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_429:If_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_429:If_L23_C0"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_429:If_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_429:If_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_429:For_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_429:While_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_429:If_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_429:If_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_429:Expr_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_429:For_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_429:If_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_429:If_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_429:If_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_429:If_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_429:For_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_429:If_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_429:If_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_429:If_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_429:If_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_429:Assign_L61_C8"}] |
#!/usr/bin/env python
"""
Network Monitoring System Server Mock
"""
import json, socket
hash_number = 1;
def register(params):
answer = { 'command':'register' }
global hash_number
services=''
client_hash = params['hash']
client_port = params['port']
client_service_list = params['service_list']
if client_hash == '':
answer['status'] = 1 # 1 - means ok
answer['hash'] = hash_number
hash_number += 1
elif client_hash == -1:
answer['status'] = 2 # 2 - force new hash
answer['hash'] = ''
else:
answer['status'] = 0 # 0 - means hash reuse
answer['hash'] = client_hash
for i in client_service_list:
services = services + i
print (str(client_hash) + ';' + str(client_port) + ';' + services)
return answer;
# End of function
def unsupported():
return { 'command' : 'unknown', 'status' : -1 }
# End of funciton
options = {}
options['host'] = ''
options['port'] = 5000
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((options['host'],options['port']))
server.listen(5)
print 'Network Monitoring Simple Server started'
while 1:
client, address = server.accept()
clientData = client.recv(1024)
question = json.loads(clientData)
if question['command'] == 'register':
response = register(question['params'])
else:
print "Unsupported command"
response = unsupported()
response = json.dumps(response)
client.send(response)
exit(0)
| ajibawa-2023/Python-Code-Large/train/row_430 | 41 | 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_430:Expr_L3_C0", "label": "expression", "type": "expression", "loc": [3, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0692, 0.0615, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nNetwork Monitoring System Server Mock\n\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Import_L8_C0", "label": "json import json, socket", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.1231, 0.0154, 0, 0.66, 0.0833, 463, 0, 2, 0, 0, 463, 0, 0], "semantic": {"name": "json", "arg_names": [], "import_names": ["json", "socket"], "rhs_call_name": "", "annotation": ""}, "snippet": "import json, socket"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L10_C0", "label": "hash_number =", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.1538, 0.0154, 0, 0.66, 0.1667, 485, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "hash_number", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "hash_number = 1;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:FunctionDef_L12_C0", "label": "register", "type": "function", "loc": [12, 33], "level": 0, "parent": null, "vector": [2, 0, 0.3462, 0.3385, 0, 0.66, 0.25, 276, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "register", "arg_names": ["params"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def register(params):\n\tanswer = { 'command':'register' }\n\tglobal hash_number\n\tservices=''\n\tclient_hash = params['hash']\n\tclient_port = params['port']\n\tclient_service_list = params['service_list']\n\tif client_hash == '':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L13_C1", "label": "answer =", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:FunctionDef_L12_C0", "vector": [14, 1, 0.2, 0.0154, 1, 0.37, 0.0, 607, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "answer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tanswer = { 'command':'register' }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L15_C1", "label": "services =", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:FunctionDef_L12_C0", "vector": [14, 1, 0.2308, 0.0154, 1, 0.37, 0.125, 135, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "services", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tservices=''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L16_C1", "label": "client_hash =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:FunctionDef_L12_C0", "vector": [14, 1, 0.2462, 0.0154, 1, 0.37, 0.25, 709, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "client_hash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tclient_hash = params['hash']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L17_C1", "label": "client_port =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:FunctionDef_L12_C0", "vector": [14, 1, 0.2615, 0.0154, 1, 0.37, 0.375, 144, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "client_port", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tclient_port = params['port']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L18_C1", "label": "client_service_list =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:FunctionDef_L12_C0", "vector": [14, 1, 0.2769, 0.0154, 1, 0.37, 0.5, 12, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "client_service_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tclient_service_list = params['service_list']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:If_L19_C1", "label": "if", "type": "if", "loc": [19, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:FunctionDef_L12_C0", "vector": [4, 1, 0.3615, 0.1538, 1, 0.37, 0.625, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif client_hash == '':\n\t\tanswer['status'] = 1 # 1 - means ok\n\t\tanswer['hash'] = hash_number\n\t\thash_number += 1\n\telif client_hash == -1:\n\t\tanswer['status'] = 2 # 2 - force new hash\n\t\tanswer['hash'] = ''\n\telse:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L20_C2", "label": "assign", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:If_L19_C1", "vector": [14, 2, 0.3077, 0.0154, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tanswer['status'] = 1 # 1 - means ok"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L21_C2", "label": "assign", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:If_L19_C1", "vector": [14, 2, 0.3231, 0.0154, 2, 0.88, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tanswer['hash'] = hash_number"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:If_L23_C1", "label": "if", "type": "if", "loc": [23, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:If_L19_C1", "vector": [4, 2, 0.3923, 0.0923, 2, 0.88, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\telif client_hash == -1:\n\t\tanswer['status'] = 2 # 2 - force new hash\n\t\tanswer['hash'] = ''\n\telse:\n\t\tanswer['status'] = 0 # 0 - means hash reuse\n\t\tanswer['hash'] = client_hash"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L24_C2", "label": "assign", "type": "assigned_variable", "loc": [24, 24], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:If_L23_C1", "vector": [14, 3, 0.3692, 0.0154, 3, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tanswer['status'] = 2 # 2 - force new hash"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L25_C2", "label": "assign", "type": "assigned_variable", "loc": [25, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:If_L23_C1", "vector": [14, 3, 0.3846, 0.0154, 3, 0.13, 0.3333, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tanswer['hash'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L27_C2", "label": "assign", "type": "assigned_variable", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:If_L23_C1", "vector": [14, 3, 0.4154, 0.0154, 3, 0.13, 0.6667, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tanswer['status'] = 0 # 0 - means hash reuse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L28_C2", "label": "assign", "type": "assigned_variable", "loc": [28, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:If_L23_C1", "vector": [14, 3, 0.4308, 0.0154, 3, 0.13, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tanswer['hash'] = client_hash"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:For_L29_C1", "label": "for i", "type": "for", "loc": [29, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:FunctionDef_L12_C0", "vector": [6, 1, 0.4538, 0.0308, 1, 0.37, 0.75, 826, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor i in client_service_list:\n\t\tservices = services + i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L30_C2", "label": "services =", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:For_L29_C1", "vector": [14, 2, 0.4615, 0.0154, 2, 0.21, 0.0, 135, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "services", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tservices = services + i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Expr_L31_C1", "label": "print()", "type": "expression", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:FunctionDef_L12_C0", "vector": [8, 1, 0.4769, 0.0154, 1, 0.37, 0.875, 535, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\tprint (str(client_hash) + ';' + str(client_port) + ';' + services)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Return_L33_C1", "label": "return", "type": "return", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:FunctionDef_L12_C0", "vector": [13, 1, 0.5077, 0.0154, 1, 0.37, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn answer;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:FunctionDef_L37_C0", "label": "unsupported", "type": "function", "loc": [37, 38], "level": 0, "parent": null, "vector": [2, 0, 0.5769, 0.0308, 0, 0.66, 0.3333, 694, 0, 0, 1, 0, 0, 0, 0], "semantic": {"name": "unsupported", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def unsupported():\n\treturn { 'command' : 'unknown', 'status' : -1 }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Return_L38_C1", "label": "return", "type": "return", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:FunctionDef_L37_C0", "vector": [13, 1, 0.5846, 0.0154, 1, 0.83, 0.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn { 'command' : 'unknown', 'status' : -1 }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L42_C0", "label": "options =", "type": "assigned_variable", "loc": [42, 42], "level": 0, "parent": null, "vector": [14, 0, 0.6462, 0.0154, 0, 0.66, 0.4167, 707, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "options = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L43_C0", "label": "assign", "type": "assigned_variable", "loc": [43, 43], "level": 0, "parent": null, "vector": [14, 0, 0.6615, 0.0154, 0, 0.66, 0.5, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "options['host'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L44_C0", "label": "assign", "type": "assigned_variable", "loc": [44, 44], "level": 0, "parent": null, "vector": [14, 0, 0.6769, 0.0154, 0, 0.66, 0.5833, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "options['port'] = 5000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L46_C0", "label": "server = socket()", "type": "assigned_variable", "loc": [46, 46], "level": 0, "parent": null, "vector": [14, 0, 0.7077, 0.0154, 0, 0.66, 0.6667, 268, 3, 2, 0, 0, 687, 10, 1], "semantic": {"name": "server", "arg_names": [], "import_names": [], "rhs_call_name": "socket", "annotation": ""}, "snippet": "server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Expr_L47_C0", "label": "bind()", "type": "expression", "loc": [47, 47], "level": 0, "parent": null, "vector": [8, 0, 0.7231, 0.0154, 0, 0.66, 0.75, 640, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "bind", "arg_names": [], "import_names": [], "rhs_call_name": "bind", "annotation": ""}, "snippet": "server.bind((options['host'],options['port']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Expr_L49_C0", "label": "listen()", "type": "expression", "loc": [49, 49], "level": 0, "parent": null, "vector": [8, 0, 0.7538, 0.0154, 0, 0.66, 0.8333, 265, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "listen", "arg_names": [], "import_names": [], "rhs_call_name": "listen", "annotation": ""}, "snippet": "server.listen(5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Expr_L50_C0", "label": "print()", "type": "expression", "loc": [50, 50], "level": 0, "parent": null, "vector": [8, 0, 0.7692, 0.0154, 0, 0.66, 0.9167, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('Network Monitoring Simple Server started')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:While_L52_C0", "label": "while", "type": "while", "loc": [52, 63], "level": 0, "parent": null, "vector": [5, 0, 0.8846, 0.1846, 0, 0.66, 1.0, 0, 1, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "while 1:\n\tclient, address = server.accept()\n\tclientData = client.recv(1024)\n\tquestion = json.loads(clientData)\n\tif question['command'] == 'register':\n\t\tresponse = register(question['params'])\n\telse:\n\t\tprint(\"Unsupported command\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L53_C1", "label": "client, address = accept()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:While_L52_C0", "vector": [14, 1, 0.8154, 0.0154, 1, 0.12, 0.0, 87, 3, 0, 0, 0, 829, 10, 1], "semantic": {"name": "client, address", "arg_names": [], "import_names": [], "rhs_call_name": "accept", "annotation": ""}, "snippet": "\tclient, address = server.accept()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L54_C1", "label": "clientData = recv()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:While_L52_C0", "vector": [14, 1, 0.8308, 0.0154, 1, 0.12, 0.1667, 376, 3, 1, 0, 0, 178, 10, 1], "semantic": {"name": "clientData", "arg_names": [], "import_names": [], "rhs_call_name": "recv", "annotation": ""}, "snippet": "\tclientData = client.recv(1024)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L55_C1", "label": "question = loads()", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:While_L52_C0", "vector": [14, 1, 0.8462, 0.0154, 1, 0.12, 0.3333, 785, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "question", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": "\tquestion = json.loads(clientData)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:If_L56_C1", "label": "if", "type": "if", "loc": [56, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:While_L52_C0", "vector": [4, 1, 0.8923, 0.0769, 1, 0.12, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif question['command'] == 'register':\n\t\tresponse = register(question['params'])\n\telse:\n\t\tprint(\"Unsupported command\")\n\t\tresponse = unsupported()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L57_C2", "label": "response = register()", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:If_L56_C1", "vector": [14, 2, 0.8769, 0.0154, 2, 0.97, 0.0, 511, 3, 1, 0, 0, 276, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "register", "annotation": ""}, "snippet": "\t\tresponse = register(question['params'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Expr_L59_C2", "label": "print()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:If_L56_C1", "vector": [8, 2, 0.9077, 0.0154, 2, 0.97, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\tprint(\"Unsupported command\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L60_C2", "label": "response = unsupported()", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:If_L56_C1", "vector": [14, 2, 0.9231, 0.0154, 2, 0.97, 1.0, 511, 3, 0, 0, 0, 694, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "unsupported", "annotation": ""}, "snippet": "\t\tresponse = unsupported()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L61_C1", "label": "response = dumps()", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:While_L52_C0", "vector": [14, 1, 0.9385, 0.0154, 1, 0.12, 0.6667, 511, 3, 1, 0, 0, 160, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "dumps", "annotation": ""}, "snippet": "\tresponse = json.dumps(response) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Expr_L62_C1", "label": "send()", "type": "expression", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:While_L52_C0", "vector": [8, 1, 0.9538, 0.0154, 1, 0.12, 0.8333, 826, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "send", "arg_names": [], "import_names": [], "rhs_call_name": "send", "annotation": ""}, "snippet": "\tclient.send(response)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_430:Expr_L63_C1", "label": "exit()", "type": "expression", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_430:While_L52_C0", "vector": [8, 1, 0.9692, 0.0154, 1, 0.12, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\texit(0)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_430:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L13_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L15_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L16_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L17_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L18_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_430:If_L19_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:If_L19_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:If_L19_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:If_L19_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_430:If_L23_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:If_L23_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L24_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:If_L23_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:If_L23_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:If_L23_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_430:For_L29_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:For_L29_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Expr_L31_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Return_L33_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Return_L38_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:While_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L53_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:While_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L54_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:While_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L55_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:While_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_430:If_L56_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:If_L56_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:If_L56_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Expr_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:If_L56_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:While_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Assign_L61_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:While_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Expr_L62_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_430:While_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_430:Expr_L63_C1"}] |
#!/usr/bin/env python
"""
Network Monitoring System Server Mock
"""
import json, socket
hash_number = 1;
def register(params):
answer = { 'command':'register' }
global hash_number
services=''
client_hash = params['hash']
client_port = params['port']
client_service_list = params['service_list']
if client_hash == '':
answer['status'] = 1 # 1 - means ok
answer['hash'] = hash_number
hash_number += 1
elif client_hash == -1:
answer['status'] = 2 # 2 - force new hash
answer['hash'] = ''
else:
answer['status'] = 0 # 0 - means hash reuse
answer['hash'] = client_hash
for i in client_service_list:
services = services + i
print (str(client_hash) + ';' + str(client_port) + ';' + services)
return answer;
# End of function
def unsupported():
return { 'command' : 'unknown', 'status' : -1 }
# End of funciton
options = {}
options['host'] = ''
options['port'] = 5000
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((options['host'],options['port']))
server.listen(5)
print 'Network Monitoring Simple Server started'
while 1:
client, address = server.accept()
clientData = client.recv(1024)
question = json.loads(clientData)
if question['command'] == 'register':
response = register(question['params'])
else:
print "Unsupported command"
response = unsupported()
response = json.dumps(response)
client.send(response)
exit(0)
| ajibawa-2023/Python-Code-Large/train/row_431 | 41 | 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_431:Expr_L3_C0", "label": "expression", "type": "expression", "loc": [3, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0692, 0.0615, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nNetwork Monitoring System Server Mock\n\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Import_L8_C0", "label": "json import json, socket", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.1231, 0.0154, 0, 0.66, 0.0833, 463, 0, 2, 0, 0, 463, 0, 0], "semantic": {"name": "json", "arg_names": [], "import_names": ["json", "socket"], "rhs_call_name": "", "annotation": ""}, "snippet": "import json, socket"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L10_C0", "label": "hash_number =", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.1538, 0.0154, 0, 0.66, 0.1667, 485, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "hash_number", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "hash_number = 1;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:FunctionDef_L12_C0", "label": "register", "type": "function", "loc": [12, 33], "level": 0, "parent": null, "vector": [2, 0, 0.3462, 0.3385, 0, 0.66, 0.25, 276, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "register", "arg_names": ["params"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def register(params):\n\tanswer = { 'command':'register' }\n\tglobal hash_number\n\tservices=''\n\tclient_hash = params['hash']\n\tclient_port = params['port']\n\tclient_service_list = params['service_list']\n\tif client_hash == '':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L13_C1", "label": "answer =", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:FunctionDef_L12_C0", "vector": [14, 1, 0.2, 0.0154, 1, 0.23, 0.0, 607, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "answer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tanswer = { 'command':'register' }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L15_C1", "label": "services =", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:FunctionDef_L12_C0", "vector": [14, 1, 0.2308, 0.0154, 1, 0.23, 0.125, 135, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "services", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tservices=''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L16_C1", "label": "client_hash =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:FunctionDef_L12_C0", "vector": [14, 1, 0.2462, 0.0154, 1, 0.23, 0.25, 709, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "client_hash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tclient_hash = params['hash']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L17_C1", "label": "client_port =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:FunctionDef_L12_C0", "vector": [14, 1, 0.2615, 0.0154, 1, 0.23, 0.375, 144, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "client_port", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tclient_port = params['port']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L18_C1", "label": "client_service_list =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:FunctionDef_L12_C0", "vector": [14, 1, 0.2769, 0.0154, 1, 0.23, 0.5, 12, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "client_service_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tclient_service_list = params['service_list']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:If_L19_C1", "label": "if", "type": "if", "loc": [19, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:FunctionDef_L12_C0", "vector": [4, 1, 0.3615, 0.1538, 1, 0.23, 0.625, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif client_hash == '':\n\t\tanswer['status'] = 1 # 1 - means ok\n\t\tanswer['hash'] = hash_number\n\t\thash_number += 1\n\telif client_hash == -1:\n\t\tanswer['status'] = 2 # 2 - force new hash\n\t\tanswer['hash'] = ''\n\telse:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L20_C2", "label": "assign", "type": "assigned_variable", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:If_L19_C1", "vector": [14, 2, 0.3077, 0.0154, 2, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tanswer['status'] = 1 # 1 - means ok"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L21_C2", "label": "assign", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:If_L19_C1", "vector": [14, 2, 0.3231, 0.0154, 2, 0.2, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tanswer['hash'] = hash_number"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:If_L23_C1", "label": "if", "type": "if", "loc": [23, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:If_L19_C1", "vector": [4, 2, 0.3923, 0.0923, 2, 0.2, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\telif client_hash == -1:\n\t\tanswer['status'] = 2 # 2 - force new hash\n\t\tanswer['hash'] = ''\n\telse:\n\t\tanswer['status'] = 0 # 0 - means hash reuse\n\t\tanswer['hash'] = client_hash"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L24_C2", "label": "assign", "type": "assigned_variable", "loc": [24, 24], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:If_L23_C1", "vector": [14, 3, 0.3692, 0.0154, 3, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tanswer['status'] = 2 # 2 - force new hash"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L25_C2", "label": "assign", "type": "assigned_variable", "loc": [25, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:If_L23_C1", "vector": [14, 3, 0.3846, 0.0154, 3, 0.76, 0.3333, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tanswer['hash'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L27_C2", "label": "assign", "type": "assigned_variable", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:If_L23_C1", "vector": [14, 3, 0.4154, 0.0154, 3, 0.76, 0.6667, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tanswer['status'] = 0 # 0 - means hash reuse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L28_C2", "label": "assign", "type": "assigned_variable", "loc": [28, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:If_L23_C1", "vector": [14, 3, 0.4308, 0.0154, 3, 0.76, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tanswer['hash'] = client_hash"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:For_L29_C1", "label": "for i", "type": "for", "loc": [29, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:FunctionDef_L12_C0", "vector": [6, 1, 0.4538, 0.0308, 1, 0.23, 0.75, 826, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tfor i in client_service_list:\n\t\tservices = services + i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L30_C2", "label": "services =", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:For_L29_C1", "vector": [14, 2, 0.4615, 0.0154, 2, 0.25, 0.0, 135, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "services", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tservices = services + i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Expr_L31_C1", "label": "print()", "type": "expression", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:FunctionDef_L12_C0", "vector": [8, 1, 0.4769, 0.0154, 1, 0.23, 0.875, 535, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\tprint (str(client_hash) + ';' + str(client_port) + ';' + services)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Return_L33_C1", "label": "return", "type": "return", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:FunctionDef_L12_C0", "vector": [13, 1, 0.5077, 0.0154, 1, 0.23, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn answer;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:FunctionDef_L37_C0", "label": "unsupported", "type": "function", "loc": [37, 38], "level": 0, "parent": null, "vector": [2, 0, 0.5769, 0.0308, 0, 0.66, 0.3333, 694, 0, 0, 1, 0, 0, 0, 0], "semantic": {"name": "unsupported", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def unsupported():\n\treturn { 'command' : 'unknown', 'status' : -1 }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Return_L38_C1", "label": "return", "type": "return", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:FunctionDef_L37_C0", "vector": [13, 1, 0.5846, 0.0154, 1, 0.35, 0.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\treturn { 'command' : 'unknown', 'status' : -1 }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L42_C0", "label": "options =", "type": "assigned_variable", "loc": [42, 42], "level": 0, "parent": null, "vector": [14, 0, 0.6462, 0.0154, 0, 0.66, 0.4167, 707, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "options = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L43_C0", "label": "assign", "type": "assigned_variable", "loc": [43, 43], "level": 0, "parent": null, "vector": [14, 0, 0.6615, 0.0154, 0, 0.66, 0.5, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "options['host'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L44_C0", "label": "assign", "type": "assigned_variable", "loc": [44, 44], "level": 0, "parent": null, "vector": [14, 0, 0.6769, 0.0154, 0, 0.66, 0.5833, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "options['port'] = 5000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L46_C0", "label": "server = socket()", "type": "assigned_variable", "loc": [46, 46], "level": 0, "parent": null, "vector": [14, 0, 0.7077, 0.0154, 0, 0.66, 0.6667, 268, 3, 2, 0, 0, 687, 10, 1], "semantic": {"name": "server", "arg_names": [], "import_names": [], "rhs_call_name": "socket", "annotation": ""}, "snippet": "server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Expr_L47_C0", "label": "bind()", "type": "expression", "loc": [47, 47], "level": 0, "parent": null, "vector": [8, 0, 0.7231, 0.0154, 0, 0.66, 0.75, 640, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "bind", "arg_names": [], "import_names": [], "rhs_call_name": "bind", "annotation": ""}, "snippet": "server.bind((options['host'],options['port']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Expr_L49_C0", "label": "listen()", "type": "expression", "loc": [49, 49], "level": 0, "parent": null, "vector": [8, 0, 0.7538, 0.0154, 0, 0.66, 0.8333, 265, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "listen", "arg_names": [], "import_names": [], "rhs_call_name": "listen", "annotation": ""}, "snippet": "server.listen(5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Expr_L50_C0", "label": "print()", "type": "expression", "loc": [50, 50], "level": 0, "parent": null, "vector": [8, 0, 0.7692, 0.0154, 0, 0.66, 0.9167, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print('Network Monitoring Simple Server started')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:While_L52_C0", "label": "while", "type": "while", "loc": [52, 63], "level": 0, "parent": null, "vector": [5, 0, 0.8846, 0.1846, 0, 0.66, 1.0, 0, 1, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "while 1:\n\tclient, address = server.accept()\n\tclientData = client.recv(1024)\n\tquestion = json.loads(clientData)\n\tif question['command'] == 'register':\n\t\tresponse = register(question['params'])\n\telse:\n\t\tprint(\"Unsupported command\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L53_C1", "label": "client, address = accept()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:While_L52_C0", "vector": [14, 1, 0.8154, 0.0154, 1, 0.73, 0.0, 87, 3, 0, 0, 0, 829, 10, 1], "semantic": {"name": "client, address", "arg_names": [], "import_names": [], "rhs_call_name": "accept", "annotation": ""}, "snippet": "\tclient, address = server.accept()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L54_C1", "label": "clientData = recv()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:While_L52_C0", "vector": [14, 1, 0.8308, 0.0154, 1, 0.73, 0.1667, 376, 3, 1, 0, 0, 178, 10, 1], "semantic": {"name": "clientData", "arg_names": [], "import_names": [], "rhs_call_name": "recv", "annotation": ""}, "snippet": "\tclientData = client.recv(1024)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L55_C1", "label": "question = loads()", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:While_L52_C0", "vector": [14, 1, 0.8462, 0.0154, 1, 0.73, 0.3333, 785, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "question", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": "\tquestion = json.loads(clientData)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:If_L56_C1", "label": "if", "type": "if", "loc": [56, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:While_L52_C0", "vector": [4, 1, 0.8923, 0.0769, 1, 0.73, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif question['command'] == 'register':\n\t\tresponse = register(question['params'])\n\telse:\n\t\tprint(\"Unsupported command\")\n\t\tresponse = unsupported()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L57_C2", "label": "response = register()", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:If_L56_C1", "vector": [14, 2, 0.8769, 0.0154, 2, 0.68, 0.0, 511, 3, 1, 0, 0, 276, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "register", "annotation": ""}, "snippet": "\t\tresponse = register(question['params'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Expr_L59_C2", "label": "print()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:If_L56_C1", "vector": [8, 2, 0.9077, 0.0154, 2, 0.68, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\tprint(\"Unsupported command\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L60_C2", "label": "response = unsupported()", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:If_L56_C1", "vector": [14, 2, 0.9231, 0.0154, 2, 0.68, 1.0, 511, 3, 0, 0, 0, 694, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "unsupported", "annotation": ""}, "snippet": "\t\tresponse = unsupported()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L61_C1", "label": "response = dumps()", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:While_L52_C0", "vector": [14, 1, 0.9385, 0.0154, 1, 0.73, 0.6667, 511, 3, 1, 0, 0, 160, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "dumps", "annotation": ""}, "snippet": "\tresponse = json.dumps(response) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Expr_L62_C1", "label": "send()", "type": "expression", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:While_L52_C0", "vector": [8, 1, 0.9538, 0.0154, 1, 0.73, 0.8333, 826, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "send", "arg_names": [], "import_names": [], "rhs_call_name": "send", "annotation": ""}, "snippet": "\tclient.send(response)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_431:Expr_L63_C1", "label": "exit()", "type": "expression", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_431:While_L52_C0", "vector": [8, 1, 0.9692, 0.0154, 1, 0.73, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\texit(0)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_431:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L13_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L15_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L16_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L17_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L18_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_431:If_L19_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:If_L19_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:If_L19_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:If_L19_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_431:If_L23_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:If_L23_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L24_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:If_L23_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:If_L23_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:If_L23_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_431:For_L29_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:For_L29_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Expr_L31_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Return_L33_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Return_L38_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:While_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L53_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:While_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L54_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:While_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L55_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:While_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_431:If_L56_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:If_L56_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:If_L56_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Expr_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:If_L56_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:While_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Assign_L61_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:While_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Expr_L62_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_431:While_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_431:Expr_L63_C1"}] |
#!/usr/bin/env python
"""
NetSpy Client
by Marcin Ciechowicz for ZPR
v0.01
"""
import socket
import json
from subprocess import call
import logging
import argparse
import os.path
appName = 'NetSpyClient'
scriptDir = 'scripts'
logger = logging.getLogger(appName)
def initLogger():
formatter = logging.Formatter('%(asctime)s %(levelname)s::%(message)s')
hdlrFile = logging.FileHandler(appName + '.log')
hdlrFile.setFormatter(formatter)
hdlrStd = logging.StreamHandler()
hdlrStd.setFormatter(formatter)
logger.addHandler(hdlrFile)
logger.addHandler(hdlrStd)
logger.setLevel(logging.DEBUG)
class Service:
name = ''
testerPath = ''
def __init__(self, name, testerPath):
"""Creates service"""
self.name = name
self.testerPath = testerPath
def getName(self):
return self.name
def getCheckerPath(self):
return self.checkerPath
def executeCheck(self):
return call(testerPath,'1')
class Config:
options = {}
def __init__(self, fileName = "netspy.conf"):
"""Initialize config from file """
self.options = {'port' : '', 'server_port' : '', 'server_ip': '', 'service_list': [] }
self.fileName = fileName
self.loadFromFile(self.fileName)
def loadFromFile(self,fileName):
try:
logger.info("Reading config file: " + fileName)
configFile = file(fileName,'r')
line = configFile.readline()
active_options = ('port','server_port','server_ip')
while line != '' :
tokens = line.strip().split(' ')
if tokens[0] == 'service':
if (tokens[1] == 'alive'):
logger.warning("Service " + tokens[1] + " is already definied, please use different name")
elif (os.path.isfile(scriptDir+'/'+tokens[2])):
self.options['service_list'].append(Service(tokens[1],tokens[2]))
logger.debug("New service added: " + tokens[1])
else:
logger.warning("Service " + tokens[1] +" error: Can't find script : " + scriptDir + '/' + tokens[2])
logger.warning("Service " + tokens[1] +" creation failed")
elif tokens[0] in active_options:
self.options[tokens[0]]=tokens[1]
logger.debug(tokens[0] + " set to " + tokens[1])
else:
logger.warning("Unkown option " + tokens[0])
line = configFile.readline()
configFile.close()
except IOError:
logger.error( "Can't read " + fileName)
exit()
def getPort(self):
return self.options['port']
def getServerPort(self):
return self.options['server_port']
def getServerIp(self):
return self.options['server_ip']
def getServiceList(self):
return self.options['service_list']
class ClientApp:
config = ''
def getHash(self):
hashValue=''
try:
hashFile=file(".netspy.hash","r")
hashValue = hashFile.readline()
except IOError:
logger.warining( "No hash found")
finally:
return hashValue
def setHash(self,hashValue):
""" Function doc """
if (hashValue!=''):
try:
hashFile=file(".netspy.hash","w")
hashFile.write(hashValue)
except IOError:
logger.error( "Can't store hash value")
exit(0)
def setConfig(self, config):
self.config = config
def __init__(self,config=None):
if config!=None:
self.setConfig(config)
def hashCheck(self,hashValue):
return True
def init(self):
logger.info('Client - running ')
def registerAtServer(self):
try:
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.connect((self.config.getServerIp(), int(self.config.getServerPort()) ))
except IOError:
logger.error("Can't register at monitoring server - connection problem")
return False
service_list = [];
for i in self.config.getServiceList():
service_list.append(i.getName())
service_list.append('alive')
message = { 'command' : 'register', 'payload': {'hash' : self.getHash(), 'port' : self.config.getPort(), 'service_list' : service_list }}
messageToSend = json.dumps(message)
server.send(messageToSend)
data = server.recv(1024)
server.close()
answer = json.loads(data)
if (answer['command'] != 'register'):
logger.error("Bad command type - expected 'register'")
return False
if (answer['payload']['status'] == 0):
logger.info("Reusing old hash")
return True
elif (answer['payload']['status'] == 1):
logger.info("Saving new hash: " + str(answer['payload']['hash']))
hashValue = answer['payload']['hash']
self.setHash(str(hashValue))
return True
elif (answer['payload']['status'] == 2):
clear = file('.netspy.hash','w')
clear.write('')
return False
else:
return False
def performServiceCheck(self,message):
try:
question = json.loads(message)
if question['command'] != 'check_status':
logger.error("Unknown command '" + question['command'] + "'received from server")
logger.error("No check performed")
return
else:
logger.info("Performing check")
resultList = []
alive = { 'alive' : 0 }
resultList.append(alive)
for service in self.config.getServiceList():
tmp = service.executeCheck()
result = {service.getName() : tmp }
resultList.append(result)
answer = {'command' : 'check_status', 'payload' : {'check_result' : resultList }}
return json.dumps(answer);
except ValueError:
logger.error("Unsupported command format")
logger.error("No check performed")
def run(self):
logger.info("Client - registering at monitoring server")
i=0
while (i<3 and not self.registerAtServer()):
i=i+1
if (i==3):
logger.error("Connect to monitoring server failed - can't connect to specified host")
logger.error("Please check your config file")
return
logger.info("Client - register succesful")
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.bind(('',int(self.config.getPort())))
client.listen(5)
logger.info('Client - waiting for commands from server')
while 1:
request, address = client.accept()
message = request.recv(1024)
answer = self.performServiceCheck(message)
request.send(answer)
request.close()
def parseArgs():
parser = argparse.ArgumentParser(prog=appName, usage='%(prog)s [options]')
parser.add_argument('--verbose','-v', action='store_false', help='verbose mode')
parser.add_argument('--config','-c', action='store', help='config filename')
args = parser.parse_args()
if args.verbose == True:
logger.setLevel(logging.ERROR)
if args.config != None:
return Config(args.config)
else:
return Config()
#---------- main --------------------------#
initLogger()
client = ClientApp(parseArgs())
client.init()
client.run()
#-----------------------------------------#
| ajibawa-2023/Python-Code-Large/train/row_432 | 182 | 244 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L3_C0", "label": "expression", "type": "expression", "loc": [3, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0205, 0.0205, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nNetSpy Client\t\t\nby Marcin Ciechowicz for ZPR\nv0.01\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Import_L9_C0", "label": "socket import socket", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0369, 0.0041, 0, 0.66, 0.0556, 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_432:Import_L10_C0", "label": "json import json", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.041, 0.0041, 0, 0.66, 0.1111, 463, 0, 1, 0, 0, 463, 0, 0], "semantic": {"name": "json", "arg_names": [], "import_names": ["json"], "rhs_call_name": "", "annotation": ""}, "snippet": "import json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:ImportFrom_L11_C0", "label": "from subprocess import call", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0451, 0.0041, 0, 0.66, 0.1667, 394, 0, 1, 0, 0, 394, 0, 0], "semantic": {"name": "subprocess", "arg_names": [], "import_names": ["call"], "rhs_call_name": "", "annotation": ""}, "snippet": "from subprocess import call"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Import_L12_C0", "label": "logging import logging", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0492, 0.0041, 0, 0.66, 0.2222, 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_432:Import_L13_C0", "label": "argparse import argparse", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0533, 0.0041, 0, 0.66, 0.2778, 325, 0, 1, 0, 0, 325, 0, 0], "semantic": {"name": "argparse", "arg_names": [], "import_names": ["argparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "import argparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Import_L14_C0", "label": "os.path import os.path", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0574, 0.0041, 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_432:Assign_L16_C0", "label": "appName =", "type": "assigned_variable", "loc": [16, 16], "level": 0, "parent": null, "vector": [14, 0, 0.0656, 0.0041, 0, 0.66, 0.3889, 650, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "appName", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "appName = 'NetSpyClient'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L17_C0", "label": "scriptDir =", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.0697, 0.0041, 0, 0.66, 0.4444, 714, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "scriptDir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "scriptDir = 'scripts'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L19_C0", "label": "logger = getLogger()", "type": "assigned_variable", "loc": [19, 19], "level": 0, "parent": null, "vector": [14, 0, 0.0779, 0.0041, 0, 0.66, 0.5, 532, 3, 1, 0, 0, 71, 10, 1], "semantic": {"name": "logger", "arg_names": [], "import_names": [], "rhs_call_name": "getLogger", "annotation": ""}, "snippet": "logger = logging.getLogger(appName)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L21_C0", "label": "initLogger", "type": "function", "loc": [21, 29], "level": 0, "parent": null, "vector": [2, 0, 0.1025, 0.0369, 0, 0.66, 0.5556, 186, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "initLogger", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def initLogger():\n\tformatter = logging.Formatter('%(asctime)s %(levelname)s::%(message)s')\n\thdlrFile = logging.FileHandler(appName + '.log')\n\thdlrFile.setFormatter(formatter)\n\thdlrStd = logging.StreamHandler()\n\thdlrStd.setFormatter(formatter)\n\tlogger.addHandler(hdlrFile)\n\tlogger.addHandler(hdlrStd) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L22_C1", "label": "formatter = Formatter()", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L21_C0", "vector": [14, 1, 0.0902, 0.0041, 1, 0.67, 0.0, 791, 3, 1, 0, 0, 766, 10, 1], "semantic": {"name": "formatter", "arg_names": [], "import_names": [], "rhs_call_name": "Formatter", "annotation": ""}, "snippet": "\tformatter = logging.Formatter('%(asctime)s %(levelname)s::%(message)s')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L23_C1", "label": "hdlrFile = FileHandler()", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L21_C0", "vector": [14, 1, 0.0943, 0.0041, 1, 0.67, 0.1429, 768, 3, 1, 0, 0, 306, 10, 1], "semantic": {"name": "hdlrFile", "arg_names": [], "import_names": [], "rhs_call_name": "FileHandler", "annotation": ""}, "snippet": "\thdlrFile = logging.FileHandler(appName + '.log')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L24_C1", "label": "setFormatter()", "type": "expression", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L21_C0", "vector": [8, 1, 0.0984, 0.0041, 1, 0.67, 0.2857, 948, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setFormatter", "arg_names": [], "import_names": [], "rhs_call_name": "setFormatter", "annotation": ""}, "snippet": "\thdlrFile.setFormatter(formatter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L25_C1", "label": "hdlrStd = StreamHandler()", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L21_C0", "vector": [14, 1, 0.1025, 0.0041, 1, 0.67, 0.4286, 413, 3, 0, 0, 0, 514, 10, 1], "semantic": {"name": "hdlrStd", "arg_names": [], "import_names": [], "rhs_call_name": "StreamHandler", "annotation": ""}, "snippet": "\thdlrStd = logging.StreamHandler()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L26_C1", "label": "setFormatter()", "type": "expression", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L21_C0", "vector": [8, 1, 0.1066, 0.0041, 1, 0.67, 0.5714, 948, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setFormatter", "arg_names": [], "import_names": [], "rhs_call_name": "setFormatter", "annotation": ""}, "snippet": "\thdlrStd.setFormatter(formatter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L27_C1", "label": "addHandler()", "type": "expression", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L21_C0", "vector": [8, 1, 0.1107, 0.0041, 1, 0.67, 0.7143, 255, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addHandler", "arg_names": [], "import_names": [], "rhs_call_name": "addHandler", "annotation": ""}, "snippet": "\tlogger.addHandler(hdlrFile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L28_C1", "label": "addHandler()", "type": "expression", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L21_C0", "vector": [8, 1, 0.1148, 0.0041, 1, 0.67, 0.8571, 255, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addHandler", "arg_names": [], "import_names": [], "rhs_call_name": "addHandler", "annotation": ""}, "snippet": "\tlogger.addHandler(hdlrStd) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L29_C1", "label": "setLevel()", "type": "expression", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L21_C0", "vector": [8, 1, 0.1189, 0.0041, 1, 0.67, 1.0, 810, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setLevel", "arg_names": [], "import_names": [], "rhs_call_name": "setLevel", "annotation": ""}, "snippet": "\tlogger.setLevel(logging.DEBUG)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L31_C0", "label": "Service", "type": "class", "loc": [31, 47], "level": 0, "parent": null, "vector": [3, 0, 0.1598, 0.0697, 0, 0.66, 0.6111, 451, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "Service", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Service:\n\t\n\tname = ''\n\ttesterPath = ''\n\n\tdef __init__(self, name, testerPath):\n\t\t\"\"\"Creates service\"\"\"\n\t\tself.name = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L33_C1", "label": "name =", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L31_C0", "vector": [14, 1, 0.1352, 0.0041, 1, 0.7, 0.0, 57, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tname = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L34_C1", "label": "testerPath =", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L31_C0", "vector": [14, 1, 0.1393, 0.0041, 1, 0.7, 0.2, 743, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "testerPath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ttesterPath = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L36_C1", "label": "__init__", "type": "function", "loc": [36, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L31_C0", "vector": [2, 1, 0.1537, 0.0164, 1, 0.7, 0.4, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "name", "testerPath"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef __init__(self, name, testerPath):\n\t\t\"\"\"Creates service\"\"\"\n\t\tself.name = name\n\t\tself.testerPath = testerPath"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L37_C2", "label": "expression", "type": "expression", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L36_C1", "vector": [8, 2, 0.1516, 0.0041, 2, 0.27, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"\"\"Creates service\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L38_C2", "label": "self.name =", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L36_C1", "vector": [14, 2, 0.1557, 0.0041, 2, 0.27, 0.5, 689, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.name = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L39_C2", "label": "self.testerPath =", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L36_C1", "vector": [14, 2, 0.1598, 0.0041, 2, 0.27, 1.0, 28, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.testerPath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.testerPath = testerPath"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L41_C1", "label": "getName", "type": "function", "loc": [41, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L31_C0", "vector": [2, 1, 0.1701, 0.0082, 1, 0.7, 0.6, 847, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "getName", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getName(self): \n\t\treturn self.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L42_C2", "label": "return", "type": "return", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L41_C1", "vector": [13, 2, 0.1721, 0.0041, 2, 0.84, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L43_C1", "label": "getCheckerPath", "type": "function", "loc": [43, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L31_C0", "vector": [2, 1, 0.1783, 0.0082, 1, 0.7, 0.8, 240, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "getCheckerPath", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getCheckerPath(self): \n\t\treturn self.checkerPath"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L44_C2", "label": "return", "type": "return", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L43_C1", "vector": [13, 2, 0.1803, 0.0041, 2, 0.79, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.checkerPath"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L46_C1", "label": "executeCheck", "type": "function", "loc": [46, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L31_C0", "vector": [2, 1, 0.1906, 0.0082, 1, 0.7, 1.0, 478, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "executeCheck", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef executeCheck(self):\n\t\treturn call(testerPath,'1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L47_C2", "label": "return", "type": "return", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L46_C1", "vector": [13, 2, 0.1926, 0.0041, 2, 0.83, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn call(testerPath,'1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L52_C0", "label": "Config", "type": "class", "loc": [52, 96], "level": 0, "parent": null, "vector": [3, 0, 0.3033, 0.1844, 0, 0.66, 0.6667, 979, 0, 6, 0, 0, 0, 0, 19], "semantic": {"name": "Config", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Config:\n\n\toptions = {}\n\n\tdef __init__(self, fileName = \"netspy.conf\"):\n\t\t\"\"\"Initialize config from file \"\"\"\n\t\tself.options = {'port' : '', 'server_port' : '', 'server_ip': '', 'service_list': [] }\n\t\tself.fileName = fileName"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L54_C1", "label": "options =", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L52_C0", "vector": [14, 1, 0.2213, 0.0041, 1, 0.44, 0.0, 707, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\toptions = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L56_C1", "label": "__init__", "type": "function", "loc": [56, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L52_C0", "vector": [2, 1, 0.2377, 0.0205, 1, 0.44, 0.1667, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "fileName"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef __init__(self, fileName = \"netspy.conf\"):\n\t\t\"\"\"Initialize config from file \"\"\"\n\t\tself.options = {'port' : '', 'server_port' : '', 'server_ip': '', 'service_list': [] }\n\t\tself.fileName = fileName\n\t\tself.loadFromFile(self.fileName)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L57_C2", "label": "expression", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L56_C1", "vector": [8, 2, 0.2336, 0.0041, 2, 0.5, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"\"\"Initialize config from file \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L58_C2", "label": "self.options =", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L56_C1", "vector": [14, 2, 0.2377, 0.0041, 2, 0.5, 0.3333, 968, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.options = {'port' : '', 'server_port' : '', 'server_ip': '', 'service_list': [] }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L59_C2", "label": "self.fileName =", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L56_C1", "vector": [14, 2, 0.2418, 0.0041, 2, 0.5, 0.6667, 344, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.fileName", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.fileName = fileName"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L60_C2", "label": "loadFromFile()", "type": "expression", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L56_C1", "vector": [8, 2, 0.2459, 0.0041, 2, 0.5, 1.0, 223, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "loadFromFile", "arg_names": [], "import_names": [], "rhs_call_name": "loadFromFile", "annotation": ""}, "snippet": "\t\tself.loadFromFile(self.fileName)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L61_C1", "label": "loadFromFile", "type": "function", "loc": [61, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L52_C0", "vector": [2, 1, 0.3033, 0.1107, 1, 0.44, 0.3333, 223, 0, 2, 0, 0, 0, 0, 18], "semantic": {"name": "loadFromFile", "arg_names": ["self", "fileName"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef loadFromFile(self,fileName):\n\t\ttry:\n\t\t\tlogger.info(\"Reading config file: \" + fileName)\n\t\t\tconfigFile = file(fileName,'r')\n\t\t\tline = configFile.readline()\n\t\t\tactive_options = ('port','server_port','server_ip')\n\t\t\twhile line != '' :\n\t\t\t\ttokens = line.strip().split(' ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L62_C2", "label": "try", "type": "try", "loc": [62, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L61_C1", "vector": [7, 2, 0.3053, 0.1066, 2, 0.09, 0.0, 0, 0, 1, 0, 0, 0, 0, 18], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ttry:\n\t\t\tlogger.info(\"Reading config file: \" + fileName)\n\t\t\tconfigFile = file(fileName,'r')\n\t\t\tline = configFile.readline()\n\t\t\tactive_options = ('port','server_port','server_ip')\n\t\t\twhile line != '' :\n\t\t\t\ttokens = line.strip().split(' ')\n\t\t\t\tif tokens[0] == 'service':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L63_C3", "label": "info()", "type": "expression", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L62_C2", "vector": [8, 3, 0.2582, 0.0041, 3, 0.18, 0.0, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": "\t\t\tlogger.info(\"Reading config file: \" + fileName)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L64_C3", "label": "configFile = file()", "type": "assigned_variable", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L62_C2", "vector": [14, 3, 0.2623, 0.0041, 3, 0.18, 0.2, 624, 3, 2, 0, 0, 107, 10, 1], "semantic": {"name": "configFile", "arg_names": [], "import_names": [], "rhs_call_name": "file", "annotation": ""}, "snippet": "\t\t\tconfigFile = file(fileName,'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L65_C3", "label": "line = readline()", "type": "assigned_variable", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L62_C2", "vector": [14, 3, 0.2664, 0.0041, 3, 0.18, 0.4, 373, 3, 0, 0, 0, 303, 10, 1], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "readline", "annotation": ""}, "snippet": "\t\t\tline = configFile.readline()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L66_C3", "label": "active_options =", "type": "assigned_variable", "loc": [66, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L62_C2", "vector": [14, 3, 0.2705, 0.0041, 3, 0.18, 0.6, 699, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "active_options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tactive_options = ('port','server_port','server_ip')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:While_L67_C3", "label": "while", "type": "while", "loc": [67, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L62_C2", "vector": [5, 3, 0.3074, 0.0697, 3, 0.18, 0.8, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\twhile line != '' :\n\t\t\t\ttokens = line.strip().split(' ')\n\t\t\t\tif tokens[0] == 'service':\n\t\t\t\t\tif (tokens[1] == 'alive'):\n\t\t\t\t\t\tlogger.warning(\"Service \" + tokens[1] + \" is already definied, please use different name\")\n\t\t\t\t\telif (os.path.isfile(scriptDir+'/'+tokens[2])):\t\n\t\t\t\t\t\tself.options['service_list'].append(Service(tokens[1],tokens[2]))\n\t\t\t\t\t\tlogger.debug(\"New service added: \" + tokens[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L68_C4", "label": "tokens = split()", "type": "assigned_variable", "loc": [68, 68], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:While_L67_C3", "vector": [14, 4, 0.2787, 0.0041, 4, 0.71, 0.0, 700, 3, 1, 0, 0, 908, 10, 2], "semantic": {"name": "tokens", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": "\t\t\t\ttokens = line.strip().split(' ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:If_L69_C4", "label": "if", "type": "if", "loc": [69, 82], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:While_L67_C3", "vector": [4, 4, 0.3094, 0.0574, 4, 0.71, 0.5, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tif tokens[0] == 'service':\n\t\t\t\t\tif (tokens[1] == 'alive'):\n\t\t\t\t\t\tlogger.warning(\"Service \" + tokens[1] + \" is already definied, please use different name\")\n\t\t\t\t\telif (os.path.isfile(scriptDir+'/'+tokens[2])):\t\n\t\t\t\t\t\tself.options['service_list'].append(Service(tokens[1],tokens[2]))\n\t\t\t\t\t\tlogger.debug(\"New service added: \" + tokens[1])\n\t\t\t\t\telse:\n\t\t\t\t\t\tlogger.warning(\"Service \" + tokens[1] +\" error: Can't find script : \" + scriptDir + '/' + tokens[2])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:If_L70_C5", "label": "if", "type": "if", "loc": [70, 77], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L69_C4", "vector": [4, 5, 0.3012, 0.0328, 5, 0.15, 0.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\tif (tokens[1] == 'alive'):\n\t\t\t\t\t\tlogger.warning(\"Service \" + tokens[1] + \" is already definied, please use different name\")\n\t\t\t\t\telif (os.path.isfile(scriptDir+'/'+tokens[2])):\t\n\t\t\t\t\t\tself.options['service_list'].append(Service(tokens[1],tokens[2]))\n\t\t\t\t\t\tlogger.debug(\"New service added: \" + tokens[1])\n\t\t\t\t\telse:\n\t\t\t\t\t\tlogger.warning(\"Service \" + tokens[1] +\" error: Can't find script : \" + scriptDir + '/' + tokens[2])\n\t\t\t\t\t\tlogger.warning(\"Service \" + tokens[1] +\" creation failed\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L71_C6", "label": "warning()", "type": "expression", "loc": [71, 71], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L70_C5", "vector": [8, 6, 0.291, 0.0041, 6, 0.56, 0.0, 320, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warning", "arg_names": [], "import_names": [], "rhs_call_name": "warning", "annotation": ""}, "snippet": "\t\t\t\t\t\tlogger.warning(\"Service \" + tokens[1] + \" is already definied, please use different name\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:If_L72_C5", "label": "if", "type": "if", "loc": [72, 77], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L70_C5", "vector": [4, 6, 0.3053, 0.0246, 6, 0.56, 1.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\telif (os.path.isfile(scriptDir+'/'+tokens[2])):\t\n\t\t\t\t\t\tself.options['service_list'].append(Service(tokens[1],tokens[2]))\n\t\t\t\t\t\tlogger.debug(\"New service added: \" + tokens[1])\n\t\t\t\t\telse:\n\t\t\t\t\t\tlogger.warning(\"Service \" + tokens[1] +\" error: Can't find script : \" + scriptDir + '/' + tokens[2])\n\t\t\t\t\t\tlogger.warning(\"Service \" + tokens[1] +\" creation failed\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L73_C6", "label": "append()", "type": "expression", "loc": [73, 73], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L72_C5", "vector": [8, 7, 0.2992, 0.0041, 7, 0.56, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\t\t\t\t\t\tself.options['service_list'].append(Service(tokens[1],tokens[2]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L74_C6", "label": "debug()", "type": "expression", "loc": [74, 74], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L72_C5", "vector": [8, 7, 0.3033, 0.0041, 7, 0.56, 0.3333, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": "\t\t\t\t\t\tlogger.debug(\"New service added: \" + tokens[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L76_C6", "label": "warning()", "type": "expression", "loc": [76, 76], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L72_C5", "vector": [8, 7, 0.3115, 0.0041, 7, 0.56, 0.6667, 320, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warning", "arg_names": [], "import_names": [], "rhs_call_name": "warning", "annotation": ""}, "snippet": "\t\t\t\t\t\tlogger.warning(\"Service \" + tokens[1] +\" error: Can't find script : \" + scriptDir + '/' + tokens[2])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L77_C6", "label": "warning()", "type": "expression", "loc": [77, 77], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L72_C5", "vector": [8, 7, 0.3156, 0.0041, 7, 0.56, 1.0, 320, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warning", "arg_names": [], "import_names": [], "rhs_call_name": "warning", "annotation": ""}, "snippet": "\t\t\t\t\t\tlogger.warning(\"Service \" + tokens[1] +\" creation failed\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:If_L78_C4", "label": "if", "type": "if", "loc": [78, 82], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L69_C4", "vector": [4, 5, 0.3279, 0.0205, 5, 0.15, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\telif tokens[0] in active_options:\n\t\t\t\t\tself.options[tokens[0]]=tokens[1]\t\n\t\t\t\t\tlogger.debug(tokens[0] + \" set to \" + tokens[1])\n\t\t\t\telse:\n\t\t\t\t\tlogger.warning(\"Unkown option \" + tokens[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L79_C5", "label": "assign", "type": "assigned_variable", "loc": [79, 79], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L78_C4", "vector": [14, 6, 0.3238, 0.0041, 6, 0.87, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\tself.options[tokens[0]]=tokens[1]\t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L80_C5", "label": "debug()", "type": "expression", "loc": [80, 80], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L78_C4", "vector": [8, 6, 0.3279, 0.0041, 6, 0.87, 0.5, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": "\t\t\t\t\tlogger.debug(tokens[0] + \" set to \" + tokens[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L82_C5", "label": "warning()", "type": "expression", "loc": [82, 82], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L78_C4", "vector": [8, 6, 0.3361, 0.0041, 6, 0.87, 1.0, 320, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warning", "arg_names": [], "import_names": [], "rhs_call_name": "warning", "annotation": ""}, "snippet": "\t\t\t\t\tlogger.warning(\"Unkown option \" + tokens[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L83_C4", "label": "line = readline()", "type": "assigned_variable", "loc": [83, 83], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:While_L67_C3", "vector": [14, 4, 0.3402, 0.0041, 4, 0.71, 1.0, 373, 3, 0, 0, 0, 303, 10, 1], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "readline", "annotation": ""}, "snippet": "\t\t\t\tline = configFile.readline()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L84_C3", "label": "close()", "type": "expression", "loc": [84, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L62_C2", "vector": [8, 3, 0.3443, 0.0041, 3, 0.18, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "\t\t\tconfigFile.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L86_C3", "label": "error()", "type": "expression", "loc": [86, 86], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L62_C2", "vector": [8, 3, 0.3525, 0.0041, 3, 0.18, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": "\t\t\tlogger.error( \"Can't read \" + fileName)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L87_C3", "label": "exit()", "type": "expression", "loc": [87, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L62_C2", "vector": [8, 3, 0.3566, 0.0041, 3, 0.18, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t\t\texit()\t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L89_C1", "label": "getPort", "type": "function", "loc": [89, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L52_C0", "vector": [2, 1, 0.3668, 0.0082, 1, 0.44, 0.5, 259, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "getPort", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getPort(self): \n\t\treturn self.options['port']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L90_C2", "label": "return", "type": "return", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L89_C1", "vector": [13, 2, 0.3689, 0.0041, 2, 0.91, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.options['port']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L91_C1", "label": "getServerPort", "type": "function", "loc": [91, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L52_C0", "vector": [2, 1, 0.375, 0.0082, 1, 0.44, 0.6667, 518, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "getServerPort", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getServerPort(self): \n\t\treturn self.options['server_port']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L92_C2", "label": "return", "type": "return", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L91_C1", "vector": [13, 2, 0.377, 0.0041, 2, 0.3, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.options['server_port']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L93_C1", "label": "getServerIp", "type": "function", "loc": [93, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L52_C0", "vector": [2, 1, 0.3832, 0.0082, 1, 0.44, 0.8333, 962, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "getServerIp", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getServerIp(self): \n\t\treturn self.options['server_ip']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L94_C2", "label": "return", "type": "return", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L93_C1", "vector": [13, 2, 0.3852, 0.0041, 2, 0.53, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.options['server_ip']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L95_C1", "label": "getServiceList", "type": "function", "loc": [95, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L52_C0", "vector": [2, 1, 0.3914, 0.0082, 1, 0.44, 1.0, 215, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "getServiceList", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getServiceList(self):\n\t\treturn self.options['service_list']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L96_C2", "label": "return", "type": "return", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L95_C1", "vector": [13, 2, 0.3934, 0.0041, 2, 0.01, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.options['service_list']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L99_C0", "label": "ClientApp", "type": "class", "loc": [99, 219], "level": 0, "parent": null, "vector": [3, 0, 0.6516, 0.4959, 0, 0.66, 0.7222, 174, 0, 9, 0, 0, 0, 0, 62], "semantic": {"name": "ClientApp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ClientApp:\n\n\tconfig = ''\n\tdef getHash(self):\n\t\thashValue=''\n\t\ttry:\n\t\t\thashFile=file(\".netspy.hash\",\"r\")\n\t\t\thashValue = hashFile.readline()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L101_C1", "label": "config =", "type": "assigned_variable", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L99_C0", "vector": [14, 1, 0.4139, 0.0041, 1, 0.59, 0.0, 308, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "config", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tconfig = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L102_C1", "label": "getHash", "type": "function", "loc": [102, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L99_C0", "vector": [2, 1, 0.4344, 0.0369, 1, 0.59, 0.1111, 67, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "getHash", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getHash(self):\n\t\thashValue=''\n\t\ttry:\n\t\t\thashFile=file(\".netspy.hash\",\"r\")\n\t\t\thashValue = hashFile.readline()\n\t\texcept IOError:\n\t\t\tlogger.warining( \"No hash found\")\n\t\tfinally:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L103_C2", "label": "hashValue =", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L102_C1", "vector": [14, 2, 0.4221, 0.0041, 2, 0.33, 0.0, 349, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "hashValue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\thashValue=''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L104_C2", "label": "try", "type": "try", "loc": [104, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L102_C1", "vector": [7, 2, 0.4385, 0.0287, 2, 0.33, 1.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ttry:\n\t\t\thashFile=file(\".netspy.hash\",\"r\")\n\t\t\thashValue = hashFile.readline()\n\t\texcept IOError:\n\t\t\tlogger.warining( \"No hash found\")\n\t\tfinally:\n\t\t\treturn hashValue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L105_C3", "label": "hashFile = file()", "type": "assigned_variable", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L104_C2", "vector": [14, 3, 0.4303, 0.0041, 3, 0.15, 0.0, 589, 3, 2, 0, 0, 107, 10, 1], "semantic": {"name": "hashFile", "arg_names": [], "import_names": [], "rhs_call_name": "file", "annotation": ""}, "snippet": "\t\t\thashFile=file(\".netspy.hash\",\"r\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L106_C3", "label": "hashValue = readline()", "type": "assigned_variable", "loc": [106, 106], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L104_C2", "vector": [14, 3, 0.4344, 0.0041, 3, 0.15, 0.5, 349, 3, 0, 0, 0, 303, 10, 1], "semantic": {"name": "hashValue", "arg_names": [], "import_names": [], "rhs_call_name": "readline", "annotation": ""}, "snippet": "\t\t\thashValue = hashFile.readline()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L108_C3", "label": "warining()", "type": "expression", "loc": [108, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L104_C2", "vector": [8, 3, 0.4426, 0.0041, 3, 0.15, 0.0, 71, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warining", "arg_names": [], "import_names": [], "rhs_call_name": "warining", "annotation": ""}, "snippet": "\t\t\tlogger.warining( \"No hash found\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L110_C3", "label": "return", "type": "return", "loc": [110, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L104_C2", "vector": [13, 3, 0.4508, 0.0041, 3, 0.15, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn hashValue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L112_C1", "label": "setHash", "type": "function", "loc": [112, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L99_C0", "vector": [2, 1, 0.4754, 0.0369, 1, 0.59, 0.2222, 558, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "setHash", "arg_names": ["self", "hashValue"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef setHash(self,hashValue):\n\t\t\"\"\" Function doc \"\"\"\n\t\tif (hashValue!=''):\n\t\t\ttry:\n\t\t\t\thashFile=file(\".netspy.hash\",\"w\")\n\t\t\t\thashFile.write(hashValue)\n\t\t\texcept IOError:\n\t\t\t\tlogger.error( \"Can't store hash value\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L113_C2", "label": "expression", "type": "expression", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L112_C1", "vector": [8, 2, 0.4631, 0.0041, 2, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"\"\" Function doc \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:If_L114_C2", "label": "if", "type": "if", "loc": [114, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L112_C1", "vector": [4, 2, 0.4795, 0.0287, 2, 0.38, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif (hashValue!=''):\n\t\t\ttry:\n\t\t\t\thashFile=file(\".netspy.hash\",\"w\")\n\t\t\t\thashFile.write(hashValue)\n\t\t\texcept IOError:\n\t\t\t\tlogger.error( \"Can't store hash value\")\n\t\t\t\texit(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L115_C3", "label": "try", "type": "try", "loc": [115, 120], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L114_C2", "vector": [7, 3, 0.4816, 0.0246, 3, 0.0, 0.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\ttry:\n\t\t\t\thashFile=file(\".netspy.hash\",\"w\")\n\t\t\t\thashFile.write(hashValue)\n\t\t\texcept IOError:\n\t\t\t\tlogger.error( \"Can't store hash value\")\n\t\t\t\texit(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L116_C4", "label": "hashFile = file()", "type": "assigned_variable", "loc": [116, 116], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L115_C3", "vector": [14, 4, 0.4754, 0.0041, 4, 0.63, 0.0, 589, 3, 2, 0, 0, 107, 10, 1], "semantic": {"name": "hashFile", "arg_names": [], "import_names": [], "rhs_call_name": "file", "annotation": ""}, "snippet": "\t\t\t\thashFile=file(\".netspy.hash\",\"w\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L117_C4", "label": "write()", "type": "expression", "loc": [117, 117], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L115_C3", "vector": [8, 4, 0.4795, 0.0041, 4, 0.63, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "\t\t\t\thashFile.write(hashValue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L119_C4", "label": "error()", "type": "expression", "loc": [119, 119], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L115_C3", "vector": [8, 4, 0.4877, 0.0041, 4, 0.63, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": "\t\t\t\tlogger.error( \"Can't store hash value\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L120_C4", "label": "exit()", "type": "expression", "loc": [120, 120], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L115_C3", "vector": [8, 4, 0.4918, 0.0041, 4, 0.63, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t\t\t\texit(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L122_C1", "label": "setConfig", "type": "function", "loc": [122, 123], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L99_C0", "vector": [2, 1, 0.502, 0.0082, 1, 0.59, 0.3333, 550, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "setConfig", "arg_names": ["self", "config"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef setConfig(self, config):\n\t\tself.config = config"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L123_C2", "label": "self.config =", "type": "assigned_variable", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L122_C1", "vector": [14, 2, 0.5041, 0.0041, 2, 0.05, 0.0, 663, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.config", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.config = config"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L125_C1", "label": "__init__", "type": "function", "loc": [125, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L99_C0", "vector": [2, 1, 0.5164, 0.0123, 1, 0.59, 0.4444, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "config"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef __init__(self,config=None):\n\t\tif config!=None:\n\t\t\tself.setConfig(config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:If_L126_C2", "label": "if", "type": "if", "loc": [126, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L125_C1", "vector": [4, 2, 0.5184, 0.0082, 2, 0.57, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif config!=None:\n\t\t\tself.setConfig(config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L127_C3", "label": "setConfig()", "type": "expression", "loc": [127, 127], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L126_C2", "vector": [8, 3, 0.5205, 0.0041, 3, 0.68, 0.0, 550, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setConfig", "arg_names": [], "import_names": [], "rhs_call_name": "setConfig", "annotation": ""}, "snippet": "\t\t\tself.setConfig(config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L129_C1", "label": "hashCheck", "type": "function", "loc": [129, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L99_C0", "vector": [2, 1, 0.5307, 0.0082, 1, 0.59, 0.5556, 665, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "hashCheck", "arg_names": ["self", "hashValue"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef hashCheck(self,hashValue):\n\t\treturn True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L130_C2", "label": "return", "type": "return", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L129_C1", "vector": [13, 2, 0.5328, 0.0041, 2, 0.29, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L132_C1", "label": "init", "type": "function", "loc": [132, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L99_C0", "vector": [2, 1, 0.543, 0.0082, 1, 0.59, 0.6667, 319, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef init(self):\n\t\tlogger.info('Client - running ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L133_C2", "label": "info()", "type": "expression", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L132_C1", "vector": [8, 2, 0.5451, 0.0041, 2, 0.36, 0.0, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": "\t\tlogger.info('Client - running ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "label": "registerAtServer", "type": "function", "loc": [135, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L99_C0", "vector": [2, 1, 0.6291, 0.1557, 1, 0.59, 0.7778, 540, 0, 1, 1, 0, 0, 0, 25], "semantic": {"name": "registerAtServer", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef registerAtServer(self):\n\t\ttry:\n\t\t\tserver = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n\t\t\tserver.connect((self.config.getServerIp(), int(self.config.getServerPort()) ))\n\t\texcept IOError:\n\t\t\tlogger.error(\"Can't register at monitoring server - connection problem\")\n\t\t\treturn False\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L136_C2", "label": "try", "type": "try", "loc": [136, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "vector": [7, 2, 0.5676, 0.0246, 2, 0.93, 0.0, 0, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ttry:\n\t\t\tserver = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n\t\t\tserver.connect((self.config.getServerIp(), int(self.config.getServerPort()) ))\n\t\texcept IOError:\n\t\t\tlogger.error(\"Can't register at monitoring server - connection problem\")\n\t\t\treturn False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L137_C3", "label": "server = socket()", "type": "assigned_variable", "loc": [137, 137], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L136_C2", "vector": [14, 3, 0.5615, 0.0041, 3, 0.35, 0.0, 268, 3, 2, 0, 0, 687, 10, 1], "semantic": {"name": "server", "arg_names": [], "import_names": [], "rhs_call_name": "socket", "annotation": ""}, "snippet": "\t\t\tserver = socket.socket(socket.AF_INET, socket.SOCK_STREAM)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L138_C3", "label": "connect()", "type": "expression", "loc": [138, 138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L136_C2", "vector": [8, 3, 0.5656, 0.0041, 3, 0.35, 1.0, 242, 3, 1, 0, 0, 0, 0, 4], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "\t\t\tserver.connect((self.config.getServerIp(), int(self.config.getServerPort()) ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L140_C3", "label": "error()", "type": "expression", "loc": [140, 140], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L136_C2", "vector": [8, 3, 0.5738, 0.0041, 3, 0.35, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": "\t\t\tlogger.error(\"Can't register at monitoring server - connection problem\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L141_C3", "label": "return", "type": "return", "loc": [141, 141], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L136_C2", "vector": [13, 3, 0.5779, 0.0041, 3, 0.35, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L143_C2", "label": "service_list =", "type": "assigned_variable", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "vector": [14, 2, 0.5861, 0.0041, 2, 0.93, 0.0909, 896, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "service_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tservice_list = [];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:For_L144_C2", "label": "for i", "type": "for", "loc": [144, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "vector": [6, 2, 0.5922, 0.0082, 2, 0.93, 0.1818, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tfor i in self.config.getServiceList():\n\t\t\tservice_list.append(i.getName())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L145_C3", "label": "append()", "type": "expression", "loc": [145, 145], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:For_L144_C2", "vector": [8, 3, 0.5943, 0.0041, 3, 0.66, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\t\t\tservice_list.append(i.getName())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L147_C2", "label": "append()", "type": "expression", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "vector": [8, 2, 0.6025, 0.0041, 2, 0.93, 0.2727, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\t\tservice_list.append('alive')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L149_C2", "label": "message =", "type": "assigned_variable", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "vector": [14, 2, 0.6107, 0.0041, 2, 0.93, 0.3636, 635, 0, 0, 0, 0, 0, 6, 2], "semantic": {"name": "message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tmessage = { 'command' : 'register', 'payload': {'hash' : self.getHash(), 'port' : self.config.getPort(), 'service_list' : service_list }}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L150_C2", "label": "messageToSend = dumps()", "type": "assigned_variable", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "vector": [14, 2, 0.6148, 0.0041, 2, 0.93, 0.4545, 23, 3, 1, 0, 0, 160, 10, 1], "semantic": {"name": "messageToSend", "arg_names": [], "import_names": [], "rhs_call_name": "dumps", "annotation": ""}, "snippet": "\t\tmessageToSend = json.dumps(message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L151_C2", "label": "send()", "type": "expression", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "vector": [8, 2, 0.6189, 0.0041, 2, 0.93, 0.5455, 826, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "send", "arg_names": [], "import_names": [], "rhs_call_name": "send", "annotation": ""}, "snippet": "\t\tserver.send(messageToSend)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L152_C2", "label": "data = recv()", "type": "assigned_variable", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "vector": [14, 2, 0.623, 0.0041, 2, 0.93, 0.6364, 929, 3, 1, 0, 0, 178, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "recv", "annotation": ""}, "snippet": "\t\tdata = server.recv(1024)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L153_C2", "label": "close()", "type": "expression", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "vector": [8, 2, 0.627, 0.0041, 2, 0.93, 0.7273, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "\t\tserver.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L154_C2", "label": "answer = loads()", "type": "assigned_variable", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "vector": [14, 2, 0.6311, 0.0041, 2, 0.93, 0.8182, 607, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "answer", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": "\t\tanswer = json.loads(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:If_L156_C2", "label": "if", "type": "if", "loc": [156, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "vector": [4, 2, 0.6434, 0.0123, 2, 0.93, 0.9091, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif (answer['command'] != 'register'): \n\t\t\tlogger.error(\"Bad command type - expected 'register'\")\n\t\t\treturn False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L157_C3", "label": "error()", "type": "expression", "loc": [157, 157], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L156_C2", "vector": [8, 3, 0.6434, 0.0041, 3, 0.66, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": "\t\t\tlogger.error(\"Bad command type - expected 'register'\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L158_C3", "label": "return", "type": "return", "loc": [158, 158], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L156_C2", "vector": [13, 3, 0.6475, 0.0041, 3, 0.66, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:If_L159_C2", "label": "if", "type": "if", "loc": [159, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "vector": [4, 2, 0.6783, 0.0574, 2, 0.93, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif (answer['payload']['status'] == 0):\n\t\t\tlogger.info(\"Reusing old hash\") \n\t\t\treturn True\n\t\telif (answer['payload']['status'] == 1):\n\t\t\tlogger.info(\"Saving new hash: \" + str(answer['payload']['hash']))\n\t\t\thashValue = answer['payload']['hash']\n\t\t\tself.setHash(str(hashValue))\n\t\t\treturn True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L160_C3", "label": "info()", "type": "expression", "loc": [160, 160], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L159_C2", "vector": [8, 3, 0.6557, 0.0041, 3, 0.44, 0.0, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": "\t\t\tlogger.info(\"Reusing old hash\") "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L161_C3", "label": "return", "type": "return", "loc": [161, 161], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L159_C2", "vector": [13, 3, 0.6598, 0.0041, 3, 0.44, 0.5, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:If_L162_C2", "label": "if", "type": "if", "loc": [162, 172], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L159_C2", "vector": [4, 3, 0.6844, 0.0451, 3, 0.44, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif (answer['payload']['status'] == 1):\n\t\t\tlogger.info(\"Saving new hash: \" + str(answer['payload']['hash']))\n\t\t\thashValue = answer['payload']['hash']\n\t\t\tself.setHash(str(hashValue))\n\t\t\treturn True\n\t\telif (answer['payload']['status'] == 2):\n\t\t\tclear = file('.netspy.hash','w')\n\t\t\tclear.write('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L163_C3", "label": "info()", "type": "expression", "loc": [163, 163], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L162_C2", "vector": [8, 4, 0.668, 0.0041, 4, 0.25, 0.0, 730, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": "\t\t\tlogger.info(\"Saving new hash: \" + str(answer['payload']['hash']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L164_C3", "label": "hashValue =", "type": "assigned_variable", "loc": [164, 164], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L162_C2", "vector": [14, 4, 0.6721, 0.0041, 4, 0.25, 0.25, 349, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "hashValue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\thashValue = answer['payload']['hash']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L165_C3", "label": "setHash()", "type": "expression", "loc": [165, 165], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L162_C2", "vector": [8, 4, 0.6762, 0.0041, 4, 0.25, 0.5, 558, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "setHash", "arg_names": [], "import_names": [], "rhs_call_name": "setHash", "annotation": ""}, "snippet": "\t\t\tself.setHash(str(hashValue))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L166_C3", "label": "return", "type": "return", "loc": [166, 166], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L162_C2", "vector": [13, 4, 0.6803, 0.0041, 4, 0.25, 0.75, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:If_L167_C2", "label": "if", "type": "if", "loc": [167, 172], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L162_C2", "vector": [4, 4, 0.6947, 0.0246, 4, 0.25, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif (answer['payload']['status'] == 2):\n\t\t\tclear = file('.netspy.hash','w')\n\t\t\tclear.write('')\n\t\t\treturn False\n\t\telse:\n\t\t\treturn False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L168_C3", "label": "clear = file()", "type": "assigned_variable", "loc": [168, 168], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L167_C2", "vector": [14, 5, 0.6885, 0.0041, 5, 0.01, 0.0, 712, 3, 2, 0, 0, 107, 10, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "file", "annotation": ""}, "snippet": "\t\t\tclear = file('.netspy.hash','w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L169_C3", "label": "write()", "type": "expression", "loc": [169, 169], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L167_C2", "vector": [8, 5, 0.6926, 0.0041, 5, 0.01, 0.3333, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "\t\t\tclear.write('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L170_C3", "label": "return", "type": "return", "loc": [170, 170], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L167_C2", "vector": [13, 5, 0.6967, 0.0041, 5, 0.01, 0.6667, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L172_C3", "label": "return", "type": "return", "loc": [172, 172], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L167_C2", "vector": [13, 5, 0.7049, 0.0041, 5, 0.01, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L174_C1", "label": "performServiceCheck", "type": "function", "loc": [174, 195], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L99_C0", "vector": [2, 1, 0.7561, 0.0902, 1, 0.59, 0.8889, 67, 0, 2, 1, 0, 0, 0, 12], "semantic": {"name": "performServiceCheck", "arg_names": ["self", "message"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef performServiceCheck(self,message):\n\t\ttry:\n\t\t\tquestion = json.loads(message)\n\t\t\tif question['command'] != 'check_status':\n\t\t\t\tlogger.error(\"Unknown command '\" + question['command'] + \"'received from server\")\n\t\t\t\tlogger.error(\"No check performed\")\n\t\t\t\treturn\n\t\t\telse:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L175_C2", "label": "try", "type": "try", "loc": [175, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L174_C1", "vector": [7, 2, 0.7582, 0.0861, 2, 0.87, 0.0, 0, 0, 1, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ttry:\n\t\t\tquestion = json.loads(message)\n\t\t\tif question['command'] != 'check_status':\n\t\t\t\tlogger.error(\"Unknown command '\" + question['command'] + \"'received from server\")\n\t\t\t\tlogger.error(\"No check performed\")\n\t\t\t\treturn\n\t\t\telse:\n\t\t\t\tlogger.info(\"Performing check\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L176_C3", "label": "question = loads()", "type": "assigned_variable", "loc": [176, 176], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L175_C2", "vector": [14, 3, 0.7213, 0.0041, 3, 0.03, 0.0, 785, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "question", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": "\t\t\tquestion = json.loads(message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:If_L177_C3", "label": "if", "type": "if", "loc": [177, 191], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L175_C2", "vector": [4, 3, 0.7541, 0.0615, 3, 0.03, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif question['command'] != 'check_status':\n\t\t\t\tlogger.error(\"Unknown command '\" + question['command'] + \"'received from server\")\n\t\t\t\tlogger.error(\"No check performed\")\n\t\t\t\treturn\n\t\t\telse:\n\t\t\t\tlogger.info(\"Performing check\")\n\t\t\t\tresultList = []\n\t\t\t\talive = { 'alive' : 0 }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L178_C4", "label": "error()", "type": "expression", "loc": [178, 178], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L177_C3", "vector": [8, 4, 0.7295, 0.0041, 4, 0.6, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": "\t\t\t\tlogger.error(\"Unknown command '\" + question['command'] + \"'received from server\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L179_C4", "label": "error()", "type": "expression", "loc": [179, 179], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L177_C3", "vector": [8, 4, 0.7336, 0.0041, 4, 0.6, 0.1111, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": "\t\t\t\tlogger.error(\"No check performed\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L180_C4", "label": "return", "type": "return", "loc": [180, 180], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L177_C3", "vector": [13, 4, 0.7377, 0.0041, 4, 0.6, 0.2222, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\treturn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L182_C4", "label": "info()", "type": "expression", "loc": [182, 182], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L177_C3", "vector": [8, 4, 0.7459, 0.0041, 4, 0.6, 0.3333, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": "\t\t\t\tlogger.info(\"Performing check\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L183_C4", "label": "resultList =", "type": "assigned_variable", "loc": [183, 183], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L177_C3", "vector": [14, 4, 0.75, 0.0041, 4, 0.6, 0.4444, 254, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "resultList", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tresultList = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L184_C4", "label": "alive =", "type": "assigned_variable", "loc": [184, 184], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L177_C3", "vector": [14, 4, 0.7541, 0.0041, 4, 0.6, 0.5556, 256, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "alive", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\talive = { 'alive' : 0 }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L185_C4", "label": "append()", "type": "expression", "loc": [185, 185], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L177_C3", "vector": [8, 4, 0.7582, 0.0041, 4, 0.6, 0.6667, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\t\t\t\tresultList.append(alive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:For_L186_C4", "label": "for service", "type": "for", "loc": [186, 189], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L177_C3", "vector": [6, 4, 0.7684, 0.0164, 4, 0.6, 0.7778, 314, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "service", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tfor service in self.config.getServiceList():\n\t\t\t\t\ttmp = service.executeCheck()\n\t\t\t\t\tresult = {service.getName() : tmp }\n\t\t\t\t\tresultList.append(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L187_C5", "label": "tmp = executeCheck()", "type": "assigned_variable", "loc": [187, 187], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:For_L186_C4", "vector": [14, 5, 0.7664, 0.0041, 5, 0.56, 0.0, 517, 3, 0, 0, 0, 478, 10, 1], "semantic": {"name": "tmp", "arg_names": [], "import_names": [], "rhs_call_name": "executeCheck", "annotation": ""}, "snippet": "\t\t\t\t\ttmp = service.executeCheck()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L188_C5", "label": "result =", "type": "assigned_variable", "loc": [188, 188], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:For_L186_C4", "vector": [14, 5, 0.7705, 0.0041, 5, 0.56, 0.5, 51, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\tresult = {service.getName() : tmp }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L189_C5", "label": "append()", "type": "expression", "loc": [189, 189], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:For_L186_C4", "vector": [8, 5, 0.7746, 0.0041, 5, 0.56, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\t\t\t\t\tresultList.append(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L190_C4", "label": "answer =", "type": "assigned_variable", "loc": [190, 190], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L177_C3", "vector": [14, 4, 0.7787, 0.0041, 4, 0.6, 0.8889, 607, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "answer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tanswer = {'command' : 'check_status', 'payload' : {'check_result' : resultList }}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L191_C4", "label": "return", "type": "return", "loc": [191, 191], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L177_C3", "vector": [13, 4, 0.7828, 0.0041, 4, 0.6, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\treturn json.dumps(answer);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L194_C3", "label": "error()", "type": "expression", "loc": [194, 194], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L175_C2", "vector": [8, 3, 0.7951, 0.0041, 3, 0.03, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": "\t\t\tlogger.error(\"Unsupported command format\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L195_C3", "label": "error()", "type": "expression", "loc": [195, 195], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L175_C2", "vector": [8, 3, 0.7992, 0.0041, 3, 0.03, 1.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": "\t\t\tlogger.error(\"No check performed\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L197_C1", "label": "run", "type": "function", "loc": [197, 219], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L99_C0", "vector": [2, 1, 0.8525, 0.0943, 1, 0.59, 1.0, 679, 0, 1, 0, 0, 0, 0, 16], "semantic": {"name": "run", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef run(self):\n\t\tlogger.info(\"Client - registering at monitoring server\")\n\t\ti=0\n\t\twhile (i<3 and not self.registerAtServer()):\n\t\t\ti=i+1\n\n\t\tif (i==3):\n\t\t\tlogger.error(\"Connect to monitoring server failed - can't connect to specified host\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L198_C2", "label": "info()", "type": "expression", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L197_C1", "vector": [8, 2, 0.8115, 0.0041, 2, 0.86, 0.0, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": "\t\tlogger.info(\"Client - registering at monitoring server\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L199_C2", "label": "i =", "type": "assigned_variable", "loc": [199, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L197_C1", "vector": [14, 2, 0.8156, 0.0041, 2, 0.86, 0.1111, 826, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ti=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:While_L200_C2", "label": "while", "type": "while", "loc": [200, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L197_C1", "vector": [5, 2, 0.8217, 0.0082, 2, 0.86, 0.2222, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\twhile (i<3 and not self.registerAtServer()):\n\t\t\ti=i+1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L201_C3", "label": "i =", "type": "assigned_variable", "loc": [201, 201], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:While_L200_C2", "vector": [14, 3, 0.8238, 0.0041, 3, 0.42, 0.0, 826, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\ti=i+1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:If_L203_C2", "label": "if", "type": "if", "loc": [203, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L197_C1", "vector": [4, 2, 0.8381, 0.0164, 2, 0.86, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif (i==3):\n\t\t\tlogger.error(\"Connect to monitoring server failed - can't connect to specified host\")\n\t\t\tlogger.error(\"Please check your config file\")\n\t\t\treturn "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L204_C3", "label": "error()", "type": "expression", "loc": [204, 204], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L203_C2", "vector": [8, 3, 0.8361, 0.0041, 3, 0.58, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": "\t\t\tlogger.error(\"Connect to monitoring server failed - can't connect to specified host\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L205_C3", "label": "error()", "type": "expression", "loc": [205, 205], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L203_C2", "vector": [8, 3, 0.8402, 0.0041, 3, 0.58, 0.5, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": "\t\t\tlogger.error(\"Please check your config file\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L206_C3", "label": "return", "type": "return", "loc": [206, 206], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L203_C2", "vector": [13, 3, 0.8443, 0.0041, 3, 0.58, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L208_C2", "label": "info()", "type": "expression", "loc": [208, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L197_C1", "vector": [8, 2, 0.8525, 0.0041, 2, 0.86, 0.4444, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": "\t\tlogger.info(\"Client - register succesful\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L209_C2", "label": "client = socket()", "type": "assigned_variable", "loc": [209, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L197_C1", "vector": [14, 2, 0.8566, 0.0041, 2, 0.86, 0.5556, 608, 3, 2, 0, 0, 687, 10, 1], "semantic": {"name": "client", "arg_names": [], "import_names": [], "rhs_call_name": "socket", "annotation": ""}, "snippet": "\t\tclient = socket.socket(socket.AF_INET, socket.SOCK_STREAM)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L210_C2", "label": "bind()", "type": "expression", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L197_C1", "vector": [8, 2, 0.8607, 0.0041, 2, 0.86, 0.6667, 640, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "bind", "arg_names": [], "import_names": [], "rhs_call_name": "bind", "annotation": ""}, "snippet": "\t\tclient.bind(('',int(self.config.getPort())))\t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L211_C2", "label": "listen()", "type": "expression", "loc": [211, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L197_C1", "vector": [8, 2, 0.8648, 0.0041, 2, 0.86, 0.7778, 265, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "listen", "arg_names": [], "import_names": [], "rhs_call_name": "listen", "annotation": ""}, "snippet": "\t\tclient.listen(5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L212_C2", "label": "info()", "type": "expression", "loc": [212, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L197_C1", "vector": [8, 2, 0.8689, 0.0041, 2, 0.86, 0.8889, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": "\t\tlogger.info('Client - waiting for commands from server')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:While_L214_C2", "label": "while", "type": "while", "loc": [214, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L197_C1", "vector": [5, 2, 0.8873, 0.0246, 2, 0.86, 1.0, 0, 1, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\twhile 1:\n\t\t\trequest, address = client.accept()\n\t\t\tmessage = request.recv(1024)\n\t\t\tanswer = self.performServiceCheck(message)\n\t\t\trequest.send(answer)\n\t\t\trequest.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L215_C3", "label": "request, address = accept()", "type": "assigned_variable", "loc": [215, 215], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:While_L214_C2", "vector": [14, 3, 0.8811, 0.0041, 3, 0.18, 0.0, 983, 3, 0, 0, 0, 829, 10, 1], "semantic": {"name": "request, address", "arg_names": [], "import_names": [], "rhs_call_name": "accept", "annotation": ""}, "snippet": "\t\t\trequest, address = client.accept()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L216_C3", "label": "message = recv()", "type": "assigned_variable", "loc": [216, 216], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:While_L214_C2", "vector": [14, 3, 0.8852, 0.0041, 3, 0.18, 0.25, 635, 3, 1, 0, 0, 178, 10, 1], "semantic": {"name": "message", "arg_names": [], "import_names": [], "rhs_call_name": "recv", "annotation": ""}, "snippet": "\t\t\tmessage = request.recv(1024)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L217_C3", "label": "answer = performServiceCheck()", "type": "assigned_variable", "loc": [217, 217], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:While_L214_C2", "vector": [14, 3, 0.8893, 0.0041, 3, 0.18, 0.5, 607, 3, 1, 0, 0, 67, 10, 1], "semantic": {"name": "answer", "arg_names": [], "import_names": [], "rhs_call_name": "performServiceCheck", "annotation": ""}, "snippet": "\t\t\tanswer = self.performServiceCheck(message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L218_C3", "label": "send()", "type": "expression", "loc": [218, 218], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:While_L214_C2", "vector": [8, 3, 0.8934, 0.0041, 3, 0.18, 0.75, 826, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "send", "arg_names": [], "import_names": [], "rhs_call_name": "send", "annotation": ""}, "snippet": "\t\t\trequest.send(answer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L219_C3", "label": "close()", "type": "expression", "loc": [219, 219], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:While_L214_C2", "vector": [8, 3, 0.8975, 0.0041, 3, 0.18, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "\t\t\trequest.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L222_C0", "label": "parseArgs", "type": "function", "loc": [222, 235], "level": 0, "parent": null, "vector": [2, 0, 0.9365, 0.0574, 0, 0.66, 0.7778, 905, 0, 0, 1, 0, 0, 0, 7], "semantic": {"name": "parseArgs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parseArgs():\n\n\tparser = argparse.ArgumentParser(prog=appName, usage='%(prog)s [options]')\n\tparser.add_argument('--verbose','-v', action='store_false', help='verbose mode')\n\tparser.add_argument('--config','-c', action='store', help='config filename')\n\n\targs = parser.parse_args()\n\tif args.verbose == True:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L224_C1", "label": "parser = ArgumentParser()", "type": "assigned_variable", "loc": [224, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L222_C0", "vector": [14, 1, 0.918, 0.0041, 1, 0.54, 0.0, 968, 3, 2, 0, 0, 570, 10, 1], "semantic": {"name": "parser", "arg_names": [], "import_names": [], "rhs_call_name": "ArgumentParser", "annotation": ""}, "snippet": "\tparser = argparse.ArgumentParser(prog=appName, usage='%(prog)s [options]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L225_C1", "label": "add_argument()", "type": "expression", "loc": [225, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L222_C0", "vector": [8, 1, 0.9221, 0.0041, 1, 0.54, 0.2, 178, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_argument", "arg_names": [], "import_names": [], "rhs_call_name": "add_argument", "annotation": ""}, "snippet": "\tparser.add_argument('--verbose','-v', action='store_false', help='verbose mode')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L226_C1", "label": "add_argument()", "type": "expression", "loc": [226, 226], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L222_C0", "vector": [8, 1, 0.9262, 0.0041, 1, 0.54, 0.4, 178, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_argument", "arg_names": [], "import_names": [], "rhs_call_name": "add_argument", "annotation": ""}, "snippet": "\tparser.add_argument('--config','-c', action='store', help='config filename')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L228_C1", "label": "args = parse_args()", "type": "assigned_variable", "loc": [228, 228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L222_C0", "vector": [14, 1, 0.9344, 0.0041, 1, 0.54, 0.6, 805, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": "\targs = parser.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:If_L229_C1", "label": "if", "type": "if", "loc": [229, 230], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L222_C0", "vector": [4, 1, 0.9406, 0.0082, 1, 0.54, 0.8, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif args.verbose == True:\n\t\tlogger.setLevel(logging.ERROR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L230_C2", "label": "setLevel()", "type": "expression", "loc": [230, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L229_C1", "vector": [8, 2, 0.9426, 0.0041, 2, 0.7, 0.0, 810, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setLevel", "arg_names": [], "import_names": [], "rhs_call_name": "setLevel", "annotation": ""}, "snippet": "\t\tlogger.setLevel(logging.ERROR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:If_L231_C1", "label": "if", "type": "if", "loc": [231, 235], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L222_C0", "vector": [4, 1, 0.9549, 0.0205, 1, 0.54, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif args.config != None:\n\t\treturn Config(args.config)\n\n\telse:\n\t\treturn Config()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L232_C2", "label": "return", "type": "return", "loc": [232, 232], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L231_C1", "vector": [13, 2, 0.9508, 0.0041, 2, 0.26, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn Config(args.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L235_C2", "label": "return", "type": "return", "loc": [235, 235], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_432:If_L231_C1", "vector": [13, 2, 0.9631, 0.0041, 2, 0.26, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn Config()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L239_C0", "label": "initLogger()", "type": "expression", "loc": [239, 239], "level": 0, "parent": null, "vector": [8, 0, 0.9795, 0.0041, 0, 0.66, 0.8333, 186, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "initLogger", "arg_names": [], "import_names": [], "rhs_call_name": "initLogger", "annotation": ""}, "snippet": "initLogger()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L240_C0", "label": "client = ClientApp()", "type": "assigned_variable", "loc": [240, 240], "level": 0, "parent": null, "vector": [14, 0, 0.9836, 0.0041, 0, 0.66, 0.8889, 608, 3, 1, 0, 0, 174, 10, 2], "semantic": {"name": "client", "arg_names": [], "import_names": [], "rhs_call_name": "ClientApp", "annotation": ""}, "snippet": "client = ClientApp(parseArgs())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L241_C0", "label": "init()", "type": "expression", "loc": [241, 241], "level": 0, "parent": null, "vector": [8, 0, 0.9877, 0.0041, 0, 0.66, 0.9444, 319, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "init", "arg_names": [], "import_names": [], "rhs_call_name": "init", "annotation": ""}, "snippet": "client.init()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L242_C0", "label": "run()", "type": "expression", "loc": [242, 242], "level": 0, "parent": null, "vector": [8, 0, 0.9918, 0.0041, 0, 0.66, 1.0, 679, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": "client.run()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L22_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L23_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L24_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L25_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L26_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L27_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L28_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L29_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L33_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L34_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L36_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L36_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L36_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L36_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L41_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L41_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L43_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L43_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L46_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L46_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L54_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L56_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L56_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L56_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L56_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L56_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L61_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L61_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L63_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L64_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L65_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L66_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:While_L67_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:While_L67_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:While_L67_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_432:If_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_432:If_L70_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L70_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L71_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L70_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_432:If_L72_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L72_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L73_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L72_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L74_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L72_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L76_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L72_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L77_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_432:If_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L79_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L80_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L82_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:While_L67_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L84_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L86_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L87_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L89_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L89_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L91_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L91_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L92_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L93_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L93_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L94_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L95_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L95_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L96_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L101_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L102_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L102_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L103_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L102_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L104_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L105_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L106_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L108_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L110_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L112_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L112_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L113_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L112_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:If_L114_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L115_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L115_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L115_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L115_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L115_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L122_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L122_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L123_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L125_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L125_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:If_L126_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L126_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L127_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L129_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L129_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L130_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L132_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L132_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L133_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L136_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L136_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L137_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L136_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L138_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L136_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L140_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L136_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L141_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L143_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:For_L144_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:For_L144_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L145_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L147_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L149_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L150_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L151_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L152_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L153_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L154_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:If_L156_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L156_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L157_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L156_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L158_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:If_L159_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L159_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L160_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L159_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L161_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L159_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:If_L162_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L162_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L163_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L162_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L164_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L162_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L165_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L162_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L166_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L162_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:If_L167_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L167_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L168_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L167_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L169_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L167_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L170_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L167_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L172_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L174_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L174_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L175_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L175_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L176_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L175_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:If_L177_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L177_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L177_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L177_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L180_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L177_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L177_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L177_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L177_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L177_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_432:For_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:For_L186_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L187_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:For_L186_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L188_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:For_L186_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L189_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L177_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L190_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L177_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L191_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L175_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L194_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:Try_L175_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L195_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L197_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L197_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L198_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L197_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L199_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L197_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:While_L200_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:While_L200_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L201_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L197_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:If_L203_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L203_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L204_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L203_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L205_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L203_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L206_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L197_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L208_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L197_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L209_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L197_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L210_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L197_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L211_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L197_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L212_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L197_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:While_L214_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:While_L214_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L215_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:While_L214_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L216_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:While_L214_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L217_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:While_L214_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L218_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:While_L214_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L219_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L224_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L225_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L226_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Assign_L228_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:If_L229_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L229_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Expr_L230_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:FunctionDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_432:If_L231_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L231_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L232_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_432:If_L231_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_432:Return_L235_C2"}] |
#!/usr/bin/env python
"""
NetSpy Client
by Marcin Ciechowicz for ZPR
v0.01
"""
import socket
import json
from subprocess import call
import logging
import argparse
import os.path
appName = 'NetSpyClient'
scriptDir = 'scripts'
logger = logging.getLogger(appName)
def initLogger():
formatter = logging.Formatter('%(asctime)s %(levelname)s::%(message)s')
hdlrFile = logging.FileHandler(appName + '.log')
hdlrFile.setFormatter(formatter)
hdlrStd = logging.StreamHandler()
hdlrStd.setFormatter(formatter)
logger.addHandler(hdlrFile)
logger.addHandler(hdlrStd)
logger.setLevel(logging.DEBUG)
class Service:
name = ''
testerPath = ''
def __init__(self, name, testerPath):
"""Creates service"""
self.name = name
self.testerPath = testerPath
def getName(self):
return self.name
def getCheckerPath(self):
return self.checkerPath
def executeCheck(self):
return call(testerPath,'1')
class Config:
options = {}
def __init__(self, fileName = "netspy.conf"):
"""Initialize config from file """
self.options = {'port' : '', 'server_port' : '', 'server_ip': '', 'service_list': [] }
self.fileName = fileName
self.loadFromFile(self.fileName)
def loadFromFile(self,fileName):
try:
logger.info("Reading config file: " + fileName)
configFile = file(fileName,'r')
line = configFile.readline()
active_options = ('port','server_port','server_ip')
while line != '' :
tokens = line.strip().split(' ')
if tokens[0] == 'service':
if (tokens[1] == 'alive'):
logger.warning("Service " + tokens[1] + " is already definied, please use different name")
elif (os.path.isfile(scriptDir+'/'+tokens[2])):
self.options['service_list'].append(Service(tokens[1],tokens[2]))
logger.debug("New service added: " + tokens[1])
else:
logger.warning("Service " + tokens[1] +" error: Can't find script : " + scriptDir + '/' + tokens[2])
logger.warning("Service " + tokens[1] +" creation failed")
elif tokens[0] in active_options:
self.options[tokens[0]]=tokens[1]
logger.debug(tokens[0] + " set to " + tokens[1])
else:
logger.warning("Unkown option " + tokens[0])
line = configFile.readline()
configFile.close()
except IOError:
logger.error( "Can't read " + fileName)
exit()
def getPort(self):
return self.options['port']
def getServerPort(self):
return self.options['server_port']
def getServerIp(self):
return self.options['server_ip']
def getServiceList(self):
return self.options['service_list']
class ClientApp:
config = ''
def getHash(self):
hashValue=''
try:
hashFile=file(".netspy.hash","r")
hashValue = hashFile.readline()
except IOError:
logger.warining( "No hash found")
finally:
return hashValue
def setHash(self,hashValue):
""" Function doc """
if (hashValue!=''):
try:
hashFile=file(".netspy.hash","w")
hashFile.write(hashValue)
except IOError:
logger.error( "Can't store hash value")
exit(0)
def setConfig(self, config):
self.config = config
def __init__(self,config=None):
if config!=None:
self.setConfig(config)
def hashCheck(self,hashValue):
return True
def init(self):
logger.info('Client - running ')
def registerAtServer(self):
try:
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.connect((self.config.getServerIp(), int(self.config.getServerPort()) ))
except IOError:
logger.error("Can't register at monitoring server - connection problem")
return False
service_list = [];
for i in self.config.getServiceList():
service_list.append(i.getName())
service_list.append('alive')
message = { 'command' : 'register', 'payload': {'hash' : self.getHash(), 'port' : self.config.getPort(), 'service_list' : service_list }}
messageToSend = json.dumps(message)
server.send(messageToSend)
data = server.recv(1024)
server.close()
answer = json.loads(data)
if (answer['command'] != 'register'):
logger.error("Bad command type - expected 'register'")
return False
if (answer['payload']['status'] == 0):
logger.info("Reusing old hash")
return True
elif (answer['payload']['status'] == 1):
logger.info("Saving new hash: " + str(answer['payload']['hash']))
hashValue = answer['payload']['hash']
self.setHash(str(hashValue))
return True
elif (answer['payload']['status'] == 2):
clear = file('.netspy.hash','w')
clear.write('')
return False
else:
return False
def performServiceCheck(self,message):
try:
question = json.loads(message)
if question['command'] != 'check_status':
logger.error("Unknown command '" + question['command'] + "'received from server")
logger.error("No check performed")
return
else:
logger.info("Performing check")
resultList = []
alive = { 'alive' : 0 }
resultList.append(alive)
for service in self.config.getServiceList():
tmp = service.executeCheck()
result = {service.getName() : tmp }
resultList.append(result)
answer = {'command' : 'check_status', 'payload' : {'check_result' : resultList }}
return json.dumps(answer);
except ValueError:
logger.error("Unsupported command format")
logger.error("No check performed")
def run(self):
logger.info("Client - registering at monitoring server")
i=0
while (i<3 and not self.registerAtServer()):
i=i+1
if (i==3):
logger.error("Connect to monitoring server failed - can't connect to specified host")
logger.error("Please check your config file")
return
logger.info("Client - register succesful")
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.bind(('',int(self.config.getPort())))
client.listen(5)
logger.info('Client - waiting for commands from server')
while 1:
request, address = client.accept()
message = request.recv(1024)
answer = self.performServiceCheck(message)
request.send(answer)
request.close()
def parseArgs():
parser = argparse.ArgumentParser(prog=appName, usage='%(prog)s [options]')
parser.add_argument('--verbose','-v', action='store_false', help='verbose mode')
parser.add_argument('--config','-c', action='store', help='config filename')
args = parser.parse_args()
if args.verbose == True:
logger.setLevel(logging.ERROR)
if args.config != None:
return Config(args.config)
else:
return Config()
#---------- main --------------------------#
initLogger()
client = ClientApp(parseArgs())
client.init()
client.run()
#-----------------------------------------#
| ajibawa-2023/Python-Code-Large/train/row_433 | 182 | 244 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L3_C0", "label": "expression", "type": "expression", "loc": [3, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0205, 0.0205, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nNetSpy Client\t\t\nby Marcin Ciechowicz for ZPR\nv0.01\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Import_L9_C0", "label": "socket import socket", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0369, 0.0041, 0, 0.66, 0.0556, 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_433:Import_L10_C0", "label": "json import json", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.041, 0.0041, 0, 0.66, 0.1111, 463, 0, 1, 0, 0, 463, 0, 0], "semantic": {"name": "json", "arg_names": [], "import_names": ["json"], "rhs_call_name": "", "annotation": ""}, "snippet": "import json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:ImportFrom_L11_C0", "label": "from subprocess import call", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0451, 0.0041, 0, 0.66, 0.1667, 394, 0, 1, 0, 0, 394, 0, 0], "semantic": {"name": "subprocess", "arg_names": [], "import_names": ["call"], "rhs_call_name": "", "annotation": ""}, "snippet": "from subprocess import call"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Import_L12_C0", "label": "logging import logging", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0492, 0.0041, 0, 0.66, 0.2222, 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_433:Import_L13_C0", "label": "argparse import argparse", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0533, 0.0041, 0, 0.66, 0.2778, 325, 0, 1, 0, 0, 325, 0, 0], "semantic": {"name": "argparse", "arg_names": [], "import_names": ["argparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "import argparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Import_L14_C0", "label": "os.path import os.path", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0574, 0.0041, 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_433:Assign_L16_C0", "label": "appName =", "type": "assigned_variable", "loc": [16, 16], "level": 0, "parent": null, "vector": [14, 0, 0.0656, 0.0041, 0, 0.66, 0.3889, 650, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "appName", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "appName = 'NetSpyClient'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L17_C0", "label": "scriptDir =", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.0697, 0.0041, 0, 0.66, 0.4444, 714, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "scriptDir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "scriptDir = 'scripts'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L19_C0", "label": "logger = getLogger()", "type": "assigned_variable", "loc": [19, 19], "level": 0, "parent": null, "vector": [14, 0, 0.0779, 0.0041, 0, 0.66, 0.5, 532, 3, 1, 0, 0, 71, 10, 1], "semantic": {"name": "logger", "arg_names": [], "import_names": [], "rhs_call_name": "getLogger", "annotation": ""}, "snippet": "logger = logging.getLogger(appName)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L21_C0", "label": "initLogger", "type": "function", "loc": [21, 29], "level": 0, "parent": null, "vector": [2, 0, 0.1025, 0.0369, 0, 0.66, 0.5556, 186, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "initLogger", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def initLogger():\n\tformatter = logging.Formatter('%(asctime)s %(levelname)s::%(message)s')\n\thdlrFile = logging.FileHandler(appName + '.log')\n\thdlrFile.setFormatter(formatter)\n\thdlrStd = logging.StreamHandler()\n\thdlrStd.setFormatter(formatter)\n\tlogger.addHandler(hdlrFile)\n\tlogger.addHandler(hdlrStd) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L22_C1", "label": "formatter = Formatter()", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L21_C0", "vector": [14, 1, 0.0902, 0.0041, 1, 0.1, 0.0, 791, 3, 1, 0, 0, 766, 10, 1], "semantic": {"name": "formatter", "arg_names": [], "import_names": [], "rhs_call_name": "Formatter", "annotation": ""}, "snippet": "\tformatter = logging.Formatter('%(asctime)s %(levelname)s::%(message)s')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L23_C1", "label": "hdlrFile = FileHandler()", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L21_C0", "vector": [14, 1, 0.0943, 0.0041, 1, 0.1, 0.1429, 768, 3, 1, 0, 0, 306, 10, 1], "semantic": {"name": "hdlrFile", "arg_names": [], "import_names": [], "rhs_call_name": "FileHandler", "annotation": ""}, "snippet": "\thdlrFile = logging.FileHandler(appName + '.log')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L24_C1", "label": "setFormatter()", "type": "expression", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L21_C0", "vector": [8, 1, 0.0984, 0.0041, 1, 0.1, 0.2857, 948, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setFormatter", "arg_names": [], "import_names": [], "rhs_call_name": "setFormatter", "annotation": ""}, "snippet": "\thdlrFile.setFormatter(formatter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L25_C1", "label": "hdlrStd = StreamHandler()", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L21_C0", "vector": [14, 1, 0.1025, 0.0041, 1, 0.1, 0.4286, 413, 3, 0, 0, 0, 514, 10, 1], "semantic": {"name": "hdlrStd", "arg_names": [], "import_names": [], "rhs_call_name": "StreamHandler", "annotation": ""}, "snippet": "\thdlrStd = logging.StreamHandler()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L26_C1", "label": "setFormatter()", "type": "expression", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L21_C0", "vector": [8, 1, 0.1066, 0.0041, 1, 0.1, 0.5714, 948, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setFormatter", "arg_names": [], "import_names": [], "rhs_call_name": "setFormatter", "annotation": ""}, "snippet": "\thdlrStd.setFormatter(formatter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L27_C1", "label": "addHandler()", "type": "expression", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L21_C0", "vector": [8, 1, 0.1107, 0.0041, 1, 0.1, 0.7143, 255, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addHandler", "arg_names": [], "import_names": [], "rhs_call_name": "addHandler", "annotation": ""}, "snippet": "\tlogger.addHandler(hdlrFile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L28_C1", "label": "addHandler()", "type": "expression", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L21_C0", "vector": [8, 1, 0.1148, 0.0041, 1, 0.1, 0.8571, 255, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addHandler", "arg_names": [], "import_names": [], "rhs_call_name": "addHandler", "annotation": ""}, "snippet": "\tlogger.addHandler(hdlrStd) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L29_C1", "label": "setLevel()", "type": "expression", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L21_C0", "vector": [8, 1, 0.1189, 0.0041, 1, 0.1, 1.0, 810, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setLevel", "arg_names": [], "import_names": [], "rhs_call_name": "setLevel", "annotation": ""}, "snippet": "\tlogger.setLevel(logging.DEBUG)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L31_C0", "label": "Service", "type": "class", "loc": [31, 47], "level": 0, "parent": null, "vector": [3, 0, 0.1598, 0.0697, 0, 0.66, 0.6111, 451, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "Service", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Service:\n\t\n\tname = ''\n\ttesterPath = ''\n\n\tdef __init__(self, name, testerPath):\n\t\t\"\"\"Creates service\"\"\"\n\t\tself.name = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L33_C1", "label": "name =", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L31_C0", "vector": [14, 1, 0.1352, 0.0041, 1, 0.83, 0.0, 57, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tname = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L34_C1", "label": "testerPath =", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L31_C0", "vector": [14, 1, 0.1393, 0.0041, 1, 0.83, 0.2, 743, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "testerPath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\ttesterPath = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L36_C1", "label": "__init__", "type": "function", "loc": [36, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L31_C0", "vector": [2, 1, 0.1537, 0.0164, 1, 0.83, 0.4, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "name", "testerPath"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef __init__(self, name, testerPath):\n\t\t\"\"\"Creates service\"\"\"\n\t\tself.name = name\n\t\tself.testerPath = testerPath"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L37_C2", "label": "expression", "type": "expression", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L36_C1", "vector": [8, 2, 0.1516, 0.0041, 2, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"\"\"Creates service\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L38_C2", "label": "self.name =", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L36_C1", "vector": [14, 2, 0.1557, 0.0041, 2, 0.85, 0.5, 689, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.name = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L39_C2", "label": "self.testerPath =", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L36_C1", "vector": [14, 2, 0.1598, 0.0041, 2, 0.85, 1.0, 28, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.testerPath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.testerPath = testerPath"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L41_C1", "label": "getName", "type": "function", "loc": [41, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L31_C0", "vector": [2, 1, 0.1701, 0.0082, 1, 0.83, 0.6, 847, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "getName", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getName(self): \n\t\treturn self.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L42_C2", "label": "return", "type": "return", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L41_C1", "vector": [13, 2, 0.1721, 0.0041, 2, 0.7, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L43_C1", "label": "getCheckerPath", "type": "function", "loc": [43, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L31_C0", "vector": [2, 1, 0.1783, 0.0082, 1, 0.83, 0.8, 240, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "getCheckerPath", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getCheckerPath(self): \n\t\treturn self.checkerPath"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L44_C2", "label": "return", "type": "return", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L43_C1", "vector": [13, 2, 0.1803, 0.0041, 2, 0.62, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.checkerPath"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L46_C1", "label": "executeCheck", "type": "function", "loc": [46, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L31_C0", "vector": [2, 1, 0.1906, 0.0082, 1, 0.83, 1.0, 478, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "executeCheck", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef executeCheck(self):\n\t\treturn call(testerPath,'1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L47_C2", "label": "return", "type": "return", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L46_C1", "vector": [13, 2, 0.1926, 0.0041, 2, 0.49, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn call(testerPath,'1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L52_C0", "label": "Config", "type": "class", "loc": [52, 96], "level": 0, "parent": null, "vector": [3, 0, 0.3033, 0.1844, 0, 0.66, 0.6667, 979, 0, 6, 0, 0, 0, 0, 19], "semantic": {"name": "Config", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Config:\n\n\toptions = {}\n\n\tdef __init__(self, fileName = \"netspy.conf\"):\n\t\t\"\"\"Initialize config from file \"\"\"\n\t\tself.options = {'port' : '', 'server_port' : '', 'server_ip': '', 'service_list': [] }\n\t\tself.fileName = fileName"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L54_C1", "label": "options =", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L52_C0", "vector": [14, 1, 0.2213, 0.0041, 1, 0.2, 0.0, 707, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\toptions = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L56_C1", "label": "__init__", "type": "function", "loc": [56, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L52_C0", "vector": [2, 1, 0.2377, 0.0205, 1, 0.2, 0.1667, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "fileName"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef __init__(self, fileName = \"netspy.conf\"):\n\t\t\"\"\"Initialize config from file \"\"\"\n\t\tself.options = {'port' : '', 'server_port' : '', 'server_ip': '', 'service_list': [] }\n\t\tself.fileName = fileName\n\t\tself.loadFromFile(self.fileName)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L57_C2", "label": "expression", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L56_C1", "vector": [8, 2, 0.2336, 0.0041, 2, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"\"\"Initialize config from file \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L58_C2", "label": "self.options =", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L56_C1", "vector": [14, 2, 0.2377, 0.0041, 2, 0.75, 0.3333, 968, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.options = {'port' : '', 'server_port' : '', 'server_ip': '', 'service_list': [] }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L59_C2", "label": "self.fileName =", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L56_C1", "vector": [14, 2, 0.2418, 0.0041, 2, 0.75, 0.6667, 344, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.fileName", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.fileName = fileName"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L60_C2", "label": "loadFromFile()", "type": "expression", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L56_C1", "vector": [8, 2, 0.2459, 0.0041, 2, 0.75, 1.0, 223, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "loadFromFile", "arg_names": [], "import_names": [], "rhs_call_name": "loadFromFile", "annotation": ""}, "snippet": "\t\tself.loadFromFile(self.fileName)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L61_C1", "label": "loadFromFile", "type": "function", "loc": [61, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L52_C0", "vector": [2, 1, 0.3033, 0.1107, 1, 0.2, 0.3333, 223, 0, 2, 0, 0, 0, 0, 18], "semantic": {"name": "loadFromFile", "arg_names": ["self", "fileName"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef loadFromFile(self,fileName):\n\t\ttry:\n\t\t\tlogger.info(\"Reading config file: \" + fileName)\n\t\t\tconfigFile = file(fileName,'r')\n\t\t\tline = configFile.readline()\n\t\t\tactive_options = ('port','server_port','server_ip')\n\t\t\twhile line != '' :\n\t\t\t\ttokens = line.strip().split(' ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L62_C2", "label": "try", "type": "try", "loc": [62, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L61_C1", "vector": [7, 2, 0.3053, 0.1066, 2, 0.62, 0.0, 0, 0, 1, 0, 0, 0, 0, 18], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ttry:\n\t\t\tlogger.info(\"Reading config file: \" + fileName)\n\t\t\tconfigFile = file(fileName,'r')\n\t\t\tline = configFile.readline()\n\t\t\tactive_options = ('port','server_port','server_ip')\n\t\t\twhile line != '' :\n\t\t\t\ttokens = line.strip().split(' ')\n\t\t\t\tif tokens[0] == 'service':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L63_C3", "label": "info()", "type": "expression", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L62_C2", "vector": [8, 3, 0.2582, 0.0041, 3, 0.04, 0.0, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": "\t\t\tlogger.info(\"Reading config file: \" + fileName)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L64_C3", "label": "configFile = file()", "type": "assigned_variable", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L62_C2", "vector": [14, 3, 0.2623, 0.0041, 3, 0.04, 0.2, 624, 3, 2, 0, 0, 107, 10, 1], "semantic": {"name": "configFile", "arg_names": [], "import_names": [], "rhs_call_name": "file", "annotation": ""}, "snippet": "\t\t\tconfigFile = file(fileName,'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L65_C3", "label": "line = readline()", "type": "assigned_variable", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L62_C2", "vector": [14, 3, 0.2664, 0.0041, 3, 0.04, 0.4, 373, 3, 0, 0, 0, 303, 10, 1], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "readline", "annotation": ""}, "snippet": "\t\t\tline = configFile.readline()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L66_C3", "label": "active_options =", "type": "assigned_variable", "loc": [66, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L62_C2", "vector": [14, 3, 0.2705, 0.0041, 3, 0.04, 0.6, 699, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "active_options", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tactive_options = ('port','server_port','server_ip')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:While_L67_C3", "label": "while", "type": "while", "loc": [67, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L62_C2", "vector": [5, 3, 0.3074, 0.0697, 3, 0.04, 0.8, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\twhile line != '' :\n\t\t\t\ttokens = line.strip().split(' ')\n\t\t\t\tif tokens[0] == 'service':\n\t\t\t\t\tif (tokens[1] == 'alive'):\n\t\t\t\t\t\tlogger.warning(\"Service \" + tokens[1] + \" is already definied, please use different name\")\n\t\t\t\t\telif (os.path.isfile(scriptDir+'/'+tokens[2])):\t\n\t\t\t\t\t\tself.options['service_list'].append(Service(tokens[1],tokens[2]))\n\t\t\t\t\t\tlogger.debug(\"New service added: \" + tokens[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L68_C4", "label": "tokens = split()", "type": "assigned_variable", "loc": [68, 68], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:While_L67_C3", "vector": [14, 4, 0.2787, 0.0041, 4, 0.22, 0.0, 700, 3, 1, 0, 0, 908, 10, 2], "semantic": {"name": "tokens", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": "\t\t\t\ttokens = line.strip().split(' ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:If_L69_C4", "label": "if", "type": "if", "loc": [69, 82], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:While_L67_C3", "vector": [4, 4, 0.3094, 0.0574, 4, 0.22, 0.5, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tif tokens[0] == 'service':\n\t\t\t\t\tif (tokens[1] == 'alive'):\n\t\t\t\t\t\tlogger.warning(\"Service \" + tokens[1] + \" is already definied, please use different name\")\n\t\t\t\t\telif (os.path.isfile(scriptDir+'/'+tokens[2])):\t\n\t\t\t\t\t\tself.options['service_list'].append(Service(tokens[1],tokens[2]))\n\t\t\t\t\t\tlogger.debug(\"New service added: \" + tokens[1])\n\t\t\t\t\telse:\n\t\t\t\t\t\tlogger.warning(\"Service \" + tokens[1] +\" error: Can't find script : \" + scriptDir + '/' + tokens[2])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:If_L70_C5", "label": "if", "type": "if", "loc": [70, 77], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L69_C4", "vector": [4, 5, 0.3012, 0.0328, 5, 0.53, 0.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\tif (tokens[1] == 'alive'):\n\t\t\t\t\t\tlogger.warning(\"Service \" + tokens[1] + \" is already definied, please use different name\")\n\t\t\t\t\telif (os.path.isfile(scriptDir+'/'+tokens[2])):\t\n\t\t\t\t\t\tself.options['service_list'].append(Service(tokens[1],tokens[2]))\n\t\t\t\t\t\tlogger.debug(\"New service added: \" + tokens[1])\n\t\t\t\t\telse:\n\t\t\t\t\t\tlogger.warning(\"Service \" + tokens[1] +\" error: Can't find script : \" + scriptDir + '/' + tokens[2])\n\t\t\t\t\t\tlogger.warning(\"Service \" + tokens[1] +\" creation failed\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L71_C6", "label": "warning()", "type": "expression", "loc": [71, 71], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L70_C5", "vector": [8, 6, 0.291, 0.0041, 6, 0.32, 0.0, 320, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warning", "arg_names": [], "import_names": [], "rhs_call_name": "warning", "annotation": ""}, "snippet": "\t\t\t\t\t\tlogger.warning(\"Service \" + tokens[1] + \" is already definied, please use different name\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:If_L72_C5", "label": "if", "type": "if", "loc": [72, 77], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L70_C5", "vector": [4, 6, 0.3053, 0.0246, 6, 0.32, 1.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\telif (os.path.isfile(scriptDir+'/'+tokens[2])):\t\n\t\t\t\t\t\tself.options['service_list'].append(Service(tokens[1],tokens[2]))\n\t\t\t\t\t\tlogger.debug(\"New service added: \" + tokens[1])\n\t\t\t\t\telse:\n\t\t\t\t\t\tlogger.warning(\"Service \" + tokens[1] +\" error: Can't find script : \" + scriptDir + '/' + tokens[2])\n\t\t\t\t\t\tlogger.warning(\"Service \" + tokens[1] +\" creation failed\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L73_C6", "label": "append()", "type": "expression", "loc": [73, 73], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L72_C5", "vector": [8, 7, 0.2992, 0.0041, 7, 0.3, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\t\t\t\t\t\tself.options['service_list'].append(Service(tokens[1],tokens[2]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L74_C6", "label": "debug()", "type": "expression", "loc": [74, 74], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L72_C5", "vector": [8, 7, 0.3033, 0.0041, 7, 0.3, 0.3333, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": "\t\t\t\t\t\tlogger.debug(\"New service added: \" + tokens[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L76_C6", "label": "warning()", "type": "expression", "loc": [76, 76], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L72_C5", "vector": [8, 7, 0.3115, 0.0041, 7, 0.3, 0.6667, 320, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warning", "arg_names": [], "import_names": [], "rhs_call_name": "warning", "annotation": ""}, "snippet": "\t\t\t\t\t\tlogger.warning(\"Service \" + tokens[1] +\" error: Can't find script : \" + scriptDir + '/' + tokens[2])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L77_C6", "label": "warning()", "type": "expression", "loc": [77, 77], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L72_C5", "vector": [8, 7, 0.3156, 0.0041, 7, 0.3, 1.0, 320, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warning", "arg_names": [], "import_names": [], "rhs_call_name": "warning", "annotation": ""}, "snippet": "\t\t\t\t\t\tlogger.warning(\"Service \" + tokens[1] +\" creation failed\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:If_L78_C4", "label": "if", "type": "if", "loc": [78, 82], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L69_C4", "vector": [4, 5, 0.3279, 0.0205, 5, 0.53, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\telif tokens[0] in active_options:\n\t\t\t\t\tself.options[tokens[0]]=tokens[1]\t\n\t\t\t\t\tlogger.debug(tokens[0] + \" set to \" + tokens[1])\n\t\t\t\telse:\n\t\t\t\t\tlogger.warning(\"Unkown option \" + tokens[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L79_C5", "label": "assign", "type": "assigned_variable", "loc": [79, 79], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L78_C4", "vector": [14, 6, 0.3238, 0.0041, 6, 0.92, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\tself.options[tokens[0]]=tokens[1]\t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L80_C5", "label": "debug()", "type": "expression", "loc": [80, 80], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L78_C4", "vector": [8, 6, 0.3279, 0.0041, 6, 0.92, 0.5, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": "\t\t\t\t\tlogger.debug(tokens[0] + \" set to \" + tokens[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L82_C5", "label": "warning()", "type": "expression", "loc": [82, 82], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L78_C4", "vector": [8, 6, 0.3361, 0.0041, 6, 0.92, 1.0, 320, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warning", "arg_names": [], "import_names": [], "rhs_call_name": "warning", "annotation": ""}, "snippet": "\t\t\t\t\tlogger.warning(\"Unkown option \" + tokens[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L83_C4", "label": "line = readline()", "type": "assigned_variable", "loc": [83, 83], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:While_L67_C3", "vector": [14, 4, 0.3402, 0.0041, 4, 0.22, 1.0, 373, 3, 0, 0, 0, 303, 10, 1], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "readline", "annotation": ""}, "snippet": "\t\t\t\tline = configFile.readline()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L84_C3", "label": "close()", "type": "expression", "loc": [84, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L62_C2", "vector": [8, 3, 0.3443, 0.0041, 3, 0.04, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "\t\t\tconfigFile.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L86_C3", "label": "error()", "type": "expression", "loc": [86, 86], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L62_C2", "vector": [8, 3, 0.3525, 0.0041, 3, 0.04, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": "\t\t\tlogger.error( \"Can't read \" + fileName)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L87_C3", "label": "exit()", "type": "expression", "loc": [87, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L62_C2", "vector": [8, 3, 0.3566, 0.0041, 3, 0.04, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t\t\texit()\t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L89_C1", "label": "getPort", "type": "function", "loc": [89, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L52_C0", "vector": [2, 1, 0.3668, 0.0082, 1, 0.2, 0.5, 259, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "getPort", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getPort(self): \n\t\treturn self.options['port']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L90_C2", "label": "return", "type": "return", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L89_C1", "vector": [13, 2, 0.3689, 0.0041, 2, 0.82, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.options['port']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L91_C1", "label": "getServerPort", "type": "function", "loc": [91, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L52_C0", "vector": [2, 1, 0.375, 0.0082, 1, 0.2, 0.6667, 518, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "getServerPort", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getServerPort(self): \n\t\treturn self.options['server_port']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L92_C2", "label": "return", "type": "return", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L91_C1", "vector": [13, 2, 0.377, 0.0041, 2, 0.52, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.options['server_port']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L93_C1", "label": "getServerIp", "type": "function", "loc": [93, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L52_C0", "vector": [2, 1, 0.3832, 0.0082, 1, 0.2, 0.8333, 962, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "getServerIp", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getServerIp(self): \n\t\treturn self.options['server_ip']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L94_C2", "label": "return", "type": "return", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L93_C1", "vector": [13, 2, 0.3852, 0.0041, 2, 0.68, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.options['server_ip']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L95_C1", "label": "getServiceList", "type": "function", "loc": [95, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L52_C0", "vector": [2, 1, 0.3914, 0.0082, 1, 0.2, 1.0, 215, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "getServiceList", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getServiceList(self):\n\t\treturn self.options['service_list']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L96_C2", "label": "return", "type": "return", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L95_C1", "vector": [13, 2, 0.3934, 0.0041, 2, 0.05, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn self.options['service_list']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L99_C0", "label": "ClientApp", "type": "class", "loc": [99, 219], "level": 0, "parent": null, "vector": [3, 0, 0.6516, 0.4959, 0, 0.66, 0.7222, 174, 0, 9, 0, 0, 0, 0, 62], "semantic": {"name": "ClientApp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ClientApp:\n\n\tconfig = ''\n\tdef getHash(self):\n\t\thashValue=''\n\t\ttry:\n\t\t\thashFile=file(\".netspy.hash\",\"r\")\n\t\t\thashValue = hashFile.readline()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L101_C1", "label": "config =", "type": "assigned_variable", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L99_C0", "vector": [14, 1, 0.4139, 0.0041, 1, 0.76, 0.0, 308, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "config", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tconfig = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L102_C1", "label": "getHash", "type": "function", "loc": [102, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L99_C0", "vector": [2, 1, 0.4344, 0.0369, 1, 0.76, 0.1111, 67, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "getHash", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef getHash(self):\n\t\thashValue=''\n\t\ttry:\n\t\t\thashFile=file(\".netspy.hash\",\"r\")\n\t\t\thashValue = hashFile.readline()\n\t\texcept IOError:\n\t\t\tlogger.warining( \"No hash found\")\n\t\tfinally:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L103_C2", "label": "hashValue =", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L102_C1", "vector": [14, 2, 0.4221, 0.0041, 2, 0.58, 0.0, 349, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "hashValue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\thashValue=''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L104_C2", "label": "try", "type": "try", "loc": [104, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L102_C1", "vector": [7, 2, 0.4385, 0.0287, 2, 0.58, 1.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ttry:\n\t\t\thashFile=file(\".netspy.hash\",\"r\")\n\t\t\thashValue = hashFile.readline()\n\t\texcept IOError:\n\t\t\tlogger.warining( \"No hash found\")\n\t\tfinally:\n\t\t\treturn hashValue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L105_C3", "label": "hashFile = file()", "type": "assigned_variable", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L104_C2", "vector": [14, 3, 0.4303, 0.0041, 3, 0.02, 0.0, 589, 3, 2, 0, 0, 107, 10, 1], "semantic": {"name": "hashFile", "arg_names": [], "import_names": [], "rhs_call_name": "file", "annotation": ""}, "snippet": "\t\t\thashFile=file(\".netspy.hash\",\"r\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L106_C3", "label": "hashValue = readline()", "type": "assigned_variable", "loc": [106, 106], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L104_C2", "vector": [14, 3, 0.4344, 0.0041, 3, 0.02, 0.5, 349, 3, 0, 0, 0, 303, 10, 1], "semantic": {"name": "hashValue", "arg_names": [], "import_names": [], "rhs_call_name": "readline", "annotation": ""}, "snippet": "\t\t\thashValue = hashFile.readline()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L108_C3", "label": "warining()", "type": "expression", "loc": [108, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L104_C2", "vector": [8, 3, 0.4426, 0.0041, 3, 0.02, 0.0, 71, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warining", "arg_names": [], "import_names": [], "rhs_call_name": "warining", "annotation": ""}, "snippet": "\t\t\tlogger.warining( \"No hash found\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L110_C3", "label": "return", "type": "return", "loc": [110, 110], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L104_C2", "vector": [13, 3, 0.4508, 0.0041, 3, 0.02, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn hashValue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L112_C1", "label": "setHash", "type": "function", "loc": [112, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L99_C0", "vector": [2, 1, 0.4754, 0.0369, 1, 0.76, 0.2222, 558, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "setHash", "arg_names": ["self", "hashValue"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef setHash(self,hashValue):\n\t\t\"\"\" Function doc \"\"\"\n\t\tif (hashValue!=''):\n\t\t\ttry:\n\t\t\t\thashFile=file(\".netspy.hash\",\"w\")\n\t\t\t\thashFile.write(hashValue)\n\t\t\texcept IOError:\n\t\t\t\tlogger.error( \"Can't store hash value\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L113_C2", "label": "expression", "type": "expression", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L112_C1", "vector": [8, 2, 0.4631, 0.0041, 2, 0.61, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\"\"\" Function doc \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:If_L114_C2", "label": "if", "type": "if", "loc": [114, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L112_C1", "vector": [4, 2, 0.4795, 0.0287, 2, 0.61, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif (hashValue!=''):\n\t\t\ttry:\n\t\t\t\thashFile=file(\".netspy.hash\",\"w\")\n\t\t\t\thashFile.write(hashValue)\n\t\t\texcept IOError:\n\t\t\t\tlogger.error( \"Can't store hash value\")\n\t\t\t\texit(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L115_C3", "label": "try", "type": "try", "loc": [115, 120], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L114_C2", "vector": [7, 3, 0.4816, 0.0246, 3, 0.18, 0.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\ttry:\n\t\t\t\thashFile=file(\".netspy.hash\",\"w\")\n\t\t\t\thashFile.write(hashValue)\n\t\t\texcept IOError:\n\t\t\t\tlogger.error( \"Can't store hash value\")\n\t\t\t\texit(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L116_C4", "label": "hashFile = file()", "type": "assigned_variable", "loc": [116, 116], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L115_C3", "vector": [14, 4, 0.4754, 0.0041, 4, 0.19, 0.0, 589, 3, 2, 0, 0, 107, 10, 1], "semantic": {"name": "hashFile", "arg_names": [], "import_names": [], "rhs_call_name": "file", "annotation": ""}, "snippet": "\t\t\t\thashFile=file(\".netspy.hash\",\"w\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L117_C4", "label": "write()", "type": "expression", "loc": [117, 117], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L115_C3", "vector": [8, 4, 0.4795, 0.0041, 4, 0.19, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "\t\t\t\thashFile.write(hashValue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L119_C4", "label": "error()", "type": "expression", "loc": [119, 119], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L115_C3", "vector": [8, 4, 0.4877, 0.0041, 4, 0.19, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": "\t\t\t\tlogger.error( \"Can't store hash value\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L120_C4", "label": "exit()", "type": "expression", "loc": [120, 120], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L115_C3", "vector": [8, 4, 0.4918, 0.0041, 4, 0.19, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": "\t\t\t\texit(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L122_C1", "label": "setConfig", "type": "function", "loc": [122, 123], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L99_C0", "vector": [2, 1, 0.502, 0.0082, 1, 0.76, 0.3333, 550, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "setConfig", "arg_names": ["self", "config"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef setConfig(self, config):\n\t\tself.config = config"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L123_C2", "label": "self.config =", "type": "assigned_variable", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L122_C1", "vector": [14, 2, 0.5041, 0.0041, 2, 0.76, 0.0, 663, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.config", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tself.config = config"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L125_C1", "label": "__init__", "type": "function", "loc": [125, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L99_C0", "vector": [2, 1, 0.5164, 0.0123, 1, 0.76, 0.4444, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "config"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef __init__(self,config=None):\n\t\tif config!=None:\n\t\t\tself.setConfig(config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:If_L126_C2", "label": "if", "type": "if", "loc": [126, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L125_C1", "vector": [4, 2, 0.5184, 0.0082, 2, 0.82, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif config!=None:\n\t\t\tself.setConfig(config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L127_C3", "label": "setConfig()", "type": "expression", "loc": [127, 127], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L126_C2", "vector": [8, 3, 0.5205, 0.0041, 3, 0.0, 0.0, 550, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setConfig", "arg_names": [], "import_names": [], "rhs_call_name": "setConfig", "annotation": ""}, "snippet": "\t\t\tself.setConfig(config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L129_C1", "label": "hashCheck", "type": "function", "loc": [129, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L99_C0", "vector": [2, 1, 0.5307, 0.0082, 1, 0.76, 0.5556, 665, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "hashCheck", "arg_names": ["self", "hashValue"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef hashCheck(self,hashValue):\n\t\treturn True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L130_C2", "label": "return", "type": "return", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L129_C1", "vector": [13, 2, 0.5328, 0.0041, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L132_C1", "label": "init", "type": "function", "loc": [132, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L99_C0", "vector": [2, 1, 0.543, 0.0082, 1, 0.76, 0.6667, 319, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "init", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef init(self):\n\t\tlogger.info('Client - running ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L133_C2", "label": "info()", "type": "expression", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L132_C1", "vector": [8, 2, 0.5451, 0.0041, 2, 0.15, 0.0, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": "\t\tlogger.info('Client - running ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "label": "registerAtServer", "type": "function", "loc": [135, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L99_C0", "vector": [2, 1, 0.6291, 0.1557, 1, 0.76, 0.7778, 540, 0, 1, 1, 0, 0, 0, 25], "semantic": {"name": "registerAtServer", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef registerAtServer(self):\n\t\ttry:\n\t\t\tserver = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n\t\t\tserver.connect((self.config.getServerIp(), int(self.config.getServerPort()) ))\n\t\texcept IOError:\n\t\t\tlogger.error(\"Can't register at monitoring server - connection problem\")\n\t\t\treturn False\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L136_C2", "label": "try", "type": "try", "loc": [136, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "vector": [7, 2, 0.5676, 0.0246, 2, 0.88, 0.0, 0, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ttry:\n\t\t\tserver = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n\t\t\tserver.connect((self.config.getServerIp(), int(self.config.getServerPort()) ))\n\t\texcept IOError:\n\t\t\tlogger.error(\"Can't register at monitoring server - connection problem\")\n\t\t\treturn False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L137_C3", "label": "server = socket()", "type": "assigned_variable", "loc": [137, 137], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L136_C2", "vector": [14, 3, 0.5615, 0.0041, 3, 0.13, 0.0, 268, 3, 2, 0, 0, 687, 10, 1], "semantic": {"name": "server", "arg_names": [], "import_names": [], "rhs_call_name": "socket", "annotation": ""}, "snippet": "\t\t\tserver = socket.socket(socket.AF_INET, socket.SOCK_STREAM)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L138_C3", "label": "connect()", "type": "expression", "loc": [138, 138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L136_C2", "vector": [8, 3, 0.5656, 0.0041, 3, 0.13, 1.0, 242, 3, 1, 0, 0, 0, 0, 4], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "\t\t\tserver.connect((self.config.getServerIp(), int(self.config.getServerPort()) ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L140_C3", "label": "error()", "type": "expression", "loc": [140, 140], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L136_C2", "vector": [8, 3, 0.5738, 0.0041, 3, 0.13, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": "\t\t\tlogger.error(\"Can't register at monitoring server - connection problem\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L141_C3", "label": "return", "type": "return", "loc": [141, 141], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L136_C2", "vector": [13, 3, 0.5779, 0.0041, 3, 0.13, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L143_C2", "label": "service_list =", "type": "assigned_variable", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "vector": [14, 2, 0.5861, 0.0041, 2, 0.88, 0.0909, 896, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "service_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tservice_list = [];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:For_L144_C2", "label": "for i", "type": "for", "loc": [144, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "vector": [6, 2, 0.5922, 0.0082, 2, 0.88, 0.1818, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tfor i in self.config.getServiceList():\n\t\t\tservice_list.append(i.getName())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L145_C3", "label": "append()", "type": "expression", "loc": [145, 145], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:For_L144_C2", "vector": [8, 3, 0.5943, 0.0041, 3, 0.74, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\t\t\tservice_list.append(i.getName())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L147_C2", "label": "append()", "type": "expression", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "vector": [8, 2, 0.6025, 0.0041, 2, 0.88, 0.2727, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\t\tservice_list.append('alive')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L149_C2", "label": "message =", "type": "assigned_variable", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "vector": [14, 2, 0.6107, 0.0041, 2, 0.88, 0.3636, 635, 0, 0, 0, 0, 0, 6, 2], "semantic": {"name": "message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tmessage = { 'command' : 'register', 'payload': {'hash' : self.getHash(), 'port' : self.config.getPort(), 'service_list' : service_list }}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L150_C2", "label": "messageToSend = dumps()", "type": "assigned_variable", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "vector": [14, 2, 0.6148, 0.0041, 2, 0.88, 0.4545, 23, 3, 1, 0, 0, 160, 10, 1], "semantic": {"name": "messageToSend", "arg_names": [], "import_names": [], "rhs_call_name": "dumps", "annotation": ""}, "snippet": "\t\tmessageToSend = json.dumps(message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L151_C2", "label": "send()", "type": "expression", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "vector": [8, 2, 0.6189, 0.0041, 2, 0.88, 0.5455, 826, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "send", "arg_names": [], "import_names": [], "rhs_call_name": "send", "annotation": ""}, "snippet": "\t\tserver.send(messageToSend)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L152_C2", "label": "data = recv()", "type": "assigned_variable", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "vector": [14, 2, 0.623, 0.0041, 2, 0.88, 0.6364, 929, 3, 1, 0, 0, 178, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "recv", "annotation": ""}, "snippet": "\t\tdata = server.recv(1024)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L153_C2", "label": "close()", "type": "expression", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "vector": [8, 2, 0.627, 0.0041, 2, 0.88, 0.7273, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "\t\tserver.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L154_C2", "label": "answer = loads()", "type": "assigned_variable", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "vector": [14, 2, 0.6311, 0.0041, 2, 0.88, 0.8182, 607, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "answer", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": "\t\tanswer = json.loads(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:If_L156_C2", "label": "if", "type": "if", "loc": [156, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "vector": [4, 2, 0.6434, 0.0123, 2, 0.88, 0.9091, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif (answer['command'] != 'register'): \n\t\t\tlogger.error(\"Bad command type - expected 'register'\")\n\t\t\treturn False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L157_C3", "label": "error()", "type": "expression", "loc": [157, 157], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L156_C2", "vector": [8, 3, 0.6434, 0.0041, 3, 0.39, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": "\t\t\tlogger.error(\"Bad command type - expected 'register'\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L158_C3", "label": "return", "type": "return", "loc": [158, 158], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L156_C2", "vector": [13, 3, 0.6475, 0.0041, 3, 0.39, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:If_L159_C2", "label": "if", "type": "if", "loc": [159, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "vector": [4, 2, 0.6783, 0.0574, 2, 0.88, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif (answer['payload']['status'] == 0):\n\t\t\tlogger.info(\"Reusing old hash\") \n\t\t\treturn True\n\t\telif (answer['payload']['status'] == 1):\n\t\t\tlogger.info(\"Saving new hash: \" + str(answer['payload']['hash']))\n\t\t\thashValue = answer['payload']['hash']\n\t\t\tself.setHash(str(hashValue))\n\t\t\treturn True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L160_C3", "label": "info()", "type": "expression", "loc": [160, 160], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L159_C2", "vector": [8, 3, 0.6557, 0.0041, 3, 0.83, 0.0, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": "\t\t\tlogger.info(\"Reusing old hash\") "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L161_C3", "label": "return", "type": "return", "loc": [161, 161], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L159_C2", "vector": [13, 3, 0.6598, 0.0041, 3, 0.83, 0.5, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:If_L162_C2", "label": "if", "type": "if", "loc": [162, 172], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L159_C2", "vector": [4, 3, 0.6844, 0.0451, 3, 0.83, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif (answer['payload']['status'] == 1):\n\t\t\tlogger.info(\"Saving new hash: \" + str(answer['payload']['hash']))\n\t\t\thashValue = answer['payload']['hash']\n\t\t\tself.setHash(str(hashValue))\n\t\t\treturn True\n\t\telif (answer['payload']['status'] == 2):\n\t\t\tclear = file('.netspy.hash','w')\n\t\t\tclear.write('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L163_C3", "label": "info()", "type": "expression", "loc": [163, 163], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L162_C2", "vector": [8, 4, 0.668, 0.0041, 4, 0.48, 0.0, 730, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": "\t\t\tlogger.info(\"Saving new hash: \" + str(answer['payload']['hash']))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L164_C3", "label": "hashValue =", "type": "assigned_variable", "loc": [164, 164], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L162_C2", "vector": [14, 4, 0.6721, 0.0041, 4, 0.48, 0.25, 349, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "hashValue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\thashValue = answer['payload']['hash']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L165_C3", "label": "setHash()", "type": "expression", "loc": [165, 165], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L162_C2", "vector": [8, 4, 0.6762, 0.0041, 4, 0.48, 0.5, 558, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "setHash", "arg_names": [], "import_names": [], "rhs_call_name": "setHash", "annotation": ""}, "snippet": "\t\t\tself.setHash(str(hashValue))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L166_C3", "label": "return", "type": "return", "loc": [166, 166], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L162_C2", "vector": [13, 4, 0.6803, 0.0041, 4, 0.48, 0.75, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:If_L167_C2", "label": "if", "type": "if", "loc": [167, 172], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L162_C2", "vector": [4, 4, 0.6947, 0.0246, 4, 0.48, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\telif (answer['payload']['status'] == 2):\n\t\t\tclear = file('.netspy.hash','w')\n\t\t\tclear.write('')\n\t\t\treturn False\n\t\telse:\n\t\t\treturn False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L168_C3", "label": "clear = file()", "type": "assigned_variable", "loc": [168, 168], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L167_C2", "vector": [14, 5, 0.6885, 0.0041, 5, 0.69, 0.0, 712, 3, 2, 0, 0, 107, 10, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "file", "annotation": ""}, "snippet": "\t\t\tclear = file('.netspy.hash','w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L169_C3", "label": "write()", "type": "expression", "loc": [169, 169], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L167_C2", "vector": [8, 5, 0.6926, 0.0041, 5, 0.69, 0.3333, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": "\t\t\tclear.write('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L170_C3", "label": "return", "type": "return", "loc": [170, 170], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L167_C2", "vector": [13, 5, 0.6967, 0.0041, 5, 0.69, 0.6667, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L172_C3", "label": "return", "type": "return", "loc": [172, 172], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L167_C2", "vector": [13, 5, 0.7049, 0.0041, 5, 0.69, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L174_C1", "label": "performServiceCheck", "type": "function", "loc": [174, 195], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L99_C0", "vector": [2, 1, 0.7561, 0.0902, 1, 0.76, 0.8889, 67, 0, 2, 1, 0, 0, 0, 12], "semantic": {"name": "performServiceCheck", "arg_names": ["self", "message"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef performServiceCheck(self,message):\n\t\ttry:\n\t\t\tquestion = json.loads(message)\n\t\t\tif question['command'] != 'check_status':\n\t\t\t\tlogger.error(\"Unknown command '\" + question['command'] + \"'received from server\")\n\t\t\t\tlogger.error(\"No check performed\")\n\t\t\t\treturn\n\t\t\telse:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L175_C2", "label": "try", "type": "try", "loc": [175, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L174_C1", "vector": [7, 2, 0.7582, 0.0861, 2, 0.89, 0.0, 0, 0, 1, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ttry:\n\t\t\tquestion = json.loads(message)\n\t\t\tif question['command'] != 'check_status':\n\t\t\t\tlogger.error(\"Unknown command '\" + question['command'] + \"'received from server\")\n\t\t\t\tlogger.error(\"No check performed\")\n\t\t\t\treturn\n\t\t\telse:\n\t\t\t\tlogger.info(\"Performing check\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L176_C3", "label": "question = loads()", "type": "assigned_variable", "loc": [176, 176], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L175_C2", "vector": [14, 3, 0.7213, 0.0041, 3, 0.98, 0.0, 785, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "question", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": "\t\t\tquestion = json.loads(message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:If_L177_C3", "label": "if", "type": "if", "loc": [177, 191], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L175_C2", "vector": [4, 3, 0.7541, 0.0615, 3, 0.98, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\tif question['command'] != 'check_status':\n\t\t\t\tlogger.error(\"Unknown command '\" + question['command'] + \"'received from server\")\n\t\t\t\tlogger.error(\"No check performed\")\n\t\t\t\treturn\n\t\t\telse:\n\t\t\t\tlogger.info(\"Performing check\")\n\t\t\t\tresultList = []\n\t\t\t\talive = { 'alive' : 0 }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L178_C4", "label": "error()", "type": "expression", "loc": [178, 178], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L177_C3", "vector": [8, 4, 0.7295, 0.0041, 4, 0.97, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": "\t\t\t\tlogger.error(\"Unknown command '\" + question['command'] + \"'received from server\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L179_C4", "label": "error()", "type": "expression", "loc": [179, 179], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L177_C3", "vector": [8, 4, 0.7336, 0.0041, 4, 0.97, 0.1111, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": "\t\t\t\tlogger.error(\"No check performed\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L180_C4", "label": "return", "type": "return", "loc": [180, 180], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L177_C3", "vector": [13, 4, 0.7377, 0.0041, 4, 0.97, 0.2222, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\treturn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L182_C4", "label": "info()", "type": "expression", "loc": [182, 182], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L177_C3", "vector": [8, 4, 0.7459, 0.0041, 4, 0.97, 0.3333, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": "\t\t\t\tlogger.info(\"Performing check\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L183_C4", "label": "resultList =", "type": "assigned_variable", "loc": [183, 183], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L177_C3", "vector": [14, 4, 0.75, 0.0041, 4, 0.97, 0.4444, 254, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "resultList", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tresultList = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L184_C4", "label": "alive =", "type": "assigned_variable", "loc": [184, 184], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L177_C3", "vector": [14, 4, 0.7541, 0.0041, 4, 0.97, 0.5556, 256, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "alive", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\talive = { 'alive' : 0 }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L185_C4", "label": "append()", "type": "expression", "loc": [185, 185], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L177_C3", "vector": [8, 4, 0.7582, 0.0041, 4, 0.97, 0.6667, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\t\t\t\tresultList.append(alive)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:For_L186_C4", "label": "for service", "type": "for", "loc": [186, 189], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L177_C3", "vector": [6, 4, 0.7684, 0.0164, 4, 0.97, 0.7778, 314, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "service", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tfor service in self.config.getServiceList():\n\t\t\t\t\ttmp = service.executeCheck()\n\t\t\t\t\tresult = {service.getName() : tmp }\n\t\t\t\t\tresultList.append(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L187_C5", "label": "tmp = executeCheck()", "type": "assigned_variable", "loc": [187, 187], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:For_L186_C4", "vector": [14, 5, 0.7664, 0.0041, 5, 0.89, 0.0, 517, 3, 0, 0, 0, 478, 10, 1], "semantic": {"name": "tmp", "arg_names": [], "import_names": [], "rhs_call_name": "executeCheck", "annotation": ""}, "snippet": "\t\t\t\t\ttmp = service.executeCheck()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L188_C5", "label": "result =", "type": "assigned_variable", "loc": [188, 188], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:For_L186_C4", "vector": [14, 5, 0.7705, 0.0041, 5, 0.89, 0.5, 51, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\t\tresult = {service.getName() : tmp }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L189_C5", "label": "append()", "type": "expression", "loc": [189, 189], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:For_L186_C4", "vector": [8, 5, 0.7746, 0.0041, 5, 0.89, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "\t\t\t\t\tresultList.append(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L190_C4", "label": "answer =", "type": "assigned_variable", "loc": [190, 190], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L177_C3", "vector": [14, 4, 0.7787, 0.0041, 4, 0.97, 0.8889, 607, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "answer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\tanswer = {'command' : 'check_status', 'payload' : {'check_result' : resultList }}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L191_C4", "label": "return", "type": "return", "loc": [191, 191], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L177_C3", "vector": [13, 4, 0.7828, 0.0041, 4, 0.97, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\t\treturn json.dumps(answer);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L194_C3", "label": "error()", "type": "expression", "loc": [194, 194], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L175_C2", "vector": [8, 3, 0.7951, 0.0041, 3, 0.98, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": "\t\t\tlogger.error(\"Unsupported command format\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L195_C3", "label": "error()", "type": "expression", "loc": [195, 195], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L175_C2", "vector": [8, 3, 0.7992, 0.0041, 3, 0.98, 1.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": "\t\t\tlogger.error(\"No check performed\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L197_C1", "label": "run", "type": "function", "loc": [197, 219], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L99_C0", "vector": [2, 1, 0.8525, 0.0943, 1, 0.76, 1.0, 679, 0, 1, 0, 0, 0, 0, 16], "semantic": {"name": "run", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tdef run(self):\n\t\tlogger.info(\"Client - registering at monitoring server\")\n\t\ti=0\n\t\twhile (i<3 and not self.registerAtServer()):\n\t\t\ti=i+1\n\n\t\tif (i==3):\n\t\t\tlogger.error(\"Connect to monitoring server failed - can't connect to specified host\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L198_C2", "label": "info()", "type": "expression", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L197_C1", "vector": [8, 2, 0.8115, 0.0041, 2, 0.95, 0.0, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": "\t\tlogger.info(\"Client - registering at monitoring server\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L199_C2", "label": "i =", "type": "assigned_variable", "loc": [199, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L197_C1", "vector": [14, 2, 0.8156, 0.0041, 2, 0.95, 0.1111, 826, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\ti=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:While_L200_C2", "label": "while", "type": "while", "loc": [200, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L197_C1", "vector": [5, 2, 0.8217, 0.0082, 2, 0.95, 0.2222, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\twhile (i<3 and not self.registerAtServer()):\n\t\t\ti=i+1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L201_C3", "label": "i =", "type": "assigned_variable", "loc": [201, 201], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:While_L200_C2", "vector": [14, 3, 0.8238, 0.0041, 3, 0.96, 0.0, 826, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\ti=i+1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:If_L203_C2", "label": "if", "type": "if", "loc": [203, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L197_C1", "vector": [4, 2, 0.8381, 0.0164, 2, 0.95, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\tif (i==3):\n\t\t\tlogger.error(\"Connect to monitoring server failed - can't connect to specified host\")\n\t\t\tlogger.error(\"Please check your config file\")\n\t\t\treturn "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L204_C3", "label": "error()", "type": "expression", "loc": [204, 204], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L203_C2", "vector": [8, 3, 0.8361, 0.0041, 3, 0.37, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": "\t\t\tlogger.error(\"Connect to monitoring server failed - can't connect to specified host\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L205_C3", "label": "error()", "type": "expression", "loc": [205, 205], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L203_C2", "vector": [8, 3, 0.8402, 0.0041, 3, 0.37, 0.5, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": "\t\t\tlogger.error(\"Please check your config file\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L206_C3", "label": "return", "type": "return", "loc": [206, 206], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L203_C2", "vector": [13, 3, 0.8443, 0.0041, 3, 0.37, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\t\treturn "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L208_C2", "label": "info()", "type": "expression", "loc": [208, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L197_C1", "vector": [8, 2, 0.8525, 0.0041, 2, 0.95, 0.4444, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": "\t\tlogger.info(\"Client - register succesful\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L209_C2", "label": "client = socket()", "type": "assigned_variable", "loc": [209, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L197_C1", "vector": [14, 2, 0.8566, 0.0041, 2, 0.95, 0.5556, 608, 3, 2, 0, 0, 687, 10, 1], "semantic": {"name": "client", "arg_names": [], "import_names": [], "rhs_call_name": "socket", "annotation": ""}, "snippet": "\t\tclient = socket.socket(socket.AF_INET, socket.SOCK_STREAM)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L210_C2", "label": "bind()", "type": "expression", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L197_C1", "vector": [8, 2, 0.8607, 0.0041, 2, 0.95, 0.6667, 640, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "bind", "arg_names": [], "import_names": [], "rhs_call_name": "bind", "annotation": ""}, "snippet": "\t\tclient.bind(('',int(self.config.getPort())))\t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L211_C2", "label": "listen()", "type": "expression", "loc": [211, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L197_C1", "vector": [8, 2, 0.8648, 0.0041, 2, 0.95, 0.7778, 265, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "listen", "arg_names": [], "import_names": [], "rhs_call_name": "listen", "annotation": ""}, "snippet": "\t\tclient.listen(5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L212_C2", "label": "info()", "type": "expression", "loc": [212, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L197_C1", "vector": [8, 2, 0.8689, 0.0041, 2, 0.95, 0.8889, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": "\t\tlogger.info('Client - waiting for commands from server')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:While_L214_C2", "label": "while", "type": "while", "loc": [214, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L197_C1", "vector": [5, 2, 0.8873, 0.0246, 2, 0.95, 1.0, 0, 1, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\twhile 1:\n\t\t\trequest, address = client.accept()\n\t\t\tmessage = request.recv(1024)\n\t\t\tanswer = self.performServiceCheck(message)\n\t\t\trequest.send(answer)\n\t\t\trequest.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L215_C3", "label": "request, address = accept()", "type": "assigned_variable", "loc": [215, 215], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:While_L214_C2", "vector": [14, 3, 0.8811, 0.0041, 3, 0.17, 0.0, 983, 3, 0, 0, 0, 829, 10, 1], "semantic": {"name": "request, address", "arg_names": [], "import_names": [], "rhs_call_name": "accept", "annotation": ""}, "snippet": "\t\t\trequest, address = client.accept()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L216_C3", "label": "message = recv()", "type": "assigned_variable", "loc": [216, 216], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:While_L214_C2", "vector": [14, 3, 0.8852, 0.0041, 3, 0.17, 0.25, 635, 3, 1, 0, 0, 178, 10, 1], "semantic": {"name": "message", "arg_names": [], "import_names": [], "rhs_call_name": "recv", "annotation": ""}, "snippet": "\t\t\tmessage = request.recv(1024)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L217_C3", "label": "answer = performServiceCheck()", "type": "assigned_variable", "loc": [217, 217], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:While_L214_C2", "vector": [14, 3, 0.8893, 0.0041, 3, 0.17, 0.5, 607, 3, 1, 0, 0, 67, 10, 1], "semantic": {"name": "answer", "arg_names": [], "import_names": [], "rhs_call_name": "performServiceCheck", "annotation": ""}, "snippet": "\t\t\tanswer = self.performServiceCheck(message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L218_C3", "label": "send()", "type": "expression", "loc": [218, 218], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:While_L214_C2", "vector": [8, 3, 0.8934, 0.0041, 3, 0.17, 0.75, 826, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "send", "arg_names": [], "import_names": [], "rhs_call_name": "send", "annotation": ""}, "snippet": "\t\t\trequest.send(answer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L219_C3", "label": "close()", "type": "expression", "loc": [219, 219], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:While_L214_C2", "vector": [8, 3, 0.8975, 0.0041, 3, 0.17, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": "\t\t\trequest.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L222_C0", "label": "parseArgs", "type": "function", "loc": [222, 235], "level": 0, "parent": null, "vector": [2, 0, 0.9365, 0.0574, 0, 0.66, 0.7778, 905, 0, 0, 1, 0, 0, 0, 7], "semantic": {"name": "parseArgs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parseArgs():\n\n\tparser = argparse.ArgumentParser(prog=appName, usage='%(prog)s [options]')\n\tparser.add_argument('--verbose','-v', action='store_false', help='verbose mode')\n\tparser.add_argument('--config','-c', action='store', help='config filename')\n\n\targs = parser.parse_args()\n\tif args.verbose == True:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L224_C1", "label": "parser = ArgumentParser()", "type": "assigned_variable", "loc": [224, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L222_C0", "vector": [14, 1, 0.918, 0.0041, 1, 0.96, 0.0, 968, 3, 2, 0, 0, 570, 10, 1], "semantic": {"name": "parser", "arg_names": [], "import_names": [], "rhs_call_name": "ArgumentParser", "annotation": ""}, "snippet": "\tparser = argparse.ArgumentParser(prog=appName, usage='%(prog)s [options]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L225_C1", "label": "add_argument()", "type": "expression", "loc": [225, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L222_C0", "vector": [8, 1, 0.9221, 0.0041, 1, 0.96, 0.2, 178, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_argument", "arg_names": [], "import_names": [], "rhs_call_name": "add_argument", "annotation": ""}, "snippet": "\tparser.add_argument('--verbose','-v', action='store_false', help='verbose mode')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L226_C1", "label": "add_argument()", "type": "expression", "loc": [226, 226], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L222_C0", "vector": [8, 1, 0.9262, 0.0041, 1, 0.96, 0.4, 178, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "add_argument", "arg_names": [], "import_names": [], "rhs_call_name": "add_argument", "annotation": ""}, "snippet": "\tparser.add_argument('--config','-c', action='store', help='config filename')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L228_C1", "label": "args = parse_args()", "type": "assigned_variable", "loc": [228, 228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L222_C0", "vector": [14, 1, 0.9344, 0.0041, 1, 0.96, 0.6, 805, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": "\targs = parser.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:If_L229_C1", "label": "if", "type": "if", "loc": [229, 230], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L222_C0", "vector": [4, 1, 0.9406, 0.0082, 1, 0.96, 0.8, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif args.verbose == True:\n\t\tlogger.setLevel(logging.ERROR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L230_C2", "label": "setLevel()", "type": "expression", "loc": [230, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L229_C1", "vector": [8, 2, 0.9426, 0.0041, 2, 0.46, 0.0, 810, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setLevel", "arg_names": [], "import_names": [], "rhs_call_name": "setLevel", "annotation": ""}, "snippet": "\t\tlogger.setLevel(logging.ERROR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:If_L231_C1", "label": "if", "type": "if", "loc": [231, 235], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L222_C0", "vector": [4, 1, 0.9549, 0.0205, 1, 0.96, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif args.config != None:\n\t\treturn Config(args.config)\n\n\telse:\n\t\treturn Config()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L232_C2", "label": "return", "type": "return", "loc": [232, 232], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L231_C1", "vector": [13, 2, 0.9508, 0.0041, 2, 0.85, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn Config(args.config)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L235_C2", "label": "return", "type": "return", "loc": [235, 235], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_433:If_L231_C1", "vector": [13, 2, 0.9631, 0.0041, 2, 0.85, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\t\treturn Config()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L239_C0", "label": "initLogger()", "type": "expression", "loc": [239, 239], "level": 0, "parent": null, "vector": [8, 0, 0.9795, 0.0041, 0, 0.66, 0.8333, 186, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "initLogger", "arg_names": [], "import_names": [], "rhs_call_name": "initLogger", "annotation": ""}, "snippet": "initLogger()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L240_C0", "label": "client = ClientApp()", "type": "assigned_variable", "loc": [240, 240], "level": 0, "parent": null, "vector": [14, 0, 0.9836, 0.0041, 0, 0.66, 0.8889, 608, 3, 1, 0, 0, 174, 10, 2], "semantic": {"name": "client", "arg_names": [], "import_names": [], "rhs_call_name": "ClientApp", "annotation": ""}, "snippet": "client = ClientApp(parseArgs())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L241_C0", "label": "init()", "type": "expression", "loc": [241, 241], "level": 0, "parent": null, "vector": [8, 0, 0.9877, 0.0041, 0, 0.66, 0.9444, 319, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "init", "arg_names": [], "import_names": [], "rhs_call_name": "init", "annotation": ""}, "snippet": "client.init()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L242_C0", "label": "run()", "type": "expression", "loc": [242, 242], "level": 0, "parent": null, "vector": [8, 0, 0.9918, 0.0041, 0, 0.66, 1.0, 679, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": "client.run()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L22_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L23_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L24_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L25_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L26_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L27_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L28_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L29_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L33_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L34_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L36_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L36_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L36_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L36_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L41_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L41_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L43_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L43_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L46_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L46_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L54_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L56_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L56_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L56_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L56_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L56_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L61_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L61_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L63_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L64_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L65_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L66_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:While_L67_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:While_L67_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:While_L67_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_433:If_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_433:If_L70_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L70_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L71_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L70_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_433:If_L72_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L72_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L73_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L72_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L74_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L72_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L76_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L72_C5", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L77_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_433:If_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L79_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L80_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L82_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:While_L67_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L84_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L86_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L62_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L87_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L89_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L89_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L91_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L91_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L92_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L93_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L93_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L94_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L95_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L95_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L96_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L101_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L102_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L102_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L103_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L102_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L104_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L105_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L106_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L108_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L110_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L112_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L112_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L113_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L112_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:If_L114_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L115_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L115_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L115_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L115_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L115_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L122_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L122_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L123_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L125_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L125_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:If_L126_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L126_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L127_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L129_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L129_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L130_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L132_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L132_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L133_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L136_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L136_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L137_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L136_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L138_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L136_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L140_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L136_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L141_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L143_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:For_L144_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:For_L144_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L145_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L147_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L149_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L150_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L151_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L152_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L153_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L154_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:If_L156_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L156_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L157_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L156_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L158_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L135_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:If_L159_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L159_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L160_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L159_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L161_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L159_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:If_L162_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L162_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L163_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L162_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L164_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L162_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L165_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L162_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L166_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L162_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:If_L167_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L167_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L168_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L167_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L169_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L167_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L170_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L167_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L172_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L174_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L174_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L175_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L175_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L176_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L175_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:If_L177_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L177_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L177_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L177_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L180_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L177_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L177_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L177_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L177_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L177_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_433:For_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:For_L186_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L187_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:For_L186_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L188_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:For_L186_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L189_C5"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L177_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L190_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L177_C3", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L191_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L175_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L194_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:Try_L175_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L195_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L197_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L197_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L198_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L197_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L199_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L197_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:While_L200_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:While_L200_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L201_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L197_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:If_L203_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L203_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L204_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L203_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L205_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L203_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L206_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L197_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L208_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L197_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L209_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L197_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L210_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L197_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L211_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L197_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L212_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L197_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:While_L214_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:While_L214_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L215_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:While_L214_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L216_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:While_L214_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L217_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:While_L214_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L218_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:While_L214_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L219_C3"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L224_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L225_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L226_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Assign_L228_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:If_L229_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L229_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Expr_L230_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:FunctionDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_433:If_L231_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L231_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L232_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_433:If_L231_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_433:Return_L235_C2"}] |
#-------- DEFAULT ---------------------------
flags = ['-O2','-Wall','-pedantic']
lib_boost = ['boost_system', 'boost_thread','boost_random','boost_program_options']
lib_cppcms = ['cppcms','cppdb']
libs = lib_boost + lib_cppcms
env = Environment(CPPFLAGS=flags, LIBS=libs)
netspy = 'netspy-server'
dbtest = 'dbtest'
sources = Split("""
main.cpp
Message.cpp
JSONParser.cpp
ClientRegistrar.cpp
RequestManager.cpp
Config.cpp
ClientChecker.cpp
ClientManager.cpp
DataProxy.cpp
""")
dbtestSources = Split("""
DataProxy.cpp
Config.cpp
DataTest.cpp
""")
targets = {
netspy : sources,
dbtest : dbtestSources
}
default = env.Program( target=netspy, source = env.Object(targets[netspy]) )
Default(default)
env.Program(target=dbtest, source = env.Object(targets[dbtest]))
| ajibawa-2023/Python-Code-Large/train/row_434 | 13 | 50 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_434:Assign_L3_C0", "label": "flags =", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.06, 0.02, 0, 0.66, 0.0, 375, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "flags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "flags = ['-O2','-Wall','-pedantic']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_434:Assign_L5_C0", "label": "lib_boost =", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.1, 0.02, 0, 0.66, 0.0833, 384, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "lib_boost", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "lib_boost = ['boost_system', 'boost_thread','boost_random','boost_program_options']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_434:Assign_L6_C0", "label": "lib_cppcms =", "type": "assigned_variable", "loc": [6, 6], "level": 0, "parent": null, "vector": [14, 0, 0.12, 0.02, 0, 0.66, 0.1667, 1, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "lib_cppcms", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "lib_cppcms = ['cppcms','cppdb']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_434:Assign_L8_C0", "label": "libs =", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.16, 0.02, 0, 0.66, 0.25, 673, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "libs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "libs = lib_boost + lib_cppcms"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_434:Assign_L10_C0", "label": "env = Environment()", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.2, 0.02, 0, 0.66, 0.3333, 803, 3, 2, 0, 0, 947, 10, 1], "semantic": {"name": "env", "arg_names": [], "import_names": [], "rhs_call_name": "Environment", "annotation": ""}, "snippet": "env = Environment(CPPFLAGS=flags, LIBS=libs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_434:Assign_L12_C0", "label": "netspy =", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.24, 0.02, 0, 0.66, 0.4167, 877, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "netspy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "netspy = 'netspy-server'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_434:Assign_L13_C0", "label": "dbtest =", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.26, 0.02, 0, 0.66, 0.5, 297, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "dbtest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "dbtest = 'dbtest'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_434:Assign_L16_C0", "label": "sources = Split()", "type": "assigned_variable", "loc": [16, 28], "level": 0, "parent": null, "vector": [14, 0, 0.44, 0.26, 0, 0.66, 0.5833, 648, 3, 1, 0, 0, 551, 10, 1], "semantic": {"name": "sources", "arg_names": [], "import_names": [], "rhs_call_name": "Split", "annotation": ""}, "snippet": "sources = Split(\"\"\"\n\nmain.cpp\nMessage.cpp\nJSONParser.cpp\nClientRegistrar.cpp\nRequestManager.cpp\nConfig.cpp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_434:Assign_L31_C0", "label": "dbtestSources = Split()", "type": "assigned_variable", "loc": [31, 37], "level": 0, "parent": null, "vector": [14, 0, 0.68, 0.14, 0, 0.66, 0.6667, 702, 3, 1, 0, 0, 551, 10, 1], "semantic": {"name": "dbtestSources", "arg_names": [], "import_names": [], "rhs_call_name": "Split", "annotation": ""}, "snippet": "dbtestSources = Split(\"\"\"\n\nDataProxy.cpp\nConfig.cpp\nDataTest.cpp\n\n\"\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_434:Assign_L40_C0", "label": "targets =", "type": "assigned_variable", "loc": [40, 45], "level": 0, "parent": null, "vector": [14, 0, 0.85, 0.12, 0, 0.66, 0.75, 409, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "targets", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "targets = { \n\nnetspy : sources,\ndbtest : dbtestSources\n\n}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_434:Assign_L48_C0", "label": "default = Program()", "type": "assigned_variable", "loc": [48, 48], "level": 0, "parent": null, "vector": [14, 0, 0.96, 0.02, 0, 0.66, 0.8333, 977, 3, 2, 0, 0, 919, 10, 2], "semantic": {"name": "default", "arg_names": [], "import_names": [], "rhs_call_name": "Program", "annotation": ""}, "snippet": "default = env.Program( target=netspy, source = env.Object(targets[netspy]) )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_434:Expr_L49_C0", "label": "Default()", "type": "expression", "loc": [49, 49], "level": 0, "parent": null, "vector": [8, 0, 0.98, 0.02, 0, 0.66, 0.9167, 684, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "Default", "arg_names": [], "import_names": [], "rhs_call_name": "Default", "annotation": ""}, "snippet": "Default(default)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_434:Expr_L50_C0", "label": "Program()", "type": "expression", "loc": [50, 50], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.02, 0, 0.66, 1.0, 919, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "Program", "arg_names": [], "import_names": [], "rhs_call_name": "Program", "annotation": ""}, "snippet": "env.Program(target=dbtest, source = env.Object(targets[dbtest]))"}] | [] |
#!/usr/bin/env python
import gluon
from gluon.fileutils import untar
import os
import sys
def main():
path = gluon.__path__
out_path = os.getcwd()
try:
if sys.argv[1] and os.path.exists(sys.argv[1]):# To untar the web2py env to the selected path
out_path = sys.argv[1]
else:
os.mkdir(sys.argv[1])
out_path = sys.argv[1]
except:
pass
try:
print "Creating a web2py env in: " + out_path
untar(os.path.join(path[0],'env.tar'),out_path)
except:
print "Failed to create the web2py env"
print "Please reinstall web2py from pip"
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_435 | 19 | 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_435:Import_L2_C0", "label": "gluon import gluon", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0741, 0.037, 0, 0.66, 0.0, 826, 0, 1, 0, 0, 826, 0, 0], "semantic": {"name": "gluon", "arg_names": [], "import_names": ["gluon"], "rhs_call_name": "", "annotation": ""}, "snippet": "import gluon"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_435:ImportFrom_L3_C0", "label": "from gluon.fileutils import untar", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1111, 0.037, 0, 0.66, 0.2, 948, 0, 1, 0, 0, 948, 0, 0], "semantic": {"name": "gluon.fileutils", "arg_names": [], "import_names": ["untar"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.fileutils import untar"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_435:Import_L4_C0", "label": "os import os", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1481, 0.037, 0, 0.66, 0.4, 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_435: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.6, 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_435:FunctionDef_L8_C0", "label": "main", "type": "function", "loc": [8, 24], "level": 0, "parent": null, "vector": [2, 0, 0.5926, 0.6296, 0, 0.66, 0.8, 624, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n path = gluon.__path__\n out_path = os.getcwd()\n try:\n if sys.argv[1] and os.path.exists(sys.argv[1]):# To untar the web2py env to the selected path\n out_path = sys.argv[1]\n else:\n os.mkdir(sys.argv[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_435:Assign_L9_C4", "label": "path =", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_435:FunctionDef_L8_C0", "vector": [14, 1, 0.3333, 0.037, 1, 0.48, 0.0, 358, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = gluon.__path__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_435:Assign_L10_C4", "label": "out_path = getcwd()", "type": "assigned_variable", "loc": [10, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_435:FunctionDef_L8_C0", "vector": [14, 1, 0.3704, 0.037, 1, 0.48, 0.3333, 285, 3, 0, 0, 0, 320, 10, 1], "semantic": {"name": "out_path", "arg_names": [], "import_names": [], "rhs_call_name": "getcwd", "annotation": ""}, "snippet": " out_path = os.getcwd()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_435:Try_L11_C4", "label": "try", "type": "try", "loc": [11, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_435:FunctionDef_L8_C0", "vector": [7, 1, 0.537, 0.2963, 1, 0.48, 0.6667, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if sys.argv[1] and os.path.exists(sys.argv[1]):# To untar the web2py env to the selected path\n out_path = sys.argv[1]\n else:\n os.mkdir(sys.argv[1])\n out_path = sys.argv[1]\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_435:If_L12_C8", "label": "if", "type": "if", "loc": [12, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_435:Try_L11_C4", "vector": [4, 2, 0.5185, 0.1852, 2, 0.64, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if sys.argv[1] and os.path.exists(sys.argv[1]):# To untar the web2py env to the selected path\n out_path = sys.argv[1]\n else:\n os.mkdir(sys.argv[1])\n out_path = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_435:Assign_L13_C12", "label": "out_path =", "type": "assigned_variable", "loc": [13, 13], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_435:If_L12_C8", "vector": [14, 3, 0.4815, 0.037, 3, 0.04, 0.0, 285, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "out_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " out_path = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_435:Expr_L15_C12", "label": "mkdir()", "type": "expression", "loc": [15, 15], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_435:If_L12_C8", "vector": [8, 3, 0.5556, 0.037, 3, 0.04, 0.5, 853, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "mkdir", "arg_names": [], "import_names": [], "rhs_call_name": "mkdir", "annotation": ""}, "snippet": " os.mkdir(sys.argv[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_435:Assign_L16_C12", "label": "out_path =", "type": "assigned_variable", "loc": [16, 16], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_435:If_L12_C8", "vector": [14, 3, 0.5926, 0.037, 3, 0.04, 1.0, 285, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "out_path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " out_path = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_435:Try_L19_C4", "label": "try", "type": "try", "loc": [19, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_435:FunctionDef_L8_C0", "vector": [7, 1, 0.7963, 0.2222, 1, 0.48, 1.0, 0, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n print(\"Creating a web2py env in: \" + out_path)\n untar(os.path.join(path[0],'env.tar'),out_path)\n except:\n print(\"Failed to create the web2py env\")\n print(\"Please reinstall web2py from pip\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_435:Expr_L20_C8", "label": "print()", "type": "expression", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_435:Try_L19_C4", "vector": [8, 2, 0.7407, 0.037, 2, 0.49, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Creating a web2py env in: \" + out_path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_435:Expr_L21_C8", "label": "untar()", "type": "expression", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_435:Try_L19_C4", "vector": [8, 2, 0.7778, 0.037, 2, 0.49, 1.0, 356, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "untar", "arg_names": [], "import_names": [], "rhs_call_name": "untar", "annotation": ""}, "snippet": " untar(os.path.join(path[0],'env.tar'),out_path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_435:Expr_L23_C8", "label": "print()", "type": "expression", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_435:Try_L19_C4", "vector": [8, 2, 0.8519, 0.037, 2, 0.49, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Failed to create the web2py env\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_435:Expr_L24_C8", "label": "print()", "type": "expression", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_435:Try_L19_C4", "vector": [8, 2, 0.8889, 0.037, 2, 0.49, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Please reinstall web2py from pip\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_435:If_L26_C0", "label": "if", "type": "if", "loc": [26, 27], "level": 0, "parent": null, "vector": [4, 0, 0.9815, 0.0741, 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_435:Expr_L27_C4", "label": "main()", "type": "expression", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_435:If_L26_C0", "vector": [8, 1, 1.0, 0.037, 1, 0.04, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_435:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_435:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_435:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_435:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_435:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_435:Try_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_435:Try_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_435:If_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_435:If_L12_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_435:Assign_L13_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_435:If_L12_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_435:Expr_L15_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_435:If_L12_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_435:Assign_L16_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_435:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_435:Try_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_435:Try_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_435:Expr_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_435:Try_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_435:Expr_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_435:Try_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_435:Expr_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_435:Try_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_435:Expr_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_435:If_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_435:Expr_L27_C4"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
This is a WSGI handler for Apache
Requires apache+mod_wsgi.
In httpd.conf put something like:
LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias / /path/to/wsgihandler.py
"""
# change these parameters as required
LOGGING = False
SOFTCRON = False
import sys
import os
path = os.path.dirname(os.path.abspath(__file__))
os.chdir(path)
sys.path = [path] + [p for p in sys.path if not p == path]
sys.stdout = sys.stderr
import gluon.main
if LOGGING:
application = gluon.main.appfactory(wsgiapp=gluon.main.wsgibase,
logfilename='httpserver.log',
profilerfilename=None)
else:
application = gluon.main.wsgibase
if SOFTCRON:
from gluon.settings import global_settings
global_settings.web2py_crontype = 'soft'
| ajibawa-2023/Python-Code-Large/train/row_436 | 16 | 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_436:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 18], "level": 0, "parent": null, "vector": [8, 0, 0.25, 0.3409, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis file is part of the web2py Web Framework\nCopyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>\nLicense: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)\n\n\nThis is a WSGI handler for Apache\nRequires apache+mod_wsgi."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_436:Assign_L21_C0", "label": "LOGGING =", "type": "assigned_variable", "loc": [21, 21], "level": 0, "parent": null, "vector": [14, 0, 0.4773, 0.0227, 0, 0.66, 0.0909, 136, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "LOGGING", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "LOGGING = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_436:Assign_L22_C0", "label": "SOFTCRON =", "type": "assigned_variable", "loc": [22, 22], "level": 0, "parent": null, "vector": [14, 0, 0.5, 0.0227, 0, 0.66, 0.1818, 762, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "SOFTCRON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SOFTCRON = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_436:Import_L24_C0", "label": "sys import sys", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.5455, 0.0227, 0, 0.66, 0.2727, 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_436:Import_L25_C0", "label": "os import os", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.5682, 0.0227, 0, 0.66, 0.3636, 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_436:Assign_L27_C0", "label": "path = dirname()", "type": "assigned_variable", "loc": [27, 27], "level": 0, "parent": null, "vector": [14, 0, 0.6136, 0.0227, 0, 0.66, 0.4545, 358, 3, 1, 0, 0, 959, 10, 2], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "dirname", "annotation": ""}, "snippet": "path = os.path.dirname(os.path.abspath(__file__))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_436:Expr_L28_C0", "label": "chdir()", "type": "expression", "loc": [28, 28], "level": 0, "parent": null, "vector": [8, 0, 0.6364, 0.0227, 0, 0.66, 0.5455, 122, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "chdir", "arg_names": [], "import_names": [], "rhs_call_name": "chdir", "annotation": ""}, "snippet": "os.chdir(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_436:Assign_L29_C0", "label": "sys.path =", "type": "assigned_variable", "loc": [29, 29], "level": 0, "parent": null, "vector": [14, 0, 0.6591, 0.0227, 0, 0.66, 0.6364, 909, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sys.path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "sys.path = [path] + [p for p in sys.path if not p == path]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_436:Assign_L31_C0", "label": "sys.stdout =", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.7045, 0.0227, 0, 0.66, 0.7273, 260, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sys.stdout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "sys.stdout = sys.stderr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_436:Import_L33_C0", "label": "gluon.main import gluon.main", "type": "import", "loc": [33, 33], "level": 0, "parent": null, "vector": [1, 0, 0.75, 0.0227, 0, 0.66, 0.8182, 639, 0, 1, 0, 0, 639, 0, 0], "semantic": {"name": "gluon.main", "arg_names": [], "import_names": ["gluon.main"], "rhs_call_name": "", "annotation": ""}, "snippet": "import gluon.main"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_436:If_L35_C0", "label": "if", "type": "if", "loc": [35, 40], "level": 0, "parent": null, "vector": [4, 0, 0.8523, 0.1364, 0, 0.66, 0.9091, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if LOGGING:\n application = gluon.main.appfactory(wsgiapp=gluon.main.wsgibase,\n logfilename='httpserver.log',\n profilerfilename=None)\nelse:\n application = gluon.main.wsgibase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_436:Assign_L36_C4", "label": "application = appfactory()", "type": "assigned_variable", "loc": [36, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_436:If_L35_C0", "vector": [14, 1, 0.8409, 0.0682, 1, 0.8, 0.0, 244, 3, 3, 0, 0, 579, 10, 1], "semantic": {"name": "application", "arg_names": [], "import_names": [], "rhs_call_name": "appfactory", "annotation": ""}, "snippet": " application = gluon.main.appfactory(wsgiapp=gluon.main.wsgibase,\n logfilename='httpserver.log',\n profilerfilename=None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_436:Assign_L40_C4", "label": "application =", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_436:If_L35_C0", "vector": [14, 1, 0.9091, 0.0227, 1, 0.8, 1.0, 244, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "application", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " application = gluon.main.wsgibase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_436:If_L42_C0", "label": "if", "type": "if", "loc": [42, 44], "level": 0, "parent": null, "vector": [4, 0, 0.9773, 0.0682, 0, 0.66, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if SOFTCRON:\n from gluon.settings import global_settings\n global_settings.web2py_crontype = 'soft'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_436:ImportFrom_L43_C4", "label": "from gluon.settings import global_settings", "type": "import", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_436:If_L42_C0", "vector": [1, 1, 0.9773, 0.0227, 1, 0.58, 0.0, 883, 0, 1, 0, 0, 883, 0, 0], "semantic": {"name": "gluon.settings", "arg_names": [], "import_names": ["global_settings"], "rhs_call_name": "", "annotation": ""}, "snippet": " from gluon.settings import global_settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_436:Assign_L44_C4", "label": "global_settings.web2py_crontype =", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_436:If_L42_C0", "vector": [14, 1, 1.0, 0.0227, 1, 0.58, 1.0, 128, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "global_settings.web2py_crontype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " global_settings.web2py_crontype = 'soft'"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_436:If_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_436:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_436:If_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_436:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_436:If_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_436:ImportFrom_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_436:If_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_436:Assign_L44_C4"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
This is a handler for lighttpd+fastcgi
This file has to be in the PYTHONPATH
Put something like this in the lighttpd.conf file:
server.port = 8000
server.bind = '127.0.0.1'
server.event-handler = 'freebsd-kqueue'
server.modules = ('mod_rewrite', 'mod_fastcgi')
server.error-handler-404 = '/test.fcgi'
server.document-root = '/somewhere/web2py'
server.errorlog = '/tmp/error.log'
fastcgi.server = ('.fcgi' =>
('localhost' =>
('min-procs' => 1,
'socket' => '/tmp/fcgi.sock'
)
)
)
"""
LOGGING = False
SOFTCRON = False
import sys
import os
path = os.path.dirname(os.path.abspath(__file__))
os.chdir(path)
sys.path = [path] + [p for p in sys.path if not p == path]
import gluon.main
import gluon.contrib.gateways.fcgi as fcgi
if LOGGING:
application = gluon.main.appfactory(wsgiapp=gluon.main.wsgibase,
logfilename='httpserver.log',
profilerfilename=None)
else:
application = gluon.main.wsgibase
if SOFTCRON:
from gluon.settings import global_settings
global_settings.web2py_crontype = 'soft'
fcgi.WSGIServer(application, bindAddress='/tmp/fcgi.sock').run()
| ajibawa-2023/Python-Code-Large/train/row_437 | 17 | 53 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_437:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 27], "level": 0, "parent": null, "vector": [8, 0, 0.2925, 0.4528, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis file is part of the web2py Web Framework\nCopyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>\nLicense: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)\n\nThis is a handler for lighttpd+fastcgi\nThis file has to be in the PYTHONPATH\nPut something like this in the lighttpd.conf file:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_437:Assign_L29_C0", "label": "LOGGING =", "type": "assigned_variable", "loc": [29, 29], "level": 0, "parent": null, "vector": [14, 0, 0.5472, 0.0189, 0, 0.66, 0.0833, 136, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "LOGGING", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "LOGGING = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_437:Assign_L30_C0", "label": "SOFTCRON =", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.566, 0.0189, 0, 0.66, 0.1667, 762, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "SOFTCRON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SOFTCRON = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_437:Import_L32_C0", "label": "sys import sys", "type": "import", "loc": [32, 32], "level": 0, "parent": null, "vector": [1, 0, 0.6038, 0.0189, 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_437:Import_L33_C0", "label": "os import os", "type": "import", "loc": [33, 33], "level": 0, "parent": null, "vector": [1, 0, 0.6226, 0.0189, 0, 0.66, 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_437:Assign_L35_C0", "label": "path = dirname()", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 0.6604, 0.0189, 0, 0.66, 0.4167, 358, 3, 1, 0, 0, 959, 10, 2], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "dirname", "annotation": ""}, "snippet": "path = os.path.dirname(os.path.abspath(__file__))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_437:Expr_L36_C0", "label": "chdir()", "type": "expression", "loc": [36, 36], "level": 0, "parent": null, "vector": [8, 0, 0.6792, 0.0189, 0, 0.66, 0.5, 122, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "chdir", "arg_names": [], "import_names": [], "rhs_call_name": "chdir", "annotation": ""}, "snippet": "os.chdir(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_437:Assign_L37_C0", "label": "sys.path =", "type": "assigned_variable", "loc": [37, 37], "level": 0, "parent": null, "vector": [14, 0, 0.6981, 0.0189, 0, 0.66, 0.5833, 909, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sys.path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "sys.path = [path] + [p for p in sys.path if not p == path]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_437:Import_L39_C0", "label": "gluon.main import gluon.main", "type": "import", "loc": [39, 39], "level": 0, "parent": null, "vector": [1, 0, 0.7358, 0.0189, 0, 0.66, 0.6667, 639, 0, 1, 0, 0, 639, 0, 0], "semantic": {"name": "gluon.main", "arg_names": [], "import_names": ["gluon.main"], "rhs_call_name": "", "annotation": ""}, "snippet": "import gluon.main"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_437:Import_L40_C0", "label": "gluon.contrib.gateways.fcgi import fcgi", "type": "import", "loc": [40, 40], "level": 0, "parent": null, "vector": [1, 0, 0.7547, 0.0189, 0, 0.66, 0.75, 879, 0, 1, 0, 0, 879, 0, 0], "semantic": {"name": "gluon.contrib.gateways.fcgi", "arg_names": [], "import_names": ["fcgi"], "rhs_call_name": "", "annotation": ""}, "snippet": "import gluon.contrib.gateways.fcgi as fcgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_437:If_L42_C0", "label": "if", "type": "if", "loc": [42, 47], "level": 0, "parent": null, "vector": [4, 0, 0.8396, 0.1132, 0, 0.66, 0.8333, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if LOGGING:\n application = gluon.main.appfactory(wsgiapp=gluon.main.wsgibase,\n logfilename='httpserver.log',\n profilerfilename=None)\nelse:\n application = gluon.main.wsgibase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_437:Assign_L43_C4", "label": "application = appfactory()", "type": "assigned_variable", "loc": [43, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_437:If_L42_C0", "vector": [14, 1, 0.8302, 0.0566, 1, 0.36, 0.0, 244, 3, 3, 0, 0, 579, 10, 1], "semantic": {"name": "application", "arg_names": [], "import_names": [], "rhs_call_name": "appfactory", "annotation": ""}, "snippet": " application = gluon.main.appfactory(wsgiapp=gluon.main.wsgibase,\n logfilename='httpserver.log',\n profilerfilename=None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_437:Assign_L47_C4", "label": "application =", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_437:If_L42_C0", "vector": [14, 1, 0.8868, 0.0189, 1, 0.36, 1.0, 244, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "application", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " application = gluon.main.wsgibase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_437:If_L49_C0", "label": "if", "type": "if", "loc": [49, 51], "level": 0, "parent": null, "vector": [4, 0, 0.9434, 0.0566, 0, 0.66, 0.9167, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if SOFTCRON:\n from gluon.settings import global_settings\n global_settings.web2py_crontype = 'soft'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_437:ImportFrom_L50_C4", "label": "from gluon.settings import global_settings", "type": "import", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_437:If_L49_C0", "vector": [1, 1, 0.9434, 0.0189, 1, 0.27, 0.0, 883, 0, 1, 0, 0, 883, 0, 0], "semantic": {"name": "gluon.settings", "arg_names": [], "import_names": ["global_settings"], "rhs_call_name": "", "annotation": ""}, "snippet": " from gluon.settings import global_settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_437:Assign_L51_C4", "label": "global_settings.web2py_crontype =", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_437:If_L49_C0", "vector": [14, 1, 0.9623, 0.0189, 1, 0.27, 1.0, 128, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "global_settings.web2py_crontype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " global_settings.web2py_crontype = 'soft'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_437:Expr_L53_C0", "label": "run()", "type": "expression", "loc": [53, 53], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0189, 0, 0.66, 1.0, 679, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": "fcgi.WSGIServer(application, bindAddress='/tmp/fcgi.sock').run()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_437:If_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_437:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_437:If_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_437:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_437:If_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_437:ImportFrom_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_437:If_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_437:Assign_L51_C4"}] |
def webapp_add_wsgi_middleware(app):
from google.appengine.ext.appstats import recording
app = recording.appstats_wsgi_middleware(app)
return app
| ajibawa-2023/Python-Code-Large/train/row_438 | 4 | 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_438:FunctionDef_L1_C0", "label": "webapp_add_wsgi_middleware", "type": "function", "loc": [1, 4], "level": 0, "parent": null, "vector": [2, 0, 0.625, 1.0, 0, 0.66, 0.0, 156, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "webapp_add_wsgi_middleware", "arg_names": ["app"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def webapp_add_wsgi_middleware(app):\n from google.appengine.ext.appstats import recording\n app = recording.appstats_wsgi_middleware(app)\n return app"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_438:ImportFrom_L2_C4", "label": "from google.appengine.ext.appstats import recording", "type": "import", "loc": [2, 2], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_438:FunctionDef_L1_C0", "vector": [1, 1, 0.5, 0.25, 1, 0.03, 0.0, 215, 0, 1, 0, 0, 215, 0, 0], "semantic": {"name": "google.appengine.ext.appstats", "arg_names": [], "import_names": ["recording"], "rhs_call_name": "", "annotation": ""}, "snippet": " from google.appengine.ext.appstats import recording"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_438:Assign_L3_C4", "label": "app = appstats_wsgi_middleware()", "type": "assigned_variable", "loc": [3, 3], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_438:FunctionDef_L1_C0", "vector": [14, 1, 0.75, 0.25, 1, 0.03, 0.5, 494, 3, 1, 0, 0, 631, 10, 1], "semantic": {"name": "app", "arg_names": [], "import_names": [], "rhs_call_name": "appstats_wsgi_middleware", "annotation": ""}, "snippet": " app = recording.appstats_wsgi_middleware(app)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_438:Return_L4_C4", "label": "return", "type": "return", "loc": [4, 4], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_438:FunctionDef_L1_C0", "vector": [13, 1, 1.0, 0.25, 1, 0.03, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return app"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_438:FunctionDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_438:ImportFrom_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_438:FunctionDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_438:Assign_L3_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_438:FunctionDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_438:Return_L4_C4"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
scgihandler.py - handler for SCGI protocol
Modified by Michele Comitini <michele.comitini@glisco.it>
from fcgihandler.py to support SCGI
fcgihandler has the following copyright:
" This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
"
This is a handler for lighttpd+scgi
This file has to be in the PYTHONPATH
Put something like this in the lighttpd.conf file:
server.document-root="/var/www/web2py/"
# for >= linux-2.6
server.event-handler = "linux-sysepoll"
url.rewrite-once = (
"^(/.+?/static/.+)$" => "/applications$1",
"(^|/.*)$" => "/handler_web2py.scgi$1",
)
scgi.server = ( "/handler_web2py.scgi" =>
("handler_web2py" =>
( "host" => "127.0.0.1",
"port" => "4000",
"check-local" => "disable", # don't forget to set "disable"!
)
)
)
"""
LOGGING = False
SOFTCRON = False
import sys
import os
path = os.path.dirname(os.path.abspath(__file__))
os.chdir(path)
sys.path = [path] + [p for p in sys.path if not p == path]
import gluon.main
# uncomment one of the two imports below depending on the SCGIWSGI server installed
#import paste.util.scgiserver as scgi
from wsgitools.scgi.forkpool import SCGIServer
from wsgitools.filters import WSGIFilterMiddleware, GzipWSGIFilter
wsgiapp = WSGIFilterMiddleware(gluon.main.wsgibase, GzipWSGIFilter)
if LOGGING:
application = gluon.main.appfactory(wsgiapp=wsgiapp,
logfilename='httpserver.log',
profilerfilename=None)
else:
application = wsgiapp
if SOFTCRON:
from gluon.settings import global_settings
global_settings.web2py_crontype = 'soft'
# uncomment one of the two rows below depending on the SCGIWSGI server installed
#scgi.serve_application(application, '', 4000).run()
SCGIServer(application, port=4000).enable_sighandler().run()
| ajibawa-2023/Python-Code-Large/train/row_439 | 19 | 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_439:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 40], "level": 0, "parent": null, "vector": [8, 0, 0.2973, 0.5, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nscgihandler.py - handler for SCGI protocol\n\nModified by Michele Comitini <michele.comitini@glisco.it>\nfrom fcgihandler.py to support SCGI\n\nfcgihandler has the following copyright:\n\" This file is part of the web2py Web Framework"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_439:Assign_L42_C0", "label": "LOGGING =", "type": "assigned_variable", "loc": [42, 42], "level": 0, "parent": null, "vector": [14, 0, 0.5676, 0.0135, 0, 0.66, 0.0714, 136, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "LOGGING", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "LOGGING = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_439:Assign_L43_C0", "label": "SOFTCRON =", "type": "assigned_variable", "loc": [43, 43], "level": 0, "parent": null, "vector": [14, 0, 0.5811, 0.0135, 0, 0.66, 0.1429, 762, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "SOFTCRON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SOFTCRON = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_439:Import_L45_C0", "label": "sys import sys", "type": "import", "loc": [45, 45], "level": 0, "parent": null, "vector": [1, 0, 0.6081, 0.0135, 0, 0.66, 0.2143, 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_439:Import_L46_C0", "label": "os import os", "type": "import", "loc": [46, 46], "level": 0, "parent": null, "vector": [1, 0, 0.6216, 0.0135, 0, 0.66, 0.2857, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_439:Assign_L48_C0", "label": "path = dirname()", "type": "assigned_variable", "loc": [48, 48], "level": 0, "parent": null, "vector": [14, 0, 0.6486, 0.0135, 0, 0.66, 0.3571, 358, 3, 1, 0, 0, 959, 10, 2], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "dirname", "annotation": ""}, "snippet": "path = os.path.dirname(os.path.abspath(__file__))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_439:Expr_L49_C0", "label": "chdir()", "type": "expression", "loc": [49, 49], "level": 0, "parent": null, "vector": [8, 0, 0.6622, 0.0135, 0, 0.66, 0.4286, 122, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "chdir", "arg_names": [], "import_names": [], "rhs_call_name": "chdir", "annotation": ""}, "snippet": "os.chdir(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_439:Assign_L50_C0", "label": "sys.path =", "type": "assigned_variable", "loc": [50, 50], "level": 0, "parent": null, "vector": [14, 0, 0.6757, 0.0135, 0, 0.66, 0.5, 909, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sys.path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "sys.path = [path] + [p for p in sys.path if not p == path]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_439:Import_L52_C0", "label": "gluon.main import gluon.main", "type": "import", "loc": [52, 52], "level": 0, "parent": null, "vector": [1, 0, 0.7027, 0.0135, 0, 0.66, 0.5714, 639, 0, 1, 0, 0, 639, 0, 0], "semantic": {"name": "gluon.main", "arg_names": [], "import_names": ["gluon.main"], "rhs_call_name": "", "annotation": ""}, "snippet": "import gluon.main"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_439:ImportFrom_L56_C0", "label": "from wsgitools.scgi.forkpool import SCGIServer", "type": "import", "loc": [56, 56], "level": 0, "parent": null, "vector": [1, 0, 0.7568, 0.0135, 0, 0.66, 0.6429, 876, 0, 1, 0, 0, 876, 0, 0], "semantic": {"name": "wsgitools.scgi.forkpool", "arg_names": [], "import_names": ["SCGIServer"], "rhs_call_name": "", "annotation": ""}, "snippet": "from wsgitools.scgi.forkpool import SCGIServer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_439:ImportFrom_L57_C0", "label": "from wsgitools.filters import WSGIFilterMiddleware, GzipWSGIFilter", "type": "import", "loc": [57, 57], "level": 0, "parent": null, "vector": [1, 0, 0.7703, 0.0135, 0, 0.66, 0.7143, 677, 0, 2, 0, 0, 677, 0, 0], "semantic": {"name": "wsgitools.filters", "arg_names": [], "import_names": ["WSGIFilterMiddleware", "GzipWSGIFilter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from wsgitools.filters import WSGIFilterMiddleware, GzipWSGIFilter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_439:Assign_L59_C0", "label": "wsgiapp = WSGIFilterMiddleware()", "type": "assigned_variable", "loc": [59, 59], "level": 0, "parent": null, "vector": [14, 0, 0.7973, 0.0135, 0, 0.66, 0.7857, 688, 3, 2, 0, 0, 794, 10, 1], "semantic": {"name": "wsgiapp", "arg_names": [], "import_names": [], "rhs_call_name": "WSGIFilterMiddleware", "annotation": ""}, "snippet": "wsgiapp = WSGIFilterMiddleware(gluon.main.wsgibase, GzipWSGIFilter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_439:If_L61_C0", "label": "if", "type": "if", "loc": [61, 66], "level": 0, "parent": null, "vector": [4, 0, 0.8581, 0.0811, 0, 0.66, 0.8571, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if LOGGING:\n application = gluon.main.appfactory(wsgiapp=wsgiapp,\n logfilename='httpserver.log',\n profilerfilename=None)\nelse:\n application = wsgiapp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_439:Assign_L62_C4", "label": "application = appfactory()", "type": "assigned_variable", "loc": [62, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_439:If_L61_C0", "vector": [14, 1, 0.8514, 0.0405, 1, 0.43, 0.0, 244, 3, 3, 0, 0, 579, 10, 1], "semantic": {"name": "application", "arg_names": [], "import_names": [], "rhs_call_name": "appfactory", "annotation": ""}, "snippet": " application = gluon.main.appfactory(wsgiapp=wsgiapp,\n logfilename='httpserver.log',\n profilerfilename=None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_439:Assign_L66_C4", "label": "application =", "type": "assigned_variable", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_439:If_L61_C0", "vector": [14, 1, 0.8919, 0.0135, 1, 0.43, 1.0, 244, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "application", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " application = wsgiapp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_439:If_L68_C0", "label": "if", "type": "if", "loc": [68, 70], "level": 0, "parent": null, "vector": [4, 0, 0.9324, 0.0405, 0, 0.66, 0.9286, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if SOFTCRON:\n from gluon.settings import global_settings\n global_settings.web2py_crontype = 'soft'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_439:ImportFrom_L69_C4", "label": "from gluon.settings import global_settings", "type": "import", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_439:If_L68_C0", "vector": [1, 1, 0.9324, 0.0135, 1, 0.91, 0.0, 883, 0, 1, 0, 0, 883, 0, 0], "semantic": {"name": "gluon.settings", "arg_names": [], "import_names": ["global_settings"], "rhs_call_name": "", "annotation": ""}, "snippet": " from gluon.settings import global_settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_439:Assign_L70_C4", "label": "global_settings.web2py_crontype =", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_439:If_L68_C0", "vector": [14, 1, 0.9459, 0.0135, 1, 0.91, 1.0, 128, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "global_settings.web2py_crontype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " global_settings.web2py_crontype = 'soft'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_439:Expr_L74_C0", "label": "run()", "type": "expression", "loc": [74, 74], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0135, 0, 0.66, 1.0, 679, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": "SCGIServer(application, port=4000).enable_sighandler().run()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_439:If_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_439:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_439:If_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_439:Assign_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_439:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_439:ImportFrom_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_439:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_439:Assign_L70_C4"}] |
# -*- coding: utf-8 -*-
# when web2py is run as a windows service (web2py.py -W)
# it does not load the command line options but it
# expects to find configuration settings in a file called
#
# web2py/options.py
#
# this file is an example for options.py
import socket
import os
ip = '0.0.0.0'
port = 80
interfaces = [('0.0.0.0', 80)]
#,('0.0.0.0',443,'ssl_private_key.pem','ssl_certificate.pem')]
password = '<recycle>' # ## <recycle> means use the previous password
pid_filename = 'httpserver.pid'
log_filename = 'httpserver.log'
profiler_filename = None
ssl_certificate = '' # 'ssl_certificate.pem' # ## path to certificate file
ssl_private_key = '' # 'ssl_private_key.pem' # ## path to private key file
#numthreads = 50 # ## deprecated; remove
minthreads = None
maxthreads = None
server_name = socket.gethostname()
request_queue_size = 5
timeout = 30
shutdown_timeout = 5
folder = os.getcwd()
extcron = None
nocron = None
| ajibawa-2023/Python-Code-Large/train/row_440 | 20 | 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_440:Import_L11_C0", "label": "socket import socket", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.0303, 0, 0.66, 0.0, 687, 0, 1, 0, 0, 687, 0, 0], "semantic": {"name": "socket", "arg_names": [], "import_names": ["socket"], "rhs_call_name": "", "annotation": ""}, "snippet": "import socket"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_440:Import_L12_C0", "label": "os import os", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.3636, 0.0303, 0, 0.66, 0.0526, 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_440:Assign_L14_C0", "label": "ip =", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.4242, 0.0303, 0, 0.66, 0.1053, 583, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ip = '0.0.0.0'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_440:Assign_L15_C0", "label": "port =", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.4545, 0.0303, 0, 0.66, 0.1579, 308, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "port", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "port = 80"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_440:Assign_L16_C0", "label": "interfaces =", "type": "assigned_variable", "loc": [16, 16], "level": 0, "parent": null, "vector": [14, 0, 0.4848, 0.0303, 0, 0.66, 0.2105, 41, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "interfaces", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "interfaces = [('0.0.0.0', 80)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_440:Assign_L18_C0", "label": "password =", "type": "assigned_variable", "loc": [18, 18], "level": 0, "parent": null, "vector": [14, 0, 0.5455, 0.0303, 0, 0.66, 0.2632, 489, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "password", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "password = '<recycle>' # ## <recycle> means use the previous password"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_440:Assign_L19_C0", "label": "pid_filename =", "type": "assigned_variable", "loc": [19, 19], "level": 0, "parent": null, "vector": [14, 0, 0.5758, 0.0303, 0, 0.66, 0.3158, 108, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "pid_filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "pid_filename = 'httpserver.pid'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_440:Assign_L20_C0", "label": "log_filename =", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.6061, 0.0303, 0, 0.66, 0.3684, 800, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "log_filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "log_filename = 'httpserver.log'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_440:Assign_L21_C0", "label": "profiler_filename =", "type": "assigned_variable", "loc": [21, 21], "level": 0, "parent": null, "vector": [14, 0, 0.6364, 0.0303, 0, 0.66, 0.4211, 280, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "profiler_filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "profiler_filename = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_440:Assign_L22_C0", "label": "ssl_certificate =", "type": "assigned_variable", "loc": [22, 22], "level": 0, "parent": null, "vector": [14, 0, 0.6667, 0.0303, 0, 0.66, 0.4737, 38, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ssl_certificate", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ssl_certificate = '' # 'ssl_certificate.pem' # ## path to certificate file"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_440:Assign_L23_C0", "label": "ssl_private_key =", "type": "assigned_variable", "loc": [23, 23], "level": 0, "parent": null, "vector": [14, 0, 0.697, 0.0303, 0, 0.66, 0.5263, 616, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ssl_private_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ssl_private_key = '' # 'ssl_private_key.pem' # ## path to private key file"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_440:Assign_L25_C0", "label": "minthreads =", "type": "assigned_variable", "loc": [25, 25], "level": 0, "parent": null, "vector": [14, 0, 0.7576, 0.0303, 0, 0.66, 0.5789, 2, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "minthreads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "minthreads = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_440:Assign_L26_C0", "label": "maxthreads =", "type": "assigned_variable", "loc": [26, 26], "level": 0, "parent": null, "vector": [14, 0, 0.7879, 0.0303, 0, 0.66, 0.6316, 130, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "maxthreads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "maxthreads = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_440:Assign_L27_C0", "label": "server_name = gethostname()", "type": "assigned_variable", "loc": [27, 27], "level": 0, "parent": null, "vector": [14, 0, 0.8182, 0.0303, 0, 0.66, 0.6842, 917, 3, 0, 0, 0, 682, 10, 1], "semantic": {"name": "server_name", "arg_names": [], "import_names": [], "rhs_call_name": "gethostname", "annotation": ""}, "snippet": "server_name = socket.gethostname()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_440:Assign_L28_C0", "label": "request_queue_size =", "type": "assigned_variable", "loc": [28, 28], "level": 0, "parent": null, "vector": [14, 0, 0.8485, 0.0303, 0, 0.66, 0.7368, 389, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "request_queue_size", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "request_queue_size = 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_440:Assign_L29_C0", "label": "timeout =", "type": "assigned_variable", "loc": [29, 29], "level": 0, "parent": null, "vector": [14, 0, 0.8788, 0.0303, 0, 0.66, 0.7895, 616, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "timeout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "timeout = 30"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_440:Assign_L30_C0", "label": "shutdown_timeout =", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.9091, 0.0303, 0, 0.66, 0.8421, 328, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "shutdown_timeout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "shutdown_timeout = 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_440:Assign_L31_C0", "label": "folder = getcwd()", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.9394, 0.0303, 0, 0.66, 0.8947, 841, 3, 0, 0, 0, 320, 10, 1], "semantic": {"name": "folder", "arg_names": [], "import_names": [], "rhs_call_name": "getcwd", "annotation": ""}, "snippet": "folder = os.getcwd()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_440:Assign_L32_C0", "label": "extcron =", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.9697, 0.0303, 0, 0.66, 0.9474, 460, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "extcron", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "extcron = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_440:Assign_L33_C0", "label": "nocron =", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.0303, 0, 0.66, 1.0, 21, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "nocron", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "nocron = None"}] | [] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
This file is based, although a rewrite, on MIT-licensed code from the Bottle web framework.
"""
import os
import sys
import optparse
import urllib
path = os.path.dirname(os.path.abspath(__file__))
os.chdir(path)
sys.path = [path] + [p for p in sys.path if not p == path]
class Servers:
@staticmethod
def cgi(app, address=None, **options):
from wsgiref.handlers import CGIHandler
CGIHandler().run(app) # Just ignore host and port here
@staticmethod
def flup(app, address, **options):
import flup.server.fcgi
flup.server.fcgi.WSGIServer(app, bindAddress=address).run()
@staticmethod
def wsgiref(app, address, **options): # pragma: no cover
from wsgiref.simple_server import make_server, WSGIRequestHandler
class QuietHandler(WSGIRequestHandler):
def log_request(*args, **kw):
pass
options['handler_class'] = QuietHandler
srv = make_server(address[0], address[1], app, **options)
srv.serve_forever()
@staticmethod
def cherrypy(app, address, **options):
from cherrypy import wsgiserver
server = wsgiserver.CherryPyWSGIServer(address, app)
server.start()
@staticmethod
def rocket(app, address, **options):
from gluon.rocket import CherryPyWSGIServer
server = CherryPyWSGIServer(address, app)
server.start()
@staticmethod
def rocket_with_repoze_profiler(app, address, **options):
from gluon.rocket import CherryPyWSGIServer
from repoze.profile.profiler import AccumulatingProfileMiddleware
from gluon.settings import global_settings
global_settings.web2py_crontype = 'none'
wrapped = AccumulatingProfileMiddleware(
app,
log_filename='wsgi.prof',
discard_first_request=True,
flush_at_shutdown=True,
path='/__profile__'
)
server = CherryPyWSGIServer(address, wrapped)
server.start()
@staticmethod
def paste(app, address, **options):
from paste import httpserver
from paste.translogger import TransLogger
httpserver.serve(app, host=address[0], port=address[1], **options)
@staticmethod
def fapws(app, address, **options):
import fapws._evwsgi as evwsgi
from fapws import base
evwsgi.start(address[0], str(address[1]))
evwsgi.set_base_module(base)
def app(environ, start_response):
environ['wsgi.multiprocess'] = False
return app(environ, start_response)
evwsgi.wsgi_cb(('', app))
evwsgi.run()
@staticmethod
def gevent(app, address, **options):
from gevent import pywsgi
from gevent.pool import Pool
pywsgi.WSGIServer(address, app, spawn='workers' in options and Pool(
int(options.workers)) or 'default').serve_forever()
@staticmethod
def bjoern(app, address, **options):
import bjoern
bjoern.run(app, *address)
@staticmethod
def tornado(app, address, **options):
import tornado.wsgi
import tornado.httpserver
import tornado.ioloop
container = tornado.wsgi.WSGIContainer(app)
server = tornado.httpserver.HTTPServer(container)
server.listen(address=address[0], port=address[1])
tornado.ioloop.IOLoop.instance().start()
@staticmethod
def twisted(app, address, **options):
from twisted.web import server, wsgi
from twisted.python.threadpool import ThreadPool
from twisted.internet import reactor
thread_pool = ThreadPool()
thread_pool.start()
reactor.addSystemEventTrigger('after', 'shutdown', thread_pool.stop)
factory = server.Site(wsgi.WSGIResource(reactor, thread_pool, app))
reactor.listenTCP(address[1], factory, interface=address[0])
reactor.run()
@staticmethod
def diesel(app, address, **options):
from diesel.protocols.wsgi import WSGIApplication
app = WSGIApplication(app, port=address[1])
app.run()
@staticmethod
def gunicorn(app, address, **options):
from gunicorn.app.base import Application
config = {'bind': "%s:%d" % address}
config.update(options)
sys.argv = ['anyserver.py']
class GunicornApplication(Application):
def init(self, parser, opts, args):
return config
def load(self):
return app
g = GunicornApplication()
g.run()
@staticmethod
def eventlet(app, address, **options):
from eventlet import wsgi, listen
wsgi.server(listen(address), app)
@staticmethod
def mongrel2(app, address, **options):
import uuid
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
from mongrel2 import handler
conn = handler.Connection(str(uuid.uuid4()),
"tcp://127.0.0.1:9997",
"tcp://127.0.0.1:9996")
mongrel2_handler(app, conn, debug=False)
@staticmethod
def motor(app, address, **options):
#https://github.com/rpedroso/motor
import motor
app = motor.WSGIContainer(app)
http_server = motor.HTTPServer(app)
http_server.listen(address=address[0], port=address[1])
#http_server.start(2)
motor.IOLoop.instance().start()
@staticmethod
def pulsar(app, address, **options):
from pulsar.apps import wsgi
sys.argv = ['anyserver.py']
s = wsgi.WSGIServer(callable=app, bind="%s:%d" % address)
s.start()
def run(servername, ip, port, softcron=True, logging=False, profiler=None):
if servername == 'gevent':
from gevent import monkey
monkey.patch_all()
import gluon.main
if logging:
application = gluon.main.appfactory(wsgiapp=gluon.main.wsgibase,
logfilename='httpserver.log',
profilerfilename=profiler)
else:
application = gluon.main.wsgibase
if softcron:
from gluon.settings import global_settings
global_settings.web2py_crontype = 'soft'
getattr(Servers, servername)(application, (ip, int(port)))
def mongrel2_handler(application, conn, debug=False):
"""
Based on :
https://github.com/berry/Mongrel2-WSGI-Handler/blob/master/wsgi-handler.py
WSGI handler based on the Python wsgiref SimpleHandler.
A WSGI application should return a iterable op StringTypes.
Any encoding must be handled by the WSGI application itself.
"""
from wsgiref.handlers import SimpleHandler
try:
import cStringIO as StringIO
except:
import StringIO
# TODO - this wsgi handler executes the application and renders a page
# in memory completely before returning it as a response to the client.
# Thus, it does not "stream" the result back to the client. It should be
# possible though. The SimpleHandler accepts file-like stream objects. So,
# it should be just a matter of connecting 0MQ requests/response streams to
# the SimpleHandler requests and response streams. However, the Python API
# for Mongrel2 doesn't seem to support file-like stream objects for requests
# and responses. Unless I have missed something.
while True:
if debug:
print "WAITING FOR REQUEST"
# receive a request
req = conn.recv()
if debug:
print "REQUEST BODY: %r\n" % req.body
if req.is_disconnect():
if debug:
print "DISCONNECT"
continue # effectively ignore the disconnect from the client
# Set a couple of environment attributes a.k.a. header attributes
# that are a must according to PEP 333
environ = req.headers
environ['SERVER_PROTOCOL'] = 'HTTP/1.1' # SimpleHandler expects a server_protocol, lets assume it is HTTP 1.1
environ['REQUEST_METHOD'] = environ['METHOD']
if ':' in environ['Host']:
environ['SERVER_NAME'] = environ['Host'].split(':')[0]
environ['SERVER_PORT'] = environ['Host'].split(':')[1]
else:
environ['SERVER_NAME'] = environ['Host']
environ['SERVER_PORT'] = ''
environ['SCRIPT_NAME'] = '' # empty for now
environ['PATH_INFO'] = urllib.unquote(environ['PATH'])
if '?' in environ['URI']:
environ['QUERY_STRING'] = environ['URI'].split('?')[1]
else:
environ['QUERY_STRING'] = ''
if 'Content-Length' in environ:
environ['CONTENT_LENGTH'] = environ[
'Content-Length'] # necessary for POST to work with Django
environ['wsgi.input'] = req.body
if debug:
print "ENVIRON: %r\n" % environ
# SimpleHandler needs file-like stream objects for
# requests, errors and responses
reqIO = StringIO.StringIO(req.body)
errIO = StringIO.StringIO()
respIO = StringIO.StringIO()
# execute the application
handler = SimpleHandler(reqIO, respIO, errIO, environ,
multithread=False, multiprocess=False)
handler.run(application)
# Get the response and filter out the response (=data) itself,
# the response headers,
# the response status code and the response status description
response = respIO.getvalue()
response = response.split("\r\n")
data = response[-1]
headers = dict([r.split(": ") for r in response[1:-2]])
code = response[0][9:12]
status = response[0][13:]
# strip BOM's from response data
# Especially the WSGI handler from Django seems to generate them (2 actually, huh?)
# a BOM isn't really necessary and cause HTML parsing errors in Chrome and Safari
# See also: http://www.xs4all.nl/~mechiel/projects/bomstrip/
# Although I still find this a ugly hack, it does work.
data = data.replace('\xef\xbb\xbf', '')
# Get the generated errors
errors = errIO.getvalue()
# return the response
if debug:
print "RESPONSE: %r\n" % response
if errors:
if debug:
print "ERRORS: %r" % errors
data = "%s\r\n\r\n%s" % (data, errors)
conn.reply_http(
req, data, code=code, status=status, headers=headers)
def main():
usage = "python anyserver.py -s tornado -i 127.0.0.1 -p 8000 -l -P"
try:
version = open('VERSION','r')
except IOError:
version = ''
parser = optparse.OptionParser(usage, None, optparse.Option, version)
parser.add_option('-l',
'--logging',
action='store_true',
default=False,
dest='logging',
help='log into httpserver.log')
parser.add_option('-P',
'--profiler',
default=False,
dest='profiler',
help='profiler filename')
servers = ', '.join(x for x in dir(Servers) if not x[0] == '_')
parser.add_option('-s',
'--server',
default='rocket',
dest='server',
help='server name (%s)' % servers)
parser.add_option('-i',
'--ip',
default='127.0.0.1',
dest='ip',
help='ip address')
parser.add_option('-p',
'--port',
default='8000',
dest='port',
help='port number')
parser.add_option('-w',
'--workers',
default='',
dest='workers',
help='number of workers number')
(options, args) = parser.parse_args()
print 'starting %s on %s:%s...' % (
options.server, options.ip, options.port)
run(options.server, options.ip, options.port,
logging=options.logging, profiler=options.profiler)
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_441 | 195 | 347 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0202, 0.0202, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis file is part of the web2py Web Framework\nCopyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>\nLicense: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)\n\nThis file is based, although a rewrite, on MIT-licensed code from the Bottle web framework.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L12_C0", "label": "os import os", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0346, 0.0029, 0, 0.66, 0.0833, 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_441:Import_L13_C0", "label": "sys import sys", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0375, 0.0029, 0, 0.66, 0.1667, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L14_C0", "label": "optparse import optparse", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0403, 0.0029, 0, 0.66, 0.25, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L15_C0", "label": "urllib import urllib", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0432, 0.0029, 0, 0.66, 0.3333, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "urllib", "arg_names": [], "import_names": ["urllib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urllib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L17_C0", "label": "path = dirname()", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.049, 0.0029, 0, 0.66, 0.4167, 358, 3, 1, 0, 0, 959, 10, 2], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "dirname", "annotation": ""}, "snippet": "path = os.path.dirname(os.path.abspath(__file__))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L18_C0", "label": "chdir()", "type": "expression", "loc": [18, 18], "level": 0, "parent": null, "vector": [8, 0, 0.0519, 0.0029, 0, 0.66, 0.5, 122, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "chdir", "arg_names": [], "import_names": [], "rhs_call_name": "chdir", "annotation": ""}, "snippet": "os.chdir(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L19_C0", "label": "sys.path =", "type": "assigned_variable", "loc": [19, 19], "level": 0, "parent": null, "vector": [14, 0, 0.0548, 0.0029, 0, 0.66, 0.5833, 909, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sys.path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "sys.path = [path] + [p for p in sys.path if not p == path]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "label": "Servers", "type": "class", "loc": [22, 177], "level": 0, "parent": null, "vector": [3, 0, 0.2867, 0.4496, 0, 0.66, 0.6667, 897, 0, 22, 0, 0, 0, 0, 58], "semantic": {"name": "Servers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Servers:\n @staticmethod\n def cgi(app, address=None, **options):\n from wsgiref.handlers import CGIHandler\n CGIHandler().run(app) # Just ignore host and port here\n\n @staticmethod\n def flup(app, address, **options):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L24_C4", "label": "cgi", "type": "function", "loc": [24, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "vector": [2, 1, 0.072, 0.0086, 1, 0.43, 0.0, 934, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "cgi", "arg_names": ["app", "address", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def cgi(app, address=None, **options):\n from wsgiref.handlers import CGIHandler\n CGIHandler().run(app) # Just ignore host and port here"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L25_C8", "label": "from wsgiref.handlers import CGIHandler", "type": "import", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L24_C4", "vector": [1, 2, 0.072, 0.0029, 2, 0.85, 0.0, 709, 0, 1, 0, 0, 709, 0, 0], "semantic": {"name": "wsgiref.handlers", "arg_names": [], "import_names": ["CGIHandler"], "rhs_call_name": "", "annotation": ""}, "snippet": " from wsgiref.handlers import CGIHandler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L26_C8", "label": "run()", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L24_C4", "vector": [8, 2, 0.0749, 0.0029, 2, 0.85, 1.0, 679, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " CGIHandler().run(app) # Just ignore host and port here"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L29_C4", "label": "flup", "type": "function", "loc": [29, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "vector": [2, 1, 0.0865, 0.0086, 1, 0.43, 0.0588, 776, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "flup", "arg_names": ["app", "address", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def flup(app, address, **options):\n import flup.server.fcgi\n flup.server.fcgi.WSGIServer(app, bindAddress=address).run()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L30_C8", "label": "flup.server.fcgi import flup.server.fcgi", "type": "import", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L29_C4", "vector": [1, 2, 0.0865, 0.0029, 2, 0.14, 0.0, 729, 0, 1, 0, 0, 729, 0, 0], "semantic": {"name": "flup.server.fcgi", "arg_names": [], "import_names": ["flup.server.fcgi"], "rhs_call_name": "", "annotation": ""}, "snippet": " import flup.server.fcgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L31_C8", "label": "run()", "type": "expression", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L29_C4", "vector": [8, 2, 0.0893, 0.0029, 2, 0.14, 1.0, 679, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " flup.server.fcgi.WSGIServer(app, bindAddress=address).run()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L34_C4", "label": "wsgiref", "type": "function", "loc": [34, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "vector": [2, 1, 0.1095, 0.0259, 1, 0.43, 0.1176, 289, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "wsgiref", "arg_names": ["app", "address", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wsgiref(app, address, **options): # pragma: no cover\n from wsgiref.simple_server import make_server, WSGIRequestHandler\n\n class QuietHandler(WSGIRequestHandler):\n def log_request(*args, **kw):\n pass\n options['handler_class'] = QuietHandler\n srv = make_server(address[0], address[1], app, **options)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L35_C8", "label": "from wsgiref.simple_server import make_server, WSGIRequestHandler", "type": "import", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L34_C4", "vector": [1, 2, 0.1009, 0.0029, 2, 0.28, 0.0, 324, 0, 2, 0, 0, 324, 0, 0], "semantic": {"name": "wsgiref.simple_server", "arg_names": [], "import_names": ["make_server", "WSGIRequestHandler"], "rhs_call_name": "", "annotation": ""}, "snippet": " from wsgiref.simple_server import make_server, WSGIRequestHandler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L37_C8", "label": "QuietHandler", "type": "class", "loc": [37, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L34_C4", "vector": [3, 2, 0.1095, 0.0086, 2, 0.28, 0.25, 884, 0, 1, 0, 0, 787, 0, 0], "semantic": {"name": "QuietHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class QuietHandler(WSGIRequestHandler):\n def log_request(*args, **kw):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L38_C12", "label": "log_request", "type": "function", "loc": [38, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L37_C8", "vector": [2, 3, 0.111, 0.0058, 3, 0.48, 0.0, 847, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "log_request", "arg_names": ["args", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def log_request(*args, **kw):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L40_C8", "label": "assign", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L34_C4", "vector": [14, 2, 0.1153, 0.0029, 2, 0.28, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " options['handler_class'] = QuietHandler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L41_C8", "label": "srv = make_server()", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L34_C4", "vector": [14, 2, 0.1182, 0.0029, 2, 0.28, 0.75, 445, 3, 4, 0, 0, 763, 10, 1], "semantic": {"name": "srv", "arg_names": [], "import_names": [], "rhs_call_name": "make_server", "annotation": ""}, "snippet": " srv = make_server(address[0], address[1], app, **options)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L42_C8", "label": "serve_forever()", "type": "expression", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L34_C4", "vector": [8, 2, 0.121, 0.0029, 2, 0.28, 1.0, 993, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "serve_forever", "arg_names": [], "import_names": [], "rhs_call_name": "serve_forever", "annotation": ""}, "snippet": " srv.serve_forever()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L45_C4", "label": "cherrypy", "type": "function", "loc": [45, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "vector": [2, 1, 0.134, 0.0115, 1, 0.43, 0.1765, 639, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "cherrypy", "arg_names": ["app", "address", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def cherrypy(app, address, **options):\n from cherrypy import wsgiserver\n server = wsgiserver.CherryPyWSGIServer(address, app)\n server.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L46_C8", "label": "from cherrypy import wsgiserver", "type": "import", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L45_C4", "vector": [1, 2, 0.1326, 0.0029, 2, 0.17, 0.0, 639, 0, 1, 0, 0, 639, 0, 0], "semantic": {"name": "cherrypy", "arg_names": [], "import_names": ["wsgiserver"], "rhs_call_name": "", "annotation": ""}, "snippet": " from cherrypy import wsgiserver"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L47_C8", "label": "server = CherryPyWSGIServer()", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L45_C4", "vector": [14, 2, 0.1354, 0.0029, 2, 0.17, 0.5, 268, 3, 2, 0, 0, 886, 10, 1], "semantic": {"name": "server", "arg_names": [], "import_names": [], "rhs_call_name": "CherryPyWSGIServer", "annotation": ""}, "snippet": " server = wsgiserver.CherryPyWSGIServer(address, app)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L48_C8", "label": "start()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L45_C4", "vector": [8, 2, 0.1383, 0.0029, 2, 0.17, 1.0, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " server.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L51_C4", "label": "rocket", "type": "function", "loc": [51, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "vector": [2, 1, 0.1513, 0.0115, 1, 0.43, 0.2353, 25, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "rocket", "arg_names": ["app", "address", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def rocket(app, address, **options):\n from gluon.rocket import CherryPyWSGIServer\n server = CherryPyWSGIServer(address, app)\n server.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L52_C8", "label": "from gluon.rocket import CherryPyWSGIServer", "type": "import", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L51_C4", "vector": [1, 2, 0.1499, 0.0029, 2, 0.18, 0.0, 692, 0, 1, 0, 0, 692, 0, 0], "semantic": {"name": "gluon.rocket", "arg_names": [], "import_names": ["CherryPyWSGIServer"], "rhs_call_name": "", "annotation": ""}, "snippet": " from gluon.rocket import CherryPyWSGIServer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L53_C8", "label": "server = CherryPyWSGIServer()", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L51_C4", "vector": [14, 2, 0.1527, 0.0029, 2, 0.18, 0.5, 268, 3, 2, 0, 0, 886, 10, 1], "semantic": {"name": "server", "arg_names": [], "import_names": [], "rhs_call_name": "CherryPyWSGIServer", "annotation": ""}, "snippet": " server = CherryPyWSGIServer(address, app)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L54_C8", "label": "start()", "type": "expression", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L51_C4", "vector": [8, 2, 0.1556, 0.0029, 2, 0.18, 1.0, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " server.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L57_C4", "label": "rocket_with_repoze_profiler", "type": "function", "loc": [57, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "vector": [2, 1, 0.183, 0.0403, 1, 0.43, 0.2941, 274, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "rocket_with_repoze_profiler", "arg_names": ["app", "address", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def rocket_with_repoze_profiler(app, address, **options):\n from gluon.rocket import CherryPyWSGIServer\n from repoze.profile.profiler import AccumulatingProfileMiddleware\n from gluon.settings import global_settings\n global_settings.web2py_crontype = 'none'\n wrapped = AccumulatingProfileMiddleware(\n app,\n log_filename='wsgi.prof',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L58_C8", "label": "from gluon.rocket import CherryPyWSGIServer", "type": "import", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L57_C4", "vector": [1, 2, 0.1671, 0.0029, 2, 0.45, 0.0, 692, 0, 1, 0, 0, 692, 0, 0], "semantic": {"name": "gluon.rocket", "arg_names": [], "import_names": ["CherryPyWSGIServer"], "rhs_call_name": "", "annotation": ""}, "snippet": " from gluon.rocket import CherryPyWSGIServer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L59_C8", "label": "from repoze.profile.profiler import AccumulatingProfileMiddleware", "type": "import", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L57_C4", "vector": [1, 2, 0.17, 0.0029, 2, 0.45, 0.1667, 880, 0, 1, 0, 0, 880, 0, 0], "semantic": {"name": "repoze.profile.profiler", "arg_names": [], "import_names": ["AccumulatingProfileMiddleware"], "rhs_call_name": "", "annotation": ""}, "snippet": " from repoze.profile.profiler import AccumulatingProfileMiddleware"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L60_C8", "label": "from gluon.settings import global_settings", "type": "import", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L57_C4", "vector": [1, 2, 0.1729, 0.0029, 2, 0.45, 0.3333, 883, 0, 1, 0, 0, 883, 0, 0], "semantic": {"name": "gluon.settings", "arg_names": [], "import_names": ["global_settings"], "rhs_call_name": "", "annotation": ""}, "snippet": " from gluon.settings import global_settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L61_C8", "label": "global_settings.web2py_crontype =", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L57_C4", "vector": [14, 2, 0.1758, 0.0029, 2, 0.45, 0.5, 128, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "global_settings.web2py_crontype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " global_settings.web2py_crontype = 'none'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L62_C8", "label": "wrapped = AccumulatingProfileMiddleware()", "type": "assigned_variable", "loc": [62, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L57_C4", "vector": [14, 2, 0.1873, 0.0202, 2, 0.45, 0.6667, 745, 3, 5, 0, 0, 741, 10, 1], "semantic": {"name": "wrapped", "arg_names": [], "import_names": [], "rhs_call_name": "AccumulatingProfileMiddleware", "annotation": ""}, "snippet": " wrapped = AccumulatingProfileMiddleware(\n app,\n log_filename='wsgi.prof',\n discard_first_request=True,\n flush_at_shutdown=True,\n path='/__profile__'\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L69_C8", "label": "server = CherryPyWSGIServer()", "type": "assigned_variable", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L57_C4", "vector": [14, 2, 0.1988, 0.0029, 2, 0.45, 0.8333, 268, 3, 2, 0, 0, 886, 10, 1], "semantic": {"name": "server", "arg_names": [], "import_names": [], "rhs_call_name": "CherryPyWSGIServer", "annotation": ""}, "snippet": " server = CherryPyWSGIServer(address, wrapped)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L70_C8", "label": "start()", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L57_C4", "vector": [8, 2, 0.2017, 0.0029, 2, 0.45, 1.0, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " server.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L73_C4", "label": "paste", "type": "function", "loc": [73, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "vector": [2, 1, 0.2147, 0.0115, 1, 0.43, 0.3529, 525, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "paste", "arg_names": ["app", "address", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def paste(app, address, **options):\n from paste import httpserver\n from paste.translogger import TransLogger\n httpserver.serve(app, host=address[0], port=address[1], **options)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L74_C8", "label": "from paste import httpserver", "type": "import", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L73_C4", "vector": [1, 2, 0.2133, 0.0029, 2, 0.21, 0.0, 525, 0, 1, 0, 0, 525, 0, 0], "semantic": {"name": "paste", "arg_names": [], "import_names": ["httpserver"], "rhs_call_name": "", "annotation": ""}, "snippet": " from paste import httpserver"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L75_C8", "label": "from paste.translogger import TransLogger", "type": "import", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L73_C4", "vector": [1, 2, 0.2161, 0.0029, 2, 0.21, 0.5, 160, 0, 1, 0, 0, 160, 0, 0], "semantic": {"name": "paste.translogger", "arg_names": [], "import_names": ["TransLogger"], "rhs_call_name": "", "annotation": ""}, "snippet": " from paste.translogger import TransLogger"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L76_C8", "label": "serve()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L73_C4", "vector": [8, 2, 0.219, 0.0029, 2, 0.21, 1.0, 606, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "serve", "arg_names": [], "import_names": [], "rhs_call_name": "serve", "annotation": ""}, "snippet": " httpserver.serve(app, host=address[0], port=address[1], **options)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L79_C4", "label": "fapws", "type": "function", "loc": [79, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "vector": [2, 1, 0.2421, 0.0317, 1, 0.43, 0.4118, 466, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "fapws", "arg_names": ["app", "address", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fapws(app, address, **options):\n import fapws._evwsgi as evwsgi\n from fapws import base\n evwsgi.start(address[0], str(address[1]))\n evwsgi.set_base_module(base)\n\n def app(environ, start_response):\n environ['wsgi.multiprocess'] = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L80_C8", "label": "fapws._evwsgi import evwsgi", "type": "import", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L79_C4", "vector": [1, 2, 0.2305, 0.0029, 2, 0.16, 0.0, 849, 0, 1, 0, 0, 849, 0, 0], "semantic": {"name": "fapws._evwsgi", "arg_names": [], "import_names": ["evwsgi"], "rhs_call_name": "", "annotation": ""}, "snippet": " import fapws._evwsgi as evwsgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L81_C8", "label": "from fapws import base", "type": "import", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L79_C4", "vector": [1, 2, 0.2334, 0.0029, 2, 0.16, 0.1667, 466, 0, 1, 0, 0, 466, 0, 0], "semantic": {"name": "fapws", "arg_names": [], "import_names": ["base"], "rhs_call_name": "", "annotation": ""}, "snippet": " from fapws import base"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L82_C8", "label": "start()", "type": "expression", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L79_C4", "vector": [8, 2, 0.2363, 0.0029, 2, 0.16, 0.3333, 511, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " evwsgi.start(address[0], str(address[1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L83_C8", "label": "set_base_module()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L79_C4", "vector": [8, 2, 0.2392, 0.0029, 2, 0.16, 0.5, 214, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_base_module", "arg_names": [], "import_names": [], "rhs_call_name": "set_base_module", "annotation": ""}, "snippet": " evwsgi.set_base_module(base)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L85_C8", "label": "app", "type": "function", "loc": [85, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L79_C4", "vector": [2, 2, 0.2478, 0.0086, 2, 0.16, 0.6667, 494, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "app", "arg_names": ["environ", "start_response"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def app(environ, start_response):\n environ['wsgi.multiprocess'] = False\n return app(environ, start_response)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L86_C12", "label": "assign", "type": "assigned_variable", "loc": [86, 86], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L85_C8", "vector": [14, 3, 0.2478, 0.0029, 3, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['wsgi.multiprocess'] = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Return_L87_C12", "label": "return", "type": "return", "loc": [87, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L85_C8", "vector": [13, 3, 0.2507, 0.0029, 3, 0.65, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return app(environ, start_response)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L88_C8", "label": "wsgi_cb()", "type": "expression", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L79_C4", "vector": [8, 2, 0.2536, 0.0029, 2, 0.16, 0.8333, 883, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "wsgi_cb", "arg_names": [], "import_names": [], "rhs_call_name": "wsgi_cb", "annotation": ""}, "snippet": " evwsgi.wsgi_cb(('', app))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L89_C8", "label": "run()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L79_C4", "vector": [8, 2, 0.2565, 0.0029, 2, 0.16, 1.0, 679, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " evwsgi.run()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L92_C4", "label": "gevent", "type": "function", "loc": [92, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "vector": [2, 1, 0.2709, 0.0144, 1, 0.43, 0.4706, 703, 0, 3, 0, 0, 0, 0, 4], "semantic": {"name": "gevent", "arg_names": ["app", "address", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def gevent(app, address, **options):\n from gevent import pywsgi\n from gevent.pool import Pool\n pywsgi.WSGIServer(address, app, spawn='workers' in options and Pool(\n int(options.workers)) or 'default').serve_forever()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L93_C8", "label": "from gevent import pywsgi", "type": "import", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L92_C4", "vector": [1, 2, 0.268, 0.0029, 2, 0.51, 0.0, 703, 0, 1, 0, 0, 703, 0, 0], "semantic": {"name": "gevent", "arg_names": [], "import_names": ["pywsgi"], "rhs_call_name": "", "annotation": ""}, "snippet": " from gevent import pywsgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L94_C8", "label": "from gevent.pool import Pool", "type": "import", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L92_C4", "vector": [1, 2, 0.2709, 0.0029, 2, 0.51, 0.5, 442, 0, 1, 0, 0, 442, 0, 0], "semantic": {"name": "gevent.pool", "arg_names": [], "import_names": ["Pool"], "rhs_call_name": "", "annotation": ""}, "snippet": " from gevent.pool import Pool"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L95_C8", "label": "serve_forever()", "type": "expression", "loc": [95, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L92_C4", "vector": [8, 2, 0.2752, 0.0058, 2, 0.51, 1.0, 993, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "serve_forever", "arg_names": [], "import_names": [], "rhs_call_name": "serve_forever", "annotation": ""}, "snippet": " pywsgi.WSGIServer(address, app, spawn='workers' in options and Pool(\n int(options.workers)) or 'default').serve_forever()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L99_C4", "label": "bjoern", "type": "function", "loc": [99, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "vector": [2, 1, 0.2882, 0.0086, 1, 0.43, 0.5294, 810, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "bjoern", "arg_names": ["app", "address", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def bjoern(app, address, **options):\n import bjoern\n bjoern.run(app, *address)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L100_C8", "label": "bjoern import bjoern", "type": "import", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L99_C4", "vector": [1, 2, 0.2882, 0.0029, 2, 0.29, 0.0, 810, 0, 1, 0, 0, 810, 0, 0], "semantic": {"name": "bjoern", "arg_names": [], "import_names": ["bjoern"], "rhs_call_name": "", "annotation": ""}, "snippet": " import bjoern"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L101_C8", "label": "run()", "type": "expression", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L99_C4", "vector": [8, 2, 0.2911, 0.0029, 2, 0.29, 1.0, 679, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " bjoern.run(app, *address)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L104_C4", "label": "tornado", "type": "function", "loc": [104, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "vector": [2, 1, 0.3098, 0.0231, 1, 0.43, 0.5882, 488, 0, 3, 0, 0, 0, 0, 5], "semantic": {"name": "tornado", "arg_names": ["app", "address", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def tornado(app, address, **options):\n import tornado.wsgi\n import tornado.httpserver\n import tornado.ioloop\n container = tornado.wsgi.WSGIContainer(app)\n server = tornado.httpserver.HTTPServer(container)\n server.listen(address=address[0], port=address[1])\n tornado.ioloop.IOLoop.instance().start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L105_C8", "label": "tornado.wsgi import tornado.wsgi", "type": "import", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L104_C4", "vector": [1, 2, 0.3026, 0.0029, 2, 0.62, 0.0, 324, 0, 1, 0, 0, 324, 0, 0], "semantic": {"name": "tornado.wsgi", "arg_names": [], "import_names": ["tornado.wsgi"], "rhs_call_name": "", "annotation": ""}, "snippet": " import tornado.wsgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L106_C8", "label": "tornado.httpserver import tornado.httpserver", "type": "import", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L104_C4", "vector": [1, 2, 0.3055, 0.0029, 2, 0.62, 0.1667, 17, 0, 1, 0, 0, 17, 0, 0], "semantic": {"name": "tornado.httpserver", "arg_names": [], "import_names": ["tornado.httpserver"], "rhs_call_name": "", "annotation": ""}, "snippet": " import tornado.httpserver"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L107_C8", "label": "tornado.ioloop import tornado.ioloop", "type": "import", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L104_C4", "vector": [1, 2, 0.3084, 0.0029, 2, 0.62, 0.3333, 730, 0, 1, 0, 0, 730, 0, 0], "semantic": {"name": "tornado.ioloop", "arg_names": [], "import_names": ["tornado.ioloop"], "rhs_call_name": "", "annotation": ""}, "snippet": " import tornado.ioloop"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L108_C8", "label": "container = WSGIContainer()", "type": "assigned_variable", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L104_C4", "vector": [14, 2, 0.3112, 0.0029, 2, 0.62, 0.5, 516, 3, 1, 0, 0, 917, 10, 1], "semantic": {"name": "container", "arg_names": [], "import_names": [], "rhs_call_name": "WSGIContainer", "annotation": ""}, "snippet": " container = tornado.wsgi.WSGIContainer(app)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L109_C8", "label": "server = HTTPServer()", "type": "assigned_variable", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L104_C4", "vector": [14, 2, 0.3141, 0.0029, 2, 0.62, 0.6667, 268, 3, 1, 0, 0, 258, 10, 1], "semantic": {"name": "server", "arg_names": [], "import_names": [], "rhs_call_name": "HTTPServer", "annotation": ""}, "snippet": " server = tornado.httpserver.HTTPServer(container)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L110_C8", "label": "listen()", "type": "expression", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L104_C4", "vector": [8, 2, 0.317, 0.0029, 2, 0.62, 0.8333, 265, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "listen", "arg_names": [], "import_names": [], "rhs_call_name": "listen", "annotation": ""}, "snippet": " server.listen(address=address[0], port=address[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L111_C8", "label": "start()", "type": "expression", "loc": [111, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L104_C4", "vector": [8, 2, 0.3199, 0.0029, 2, 0.62, 1.0, 511, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " tornado.ioloop.IOLoop.instance().start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L114_C4", "label": "twisted", "type": "function", "loc": [114, 123], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "vector": [2, 1, 0.3415, 0.0288, 1, 0.43, 0.6471, 208, 0, 3, 0, 0, 0, 0, 7], "semantic": {"name": "twisted", "arg_names": ["app", "address", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def twisted(app, address, **options):\n from twisted.web import server, wsgi\n from twisted.python.threadpool import ThreadPool\n from twisted.internet import reactor\n thread_pool = ThreadPool()\n thread_pool.start()\n reactor.addSystemEventTrigger('after', 'shutdown', thread_pool.stop)\n factory = server.Site(wsgi.WSGIResource(reactor, thread_pool, app))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L115_C8", "label": "from twisted.web import server, wsgi", "type": "import", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L114_C4", "vector": [1, 2, 0.3314, 0.0029, 2, 0.96, 0.0, 762, 0, 2, 0, 0, 762, 0, 0], "semantic": {"name": "twisted.web", "arg_names": [], "import_names": ["server", "wsgi"], "rhs_call_name": "", "annotation": ""}, "snippet": " from twisted.web import server, wsgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L116_C8", "label": "from twisted.python.threadpool import ThreadPool", "type": "import", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L114_C4", "vector": [1, 2, 0.3343, 0.0029, 2, 0.96, 0.125, 851, 0, 1, 0, 0, 851, 0, 0], "semantic": {"name": "twisted.python.threadpool", "arg_names": [], "import_names": ["ThreadPool"], "rhs_call_name": "", "annotation": ""}, "snippet": " from twisted.python.threadpool import ThreadPool"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L117_C8", "label": "from twisted.internet import reactor", "type": "import", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L114_C4", "vector": [1, 2, 0.3372, 0.0029, 2, 0.96, 0.25, 937, 0, 1, 0, 0, 937, 0, 0], "semantic": {"name": "twisted.internet", "arg_names": [], "import_names": ["reactor"], "rhs_call_name": "", "annotation": ""}, "snippet": " from twisted.internet import reactor"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L118_C8", "label": "thread_pool = ThreadPool()", "type": "assigned_variable", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L114_C4", "vector": [14, 2, 0.3401, 0.0029, 2, 0.96, 0.375, 505, 3, 0, 0, 0, 395, 10, 1], "semantic": {"name": "thread_pool", "arg_names": [], "import_names": [], "rhs_call_name": "ThreadPool", "annotation": ""}, "snippet": " thread_pool = ThreadPool()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L119_C8", "label": "start()", "type": "expression", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L114_C4", "vector": [8, 2, 0.3429, 0.0029, 2, 0.96, 0.5, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " thread_pool.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L120_C8", "label": "addSystemEventTrigger()", "type": "expression", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L114_C4", "vector": [8, 2, 0.3458, 0.0029, 2, 0.96, 0.625, 260, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "addSystemEventTrigger", "arg_names": [], "import_names": [], "rhs_call_name": "addSystemEventTrigger", "annotation": ""}, "snippet": " reactor.addSystemEventTrigger('after', 'shutdown', thread_pool.stop)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L121_C8", "label": "factory = Site()", "type": "assigned_variable", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L114_C4", "vector": [14, 2, 0.3487, 0.0029, 2, 0.96, 0.75, 235, 3, 1, 0, 0, 695, 10, 2], "semantic": {"name": "factory", "arg_names": [], "import_names": [], "rhs_call_name": "Site", "annotation": ""}, "snippet": " factory = server.Site(wsgi.WSGIResource(reactor, thread_pool, app))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L122_C8", "label": "listenTCP()", "type": "expression", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L114_C4", "vector": [8, 2, 0.3516, 0.0029, 2, 0.96, 0.875, 580, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "listenTCP", "arg_names": [], "import_names": [], "rhs_call_name": "listenTCP", "annotation": ""}, "snippet": " reactor.listenTCP(address[1], factory, interface=address[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L123_C8", "label": "run()", "type": "expression", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L114_C4", "vector": [8, 2, 0.3545, 0.0029, 2, 0.96, 1.0, 679, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " reactor.run()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L126_C4", "label": "diesel", "type": "function", "loc": [126, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "vector": [2, 1, 0.3674, 0.0115, 1, 0.43, 0.7059, 263, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "diesel", "arg_names": ["app", "address", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def diesel(app, address, **options):\n from diesel.protocols.wsgi import WSGIApplication\n app = WSGIApplication(app, port=address[1])\n app.run()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L127_C8", "label": "from diesel.protocols.wsgi import WSGIApplication", "type": "import", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L126_C4", "vector": [1, 2, 0.366, 0.0029, 2, 0.31, 0.0, 494, 0, 1, 0, 0, 494, 0, 0], "semantic": {"name": "diesel.protocols.wsgi", "arg_names": [], "import_names": ["WSGIApplication"], "rhs_call_name": "", "annotation": ""}, "snippet": " from diesel.protocols.wsgi import WSGIApplication"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L128_C8", "label": "app = WSGIApplication()", "type": "assigned_variable", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L126_C4", "vector": [14, 2, 0.3689, 0.0029, 2, 0.31, 0.5, 494, 3, 2, 0, 0, 623, 10, 1], "semantic": {"name": "app", "arg_names": [], "import_names": [], "rhs_call_name": "WSGIApplication", "annotation": ""}, "snippet": " app = WSGIApplication(app, port=address[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L129_C8", "label": "run()", "type": "expression", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L126_C4", "vector": [8, 2, 0.3718, 0.0029, 2, 0.31, 1.0, 679, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " app.run()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L132_C4", "label": "gunicorn", "type": "function", "loc": [132, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "vector": [2, 1, 0.3991, 0.0403, 1, 0.43, 0.7647, 646, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "gunicorn", "arg_names": ["app", "address", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def gunicorn(app, address, **options):\n from gunicorn.app.base import Application\n config = {'bind': \"%s:%d\" % address}\n config.update(options)\n sys.argv = ['anyserver.py']\n\n class GunicornApplication(Application):\n def init(self, parser, opts, args):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L133_C8", "label": "from gunicorn.app.base import Application", "type": "import", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L132_C4", "vector": [1, 2, 0.3833, 0.0029, 2, 0.07, 0.0, 816, 0, 1, 0, 0, 816, 0, 0], "semantic": {"name": "gunicorn.app.base", "arg_names": [], "import_names": ["Application"], "rhs_call_name": "", "annotation": ""}, "snippet": " from gunicorn.app.base import Application"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L134_C8", "label": "config =", "type": "assigned_variable", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L132_C4", "vector": [14, 2, 0.3862, 0.0029, 2, 0.07, 0.1667, 308, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "config", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " config = {'bind': \"%s:%d\" % address}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L135_C8", "label": "update()", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L132_C4", "vector": [8, 2, 0.389, 0.0029, 2, 0.07, 0.3333, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " config.update(options)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L136_C8", "label": "sys.argv =", "type": "assigned_variable", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L132_C4", "vector": [14, 2, 0.3919, 0.0029, 2, 0.07, 0.5, 668, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "sys.argv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sys.argv = ['anyserver.py']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L138_C8", "label": "GunicornApplication", "type": "class", "loc": [138, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L132_C4", "vector": [3, 2, 0.4049, 0.0173, 2, 0.07, 0.6667, 306, 0, 2, 0, 0, 979, 0, 0], "semantic": {"name": "GunicornApplication", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class GunicornApplication(Application):\n def init(self, parser, opts, args):\n return config\n\n def load(self):\n return app"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L139_C12", "label": "init", "type": "function", "loc": [139, 140], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L138_C8", "vector": [2, 3, 0.402, 0.0058, 3, 0.18, 0.0, 319, 0, 4, 1, 0, 0, 0, 0], "semantic": {"name": "init", "arg_names": ["self", "parser", "opts", "args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def init(self, parser, opts, args):\n return config"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Return_L140_C16", "label": "return", "type": "return", "loc": [140, 140], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L139_C12", "vector": [13, 4, 0.4035, 0.0029, 4, 0.02, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return config"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L142_C12", "label": "load", "type": "function", "loc": [142, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L138_C8", "vector": [2, 3, 0.4107, 0.0058, 3, 0.18, 1.0, 37, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "load", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def load(self):\n return app"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Return_L143_C16", "label": "return", "type": "return", "loc": [143, 143], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L142_C12", "vector": [13, 4, 0.4121, 0.0029, 4, 0.14, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return app"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L144_C8", "label": "g = GunicornApplication()", "type": "assigned_variable", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L132_C4", "vector": [14, 2, 0.415, 0.0029, 2, 0.07, 0.8333, 384, 3, 0, 0, 0, 306, 10, 1], "semantic": {"name": "g", "arg_names": [], "import_names": [], "rhs_call_name": "GunicornApplication", "annotation": ""}, "snippet": " g = GunicornApplication()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L145_C8", "label": "run()", "type": "expression", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L132_C4", "vector": [8, 2, 0.4179, 0.0029, 2, 0.07, 1.0, 679, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " g.run()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L148_C4", "label": "eventlet", "type": "function", "loc": [148, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "vector": [2, 1, 0.4294, 0.0086, 1, 0.43, 0.8235, 825, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "eventlet", "arg_names": ["app", "address", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def eventlet(app, address, **options):\n from eventlet import wsgi, listen\n wsgi.server(listen(address), app)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L149_C8", "label": "from eventlet import wsgi, listen", "type": "import", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L148_C4", "vector": [1, 2, 0.4294, 0.0029, 2, 0.78, 0.0, 825, 0, 2, 0, 0, 825, 0, 0], "semantic": {"name": "eventlet", "arg_names": [], "import_names": ["wsgi", "listen"], "rhs_call_name": "", "annotation": ""}, "snippet": " from eventlet import wsgi, listen"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L150_C8", "label": "server()", "type": "expression", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L148_C4", "vector": [8, 2, 0.4323, 0.0029, 2, 0.78, 1.0, 268, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "server", "arg_names": [], "import_names": [], "rhs_call_name": "server", "annotation": ""}, "snippet": " wsgi.server(listen(address), app)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L153_C4", "label": "mongrel2", "type": "function", "loc": [153, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "vector": [2, 1, 0.451, 0.0231, 1, 0.43, 0.8824, 657, 0, 3, 0, 0, 0, 0, 7], "semantic": {"name": "mongrel2", "arg_names": ["app", "address", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def mongrel2(app, address, **options):\n import uuid\n sys.path.append(os.path.abspath(os.path.dirname(__file__)))\n from mongrel2 import handler\n conn = handler.Connection(str(uuid.uuid4()),\n \"tcp://127.0.0.1:9997\",\n \"tcp://127.0.0.1:9996\")\n mongrel2_handler(app, conn, debug=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L154_C8", "label": "uuid import uuid", "type": "import", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L153_C4", "vector": [1, 2, 0.4438, 0.0029, 2, 0.47, 0.0, 9, 0, 1, 0, 0, 9, 0, 0], "semantic": {"name": "uuid", "arg_names": [], "import_names": ["uuid"], "rhs_call_name": "", "annotation": ""}, "snippet": " import uuid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L155_C8", "label": "append()", "type": "expression", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L153_C4", "vector": [8, 2, 0.4467, 0.0029, 2, 0.47, 0.25, 243, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " sys.path.append(os.path.abspath(os.path.dirname(__file__)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L156_C8", "label": "from mongrel2 import handler", "type": "import", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L153_C4", "vector": [1, 2, 0.4496, 0.0029, 2, 0.47, 0.5, 657, 0, 1, 0, 0, 657, 0, 0], "semantic": {"name": "mongrel2", "arg_names": [], "import_names": ["handler"], "rhs_call_name": "", "annotation": ""}, "snippet": " from mongrel2 import handler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L157_C8", "label": "conn = Connection()", "type": "assigned_variable", "loc": [157, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L153_C4", "vector": [14, 2, 0.4553, 0.0086, 2, 0.47, 0.75, 345, 3, 3, 0, 0, 823, 10, 3], "semantic": {"name": "conn", "arg_names": [], "import_names": [], "rhs_call_name": "Connection", "annotation": ""}, "snippet": " conn = handler.Connection(str(uuid.uuid4()),\n \"tcp://127.0.0.1:9997\",\n \"tcp://127.0.0.1:9996\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L160_C8", "label": "mongrel2_handler()", "type": "expression", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L153_C4", "vector": [8, 2, 0.4611, 0.0029, 2, 0.47, 1.0, 364, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "mongrel2_handler", "arg_names": [], "import_names": [], "rhs_call_name": "mongrel2_handler", "annotation": ""}, "snippet": " mongrel2_handler(app, conn, debug=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L163_C4", "label": "motor", "type": "function", "loc": [163, 170], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "vector": [2, 1, 0.4798, 0.0231, 1, 0.43, 0.9412, 686, 0, 3, 0, 0, 0, 0, 5], "semantic": {"name": "motor", "arg_names": ["app", "address", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def motor(app, address, **options):\n #https://github.com/rpedroso/motor\n import motor\n app = motor.WSGIContainer(app)\n http_server = motor.HTTPServer(app)\n http_server.listen(address=address[0], port=address[1])\n #http_server.start(2)\n motor.IOLoop.instance().start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L165_C8", "label": "motor import motor", "type": "import", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L163_C4", "vector": [1, 2, 0.4755, 0.0029, 2, 0.14, 0.0, 686, 0, 1, 0, 0, 686, 0, 0], "semantic": {"name": "motor", "arg_names": [], "import_names": ["motor"], "rhs_call_name": "", "annotation": ""}, "snippet": " import motor"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L166_C8", "label": "app = WSGIContainer()", "type": "assigned_variable", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L163_C4", "vector": [14, 2, 0.4784, 0.0029, 2, 0.14, 0.25, 494, 3, 1, 0, 0, 917, 10, 1], "semantic": {"name": "app", "arg_names": [], "import_names": [], "rhs_call_name": "WSGIContainer", "annotation": ""}, "snippet": " app = motor.WSGIContainer(app)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L167_C8", "label": "http_server = HTTPServer()", "type": "assigned_variable", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L163_C4", "vector": [14, 2, 0.4813, 0.0029, 2, 0.14, 0.5, 337, 3, 1, 0, 0, 258, 10, 1], "semantic": {"name": "http_server", "arg_names": [], "import_names": [], "rhs_call_name": "HTTPServer", "annotation": ""}, "snippet": " http_server = motor.HTTPServer(app)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L168_C8", "label": "listen()", "type": "expression", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L163_C4", "vector": [8, 2, 0.4841, 0.0029, 2, 0.14, 0.75, 265, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "listen", "arg_names": [], "import_names": [], "rhs_call_name": "listen", "annotation": ""}, "snippet": " http_server.listen(address=address[0], port=address[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L170_C8", "label": "start()", "type": "expression", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L163_C4", "vector": [8, 2, 0.4899, 0.0029, 2, 0.14, 1.0, 511, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " motor.IOLoop.instance().start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L173_C4", "label": "pulsar", "type": "function", "loc": [173, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "vector": [2, 1, 0.5043, 0.0144, 1, 0.43, 1.0, 178, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "pulsar", "arg_names": ["app", "address", "options"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pulsar(app, address, **options):\n from pulsar.apps import wsgi\n sys.argv = ['anyserver.py']\n s = wsgi.WSGIServer(callable=app, bind=\"%s:%d\" % address)\n s.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L174_C8", "label": "from pulsar.apps import wsgi", "type": "import", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L173_C4", "vector": [1, 2, 0.5014, 0.0029, 2, 0.73, 0.0, 249, 0, 1, 0, 0, 249, 0, 0], "semantic": {"name": "pulsar.apps", "arg_names": [], "import_names": ["wsgi"], "rhs_call_name": "", "annotation": ""}, "snippet": " from pulsar.apps import wsgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L175_C8", "label": "sys.argv =", "type": "assigned_variable", "loc": [175, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L173_C4", "vector": [14, 2, 0.5043, 0.0029, 2, 0.73, 0.3333, 668, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "sys.argv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sys.argv = ['anyserver.py']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L176_C8", "label": "s = WSGIServer()", "type": "assigned_variable", "loc": [176, 176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L173_C4", "vector": [14, 2, 0.5072, 0.0029, 2, 0.73, 0.6667, 553, 3, 2, 0, 0, 524, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "WSGIServer", "annotation": ""}, "snippet": " s = wsgi.WSGIServer(callable=app, bind=\"%s:%d\" % address)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L177_C8", "label": "start()", "type": "expression", "loc": [177, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L173_C4", "vector": [8, 2, 0.5101, 0.0029, 2, 0.73, 1.0, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " s.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L179_C0", "label": "run", "type": "function", "loc": [179, 195], "level": 0, "parent": null, "vector": [2, 0, 0.5389, 0.049, 0, 0.66, 0.75, 679, 0, 6, 0, 0, 0, 0, 5], "semantic": {"name": "run", "arg_names": ["servername", "ip", "port", "softcron", "logging", "profiler"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def run(servername, ip, port, softcron=True, logging=False, profiler=None):\n if servername == 'gevent':\n from gevent import monkey\n monkey.patch_all()\n\n import gluon.main\n\n if logging:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:If_L180_C4", "label": "if", "type": "if", "loc": [180, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L179_C0", "vector": [4, 1, 0.5216, 0.0086, 1, 0.27, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if servername == 'gevent':\n from gevent import monkey\n monkey.patch_all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L181_C8", "label": "from gevent import monkey", "type": "import", "loc": [181, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L180_C4", "vector": [1, 2, 0.5216, 0.0029, 2, 0.87, 0.0, 703, 0, 1, 0, 0, 703, 0, 0], "semantic": {"name": "gevent", "arg_names": [], "import_names": ["monkey"], "rhs_call_name": "", "annotation": ""}, "snippet": " from gevent import monkey"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L182_C8", "label": "patch_all()", "type": "expression", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L180_C4", "vector": [8, 2, 0.5245, 0.0029, 2, 0.87, 1.0, 472, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "patch_all", "arg_names": [], "import_names": [], "rhs_call_name": "patch_all", "annotation": ""}, "snippet": " monkey.patch_all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L184_C4", "label": "gluon.main import gluon.main", "type": "import", "loc": [184, 184], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L179_C0", "vector": [1, 1, 0.5303, 0.0029, 1, 0.27, 0.25, 639, 0, 1, 0, 0, 639, 0, 0], "semantic": {"name": "gluon.main", "arg_names": [], "import_names": ["gluon.main"], "rhs_call_name": "", "annotation": ""}, "snippet": " import gluon.main"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:If_L186_C4", "label": "if", "type": "if", "loc": [186, 191], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L179_C0", "vector": [4, 1, 0.5432, 0.0173, 1, 0.27, 0.5, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if logging:\n application = gluon.main.appfactory(wsgiapp=gluon.main.wsgibase,\n logfilename='httpserver.log',\n profilerfilename=profiler)\n else:\n application = gluon.main.wsgibase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L187_C8", "label": "application = appfactory()", "type": "assigned_variable", "loc": [187, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L186_C4", "vector": [14, 2, 0.5418, 0.0086, 2, 0.72, 0.0, 244, 3, 3, 0, 0, 579, 10, 1], "semantic": {"name": "application", "arg_names": [], "import_names": [], "rhs_call_name": "appfactory", "annotation": ""}, "snippet": " application = gluon.main.appfactory(wsgiapp=gluon.main.wsgibase,\n logfilename='httpserver.log',\n profilerfilename=profiler)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L191_C8", "label": "application =", "type": "assigned_variable", "loc": [191, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L186_C4", "vector": [14, 2, 0.5504, 0.0029, 2, 0.72, 1.0, 244, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "application", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " application = gluon.main.wsgibase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:If_L192_C4", "label": "if", "type": "if", "loc": [192, 194], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L179_C0", "vector": [4, 1, 0.5562, 0.0086, 1, 0.27, 0.75, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if softcron:\n from gluon.settings import global_settings\n global_settings.web2py_crontype = 'soft'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L193_C8", "label": "from gluon.settings import global_settings", "type": "import", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L192_C4", "vector": [1, 2, 0.5562, 0.0029, 2, 0.94, 0.0, 883, 0, 1, 0, 0, 883, 0, 0], "semantic": {"name": "gluon.settings", "arg_names": [], "import_names": ["global_settings"], "rhs_call_name": "", "annotation": ""}, "snippet": " from gluon.settings import global_settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L194_C8", "label": "global_settings.web2py_crontype =", "type": "assigned_variable", "loc": [194, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L192_C4", "vector": [14, 2, 0.5591, 0.0029, 2, 0.94, 1.0, 128, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "global_settings.web2py_crontype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " global_settings.web2py_crontype = 'soft'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L195_C4", "label": "expression", "type": "expression", "loc": [195, 195], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L179_C0", "vector": [8, 1, 0.562, 0.0029, 1, 0.27, 1.0, 0, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " getattr(Servers, servername)(application, (ip, int(port)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L198_C0", "label": "mongrel2_handler", "type": "function", "loc": [198, 300], "level": 0, "parent": null, "vector": [2, 0, 0.7176, 0.2968, 0, 0.66, 0.8333, 364, 0, 3, 0, 0, 0, 0, 24], "semantic": {"name": "mongrel2_handler", "arg_names": ["application", "conn", "debug"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def mongrel2_handler(application, conn, debug=False):\n \"\"\"\n Based on :\n https://github.com/berry/Mongrel2-WSGI-Handler/blob/master/wsgi-handler.py\n\n WSGI handler based on the Python wsgiref SimpleHandler.\n A WSGI application should return a iterable op StringTypes.\n Any encoding must be handled by the WSGI application itself."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L199_C4", "label": "expression", "type": "expression", "loc": [199, 206], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L198_C0", "vector": [8, 1, 0.5836, 0.0231, 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 Based on :\n https://github.com/berry/Mongrel2-WSGI-Handler/blob/master/wsgi-handler.py\n\n WSGI handler based on the Python wsgiref SimpleHandler.\n A WSGI application should return a iterable op StringTypes.\n Any encoding must be handled by the WSGI application itself.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L207_C4", "label": "from wsgiref.handlers import SimpleHandler", "type": "import", "loc": [207, 207], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L198_C0", "vector": [1, 1, 0.5965, 0.0029, 1, 0.48, 0.3333, 709, 0, 1, 0, 0, 709, 0, 0], "semantic": {"name": "wsgiref.handlers", "arg_names": [], "import_names": ["SimpleHandler"], "rhs_call_name": "", "annotation": ""}, "snippet": " from wsgiref.handlers import SimpleHandler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Try_L208_C4", "label": "try", "type": "try", "loc": [208, 211], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L198_C0", "vector": [7, 1, 0.6037, 0.0115, 1, 0.48, 0.6667, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n import cStringIO as StringIO\n except:\n import StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L209_C8", "label": "cStringIO import StringIO", "type": "import", "loc": [209, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:Try_L208_C4", "vector": [1, 2, 0.6023, 0.0029, 2, 0.82, 0.0, 764, 0, 1, 0, 0, 764, 0, 0], "semantic": {"name": "cStringIO", "arg_names": [], "import_names": ["StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": " import cStringIO as StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L211_C8", "label": "StringIO import StringIO", "type": "import", "loc": [211, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:Try_L208_C4", "vector": [1, 2, 0.6081, 0.0029, 2, 0.82, 0.0, 609, 0, 1, 0, 0, 609, 0, 0], "semantic": {"name": "StringIO", "arg_names": [], "import_names": ["StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": " import StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "label": "while", "type": "while", "loc": [222, 300], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L198_C0", "vector": [5, 1, 0.7522, 0.2277, 1, 0.48, 1.0, 0, 1, 0, 0, 0, 0, 0, 24], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n if debug:\n print(\"WAITING FOR REQUEST\")\n\n # receive a request\n req = conn.recv()\n if debug:\n print(\"REQUEST BODY: %r\\n\" % req.body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:If_L223_C8", "label": "if", "type": "if", "loc": [223, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [4, 2, 0.6441, 0.0058, 2, 0.36, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if debug:\n print(\"WAITING FOR REQUEST\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L224_C12", "label": "print()", "type": "expression", "loc": [224, 224], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L223_C8", "vector": [8, 3, 0.6455, 0.0029, 3, 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(\"WAITING FOR REQUEST\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L227_C8", "label": "req = recv()", "type": "assigned_variable", "loc": [227, 227], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [14, 2, 0.6542, 0.0029, 2, 0.36, 0.0345, 233, 3, 0, 0, 0, 178, 10, 1], "semantic": {"name": "req", "arg_names": [], "import_names": [], "rhs_call_name": "recv", "annotation": ""}, "snippet": " req = conn.recv()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:If_L228_C8", "label": "if", "type": "if", "loc": [228, 229], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [4, 2, 0.6585, 0.0058, 2, 0.36, 0.069, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if debug:\n print(\"REQUEST BODY: %r\\n\" % req.body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L229_C12", "label": "print()", "type": "expression", "loc": [229, 229], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L228_C8", "vector": [8, 3, 0.6599, 0.0029, 3, 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(\"REQUEST BODY: %r\\n\" % req.body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:If_L231_C8", "label": "if", "type": "if", "loc": [231, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [4, 2, 0.67, 0.0115, 2, 0.36, 0.1034, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if req.is_disconnect():\n if debug:\n print(\"DISCONNECT\")\n continue # effectively ignore the disconnect from the client"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:If_L232_C12", "label": "if", "type": "if", "loc": [232, 233], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L231_C8", "vector": [4, 3, 0.67, 0.0058, 3, 0.51, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if debug:\n print(\"DISCONNECT\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L233_C16", "label": "print()", "type": "expression", "loc": [233, 233], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L232_C12", "vector": [8, 4, 0.6715, 0.0029, 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(\"DISCONNECT\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L238_C8", "label": "environ =", "type": "assigned_variable", "loc": [238, 238], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [14, 2, 0.6859, 0.0029, 2, 0.36, 0.1379, 422, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "environ", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ = req.headers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L239_C8", "label": "assign", "type": "assigned_variable", "loc": [239, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [14, 2, 0.6888, 0.0029, 2, 0.36, 0.1724, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['SERVER_PROTOCOL'] = 'HTTP/1.1' # SimpleHandler expects a server_protocol, lets assume it is HTTP 1.1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L240_C8", "label": "assign", "type": "assigned_variable", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [14, 2, 0.6916, 0.0029, 2, 0.36, 0.2069, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['REQUEST_METHOD'] = environ['METHOD']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:If_L241_C8", "label": "if", "type": "if", "loc": [241, 246], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [4, 2, 0.7017, 0.0173, 2, 0.36, 0.2414, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ':' in environ['Host']:\n environ['SERVER_NAME'] = environ['Host'].split(':')[0]\n environ['SERVER_PORT'] = environ['Host'].split(':')[1]\n else:\n environ['SERVER_NAME'] = environ['Host']\n environ['SERVER_PORT'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L242_C12", "label": "assign", "type": "assigned_variable", "loc": [242, 242], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L241_C8", "vector": [14, 3, 0.6974, 0.0029, 3, 0.7, 0.0, 0, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['SERVER_NAME'] = environ['Host'].split(':')[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L243_C12", "label": "assign", "type": "assigned_variable", "loc": [243, 243], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L241_C8", "vector": [14, 3, 0.7003, 0.0029, 3, 0.7, 0.3333, 0, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['SERVER_PORT'] = environ['Host'].split(':')[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L245_C12", "label": "assign", "type": "assigned_variable", "loc": [245, 245], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L241_C8", "vector": [14, 3, 0.7061, 0.0029, 3, 0.7, 0.6667, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['SERVER_NAME'] = environ['Host']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L246_C12", "label": "assign", "type": "assigned_variable", "loc": [246, 246], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L241_C8", "vector": [14, 3, 0.7089, 0.0029, 3, 0.7, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['SERVER_PORT'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L247_C8", "label": "assign", "type": "assigned_variable", "loc": [247, 247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [14, 2, 0.7118, 0.0029, 2, 0.36, 0.2759, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['SCRIPT_NAME'] = '' # empty for now"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L248_C8", "label": " = unquote()", "type": "assigned_variable", "loc": [248, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [14, 2, 0.7147, 0.0029, 2, 0.36, 0.3103, 0, 3, 1, 0, 0, 432, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "unquote", "annotation": ""}, "snippet": " environ['PATH_INFO'] = urllib.unquote(environ['PATH'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:If_L249_C8", "label": "if", "type": "if", "loc": [249, 252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [4, 2, 0.7219, 0.0115, 2, 0.36, 0.3448, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if '?' in environ['URI']:\n environ['QUERY_STRING'] = environ['URI'].split('?')[1]\n else:\n environ['QUERY_STRING'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L250_C12", "label": "assign", "type": "assigned_variable", "loc": [250, 250], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L249_C8", "vector": [14, 3, 0.7205, 0.0029, 3, 0.97, 0.0, 0, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['QUERY_STRING'] = environ['URI'].split('?')[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L252_C12", "label": "assign", "type": "assigned_variable", "loc": [252, 252], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L249_C8", "vector": [14, 3, 0.7262, 0.0029, 3, 0.97, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['QUERY_STRING'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:If_L253_C8", "label": "if", "type": "if", "loc": [253, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [4, 2, 0.732, 0.0086, 2, 0.36, 0.3793, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'Content-Length' in environ:\n environ['CONTENT_LENGTH'] = environ[\n 'Content-Length'] # necessary for POST to work with Django"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L254_C12", "label": "assign", "type": "assigned_variable", "loc": [254, 255], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L253_C8", "vector": [14, 3, 0.7334, 0.0058, 3, 0.18, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['CONTENT_LENGTH'] = environ[\n 'Content-Length'] # necessary for POST to work with Django"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L256_C8", "label": "assign", "type": "assigned_variable", "loc": [256, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [14, 2, 0.7378, 0.0029, 2, 0.36, 0.4138, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['wsgi.input'] = req.body"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:If_L258_C8", "label": "if", "type": "if", "loc": [258, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [4, 2, 0.745, 0.0058, 2, 0.36, 0.4483, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if debug:\n print(\"ENVIRON: %r\\n\" % environ)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L259_C12", "label": "print()", "type": "expression", "loc": [259, 259], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L258_C8", "vector": [8, 3, 0.7464, 0.0029, 3, 0.39, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"ENVIRON: %r\\n\" % environ)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L263_C8", "label": "reqIO = StringIO()", "type": "assigned_variable", "loc": [263, 263], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [14, 2, 0.7579, 0.0029, 2, 0.36, 0.4828, 366, 3, 1, 0, 0, 609, 10, 1], "semantic": {"name": "reqIO", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": " reqIO = StringIO.StringIO(req.body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L264_C8", "label": "errIO = StringIO()", "type": "assigned_variable", "loc": [264, 264], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [14, 2, 0.7608, 0.0029, 2, 0.36, 0.5172, 131, 3, 0, 0, 0, 609, 10, 1], "semantic": {"name": "errIO", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": " errIO = StringIO.StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L265_C8", "label": "respIO = StringIO()", "type": "assigned_variable", "loc": [265, 265], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [14, 2, 0.7637, 0.0029, 2, 0.36, 0.5517, 573, 3, 0, 0, 0, 609, 10, 1], "semantic": {"name": "respIO", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": " respIO = StringIO.StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L268_C8", "label": "handler = SimpleHandler()", "type": "assigned_variable", "loc": [268, 269], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [14, 2, 0.7738, 0.0058, 2, 0.36, 0.5862, 388, 3, 6, 0, 0, 167, 10, 1], "semantic": {"name": "handler", "arg_names": [], "import_names": [], "rhs_call_name": "SimpleHandler", "annotation": ""}, "snippet": " handler = SimpleHandler(reqIO, respIO, errIO, environ,\n multithread=False, multiprocess=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L270_C8", "label": "run()", "type": "expression", "loc": [270, 270], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [8, 2, 0.7781, 0.0029, 2, 0.36, 0.6207, 679, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " handler.run(application)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L275_C8", "label": "response = getvalue()", "type": "assigned_variable", "loc": [275, 275], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [14, 2, 0.7925, 0.0029, 2, 0.36, 0.6552, 511, 3, 0, 0, 0, 626, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "getvalue", "annotation": ""}, "snippet": " response = respIO.getvalue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L276_C8", "label": "response = split()", "type": "assigned_variable", "loc": [276, 276], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [14, 2, 0.7954, 0.0029, 2, 0.36, 0.6897, 511, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " response = response.split(\"\\r\\n\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L277_C8", "label": "data =", "type": "assigned_variable", "loc": [277, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [14, 2, 0.7983, 0.0029, 2, 0.36, 0.7241, 929, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = response[-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L278_C8", "label": "headers = dict()", "type": "assigned_variable", "loc": [278, 278], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [14, 2, 0.8012, 0.0029, 2, 0.36, 0.7586, 950, 3, 1, 0, 0, 827, 10, 2], "semantic": {"name": "headers", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " headers = dict([r.split(\": \") for r in response[1:-2]])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L279_C8", "label": "code =", "type": "assigned_variable", "loc": [279, 279], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [14, 2, 0.804, 0.0029, 2, 0.36, 0.7931, 44, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " code = response[0][9:12]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L280_C8", "label": "status =", "type": "assigned_variable", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [14, 2, 0.8069, 0.0029, 2, 0.36, 0.8276, 699, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " status = response[0][13:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L287_C8", "label": "data = replace()", "type": "assigned_variable", "loc": [287, 287], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [14, 2, 0.8271, 0.0029, 2, 0.36, 0.8621, 929, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " data = data.replace('\\xef\\xbb\\xbf', '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L290_C8", "label": "errors = getvalue()", "type": "assigned_variable", "loc": [290, 290], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [14, 2, 0.8357, 0.0029, 2, 0.36, 0.8966, 841, 3, 0, 0, 0, 626, 10, 1], "semantic": {"name": "errors", "arg_names": [], "import_names": [], "rhs_call_name": "getvalue", "annotation": ""}, "snippet": " errors = errIO.getvalue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:If_L293_C8", "label": "if", "type": "if", "loc": [293, 294], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [4, 2, 0.8458, 0.0058, 2, 0.36, 0.931, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if debug:\n print(\"RESPONSE: %r\\n\" % response)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L294_C12", "label": "print()", "type": "expression", "loc": [294, 294], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L293_C8", "vector": [8, 3, 0.8473, 0.0029, 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(\"RESPONSE: %r\\n\" % response)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:If_L295_C8", "label": "if", "type": "if", "loc": [295, 298], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [4, 2, 0.8545, 0.0115, 2, 0.36, 0.9655, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if errors:\n if debug:\n print(\"ERRORS: %r\" % errors)\n data = \"%s\\r\\n\\r\\n%s\" % (data, errors)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:If_L296_C12", "label": "if", "type": "if", "loc": [296, 297], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L295_C8", "vector": [4, 3, 0.8545, 0.0058, 3, 0.23, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if debug:\n print(\"ERRORS: %r\" % errors)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L297_C16", "label": "print()", "type": "expression", "loc": [297, 297], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L296_C12", "vector": [8, 4, 0.8559, 0.0029, 4, 0.93, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"ERRORS: %r\" % errors)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L298_C12", "label": "data =", "type": "assigned_variable", "loc": [298, 298], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L295_C8", "vector": [14, 3, 0.8588, 0.0029, 3, 0.23, 1.0, 929, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = \"%s\\r\\n\\r\\n%s\" % (data, errors)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L299_C8", "label": "reply_http()", "type": "expression", "loc": [299, 300], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "vector": [8, 2, 0.8631, 0.0058, 2, 0.36, 1.0, 96, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "reply_http", "arg_names": [], "import_names": [], "rhs_call_name": "reply_http", "annotation": ""}, "snippet": " conn.reply_http(\n req, data, code=code, status=status, headers=headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "label": "main", "type": "function", "loc": [303, 344], "level": 0, "parent": null, "vector": [2, 0, 0.9323, 0.121, 0, 0.66, 0.9167, 624, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n usage = \"python anyserver.py -s tornado -i 127.0.0.1 -p 8000 -l -P\"\n try:\n version = open('VERSION','r')\n except IOError:\n version = ''\n parser = optparse.OptionParser(usage, None, optparse.Option, version)\n parser.add_option('-l',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L304_C4", "label": "usage =", "type": "assigned_variable", "loc": [304, 304], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "vector": [14, 1, 0.8761, 0.0029, 1, 0.65, 0.0, 129, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "usage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " usage = \"python anyserver.py -s tornado -i 127.0.0.1 -p 8000 -l -P\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Try_L305_C4", "label": "try", "type": "try", "loc": [305, 308], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "vector": [7, 1, 0.8833, 0.0115, 1, 0.65, 0.0909, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n version = open('VERSION','r')\n except IOError:\n version = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L306_C8", "label": "version = open()", "type": "assigned_variable", "loc": [306, 306], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:Try_L305_C4", "vector": [14, 2, 0.8818, 0.0029, 2, 0.15, 0.0, 623, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " version = open('VERSION','r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L308_C8", "label": "version =", "type": "assigned_variable", "loc": [308, 308], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:Try_L305_C4", "vector": [14, 2, 0.8876, 0.0029, 2, 0.15, 0.0, 623, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L309_C4", "label": "parser = OptionParser()", "type": "assigned_variable", "loc": [309, 309], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "vector": [14, 1, 0.8905, 0.0029, 1, 0.65, 0.1818, 968, 3, 4, 0, 0, 894, 10, 1], "semantic": {"name": "parser", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " parser = optparse.OptionParser(usage, None, optparse.Option, version)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L310_C4", "label": "add_option()", "type": "expression", "loc": [310, 315], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "vector": [8, 1, 0.9006, 0.0173, 1, 0.65, 0.2727, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-l',\n '--logging',\n action='store_true',\n default=False,\n dest='logging',\n help='log into httpserver.log')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L316_C4", "label": "add_option()", "type": "expression", "loc": [316, 320], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "vector": [8, 1, 0.9164, 0.0144, 1, 0.65, 0.3636, 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('-P',\n '--profiler',\n default=False,\n dest='profiler',\n help='profiler filename')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L321_C4", "label": "servers = join()", "type": "assigned_variable", "loc": [321, 321], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "vector": [14, 1, 0.9251, 0.0029, 1, 0.65, 0.4545, 128, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "servers", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " servers = ', '.join(x for x in dir(Servers) if not x[0] == '_')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L322_C4", "label": "add_option()", "type": "expression", "loc": [322, 326], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "vector": [8, 1, 0.9337, 0.0144, 1, 0.65, 0.5455, 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',\n '--server',\n default='rocket',\n dest='server',\n help='server name (%s)' % servers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L327_C4", "label": "add_option()", "type": "expression", "loc": [327, 331], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "vector": [8, 1, 0.9481, 0.0144, 1, 0.65, 0.6364, 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('-i',\n '--ip',\n default='127.0.0.1',\n dest='ip',\n help='ip address')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L332_C4", "label": "add_option()", "type": "expression", "loc": [332, 336], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "vector": [8, 1, 0.9625, 0.0144, 1, 0.65, 0.7273, 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('-p',\n '--port',\n default='8000',\n dest='port',\n help='port number')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L337_C4", "label": "add_option()", "type": "expression", "loc": [337, 341], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "vector": [8, 1, 0.9769, 0.0144, 1, 0.65, 0.8182, 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('-w',\n '--workers',\n default='',\n dest='workers',\n help='number of workers number')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L342_C4", "label": "options, args = parse_args()", "type": "assigned_variable", "loc": [342, 342], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "vector": [14, 1, 0.9856, 0.0029, 1, 0.65, 0.9091, 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_441:Expr_L343_C4", "label": "run()", "type": "expression", "loc": [343, 344], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "vector": [8, 1, 0.9899, 0.0058, 1, 0.65, 1.0, 679, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " run(options.server, options.ip, options.port,\n logging=options.logging, profiler=options.profiler)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_441:If_L346_C0", "label": "if", "type": "if", "loc": [346, 347], "level": 0, "parent": null, "vector": [4, 0, 0.9986, 0.0058, 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_441:Expr_L347_C4", "label": "main()", "type": "expression", "loc": [347, 347], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_441:If_L346_C0", "vector": [8, 1, 1.0, 0.0029, 1, 0.47, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L85_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L86_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L85_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Return_L87_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L139_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L139_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Return_L140_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L142_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L142_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Return_L143_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L148_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L148_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L175_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:If_L180_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L181_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L180_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L182_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:If_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L186_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L187_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L186_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L191_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:If_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L192_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L179_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L198_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L198_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:ImportFrom_L207_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L198_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Try_L208_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:Try_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L209_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:Try_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Import_L211_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L198_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:If_L223_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L223_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L224_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L227_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:If_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L228_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L229_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:If_L231_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L231_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_441:If_L232_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L232_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L233_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L238_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L239_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:If_L241_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L241_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L242_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L241_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L243_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L241_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L245_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L241_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L246_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L247_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L248_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:If_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L249_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L250_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L249_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L252_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:If_L253_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L253_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L254_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L256_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:If_L258_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L258_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L259_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L263_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L264_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L265_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L268_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L270_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L275_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L276_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L278_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L279_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L280_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L287_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L290_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:If_L293_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L293_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L294_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:If_L295_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L295_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_441:If_L296_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L296_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L297_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L295_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L298_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:While_L222_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L299_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L304_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Try_L305_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:Try_L305_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L306_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:Try_L305_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L308_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L309_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L310_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L316_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L321_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L322_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L327_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L332_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L337_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Assign_L342_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:FunctionDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L343_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_441:If_L346_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_441:Expr_L347_C4"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Usage:
Install py2exe: http://sourceforge.net/projects/py2exe/files/
Copy script to the web2py directory
c:\bin\python26\python build_windows_exe.py py2exe
Adapted from http://bazaar.launchpad.net/~flavour/sahana-eden/trunk/view/head:/static/scripts/tools/standalone_exe.py
"""
from distutils.core import setup
import py2exe
from gluon.import_all import base_modules, contributed_modules
from gluon.fileutils import readlines_file
from glob import glob
import fnmatch
import os
import shutil
import sys
import re
import zipfile
#read web2py version from VERSION file
web2py_version_line = readlines_file('VERSION')[0]
#use regular expression to get just the version number
v_re = re.compile('[0-9]+\.[0-9]+\.[0-9]+')
web2py_version = v_re.search(web2py_version_line).group(0)
#pull in preferences from config file
import ConfigParser
Config = ConfigParser.ConfigParser()
Config.read('setup_exe.conf')
remove_msft_dlls = Config.getboolean("Setup", "remove_microsoft_dlls")
copy_apps = Config.getboolean("Setup", "copy_apps")
copy_site_packages = Config.getboolean("Setup", "copy_site_packages")
copy_scripts = Config.getboolean("Setup", "copy_scripts")
make_zip = Config.getboolean("Setup", "make_zip")
zip_filename = Config.get("Setup", "zip_filename")
remove_build_files = Config.getboolean("Setup", "remove_build_files")
# Python base version
python_version = sys.version[:3]
# List of modules deprecated in python2.6 that are in the above set
py26_deprecated = ['mhlib', 'multifile', 'mimify', 'sets', 'MimeWriter']
if python_version == '2.6':
base_modules += ['json', 'multiprocessing']
base_modules = list(set(base_modules).difference(set(py26_deprecated)))
#I don't know if this is even necessary
if python_version == '2.6':
# Python26 compatibility: http://www.py2exe.org/index.cgi/Tutorial#Step52
try:
shutil.copytree('C:\Bin\Microsoft.VC90.CRT', 'dist/')
except:
print "You MUST copy Microsoft.VC90.CRT folder into the dist directory"
setup(
console=['web2py.py'],
windows=[{'script':'web2py.py',
'dest_base':'web2py_no_console' # MUST NOT be just 'web2py' otherwise it overrides the standard web2py.exe
}],
name="web2py",
version=web2py_version,
description="web2py web framework",
author="Massimo DiPierro",
license="LGPL v3",
data_files=[
'ABOUT',
'LICENSE',
'VERSION',
'splashlogo.gif',
'logging.example.conf',
'options_std.py',
'app.example.yaml',
'queue.example.yaml'
],
options={'py2exe': {
'packages': contributed_modules,
'includes': base_modules,
}},
)
print "web2py binary successfully built"
def copy_folders(source, destination):
"""Copy files & folders from source to destination (within dist/)"""
if os.path.exists(os.path.join('dist', destination)):
shutil.rmtree(os.path.join('dist', destination))
shutil.copytree(os.path.join(source), os.path.join('dist', destination))
#should we remove Windows OS dlls user is unlikely to be able to distribute
if remove_msft_dlls:
print "Deleted Microsoft files not licensed for open source distribution"
print "You are still responsible for making sure you have the rights to distribute any other included files!"
#delete the API-MS-Win-Core DLLs
for f in glob('dist/API-MS-Win-*.dll'):
os.unlink(f)
#then delete some other files belonging to Microsoft
other_ms_files = ['KERNELBASE.dll', 'MPR.dll', 'MSWSOCK.dll',
'POWRPROF.dll']
for f in other_ms_files:
try:
os.unlink(os.path.join('dist', f))
except:
print "unable to delete dist/" + f
#sys.exit(1)
#Should we include applications?
if copy_apps:
copy_folders('applications', 'applications')
print "Your application(s) have been added"
else:
#only copy web2py's default applications
copy_folders('applications/admin', 'applications/admin')
copy_folders('applications/welcome', 'applications/welcome')
copy_folders('applications/examples', 'applications/examples')
print "Only web2py's admin, examples & welcome applications have been added"
#should we copy project's site-packages into dist/site-packages
if copy_site_packages:
#copy site-packages
copy_folders('site-packages', 'site-packages')
else:
#no worries, web2py will create the (empty) folder first run
print "Skipping site-packages"
pass
#should we copy project's scripts into dist/scripts
if copy_scripts:
#copy scripts
copy_folders('scripts', 'scripts')
else:
#no worries, web2py will create the (empty) folder first run
print "Skipping scripts"
pass
#borrowed from http://bytes.com/topic/python/answers/851018-how-zip-directory-python-using-zipfile
def recursive_zip(zipf, directory, folder=""):
for item in os.listdir(directory):
if os.path.isfile(os.path.join(directory, item)):
zipf.write(os.path.join(directory, item), folder + os.sep + item)
elif os.path.isdir(os.path.join(directory, item)):
recursive_zip(
zipf, os.path.join(directory, item), folder + os.sep + item)
#should we create a zip file of the build?
if make_zip:
#to keep consistent with how official web2py windows zip file is setup,
#create a web2py folder & copy dist's files into it
shutil.copytree('dist', 'zip_temp/web2py')
#create zip file
#use filename specified via command line
zipf = zipfile.ZipFile(
zip_filename + ".zip", "w", compression=zipfile.ZIP_DEFLATED)
path = 'zip_temp' # just temp so the web2py directory is included in our zip file
recursive_zip(
zipf, path) # leave the first folder as None, as path is root.
zipf.close()
shutil.rmtree('zip_temp')
print "Your Windows binary version of web2py can be found in " + \
zip_filename + ".zip"
print "You may extract the archive anywhere and then run web2py/web2py.exe"
#should py2exe build files be removed?
if remove_build_files:
shutil.rmtree('build')
shutil.rmtree('deposit')
shutil.rmtree('dist')
print "py2exe build files removed"
#final info
if not make_zip and not remove_build_files:
print "Your Windows binary & associated files can also be found in /dist"
print "Finished!"
print "Enjoy web2py " + web2py_version_line
| ajibawa-2023/Python-Code-Large/train/row_442 | 86 | 187 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 11], "level": 0, "parent": null, "vector": [8, 0, 0.0401, 0.0428, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nUsage:\n Install py2exe: http://sourceforge.net/projects/py2exe/files/\n Copy script to the web2py directory\n c:\\bin\\python26\\python build_windows_exe.py py2exe\n\nAdapted from http://bazaar.launchpad.net/~flavour/sahana-eden/trunk/view/head:/static/scripts/tools/standalone_exe.py\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:ImportFrom_L13_C0", "label": "from distutils.core import setup", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0695, 0.0053, 0, 0.66, 0.0244, 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_442:Import_L14_C0", "label": "py2exe import py2exe", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0749, 0.0053, 0, 0.66, 0.0488, 768, 0, 1, 0, 0, 768, 0, 0], "semantic": {"name": "py2exe", "arg_names": [], "import_names": ["py2exe"], "rhs_call_name": "", "annotation": ""}, "snippet": "import py2exe"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:ImportFrom_L15_C0", "label": "from gluon.import_all import base_modules, contributed_modules", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0802, 0.0053, 0, 0.66, 0.0732, 710, 0, 2, 0, 0, 710, 0, 0], "semantic": {"name": "gluon.import_all", "arg_names": [], "import_names": ["base_modules", "contributed_modules"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.import_all import base_modules, contributed_modules"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:ImportFrom_L16_C0", "label": "from gluon.fileutils import readlines_file", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0856, 0.0053, 0, 0.66, 0.0976, 948, 0, 1, 0, 0, 948, 0, 0], "semantic": {"name": "gluon.fileutils", "arg_names": [], "import_names": ["readlines_file"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.fileutils import readlines_file"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:ImportFrom_L17_C0", "label": "from glob import glob", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0053, 0, 0.66, 0.122, 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_442:Import_L18_C0", "label": "fnmatch import fnmatch", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0963, 0.0053, 0, 0.66, 0.1463, 626, 0, 1, 0, 0, 626, 0, 0], "semantic": {"name": "fnmatch", "arg_names": [], "import_names": ["fnmatch"], "rhs_call_name": "", "annotation": ""}, "snippet": "import fnmatch"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Import_L19_C0", "label": "os import os", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.1016, 0.0053, 0, 0.66, 0.1707, 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_442:Import_L20_C0", "label": "shutil import shutil", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.107, 0.0053, 0, 0.66, 0.1951, 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_442:Import_L21_C0", "label": "sys import sys", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.1123, 0.0053, 0, 0.66, 0.2195, 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_442:Import_L22_C0", "label": "re import re", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.1176, 0.0053, 0, 0.66, 0.2439, 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_442:Import_L23_C0", "label": "zipfile import zipfile", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.123, 0.0053, 0, 0.66, 0.2683, 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_442:Assign_L26_C0", "label": "web2py_version_line =", "type": "assigned_variable", "loc": [26, 26], "level": 0, "parent": null, "vector": [14, 0, 0.139, 0.0053, 0, 0.66, 0.2927, 13, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "web2py_version_line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "web2py_version_line = readlines_file('VERSION')[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Assign_L28_C0", "label": "v_re = compile()", "type": "assigned_variable", "loc": [28, 28], "level": 0, "parent": null, "vector": [14, 0, 0.1497, 0.0053, 0, 0.66, 0.3171, 633, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "v_re", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "v_re = re.compile('[0-9]+\\.[0-9]+\\.[0-9]+')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Assign_L29_C0", "label": "web2py_version = group()", "type": "assigned_variable", "loc": [29, 29], "level": 0, "parent": null, "vector": [14, 0, 0.1551, 0.0053, 0, 0.66, 0.3415, 199, 3, 1, 0, 0, 43, 10, 2], "semantic": {"name": "web2py_version", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": "web2py_version = v_re.search(web2py_version_line).group(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Import_L32_C0", "label": "ConfigParser import ConfigParser", "type": "import", "loc": [32, 32], "level": 0, "parent": null, "vector": [1, 0, 0.1711, 0.0053, 0, 0.66, 0.3659, 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_442:Assign_L33_C0", "label": "Config = ConfigParser()", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.1765, 0.0053, 0, 0.66, 0.3902, 979, 3, 0, 0, 0, 272, 10, 1], "semantic": {"name": "Config", "arg_names": [], "import_names": [], "rhs_call_name": "ConfigParser", "annotation": ""}, "snippet": "Config = ConfigParser.ConfigParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L34_C0", "label": "read()", "type": "expression", "loc": [34, 34], "level": 0, "parent": null, "vector": [8, 0, 0.1818, 0.0053, 0, 0.66, 0.4146, 453, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "read", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": "Config.read('setup_exe.conf')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Assign_L35_C0", "label": "remove_msft_dlls = getboolean()", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 0.1872, 0.0053, 0, 0.66, 0.439, 765, 3, 2, 0, 0, 726, 10, 1], "semantic": {"name": "remove_msft_dlls", "arg_names": [], "import_names": [], "rhs_call_name": "getboolean", "annotation": ""}, "snippet": "remove_msft_dlls = Config.getboolean(\"Setup\", \"remove_microsoft_dlls\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Assign_L36_C0", "label": "copy_apps = getboolean()", "type": "assigned_variable", "loc": [36, 36], "level": 0, "parent": null, "vector": [14, 0, 0.1925, 0.0053, 0, 0.66, 0.4634, 588, 3, 2, 0, 0, 726, 10, 1], "semantic": {"name": "copy_apps", "arg_names": [], "import_names": [], "rhs_call_name": "getboolean", "annotation": ""}, "snippet": "copy_apps = Config.getboolean(\"Setup\", \"copy_apps\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Assign_L37_C0", "label": "copy_site_packages = getboolean()", "type": "assigned_variable", "loc": [37, 37], "level": 0, "parent": null, "vector": [14, 0, 0.1979, 0.0053, 0, 0.66, 0.4878, 279, 3, 2, 0, 0, 726, 10, 1], "semantic": {"name": "copy_site_packages", "arg_names": [], "import_names": [], "rhs_call_name": "getboolean", "annotation": ""}, "snippet": "copy_site_packages = Config.getboolean(\"Setup\", \"copy_site_packages\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Assign_L38_C0", "label": "copy_scripts = getboolean()", "type": "assigned_variable", "loc": [38, 38], "level": 0, "parent": null, "vector": [14, 0, 0.2032, 0.0053, 0, 0.66, 0.5122, 874, 3, 2, 0, 0, 726, 10, 1], "semantic": {"name": "copy_scripts", "arg_names": [], "import_names": [], "rhs_call_name": "getboolean", "annotation": ""}, "snippet": "copy_scripts = Config.getboolean(\"Setup\", \"copy_scripts\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Assign_L39_C0", "label": "make_zip = getboolean()", "type": "assigned_variable", "loc": [39, 39], "level": 0, "parent": null, "vector": [14, 0, 0.2086, 0.0053, 0, 0.66, 0.5366, 369, 3, 2, 0, 0, 726, 10, 1], "semantic": {"name": "make_zip", "arg_names": [], "import_names": [], "rhs_call_name": "getboolean", "annotation": ""}, "snippet": "make_zip = Config.getboolean(\"Setup\", \"make_zip\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Assign_L40_C0", "label": "zip_filename = get()", "type": "assigned_variable", "loc": [40, 40], "level": 0, "parent": null, "vector": [14, 0, 0.2139, 0.0053, 0, 0.66, 0.561, 454, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "zip_filename", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": "zip_filename = Config.get(\"Setup\", \"zip_filename\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Assign_L41_C0", "label": "remove_build_files = getboolean()", "type": "assigned_variable", "loc": [41, 41], "level": 0, "parent": null, "vector": [14, 0, 0.2193, 0.0053, 0, 0.66, 0.5854, 926, 3, 2, 0, 0, 726, 10, 1], "semantic": {"name": "remove_build_files", "arg_names": [], "import_names": [], "rhs_call_name": "getboolean", "annotation": ""}, "snippet": "remove_build_files = Config.getboolean(\"Setup\", \"remove_build_files\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Assign_L45_C0", "label": "python_version =", "type": "assigned_variable", "loc": [45, 45], "level": 0, "parent": null, "vector": [14, 0, 0.2406, 0.0053, 0, 0.66, 0.6098, 250, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "python_version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "python_version = sys.version[:3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Assign_L48_C0", "label": "py26_deprecated =", "type": "assigned_variable", "loc": [48, 48], "level": 0, "parent": null, "vector": [14, 0, 0.2567, 0.0053, 0, 0.66, 0.6341, 517, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "py26_deprecated", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "py26_deprecated = ['mhlib', 'multifile', 'mimify', 'sets', 'MimeWriter']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:If_L50_C0", "label": "if", "type": "if", "loc": [50, 52], "level": 0, "parent": null, "vector": [4, 0, 0.2727, 0.016, 0, 0.66, 0.6585, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if python_version == '2.6':\n base_modules += ['json', 'multiprocessing']\n base_modules = list(set(base_modules).difference(set(py26_deprecated)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Assign_L52_C4", "label": "base_modules = list()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L50_C0", "vector": [14, 1, 0.2781, 0.0053, 1, 0.36, 0.0, 675, 3, 1, 0, 0, 430, 10, 4], "semantic": {"name": "base_modules", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " base_modules = list(set(base_modules).difference(set(py26_deprecated)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:If_L56_C0", "label": "if", "type": "if", "loc": [56, 61], "level": 0, "parent": null, "vector": [4, 0, 0.3128, 0.0321, 0, 0.66, 0.6829, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if python_version == '2.6':\n # Python26 compatibility: http://www.py2exe.org/index.cgi/Tutorial#Step52\n try:\n shutil.copytree('C:\\Bin\\Microsoft.VC90.CRT', 'dist/')\n except:\n print(\"You MUST copy Microsoft.VC90.CRT folder into the dist directory\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Try_L58_C4", "label": "try", "type": "try", "loc": [58, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L56_C0", "vector": [7, 1, 0.3182, 0.0214, 1, 0.13, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n shutil.copytree('C:\\Bin\\Microsoft.VC90.CRT', 'dist/')\n except:\n print(\"You MUST copy Microsoft.VC90.CRT folder into the dist directory\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L59_C8", "label": "copytree()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:Try_L58_C4", "vector": [8, 2, 0.3155, 0.0053, 2, 0.73, 0.0, 739, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "copytree", "arg_names": [], "import_names": [], "rhs_call_name": "copytree", "annotation": ""}, "snippet": " shutil.copytree('C:\\Bin\\Microsoft.VC90.CRT', 'dist/')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L61_C8", "label": "print()", "type": "expression", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:Try_L58_C4", "vector": [8, 2, 0.3262, 0.0053, 2, 0.73, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"You MUST copy Microsoft.VC90.CRT folder into the dist directory\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L64_C0", "label": "setup()", "type": "expression", "loc": [64, 88], "level": 0, "parent": null, "vector": [8, 0, 0.4064, 0.1337, 0, 0.66, 0.7073, 234, 3, 9, 0, 0, 0, 0, 1], "semantic": {"name": "setup", "arg_names": [], "import_names": [], "rhs_call_name": "setup", "annotation": ""}, "snippet": "setup(\n console=['web2py.py'],\n windows=[{'script':'web2py.py',\n 'dest_base':'web2py_no_console' # MUST NOT be just 'web2py' otherwise it overrides the standard web2py.exe\n }],\n name=\"web2py\",\n version=web2py_version,\n description=\"web2py web framework\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L90_C0", "label": "print()", "type": "expression", "loc": [90, 90], "level": 0, "parent": null, "vector": [8, 0, 0.4813, 0.0053, 0, 0.66, 0.7317, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"web2py binary successfully built\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:FunctionDef_L93_C0", "label": "copy_folders", "type": "function", "loc": [93, 97], "level": 0, "parent": null, "vector": [2, 0, 0.508, 0.0267, 0, 0.66, 0.7561, 628, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "copy_folders", "arg_names": ["source", "destination"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def copy_folders(source, destination):\n \"\"\"Copy files & folders from source to destination (within dist/)\"\"\"\n if os.path.exists(os.path.join('dist', destination)):\n shutil.rmtree(os.path.join('dist', destination))\n shutil.copytree(os.path.join(source), os.path.join('dist', destination))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L94_C4", "label": "expression", "type": "expression", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:FunctionDef_L93_C0", "vector": [8, 1, 0.5027, 0.0053, 1, 0.17, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Copy files & folders from source to destination (within dist/)\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:If_L95_C4", "label": "if", "type": "if", "loc": [95, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:FunctionDef_L93_C0", "vector": [4, 1, 0.5107, 0.0107, 1, 0.17, 0.5, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.exists(os.path.join('dist', destination)):\n shutil.rmtree(os.path.join('dist', destination))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L96_C8", "label": "rmtree()", "type": "expression", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L95_C4", "vector": [8, 2, 0.5134, 0.0053, 2, 0.18, 0.0, 317, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "rmtree", "arg_names": [], "import_names": [], "rhs_call_name": "rmtree", "annotation": ""}, "snippet": " shutil.rmtree(os.path.join('dist', destination))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L97_C4", "label": "copytree()", "type": "expression", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:FunctionDef_L93_C0", "vector": [8, 1, 0.5187, 0.0053, 1, 0.17, 1.0, 739, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "copytree", "arg_names": [], "import_names": [], "rhs_call_name": "copytree", "annotation": ""}, "snippet": " shutil.copytree(os.path.join(source), os.path.join('dist', destination))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:If_L101_C0", "label": "if", "type": "if", "loc": [101, 114], "level": 0, "parent": null, "vector": [4, 0, 0.5749, 0.0749, 0, 0.66, 0.7805, 0, 2, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if remove_msft_dlls:\n print(\"Deleted Microsoft files not licensed for open source distribution\")\n print(\"You are still responsible for making sure you have the rights to distribute any other included files!\")\n #delete the API-MS-Win-Core DLLs\n for f in glob('dist/API-MS-Win-*.dll'):\n os.unlink(f)\n #then delete some other files belonging to Microsoft\n other_ms_files = ['KERNELBASE.dll', 'MPR.dll', 'MSWSOCK.dll',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L102_C4", "label": "print()", "type": "expression", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L101_C0", "vector": [8, 1, 0.5455, 0.0053, 1, 0.44, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Deleted Microsoft files not licensed for open source distribution\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L103_C4", "label": "print()", "type": "expression", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L101_C0", "vector": [8, 1, 0.5508, 0.0053, 1, 0.44, 0.25, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"You are still responsible for making sure you have the rights to distribute any other included files!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:For_L105_C4", "label": "for f", "type": "for", "loc": [105, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L101_C0", "vector": [6, 1, 0.5642, 0.0107, 1, 0.44, 0.5, 899, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for f in glob('dist/API-MS-Win-*.dll'):\n os.unlink(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L106_C8", "label": "unlink()", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:For_L105_C4", "vector": [8, 2, 0.5668, 0.0053, 2, 0.0, 0.0, 701, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "unlink", "arg_names": [], "import_names": [], "rhs_call_name": "unlink", "annotation": ""}, "snippet": " os.unlink(f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Assign_L108_C4", "label": "other_ms_files =", "type": "assigned_variable", "loc": [108, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L101_C0", "vector": [14, 1, 0.5802, 0.0107, 1, 0.44, 0.75, 669, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "other_ms_files", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " other_ms_files = ['KERNELBASE.dll', 'MPR.dll', 'MSWSOCK.dll',\n 'POWRPROF.dll']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:For_L110_C4", "label": "for f", "type": "for", "loc": [110, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L101_C0", "vector": [6, 1, 0.5989, 0.0267, 1, 0.44, 1.0, 899, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for f in other_ms_files:\n try:\n os.unlink(os.path.join('dist', f))\n except:\n print(\"unable to delete dist/\" + f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Try_L111_C8", "label": "try", "type": "try", "loc": [111, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:For_L110_C4", "vector": [7, 2, 0.6016, 0.0214, 2, 0.67, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n os.unlink(os.path.join('dist', f))\n except:\n print(\"unable to delete dist/\" + f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L112_C12", "label": "unlink()", "type": "expression", "loc": [112, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:Try_L111_C8", "vector": [8, 3, 0.5989, 0.0053, 3, 0.26, 0.0, 701, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "unlink", "arg_names": [], "import_names": [], "rhs_call_name": "unlink", "annotation": ""}, "snippet": " os.unlink(os.path.join('dist', f))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L114_C12", "label": "print()", "type": "expression", "loc": [114, 114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:Try_L111_C8", "vector": [8, 3, 0.6096, 0.0053, 3, 0.26, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"unable to delete dist/\" + f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:If_L119_C0", "label": "if", "type": "if", "loc": [119, 127], "level": 0, "parent": null, "vector": [4, 0, 0.6578, 0.0481, 0, 0.66, 0.8049, 0, 2, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if copy_apps:\n copy_folders('applications', 'applications')\n print(\"Your application(s) have been added\")\nelse:\n #only copy web2py's default applications\n copy_folders('applications/admin', 'applications/admin')\n copy_folders('applications/welcome', 'applications/welcome')\n copy_folders('applications/examples', 'applications/examples')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L120_C4", "label": "copy_folders()", "type": "expression", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L119_C0", "vector": [8, 1, 0.6417, 0.0053, 1, 0.61, 0.0, 628, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "copy_folders", "arg_names": [], "import_names": [], "rhs_call_name": "copy_folders", "annotation": ""}, "snippet": " copy_folders('applications', 'applications')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L121_C4", "label": "print()", "type": "expression", "loc": [121, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L119_C0", "vector": [8, 1, 0.6471, 0.0053, 1, 0.61, 0.2, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Your application(s) have been added\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L124_C4", "label": "copy_folders()", "type": "expression", "loc": [124, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L119_C0", "vector": [8, 1, 0.6631, 0.0053, 1, 0.61, 0.4, 628, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "copy_folders", "arg_names": [], "import_names": [], "rhs_call_name": "copy_folders", "annotation": ""}, "snippet": " copy_folders('applications/admin', 'applications/admin')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L125_C4", "label": "copy_folders()", "type": "expression", "loc": [125, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L119_C0", "vector": [8, 1, 0.6684, 0.0053, 1, 0.61, 0.6, 628, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "copy_folders", "arg_names": [], "import_names": [], "rhs_call_name": "copy_folders", "annotation": ""}, "snippet": " copy_folders('applications/welcome', 'applications/welcome')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L126_C4", "label": "copy_folders()", "type": "expression", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L119_C0", "vector": [8, 1, 0.6738, 0.0053, 1, 0.61, 0.8, 628, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "copy_folders", "arg_names": [], "import_names": [], "rhs_call_name": "copy_folders", "annotation": ""}, "snippet": " copy_folders('applications/examples', 'applications/examples')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L127_C4", "label": "print()", "type": "expression", "loc": [127, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L119_C0", "vector": [8, 1, 0.6791, 0.0053, 1, 0.61, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Only web2py's admin, examples & welcome applications have been added\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:If_L131_C0", "label": "if", "type": "if", "loc": [131, 137], "level": 0, "parent": null, "vector": [4, 0, 0.7166, 0.0374, 0, 0.66, 0.8293, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if copy_site_packages:\n #copy site-packages\n copy_folders('site-packages', 'site-packages')\nelse:\n #no worries, web2py will create the (empty) folder first run\n print(\"Skipping site-packages\")\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L133_C4", "label": "copy_folders()", "type": "expression", "loc": [133, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L131_C0", "vector": [8, 1, 0.7112, 0.0053, 1, 0.36, 0.0, 628, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "copy_folders", "arg_names": [], "import_names": [], "rhs_call_name": "copy_folders", "annotation": ""}, "snippet": " copy_folders('site-packages', 'site-packages')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L136_C4", "label": "print()", "type": "expression", "loc": [136, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L131_C0", "vector": [8, 1, 0.7273, 0.0053, 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(\"Skipping site-packages\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:If_L140_C0", "label": "if", "type": "if", "loc": [140, 146], "level": 0, "parent": null, "vector": [4, 0, 0.7647, 0.0374, 0, 0.66, 0.8537, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if copy_scripts:\n #copy scripts\n copy_folders('scripts', 'scripts')\nelse:\n #no worries, web2py will create the (empty) folder first run\n print(\"Skipping scripts\")\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L142_C4", "label": "copy_folders()", "type": "expression", "loc": [142, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L140_C0", "vector": [8, 1, 0.7594, 0.0053, 1, 0.99, 0.0, 628, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "copy_folders", "arg_names": [], "import_names": [], "rhs_call_name": "copy_folders", "annotation": ""}, "snippet": " copy_folders('scripts', 'scripts')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L145_C4", "label": "print()", "type": "expression", "loc": [145, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L140_C0", "vector": [8, 1, 0.7754, 0.0053, 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(\"Skipping scripts\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:FunctionDef_L150_C0", "label": "recursive_zip", "type": "function", "loc": [150, 156], "level": 0, "parent": null, "vector": [2, 0, 0.8182, 0.0374, 0, 0.66, 0.878, 5, 0, 3, 0, 0, 0, 0, 9], "semantic": {"name": "recursive_zip", "arg_names": ["zipf", "directory", "folder"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def recursive_zip(zipf, directory, folder=\"\"):\n for item in os.listdir(directory):\n if os.path.isfile(os.path.join(directory, item)):\n zipf.write(os.path.join(directory, item), folder + os.sep + item)\n elif os.path.isdir(os.path.join(directory, item)):\n recursive_zip(\n zipf, os.path.join(directory, item), folder + os.sep + item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:For_L151_C4", "label": "for item", "type": "for", "loc": [151, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:FunctionDef_L150_C0", "vector": [6, 1, 0.8209, 0.0321, 1, 0.74, 0.0, 434, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in os.listdir(directory):\n if os.path.isfile(os.path.join(directory, item)):\n zipf.write(os.path.join(directory, item), folder + os.sep + item)\n elif os.path.isdir(os.path.join(directory, item)):\n recursive_zip(\n zipf, os.path.join(directory, item), folder + os.sep + item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:If_L152_C8", "label": "if", "type": "if", "loc": [152, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:For_L151_C4", "vector": [4, 2, 0.8235, 0.0267, 2, 0.73, 0.0, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.isfile(os.path.join(directory, item)):\n zipf.write(os.path.join(directory, item), folder + os.sep + item)\n elif os.path.isdir(os.path.join(directory, item)):\n recursive_zip(\n zipf, os.path.join(directory, item), folder + os.sep + item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L153_C12", "label": "write()", "type": "expression", "loc": [153, 153], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L152_C8", "vector": [8, 3, 0.8182, 0.0053, 3, 0.64, 0.0, 837, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " zipf.write(os.path.join(directory, item), folder + os.sep + item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:If_L154_C8", "label": "if", "type": "if", "loc": [154, 156], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L152_C8", "vector": [4, 3, 0.8289, 0.016, 3, 0.64, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif os.path.isdir(os.path.join(directory, item)):\n recursive_zip(\n zipf, os.path.join(directory, item), folder + os.sep + item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L155_C12", "label": "recursive_zip()", "type": "expression", "loc": [155, 156], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L154_C8", "vector": [8, 4, 0.8316, 0.0107, 4, 0.36, 0.0, 5, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "recursive_zip", "arg_names": [], "import_names": [], "rhs_call_name": "recursive_zip", "annotation": ""}, "snippet": " recursive_zip(\n zipf, os.path.join(directory, item), folder + os.sep + item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:If_L160_C0", "label": "if", "type": "if", "loc": [160, 173], "level": 0, "parent": null, "vector": [4, 0, 0.8904, 0.0749, 0, 0.66, 0.9024, 0, 2, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if make_zip:\n #to keep consistent with how official web2py windows zip file is setup,\n #create a web2py folder & copy dist's files into it\n shutil.copytree('dist', 'zip_temp/web2py')\n #create zip file\n #use filename specified via command line\n zipf = zipfile.ZipFile(\n zip_filename + \".zip\", \"w\", compression=zipfile.ZIP_DEFLATED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L163_C4", "label": "copytree()", "type": "expression", "loc": [163, 163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L160_C0", "vector": [8, 1, 0.8717, 0.0053, 1, 0.98, 0.0, 739, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "copytree", "arg_names": [], "import_names": [], "rhs_call_name": "copytree", "annotation": ""}, "snippet": " shutil.copytree('dist', 'zip_temp/web2py')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Assign_L166_C4", "label": "zipf = ZipFile()", "type": "assigned_variable", "loc": [166, 167], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L160_C0", "vector": [14, 1, 0.8904, 0.0107, 1, 0.98, 0.1667, 289, 3, 3, 0, 0, 299, 10, 1], "semantic": {"name": "zipf", "arg_names": [], "import_names": [], "rhs_call_name": "ZipFile", "annotation": ""}, "snippet": " zipf = zipfile.ZipFile(\n zip_filename + \".zip\", \"w\", compression=zipfile.ZIP_DEFLATED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Assign_L168_C4", "label": "path =", "type": "assigned_variable", "loc": [168, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L160_C0", "vector": [14, 1, 0.8984, 0.0053, 1, 0.98, 0.3333, 358, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = 'zip_temp' # just temp so the web2py directory is included in our zip file"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L169_C4", "label": "recursive_zip()", "type": "expression", "loc": [169, 170], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L160_C0", "vector": [8, 1, 0.9064, 0.0107, 1, 0.98, 0.5, 5, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "recursive_zip", "arg_names": [], "import_names": [], "rhs_call_name": "recursive_zip", "annotation": ""}, "snippet": " recursive_zip(\n zipf, path) # leave the first folder as None, as path is root."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L171_C4", "label": "close()", "type": "expression", "loc": [171, 171], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L160_C0", "vector": [8, 1, 0.9144, 0.0053, 1, 0.98, 0.6667, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " zipf.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L172_C4", "label": "rmtree()", "type": "expression", "loc": [172, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L160_C0", "vector": [8, 1, 0.9198, 0.0053, 1, 0.98, 0.8333, 317, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "rmtree", "arg_names": [], "import_names": [], "rhs_call_name": "rmtree", "annotation": ""}, "snippet": " shutil.rmtree('zip_temp')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L173_C4", "label": "print()", "type": "expression", "loc": [173, 173], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L160_C0", "vector": [8, 1, 0.9251, 0.0053, 1, 0.98, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"You may extract the archive anywhere and then run web2py/web2py.exe\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:If_L176_C0", "label": "if", "type": "if", "loc": [176, 180], "level": 0, "parent": null, "vector": [4, 0, 0.9519, 0.0267, 0, 0.66, 0.9268, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if remove_build_files:\n shutil.rmtree('build')\n shutil.rmtree('deposit')\n shutil.rmtree('dist')\n print(\"py2exe build files removed\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L177_C4", "label": "rmtree()", "type": "expression", "loc": [177, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L176_C0", "vector": [8, 1, 0.9465, 0.0053, 1, 0.54, 0.0, 317, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "rmtree", "arg_names": [], "import_names": [], "rhs_call_name": "rmtree", "annotation": ""}, "snippet": " shutil.rmtree('build')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L178_C4", "label": "rmtree()", "type": "expression", "loc": [178, 178], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L176_C0", "vector": [8, 1, 0.9519, 0.0053, 1, 0.54, 0.3333, 317, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "rmtree", "arg_names": [], "import_names": [], "rhs_call_name": "rmtree", "annotation": ""}, "snippet": " shutil.rmtree('deposit')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L179_C4", "label": "rmtree()", "type": "expression", "loc": [179, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L176_C0", "vector": [8, 1, 0.9572, 0.0053, 1, 0.54, 0.6667, 317, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "rmtree", "arg_names": [], "import_names": [], "rhs_call_name": "rmtree", "annotation": ""}, "snippet": " shutil.rmtree('dist')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L180_C4", "label": "print()", "type": "expression", "loc": [180, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L176_C0", "vector": [8, 1, 0.9626, 0.0053, 1, 0.54, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"py2exe build files removed\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:If_L183_C0", "label": "if", "type": "if", "loc": [183, 184], "level": 0, "parent": null, "vector": [4, 0, 0.9813, 0.0107, 0, 0.66, 0.9512, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if not make_zip and not remove_build_files:\n print(\"Your Windows binary & associated files can also be found in /dist\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L184_C4", "label": "print()", "type": "expression", "loc": [184, 184], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_442:If_L183_C0", "vector": [8, 1, 0.984, 0.0053, 1, 0.29, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Your Windows binary & associated files can also be found in /dist\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L186_C0", "label": "print()", "type": "expression", "loc": [186, 186], "level": 0, "parent": null, "vector": [8, 0, 0.9947, 0.0053, 0, 0.66, 0.9756, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"Finished!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L187_C0", "label": "print()", "type": "expression", "loc": [187, 187], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0053, 0, 0.66, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"Enjoy web2py \" + web2py_version_line)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Try_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:Try_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:Try_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:If_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L95_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:For_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:For_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Assign_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:For_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:For_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Try_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:Try_L111_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L112_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:Try_L111_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L114_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L131_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L131_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L140_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L140_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:FunctionDef_L150_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:For_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:For_L151_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_442:If_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L152_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L152_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_442:If_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L154_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L155_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L160_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L160_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Assign_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L160_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Assign_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L160_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L160_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L171_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L160_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L160_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L177_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L180_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_442:If_L183_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_442:Expr_L184_C4"}] |
#!/usr/bin/env python
import os
import sys
"""
Author: Christopher Steel on behalf of Voice of Access
Copyright: Copyrighted (c) by Massimo Di Pierro (2007-2013)
web2py_clone becomes part of the web2py distribution available
on Pypi via 'pip install web2py'
web2py_clone is one of multiple commands that become available after running
'pip install web2py' in a virtual environment. It requires
mercurial to be installed in the virtual environment.
web2py_clone creates a local clone from the Web2py google code
project in the directory "./web2py," a directory called web2py
one directory up from the location of this script.
./bin/web2py_clone
./web2py
"""
def main():
iwd = cwd = os.getcwd() # set initial and current working directories
script_filename = os.path.realpath(__file__)
script_dirname = os.path.dirname(script_filename)
try:
print ("cwd now: %s" % cwd)
except:
print ("command failed %s" % cwd)
try:
os.chdir(script_dirname)
cwd = os.getcwd()
print ("cwd now: %s" % cwd)
source = "https://code.google.com/p/web2py/"
target = os.path.join('..','web2py')
print ("attempting to clone %s" % source)
print ("to %s" % target)
if os.path.isdir(target):
print ("found directory called web2py at %s" % target)
print ("is web2py already installed?")
print ("aborting clone attempt")
else:
os.system("hg clone %s %s" % (source,target))
os.chdir(iwd) # return to our initial working directory
cwd = iwd # set current working directory
except:
print ("web2py-clone failed in second try statement %s" % cwd)
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_443 | 28 | 55 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_443:Import_L2_C0", "label": "os import os", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0364, 0.0182, 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_443:Import_L3_C0", "label": "sys import sys", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0545, 0.0182, 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_443:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 22], "level": 0, "parent": null, "vector": [8, 0, 0.2455, 0.3273, 0, 0.66, 0.5, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nAuthor: Christopher Steel on behalf of Voice of Access\nCopyright: Copyrighted (c) by Massimo Di Pierro (2007-2013)\n\nweb2py_clone becomes part of the web2py distribution available\non Pypi via 'pip install web2py'\n\nweb2py_clone is one of multiple commands that become available after running"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:FunctionDef_L25_C0", "label": "main", "type": "function", "loc": [25, 51], "level": 0, "parent": null, "vector": [2, 0, 0.6909, 0.4909, 0, 0.66, 0.75, 624, 0, 0, 0, 0, 0, 0, 18], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n iwd = cwd = os.getcwd() # set initial and current working directories\n script_filename = os.path.realpath(__file__)\n script_dirname = os.path.dirname(script_filename)\n try:\n print (\"cwd now: %s\" % cwd)\n except:\n print (\"command failed %s\" % cwd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:Assign_L26_C4", "label": "iwd = getcwd()", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:FunctionDef_L25_C0", "vector": [14, 1, 0.4727, 0.0182, 1, 0.89, 0.0, 199, 3, 0, 0, 0, 320, 10, 1], "semantic": {"name": "iwd", "arg_names": [], "import_names": [], "rhs_call_name": "getcwd", "annotation": ""}, "snippet": " iwd = cwd = os.getcwd() # set initial and current working directories"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:Assign_L27_C4", "label": "script_filename = realpath()", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:FunctionDef_L25_C0", "vector": [14, 1, 0.4909, 0.0182, 1, 0.89, 0.25, 592, 3, 1, 0, 0, 45, 10, 1], "semantic": {"name": "script_filename", "arg_names": [], "import_names": [], "rhs_call_name": "realpath", "annotation": ""}, "snippet": " script_filename = os.path.realpath(__file__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:Assign_L28_C4", "label": "script_dirname = dirname()", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:FunctionDef_L25_C0", "vector": [14, 1, 0.5091, 0.0182, 1, 0.89, 0.5, 294, 3, 1, 0, 0, 959, 10, 1], "semantic": {"name": "script_dirname", "arg_names": [], "import_names": [], "rhs_call_name": "dirname", "annotation": ""}, "snippet": " script_dirname = os.path.dirname(script_filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L29_C4", "label": "try", "type": "try", "loc": [29, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:FunctionDef_L25_C0", "vector": [7, 1, 0.5545, 0.0727, 1, 0.89, 0.75, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n print (\"cwd now: %s\" % cwd)\n except:\n print (\"command failed %s\" % cwd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L30_C8", "label": "print()", "type": "expression", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L29_C4", "vector": [8, 2, 0.5455, 0.0182, 2, 0.83, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print (\"cwd now: %s\" % cwd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L32_C8", "label": "print()", "type": "expression", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L29_C4", "vector": [8, 2, 0.5818, 0.0182, 2, 0.83, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print (\"command failed %s\" % cwd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L33_C4", "label": "try", "type": "try", "loc": [33, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:FunctionDef_L25_C0", "vector": [7, 1, 0.7636, 0.3455, 1, 0.89, 1.0, 0, 0, 1, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n os.chdir(script_dirname)\n cwd = os.getcwd()\n print (\"cwd now: %s\" % cwd)\n source = \"https://code.google.com/p/web2py/\"\n target = os.path.join('..','web2py')\n print (\"attempting to clone %s\" % source)\n print (\"to %s\" % target)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L34_C8", "label": "chdir()", "type": "expression", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L33_C4", "vector": [8, 2, 0.6182, 0.0182, 2, 0.72, 0.0, 122, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "chdir", "arg_names": [], "import_names": [], "rhs_call_name": "chdir", "annotation": ""}, "snippet": " os.chdir(script_dirname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:Assign_L35_C8", "label": "cwd = getcwd()", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L33_C4", "vector": [14, 2, 0.6364, 0.0182, 2, 0.72, 0.1429, 898, 3, 0, 0, 0, 320, 10, 1], "semantic": {"name": "cwd", "arg_names": [], "import_names": [], "rhs_call_name": "getcwd", "annotation": ""}, "snippet": " cwd = os.getcwd()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L36_C8", "label": "print()", "type": "expression", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L33_C4", "vector": [8, 2, 0.6545, 0.0182, 2, 0.72, 0.2857, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print (\"cwd now: %s\" % cwd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:Assign_L37_C8", "label": "source =", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L33_C4", "vector": [14, 2, 0.6727, 0.0182, 2, 0.72, 0.4286, 703, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "source", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source = \"https://code.google.com/p/web2py/\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:Assign_L38_C8", "label": "target = join()", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L33_C4", "vector": [14, 2, 0.6909, 0.0182, 2, 0.72, 0.5714, 766, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "target", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " target = os.path.join('..','web2py')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L39_C8", "label": "print()", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L33_C4", "vector": [8, 2, 0.7091, 0.0182, 2, 0.72, 0.7143, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print (\"attempting to clone %s\" % source)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L40_C8", "label": "print()", "type": "expression", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L33_C4", "vector": [8, 2, 0.7273, 0.0182, 2, 0.72, 0.8571, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print (\"to %s\" % target)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:If_L41_C8", "label": "if", "type": "if", "loc": [41, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L33_C4", "vector": [4, 2, 0.8091, 0.1455, 2, 0.72, 1.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.isdir(target):\n print (\"found directory called web2py at %s\" % target)\n print (\"is web2py already installed?\")\n print (\"aborting clone attempt\")\n else:\n os.system(\"hg clone %s %s\" % (source,target))\n os.chdir(iwd) # return to our initial working directory\n cwd = iwd # set current working directory "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L42_C12", "label": "print()", "type": "expression", "loc": [42, 42], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:If_L41_C8", "vector": [8, 3, 0.7636, 0.0182, 3, 0.14, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print (\"found directory called web2py at %s\" % target)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L43_C12", "label": "print()", "type": "expression", "loc": [43, 43], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:If_L41_C8", "vector": [8, 3, 0.7818, 0.0182, 3, 0.14, 0.2, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print (\"is web2py already installed?\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L44_C12", "label": "print()", "type": "expression", "loc": [44, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:If_L41_C8", "vector": [8, 3, 0.8, 0.0182, 3, 0.14, 0.4, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print (\"aborting clone attempt\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L46_C12", "label": "system()", "type": "expression", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:If_L41_C8", "vector": [8, 3, 0.8364, 0.0182, 3, 0.14, 0.6, 856, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "system", "arg_names": [], "import_names": [], "rhs_call_name": "system", "annotation": ""}, "snippet": " os.system(\"hg clone %s %s\" % (source,target))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L47_C12", "label": "chdir()", "type": "expression", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:If_L41_C8", "vector": [8, 3, 0.8545, 0.0182, 3, 0.14, 0.8, 122, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "chdir", "arg_names": [], "import_names": [], "rhs_call_name": "chdir", "annotation": ""}, "snippet": " os.chdir(iwd) # return to our initial working directory"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:Assign_L48_C12", "label": "cwd =", "type": "assigned_variable", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:If_L41_C8", "vector": [14, 3, 0.8727, 0.0182, 3, 0.14, 1.0, 898, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cwd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cwd = iwd # set current working directory "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L51_C8", "label": "print()", "type": "expression", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L33_C4", "vector": [8, 2, 0.9273, 0.0182, 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 (\"web2py-clone failed in second try statement %s\" % cwd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_443:If_L53_C0", "label": "if", "type": "if", "loc": [53, 54], "level": 0, "parent": null, "vector": [4, 0, 0.9727, 0.0364, 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_443:Expr_L54_C4", "label": "main()", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_443:If_L53_C0", "vector": [8, 1, 0.9818, 0.0182, 1, 0.26, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_443:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_443:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_443:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_443:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_443:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_443:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_443:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_443:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_443:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_443:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_443:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_443:If_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_443:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L42_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_443:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_443:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L44_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_443:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_443:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_443:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_443:Assign_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_443:Try_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_443:If_L53_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_443:Expr_L54_C4"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
path = os.getcwd()
try:
if sys.argv[1] and os.path.exists(sys.argv[1]):
path = sys.argv[1]
except:
pass
os.chdir(path)
sys.path = [path]+[p for p in sys.path if not p==path]
# import gluon.import_all ##### This should be uncommented for py2exe.py
import gluon.widget
def main():
# Start Web2py and Web2py cron service!
gluon.widget.start(cron=True)
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_444 | 13 | 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_444:Import_L4_C0", "label": "os import os", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1667, 0.0417, 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_444:Import_L5_C0", "label": "sys import sys", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.2083, 0.0417, 0, 0.66, 0.125, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_444:Assign_L7_C0", "label": "path = getcwd()", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.2917, 0.0417, 0, 0.66, 0.25, 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_444:Try_L8_C0", "label": "try", "type": "try", "loc": [8, 12], "level": 0, "parent": null, "vector": [7, 0, 0.4167, 0.2083, 0, 0.66, 0.375, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n if sys.argv[1] and os.path.exists(sys.argv[1]):\n path = sys.argv[1]\nexcept:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_444:If_L9_C4", "label": "if", "type": "if", "loc": [9, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_444:Try_L8_C0", "vector": [4, 1, 0.3958, 0.0833, 1, 0.74, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if sys.argv[1] and os.path.exists(sys.argv[1]):\n path = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_444:Assign_L10_C8", "label": "path =", "type": "assigned_variable", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_444:If_L9_C4", "vector": [14, 2, 0.4167, 0.0417, 2, 0.22, 0.0, 358, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_444:Expr_L14_C0", "label": "chdir()", "type": "expression", "loc": [14, 14], "level": 0, "parent": null, "vector": [8, 0, 0.5833, 0.0417, 0, 0.66, 0.5, 122, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "chdir", "arg_names": [], "import_names": [], "rhs_call_name": "chdir", "annotation": ""}, "snippet": "os.chdir(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_444:Assign_L15_C0", "label": "sys.path =", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.625, 0.0417, 0, 0.66, 0.625, 909, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sys.path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "sys.path = [path]+[p for p in sys.path if not p==path]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_444:Import_L17_C0", "label": "gluon.widget import gluon.widget", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.7083, 0.0417, 0, 0.66, 0.75, 624, 0, 1, 0, 0, 624, 0, 0], "semantic": {"name": "gluon.widget", "arg_names": [], "import_names": ["gluon.widget"], "rhs_call_name": "", "annotation": ""}, "snippet": "import gluon.widget"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_444:FunctionDef_L19_C0", "label": "main", "type": "function", "loc": [19, 21], "level": 0, "parent": null, "vector": [2, 0, 0.8333, 0.125, 0, 0.66, 0.875, 624, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n # Start Web2py and Web2py cron service!\n gluon.widget.start(cron=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_444:Expr_L21_C4", "label": "start()", "type": "expression", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_444:FunctionDef_L19_C0", "vector": [8, 1, 0.875, 0.0417, 1, 0.54, 0.0, 511, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " gluon.widget.start(cron=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_444:If_L23_C0", "label": "if", "type": "if", "loc": [23, 24], "level": 0, "parent": null, "vector": [4, 0, 0.9792, 0.0833, 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_444:Expr_L24_C4", "label": "main()", "type": "expression", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_444:If_L23_C0", "vector": [8, 1, 1.0, 0.0417, 1, 0.02, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_444:Try_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_444:If_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_444:If_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_444:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_444:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_444:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_444:If_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_444:Expr_L24_C4"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# portalocker.py
# Cross-platform (posix/nt) API for flock-style file locking.
# Requires python 1.5.2 or better.
"""
Cross-platform (posix/nt) API for flock-style file locking.
Synopsis:
import portalocker
file = open(\"somefile\", \"r+\")
portalocker.lock(file, portalocker.LOCK_EX)
file.seek(12)
file.write(\"foo\")
file.close()
If you know what you're doing, you may choose to
portalocker.unlock(file)
before closing the file, but why?
Methods:
lock( file, flags )
unlock( file )
Constants:
LOCK_EX
LOCK_SH
LOCK_NB
I learned the win32 technique for locking files from sample code
provided by John Nielsen <nielsenjf@my-deja.com> in the documentation
that accompanies the win32 modules.
Author: Jonathan Feinberg <jdf@pobox.com>
Version: $Id: portalocker.py,v 1.3 2001/05/29 18:47:55 Administrator Exp $
"""
import logging
import platform
logger = logging.getLogger("web2py")
os_locking = None
try:
import google.appengine
os_locking = 'gae'
except:
try:
import fcntl
os_locking = 'posix'
except:
try:
import win32con
import win32file
import pywintypes
os_locking = 'windows'
except:
pass
if os_locking == 'windows':
LOCK_EX = win32con.LOCKFILE_EXCLUSIVE_LOCK
LOCK_SH = 0 # the default
LOCK_NB = win32con.LOCKFILE_FAIL_IMMEDIATELY
# is there any reason not to reuse the following structure?
__overlapped = pywintypes.OVERLAPPED()
def lock(file, flags):
hfile = win32file._get_osfhandle(file.fileno())
win32file.LockFileEx(hfile, flags, 0, 0x7fff0000, __overlapped)
def unlock(file):
hfile = win32file._get_osfhandle(file.fileno())
win32file.UnlockFileEx(hfile, 0, 0x7fff0000, __overlapped)
elif os_locking == 'posix':
LOCK_EX = fcntl.LOCK_EX
LOCK_SH = fcntl.LOCK_SH
LOCK_NB = fcntl.LOCK_NB
def lock(file, flags):
fcntl.flock(file.fileno(), flags)
def unlock(file):
fcntl.flock(file.fileno(), fcntl.LOCK_UN)
else:
if platform.system() == 'Windows':
logger.error('no file locking, you must install the win32 extensions from: http://sourceforge.net/projects/pywin32/files/')
elif os_locking != 'gae':
logger.debug('no file locking, this will cause problems')
LOCK_EX = None
LOCK_SH = None
LOCK_NB = None
def lock(file, flags):
pass
def unlock(file):
pass
class LockedFile(object):
def __init__(self, filename, mode='rb'):
self.filename = filename
self.mode = mode
self.file = None
if 'r' in mode:
self.file = open(filename, mode)
lock(self.file, LOCK_SH)
elif 'w' in mode or 'a' in mode:
self.file = open(filename, mode.replace('w', 'a'))
lock(self.file, LOCK_EX)
if not 'a' in mode:
self.file.seek(0)
self.file.truncate()
else:
raise RuntimeError("invalid LockedFile(...,mode)")
def read(self, size=None):
return self.file.read() if size is None else self.file.read(size)
def readline(self):
return self.file.readline()
def readlines(self):
return self.file.readlines()
def write(self, data):
self.file.write(data)
self.file.flush()
def close(self):
if not self.file is None:
unlock(self.file)
self.file.close()
self.file = None
def __del__(self):
if not self.file is None:
self.close()
def read_locked(filename):
fp = LockedFile(filename, 'r')
data = fp.read()
fp.close()
return data
def write_locked(filename, data):
fp = LockedFile(filename, 'w')
data = fp.write(data)
fp.close()
if __name__ == '__main__':
f = LockedFile('test.txt', mode='wb')
f.write('test ok')
f.close()
f = LockedFile('test.txt', mode='rb')
sys.stdout.write(f.read()+'\n')
f.close()
| ajibawa-2023/Python-Code-Large/train/row_446 | 91 | 171 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L7_C0", "label": "expression", "type": "expression", "loc": [7, 42], "level": 0, "parent": null, "vector": [8, 0, 0.1433, 0.2105, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nCross-platform (posix/nt) API for flock-style file locking.\n\nSynopsis:\n\n import portalocker\n file = open(\\\"somefile\\\", \\\"r+\\\")\n portalocker.lock(file, portalocker.LOCK_EX)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Import_L44_C0", "label": "logging import logging", "type": "import", "loc": [44, 44], "level": 0, "parent": null, "vector": [1, 0, 0.2573, 0.0058, 0, 0.66, 0.1, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Import_L45_C0", "label": "platform import platform", "type": "import", "loc": [45, 45], "level": 0, "parent": null, "vector": [1, 0, 0.2632, 0.0058, 0, 0.66, 0.2, 590, 0, 1, 0, 0, 590, 0, 0], "semantic": {"name": "platform", "arg_names": [], "import_names": ["platform"], "rhs_call_name": "", "annotation": ""}, "snippet": "import platform"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L46_C0", "label": "logger = getLogger()", "type": "assigned_variable", "loc": [46, 46], "level": 0, "parent": null, "vector": [14, 0, 0.269, 0.0058, 0, 0.66, 0.3, 532, 3, 1, 0, 0, 71, 10, 1], "semantic": {"name": "logger", "arg_names": [], "import_names": [], "rhs_call_name": "getLogger", "annotation": ""}, "snippet": "logger = logging.getLogger(\"web2py\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L48_C0", "label": "os_locking =", "type": "assigned_variable", "loc": [48, 48], "level": 0, "parent": null, "vector": [14, 0, 0.2807, 0.0058, 0, 0.66, 0.4, 143, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "os_locking", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "os_locking = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L49_C0", "label": "try", "type": "try", "loc": [49, 63], "level": 0, "parent": null, "vector": [7, 0, 0.3275, 0.0877, 0, 0.66, 0.5, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n import google.appengine\n os_locking = 'gae'\nexcept:\n try:\n import fcntl\n os_locking = 'posix'\n except:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Import_L50_C4", "label": "google.appengine import google.appengine", "type": "import", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L49_C0", "vector": [1, 1, 0.2924, 0.0058, 1, 0.93, 0.0, 776, 0, 1, 0, 0, 776, 0, 0], "semantic": {"name": "google.appengine", "arg_names": [], "import_names": ["google.appengine"], "rhs_call_name": "", "annotation": ""}, "snippet": " import google.appengine"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L51_C4", "label": "os_locking =", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L49_C0", "vector": [14, 1, 0.2982, 0.0058, 1, 0.93, 1.0, 143, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "os_locking", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " os_locking = 'gae'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L53_C4", "label": "try", "type": "try", "loc": [53, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L49_C0", "vector": [7, 1, 0.3392, 0.0643, 1, 0.93, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n import fcntl\n os_locking = 'posix'\n except:\n try:\n import win32con\n import win32file\n import pywintypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Import_L54_C8", "label": "fcntl import fcntl", "type": "import", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L53_C4", "vector": [1, 2, 0.3158, 0.0058, 2, 0.47, 0.0, 488, 0, 1, 0, 0, 488, 0, 0], "semantic": {"name": "fcntl", "arg_names": [], "import_names": ["fcntl"], "rhs_call_name": "", "annotation": ""}, "snippet": " import fcntl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L55_C8", "label": "os_locking =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L53_C4", "vector": [14, 2, 0.3216, 0.0058, 2, 0.47, 1.0, 143, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "os_locking", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " os_locking = 'posix'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L57_C8", "label": "try", "type": "try", "loc": [57, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L53_C4", "vector": [7, 2, 0.3509, 0.0409, 2, 0.47, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n import win32con\n import win32file\n import pywintypes\n os_locking = 'windows'\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Import_L58_C12", "label": "win32con import win32con", "type": "import", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L57_C8", "vector": [1, 3, 0.3392, 0.0058, 3, 0.62, 0.0, 507, 0, 1, 0, 0, 507, 0, 0], "semantic": {"name": "win32con", "arg_names": [], "import_names": ["win32con"], "rhs_call_name": "", "annotation": ""}, "snippet": " import win32con"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Import_L59_C12", "label": "win32file import win32file", "type": "import", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L57_C8", "vector": [1, 3, 0.345, 0.0058, 3, 0.62, 0.3333, 815, 0, 1, 0, 0, 815, 0, 0], "semantic": {"name": "win32file", "arg_names": [], "import_names": ["win32file"], "rhs_call_name": "", "annotation": ""}, "snippet": " import win32file"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Import_L60_C12", "label": "pywintypes import pywintypes", "type": "import", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L57_C8", "vector": [1, 3, 0.3509, 0.0058, 3, 0.62, 0.6667, 491, 0, 1, 0, 0, 491, 0, 0], "semantic": {"name": "pywintypes", "arg_names": [], "import_names": ["pywintypes"], "rhs_call_name": "", "annotation": ""}, "snippet": " import pywintypes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L61_C12", "label": "os_locking =", "type": "assigned_variable", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L57_C8", "vector": [14, 3, 0.3567, 0.0058, 3, 0.62, 1.0, 143, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "os_locking", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " os_locking = 'windows'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:If_L65_C0", "label": "if", "type": "if", "loc": [65, 109], "level": 0, "parent": null, "vector": [4, 0, 0.5088, 0.2632, 0, 0.66, 0.6, 0, 0, 0, 0, 0, 0, 0, 14], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if os_locking == 'windows':\n LOCK_EX = win32con.LOCKFILE_EXCLUSIVE_LOCK\n LOCK_SH = 0 # the default\n LOCK_NB = win32con.LOCKFILE_FAIL_IMMEDIATELY\n\n # is there any reason not to reuse the following structure?\n\n __overlapped = pywintypes.OVERLAPPED()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L66_C4", "label": "LOCK_EX =", "type": "assigned_variable", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L65_C0", "vector": [14, 1, 0.386, 0.0058, 1, 0.85, 0.0, 814, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "LOCK_EX", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " LOCK_EX = win32con.LOCKFILE_EXCLUSIVE_LOCK"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L67_C4", "label": "LOCK_SH =", "type": "assigned_variable", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L65_C0", "vector": [14, 1, 0.3918, 0.0058, 1, 0.85, 0.1667, 980, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "LOCK_SH", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " LOCK_SH = 0 # the default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L68_C4", "label": "LOCK_NB =", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L65_C0", "vector": [14, 1, 0.3977, 0.0058, 1, 0.85, 0.3333, 680, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "LOCK_NB", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " LOCK_NB = win32con.LOCKFILE_FAIL_IMMEDIATELY"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L72_C4", "label": "__overlapped = OVERLAPPED()", "type": "assigned_variable", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L65_C0", "vector": [14, 1, 0.4211, 0.0058, 1, 0.85, 0.5, 208, 3, 0, 0, 0, 678, 10, 1], "semantic": {"name": "__overlapped", "arg_names": [], "import_names": [], "rhs_call_name": "OVERLAPPED", "annotation": ""}, "snippet": " __overlapped = pywintypes.OVERLAPPED()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L74_C4", "label": "lock", "type": "function", "loc": [74, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L65_C0", "vector": [2, 1, 0.4386, 0.0175, 1, 0.85, 0.6667, 104, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "lock", "arg_names": ["file", "flags"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lock(file, flags):\n hfile = win32file._get_osfhandle(file.fileno())\n win32file.LockFileEx(hfile, flags, 0, 0x7fff0000, __overlapped)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L75_C8", "label": "hfile = _get_osfhandle()", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L74_C4", "vector": [14, 2, 0.4386, 0.0058, 2, 0.63, 0.0, 214, 3, 1, 0, 0, 190, 10, 2], "semantic": {"name": "hfile", "arg_names": [], "import_names": [], "rhs_call_name": "_get_osfhandle", "annotation": ""}, "snippet": " hfile = win32file._get_osfhandle(file.fileno())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L76_C8", "label": "LockFileEx()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L74_C4", "vector": [8, 2, 0.4444, 0.0058, 2, 0.63, 1.0, 13, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "LockFileEx", "arg_names": [], "import_names": [], "rhs_call_name": "LockFileEx", "annotation": ""}, "snippet": " win32file.LockFileEx(hfile, flags, 0, 0x7fff0000, __overlapped)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L78_C4", "label": "unlock", "type": "function", "loc": [78, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L65_C0", "vector": [2, 1, 0.462, 0.0175, 1, 0.85, 0.8333, 612, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "unlock", "arg_names": ["file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def unlock(file):\n hfile = win32file._get_osfhandle(file.fileno())\n win32file.UnlockFileEx(hfile, 0, 0x7fff0000, __overlapped)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L79_C8", "label": "hfile = _get_osfhandle()", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L78_C4", "vector": [14, 2, 0.462, 0.0058, 2, 0.91, 0.0, 214, 3, 1, 0, 0, 190, 10, 2], "semantic": {"name": "hfile", "arg_names": [], "import_names": [], "rhs_call_name": "_get_osfhandle", "annotation": ""}, "snippet": " hfile = win32file._get_osfhandle(file.fileno())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L80_C8", "label": "UnlockFileEx()", "type": "expression", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L78_C4", "vector": [8, 2, 0.4678, 0.0058, 2, 0.91, 1.0, 879, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "UnlockFileEx", "arg_names": [], "import_names": [], "rhs_call_name": "UnlockFileEx", "annotation": ""}, "snippet": " win32file.UnlockFileEx(hfile, 0, 0x7fff0000, __overlapped)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "label": "if", "type": "if", "loc": [83, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L65_C0", "vector": [4, 1, 0.5614, 0.1579, 1, 0.85, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "elif os_locking == 'posix':\n LOCK_EX = fcntl.LOCK_EX\n LOCK_SH = fcntl.LOCK_SH\n LOCK_NB = fcntl.LOCK_NB\n\n def lock(file, flags):\n fcntl.flock(file.fileno(), flags)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L84_C4", "label": "LOCK_EX =", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "vector": [14, 2, 0.4912, 0.0058, 2, 0.4, 0.0, 814, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "LOCK_EX", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " LOCK_EX = fcntl.LOCK_EX"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L85_C4", "label": "LOCK_SH =", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "vector": [14, 2, 0.4971, 0.0058, 2, 0.4, 0.1, 980, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "LOCK_SH", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " LOCK_SH = fcntl.LOCK_SH"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L86_C4", "label": "LOCK_NB =", "type": "assigned_variable", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "vector": [14, 2, 0.5029, 0.0058, 2, 0.4, 0.2, 680, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "LOCK_NB", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " LOCK_NB = fcntl.LOCK_NB"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L88_C4", "label": "lock", "type": "function", "loc": [88, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "vector": [2, 2, 0.5175, 0.0117, 2, 0.4, 0.3, 104, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "lock", "arg_names": ["file", "flags"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lock(file, flags):\n fcntl.flock(file.fileno(), flags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L89_C8", "label": "flock()", "type": "expression", "loc": [89, 89], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L88_C4", "vector": [8, 3, 0.5205, 0.0058, 3, 0.93, 0.0, 839, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "flock", "arg_names": [], "import_names": [], "rhs_call_name": "flock", "annotation": ""}, "snippet": " fcntl.flock(file.fileno(), flags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L91_C4", "label": "unlock", "type": "function", "loc": [91, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "vector": [2, 2, 0.5351, 0.0117, 2, 0.4, 0.4, 612, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "unlock", "arg_names": ["file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def unlock(file):\n fcntl.flock(file.fileno(), fcntl.LOCK_UN)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L92_C8", "label": "flock()", "type": "expression", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L91_C4", "vector": [8, 3, 0.538, 0.0058, 3, 0.95, 0.0, 839, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "flock", "arg_names": [], "import_names": [], "rhs_call_name": "flock", "annotation": ""}, "snippet": " fcntl.flock(file.fileno(), fcntl.LOCK_UN)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:If_L96_C4", "label": "if", "type": "if", "loc": [96, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "vector": [4, 2, 0.5702, 0.0234, 2, 0.4, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if platform.system() == 'Windows':\n logger.error('no file locking, you must install the win32 extensions from: http://sourceforge.net/projects/pywin32/files/')\n elif os_locking != 'gae':\n logger.debug('no file locking, this will cause problems')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L97_C8", "label": "error()", "type": "expression", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L96_C4", "vector": [8, 3, 0.5673, 0.0058, 3, 0.78, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " logger.error('no file locking, you must install the win32 extensions from: http://sourceforge.net/projects/pywin32/files/')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:If_L98_C4", "label": "if", "type": "if", "loc": [98, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L96_C4", "vector": [4, 3, 0.576, 0.0117, 3, 0.78, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif os_locking != 'gae':\n logger.debug('no file locking, this will cause problems')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L99_C8", "label": "debug()", "type": "expression", "loc": [99, 99], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L98_C4", "vector": [8, 4, 0.5789, 0.0058, 4, 0.88, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " logger.debug('no file locking, this will cause problems')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L101_C4", "label": "LOCK_EX =", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "vector": [14, 2, 0.5906, 0.0058, 2, 0.4, 0.6, 814, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "LOCK_EX", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " LOCK_EX = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L102_C4", "label": "LOCK_SH =", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "vector": [14, 2, 0.5965, 0.0058, 2, 0.4, 0.7, 980, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "LOCK_SH", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " LOCK_SH = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L103_C4", "label": "LOCK_NB =", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "vector": [14, 2, 0.6023, 0.0058, 2, 0.4, 0.8, 680, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "LOCK_NB", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " LOCK_NB = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L105_C4", "label": "lock", "type": "function", "loc": [105, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "vector": [2, 2, 0.617, 0.0117, 2, 0.4, 0.9, 104, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "lock", "arg_names": ["file", "flags"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lock(file, flags):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L108_C4", "label": "unlock", "type": "function", "loc": [108, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "vector": [2, 2, 0.6345, 0.0117, 2, 0.4, 1.0, 612, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "unlock", "arg_names": ["file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def unlock(file):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:ClassDef_L112_C0", "label": "LockedFile", "type": "class", "loc": [112, 150], "level": 0, "parent": null, "vector": [3, 0, 0.7661, 0.2281, 0, 0.66, 0.7, 1, 0, 7, 0, 0, 186, 0, 17], "semantic": {"name": "LockedFile", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class LockedFile(object):\n def __init__(self, filename, mode='rb'):\n self.filename = filename\n self.mode = mode\n self.file = None\n if 'r' in mode:\n self.file = open(filename, mode)\n lock(self.file, LOCK_SH)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L113_C4", "label": "__init__", "type": "function", "loc": [113, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:ClassDef_L112_C0", "vector": [2, 1, 0.7018, 0.0877, 1, 0.0, 0.0, 555, 0, 3, 0, 0, 0, 0, 8], "semantic": {"name": "__init__", "arg_names": ["self", "filename", "mode"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, filename, mode='rb'):\n self.filename = filename\n self.mode = mode\n self.file = None\n if 'r' in mode:\n self.file = open(filename, mode)\n lock(self.file, LOCK_SH)\n elif 'w' in mode or 'a' in mode:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L114_C8", "label": "self.filename =", "type": "assigned_variable", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L113_C4", "vector": [14, 2, 0.6667, 0.0058, 2, 0.16, 0.0, 942, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.filename = filename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L115_C8", "label": "self.mode =", "type": "assigned_variable", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L113_C4", "vector": [14, 2, 0.6725, 0.0058, 2, 0.16, 0.3333, 474, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mode = mode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L116_C8", "label": "self.file =", "type": "assigned_variable", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L113_C4", "vector": [14, 2, 0.6784, 0.0058, 2, 0.16, 0.6667, 678, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.file = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:If_L117_C8", "label": "if", "type": "if", "loc": [117, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L113_C4", "vector": [4, 2, 0.7135, 0.0643, 2, 0.16, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'r' in mode:\n self.file = open(filename, mode)\n lock(self.file, LOCK_SH)\n elif 'w' in mode or 'a' in mode:\n self.file = open(filename, mode.replace('w', 'a'))\n lock(self.file, LOCK_EX)\n if not 'a' in mode:\n self.file.seek(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L118_C12", "label": "self.file = open()", "type": "assigned_variable", "loc": [118, 118], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L117_C8", "vector": [14, 3, 0.6901, 0.0058, 3, 0.11, 0.0, 678, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "self.file", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " self.file = open(filename, mode)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L119_C12", "label": "lock()", "type": "expression", "loc": [119, 119], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L117_C8", "vector": [8, 3, 0.6959, 0.0058, 3, 0.11, 0.5, 104, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "lock", "arg_names": [], "import_names": [], "rhs_call_name": "lock", "annotation": ""}, "snippet": " lock(self.file, LOCK_SH)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:If_L120_C8", "label": "if", "type": "if", "loc": [120, 127], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L117_C8", "vector": [4, 3, 0.7222, 0.0468, 3, 0.11, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif 'w' in mode or 'a' in mode:\n self.file = open(filename, mode.replace('w', 'a'))\n lock(self.file, LOCK_EX)\n if not 'a' in mode:\n self.file.seek(0)\n self.file.truncate()\n else:\n raise RuntimeError(\"invalid LockedFile(...,mode)\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L121_C12", "label": "self.file = open()", "type": "assigned_variable", "loc": [121, 121], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L120_C8", "vector": [14, 4, 0.7076, 0.0058, 4, 0.96, 0.0, 678, 3, 2, 0, 0, 693, 10, 2], "semantic": {"name": "self.file", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " self.file = open(filename, mode.replace('w', 'a'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L122_C12", "label": "lock()", "type": "expression", "loc": [122, 122], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L120_C8", "vector": [8, 4, 0.7135, 0.0058, 4, 0.96, 0.5, 104, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "lock", "arg_names": [], "import_names": [], "rhs_call_name": "lock", "annotation": ""}, "snippet": " lock(self.file, LOCK_EX)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:If_L123_C12", "label": "if", "type": "if", "loc": [123, 125], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L120_C8", "vector": [4, 4, 0.7251, 0.0175, 4, 0.96, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not 'a' in mode:\n self.file.seek(0)\n self.file.truncate()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L124_C16", "label": "seek()", "type": "expression", "loc": [124, 124], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L123_C12", "vector": [8, 5, 0.7251, 0.0058, 5, 0.44, 0.0, 66, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "seek", "arg_names": [], "import_names": [], "rhs_call_name": "seek", "annotation": ""}, "snippet": " self.file.seek(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L125_C16", "label": "truncate()", "type": "expression", "loc": [125, 125], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L123_C12", "vector": [8, 5, 0.731, 0.0058, 5, 0.44, 1.0, 39, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "truncate", "arg_names": [], "import_names": [], "rhs_call_name": "truncate", "annotation": ""}, "snippet": " self.file.truncate()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L129_C4", "label": "read", "type": "function", "loc": [129, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:ClassDef_L112_C0", "vector": [2, 1, 0.7573, 0.0117, 1, 0.0, 0.1667, 453, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "read", "arg_names": ["self", "size"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def read(self, size=None):\n return self.file.read() if size is None else self.file.read(size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Return_L130_C8", "label": "return", "type": "return", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L129_C4", "vector": [13, 2, 0.7602, 0.0058, 2, 0.86, 0.0, 0, 8, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.file.read() if size is None else self.file.read(size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L132_C4", "label": "readline", "type": "function", "loc": [132, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:ClassDef_L112_C0", "vector": [2, 1, 0.7749, 0.0117, 1, 0.0, 0.3333, 303, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "readline", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def readline(self):\n return self.file.readline()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Return_L133_C8", "label": "return", "type": "return", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L132_C4", "vector": [13, 2, 0.7778, 0.0058, 2, 0.03, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.file.readline()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L135_C4", "label": "readlines", "type": "function", "loc": [135, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:ClassDef_L112_C0", "vector": [2, 1, 0.7924, 0.0117, 1, 0.0, 0.5, 841, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "readlines", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def readlines(self):\n return self.file.readlines()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Return_L136_C8", "label": "return", "type": "return", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L135_C4", "vector": [13, 2, 0.7953, 0.0058, 2, 0.4, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.file.readlines()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L138_C4", "label": "write", "type": "function", "loc": [138, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:ClassDef_L112_C0", "vector": [2, 1, 0.8129, 0.0175, 1, 0.0, 0.6667, 837, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def write(self, data):\n self.file.write(data)\n self.file.flush()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L139_C8", "label": "write()", "type": "expression", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L138_C4", "vector": [8, 2, 0.8129, 0.0058, 2, 0.21, 0.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.file.write(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L140_C8", "label": "flush()", "type": "expression", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L138_C4", "vector": [8, 2, 0.8187, 0.0058, 2, 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": " self.file.flush()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L142_C4", "label": "close", "type": "function", "loc": [142, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:ClassDef_L112_C0", "vector": [2, 1, 0.8421, 0.0292, 1, 0.0, 0.8333, 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 if not self.file is None:\n unlock(self.file)\n self.file.close()\n self.file = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:If_L143_C8", "label": "if", "type": "if", "loc": [143, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L142_C4", "vector": [4, 2, 0.845, 0.0234, 2, 0.93, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.file is None:\n unlock(self.file)\n self.file.close()\n self.file = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L144_C12", "label": "unlock()", "type": "expression", "loc": [144, 144], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L143_C8", "vector": [8, 3, 0.8421, 0.0058, 3, 0.58, 0.0, 612, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "unlock", "arg_names": [], "import_names": [], "rhs_call_name": "unlock", "annotation": ""}, "snippet": " unlock(self.file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L145_C12", "label": "close()", "type": "expression", "loc": [145, 145], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L143_C8", "vector": [8, 3, 0.848, 0.0058, 3, 0.58, 0.5, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " self.file.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L146_C12", "label": "self.file =", "type": "assigned_variable", "loc": [146, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L143_C8", "vector": [14, 3, 0.8538, 0.0058, 3, 0.58, 1.0, 678, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.file = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L148_C4", "label": "__del__", "type": "function", "loc": [148, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:ClassDef_L112_C0", "vector": [2, 1, 0.8713, 0.0175, 1, 0.0, 1.0, 258, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__del__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __del__(self):\n if not self.file is None:\n self.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:If_L149_C8", "label": "if", "type": "if", "loc": [149, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L148_C4", "vector": [4, 2, 0.8743, 0.0117, 2, 0.21, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.file is None:\n self.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L150_C12", "label": "close()", "type": "expression", "loc": [150, 150], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L149_C8", "vector": [8, 3, 0.8772, 0.0058, 3, 0.65, 0.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_446:FunctionDef_L153_C0", "label": "read_locked", "type": "function", "loc": [153, 157], "level": 0, "parent": null, "vector": [2, 0, 0.9064, 0.0292, 0, 0.66, 0.8, 518, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "read_locked", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def read_locked(filename):\n fp = LockedFile(filename, 'r')\n data = fp.read()\n fp.close()\n return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L154_C4", "label": "fp = LockedFile()", "type": "assigned_variable", "loc": [154, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L153_C0", "vector": [14, 1, 0.9006, 0.0058, 1, 0.87, 0.0, 392, 3, 2, 0, 0, 1, 10, 1], "semantic": {"name": "fp", "arg_names": [], "import_names": [], "rhs_call_name": "LockedFile", "annotation": ""}, "snippet": " fp = LockedFile(filename, 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L155_C4", "label": "data = read()", "type": "assigned_variable", "loc": [155, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L153_C0", "vector": [14, 1, 0.9064, 0.0058, 1, 0.87, 0.3333, 929, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " data = fp.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L156_C4", "label": "close()", "type": "expression", "loc": [156, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L153_C0", "vector": [8, 1, 0.9123, 0.0058, 1, 0.87, 0.6667, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fp.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Return_L157_C4", "label": "return", "type": "return", "loc": [157, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L153_C0", "vector": [13, 1, 0.9181, 0.0058, 1, 0.87, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L160_C0", "label": "write_locked", "type": "function", "loc": [160, 163], "level": 0, "parent": null, "vector": [2, 0, 0.9444, 0.0234, 0, 0.66, 0.9, 65, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "write_locked", "arg_names": ["filename", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def write_locked(filename, data):\n fp = LockedFile(filename, 'w')\n data = fp.write(data)\n fp.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L161_C4", "label": "fp = LockedFile()", "type": "assigned_variable", "loc": [161, 161], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L160_C0", "vector": [14, 1, 0.9415, 0.0058, 1, 0.44, 0.0, 392, 3, 2, 0, 0, 1, 10, 1], "semantic": {"name": "fp", "arg_names": [], "import_names": [], "rhs_call_name": "LockedFile", "annotation": ""}, "snippet": " fp = LockedFile(filename, 'w')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L162_C4", "label": "data = write()", "type": "assigned_variable", "loc": [162, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L160_C0", "vector": [14, 1, 0.9474, 0.0058, 1, 0.44, 0.5, 929, 3, 1, 0, 0, 837, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " data = fp.write(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L163_C4", "label": "close()", "type": "expression", "loc": [163, 163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L160_C0", "vector": [8, 1, 0.9532, 0.0058, 1, 0.44, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fp.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:If_L165_C0", "label": "if", "type": "if", "loc": [165, 171], "level": 0, "parent": null, "vector": [4, 0, 0.9825, 0.0409, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n f = LockedFile('test.txt', mode='wb')\n f.write('test ok')\n f.close()\n f = LockedFile('test.txt', mode='rb')\n sys.stdout.write(f.read()+'\\n')\n f.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L166_C4", "label": "f = LockedFile()", "type": "assigned_variable", "loc": [166, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L165_C0", "vector": [14, 1, 0.9708, 0.0058, 1, 0.78, 0.0, 899, 3, 2, 0, 0, 1, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "LockedFile", "annotation": ""}, "snippet": " f = LockedFile('test.txt', mode='wb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L167_C4", "label": "write()", "type": "expression", "loc": [167, 167], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L165_C0", "vector": [8, 1, 0.9766, 0.0058, 1, 0.78, 0.2, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " f.write('test ok')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L168_C4", "label": "close()", "type": "expression", "loc": [168, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L165_C0", "vector": [8, 1, 0.9825, 0.0058, 1, 0.78, 0.4, 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_446:Assign_L169_C4", "label": "f = LockedFile()", "type": "assigned_variable", "loc": [169, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L165_C0", "vector": [14, 1, 0.9883, 0.0058, 1, 0.78, 0.6, 899, 3, 2, 0, 0, 1, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "LockedFile", "annotation": ""}, "snippet": " f = LockedFile('test.txt', mode='rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L170_C4", "label": "write()", "type": "expression", "loc": [170, 170], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L165_C0", "vector": [8, 1, 0.9942, 0.0058, 1, 0.78, 0.8, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " sys.stdout.write(f.read()+'\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L171_C4", "label": "close()", "type": "expression", "loc": [171, 171], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_446:If_L165_C0", "vector": [8, 1, 1.0, 0.0058, 1, 0.78, 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()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Import_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Import_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Import_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Import_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Import_L60_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:Try_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:If_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:If_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:ClassDef_L112_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:If_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L117_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L118_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L117_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L119_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L117_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_446:If_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L120_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L121_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L120_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L122_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L120_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_446:If_L123_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L123_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L124_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L123_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L125_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:ClassDef_L112_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Return_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:ClassDef_L112_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Return_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:ClassDef_L112_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Return_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:ClassDef_L112_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:ClassDef_L112_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L142_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:If_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L143_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L144_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L143_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L145_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L143_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L146_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:ClassDef_L112_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L148_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_446:If_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L150_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L153_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L153_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L155_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L153_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L153_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Return_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L160_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L160_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:FunctionDef_L160_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L165_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L165_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L167_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L165_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L165_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Assign_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L165_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_446:If_L165_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_446:Expr_L171_C4"}] |
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
"""
import os
import sys
import socket
import platform
from storage import Storage
global_settings = Storage()
settings = global_settings # legacy compatibility
if not hasattr(os, 'mkdir'):
global_settings.db_sessions = True
if global_settings.db_sessions is not True:
global_settings.db_sessions = set()
global_settings.gluon_parent = \
os.environ.get('web2py_path', os.getcwd())
global_settings.applications_parent = global_settings.gluon_parent
global_settings.app_folders = set()
global_settings.debugging = False
global_settings.is_pypy = \
hasattr(platform, 'python_implementation') and \
platform.python_implementation() == 'PyPy'
global_settings.is_jython = \
'java' in sys.platform.lower() or \
hasattr(sys, 'JYTHON_JAR') or \
str(sys.copyright).find('Jython') > 0
| ajibawa-2023/Python-Code-Large/train/row_447 | 18 | 38 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_447:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0789, 0.1316, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis file is part of the web2py Web Framework\nCopyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>\nLicense: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_447:Import_L7_C0", "label": "os import os", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1842, 0.0263, 0, 0.66, 0.0667, 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_447:Import_L8_C0", "label": "sys import sys", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.2105, 0.0263, 0, 0.66, 0.1333, 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_447:Import_L9_C0", "label": "socket import socket", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.2368, 0.0263, 0, 0.66, 0.2, 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_447:Import_L10_C0", "label": "platform import platform", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.2632, 0.0263, 0, 0.66, 0.2667, 590, 0, 1, 0, 0, 590, 0, 0], "semantic": {"name": "platform", "arg_names": [], "import_names": ["platform"], "rhs_call_name": "", "annotation": ""}, "snippet": "import platform"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_447:ImportFrom_L11_C0", "label": "from storage import Storage", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.2895, 0.0263, 0, 0.66, 0.3333, 864, 0, 1, 0, 0, 864, 0, 0], "semantic": {"name": "storage", "arg_names": [], "import_names": ["Storage"], "rhs_call_name": "", "annotation": ""}, "snippet": "from storage import Storage"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_447:Assign_L13_C0", "label": "global_settings = Storage()", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.3421, 0.0263, 0, 0.66, 0.4, 493, 3, 0, 0, 0, 850, 10, 1], "semantic": {"name": "global_settings", "arg_names": [], "import_names": [], "rhs_call_name": "Storage", "annotation": ""}, "snippet": "global_settings = Storage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_447:Assign_L14_C0", "label": "settings =", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.3684, 0.0263, 0, 0.66, 0.4667, 168, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "settings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "settings = global_settings # legacy compatibility"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_447:If_L16_C0", "label": "if", "type": "if", "loc": [16, 17], "level": 0, "parent": null, "vector": [4, 0, 0.4342, 0.0526, 0, 0.66, 0.5333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if not hasattr(os, 'mkdir'):\n global_settings.db_sessions = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_447:Assign_L17_C4", "label": "global_settings.db_sessions =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_447:If_L16_C0", "vector": [14, 1, 0.4474, 0.0263, 1, 0.19, 0.0, 938, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "global_settings.db_sessions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " global_settings.db_sessions = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_447:If_L19_C0", "label": "if", "type": "if", "loc": [19, 20], "level": 0, "parent": null, "vector": [4, 0, 0.5132, 0.0526, 0, 0.66, 0.6, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if global_settings.db_sessions is not True:\n global_settings.db_sessions = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_447:Assign_L20_C4", "label": "global_settings.db_sessions = set()", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_447:If_L19_C0", "vector": [14, 1, 0.5263, 0.0263, 1, 0.62, 0.0, 938, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "global_settings.db_sessions", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " global_settings.db_sessions = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_447:Assign_L22_C0", "label": "global_settings.gluon_parent = get()", "type": "assigned_variable", "loc": [22, 23], "level": 0, "parent": null, "vector": [14, 0, 0.5921, 0.0526, 0, 0.66, 0.6667, 207, 3, 2, 0, 0, 607, 10, 2], "semantic": {"name": "global_settings.gluon_parent", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": "global_settings.gluon_parent = \\\n os.environ.get('web2py_path', os.getcwd())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_447:Assign_L25_C0", "label": "global_settings.applications_parent =", "type": "assigned_variable", "loc": [25, 25], "level": 0, "parent": null, "vector": [14, 0, 0.6579, 0.0263, 0, 0.66, 0.7333, 840, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "global_settings.applications_parent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "global_settings.applications_parent = global_settings.gluon_parent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_447:Assign_L27_C0", "label": "global_settings.app_folders = set()", "type": "assigned_variable", "loc": [27, 27], "level": 0, "parent": null, "vector": [14, 0, 0.7105, 0.0263, 0, 0.66, 0.8, 712, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "global_settings.app_folders", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": "global_settings.app_folders = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_447:Assign_L29_C0", "label": "global_settings.debugging =", "type": "assigned_variable", "loc": [29, 29], "level": 0, "parent": null, "vector": [14, 0, 0.7632, 0.0263, 0, 0.66, 0.8667, 18, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "global_settings.debugging", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "global_settings.debugging = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_447:Assign_L31_C0", "label": "global_settings.is_pypy =", "type": "assigned_variable", "loc": [31, 33], "level": 0, "parent": null, "vector": [14, 0, 0.8421, 0.0789, 0, 0.66, 0.9333, 918, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "global_settings.is_pypy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "global_settings.is_pypy = \\\n hasattr(platform, 'python_implementation') and \\\n platform.python_implementation() == 'PyPy'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_447:Assign_L35_C0", "label": "global_settings.is_jython =", "type": "assigned_variable", "loc": [35, 38], "level": 0, "parent": null, "vector": [14, 0, 0.9605, 0.1053, 0, 0.66, 1.0, 800, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "global_settings.is_jython", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "global_settings.is_jython = \\\n 'java' in sys.platform.lower() or \\\n hasattr(sys, 'JYTHON_JAR') or \\\n str(sys.copyright).find('Jython') > 0"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_447:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_447:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_447:If_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_447:Assign_L20_C4"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
"""
import re
__all__ = ['HTTP', 'redirect']
defined_status = {
200: 'OK',
201: 'CREATED',
202: 'ACCEPTED',
203: 'NON-AUTHORITATIVE INFORMATION',
204: 'NO CONTENT',
205: 'RESET CONTENT',
206: 'PARTIAL CONTENT',
301: 'MOVED PERMANENTLY',
302: 'FOUND',
303: 'SEE OTHER',
304: 'NOT MODIFIED',
305: 'USE PROXY',
307: 'TEMPORARY REDIRECT',
400: 'BAD REQUEST',
401: 'UNAUTHORIZED',
403: 'FORBIDDEN',
404: 'NOT FOUND',
405: 'METHOD NOT ALLOWED',
406: 'NOT ACCEPTABLE',
407: 'PROXY AUTHENTICATION REQUIRED',
408: 'REQUEST TIMEOUT',
409: 'CONFLICT',
410: 'GONE',
411: 'LENGTH REQUIRED',
412: 'PRECONDITION FAILED',
413: 'REQUEST ENTITY TOO LARGE',
414: 'REQUEST-URI TOO LONG',
415: 'UNSUPPORTED MEDIA TYPE',
416: 'REQUESTED RANGE NOT SATISFIABLE',
417: 'EXPECTATION FAILED',
422: 'UNPROCESSABLE ENTITY',
500: 'INTERNAL SERVER ERROR',
501: 'NOT IMPLEMENTED',
502: 'BAD GATEWAY',
503: 'SERVICE UNAVAILABLE',
504: 'GATEWAY TIMEOUT',
505: 'HTTP VERSION NOT SUPPORTED',
}
# If web2py is executed with python2.4 we need
# to use Exception instead of BaseException
try:
BaseException
except NameError:
BaseException = Exception
regex_status = re.compile('^\d{3} \w+$')
class HTTP(BaseException):
def __init__(
self,
status,
body='',
cookies=None,
status_message='',
**headers
):
self.status = status
self.body = body
self.headers = headers
self.cookies2headers(cookies)
self.status_message = status_message
def cookies2headers(self, cookies):
if cookies and len(cookies) > 0:
self.headers['Set-Cookie'] = [
str(cookie)[11:] for cookie in cookies.values()]
def to(self, responder, env=None):
env = env or {}
status = self.status
headers = self.headers
status_message = status
if status in defined_status:
if status_message:
status = str(status) + ' ' + str(status_message)
else:
status = '%d %s' % (status, defined_status[status])
else:
status = str(status) + ' ' + status_message
if not regex_status.match(status):
status = '500 %s' % (defined_status[500])
headers.setdefault('Content-Type', 'text/html; charset=UTF-8')
body = self.body
if status[:1] == '4':
if not body:
body = status
if isinstance(body, str):
headers['Content-Length'] = len(body)
rheaders = []
for k, v in headers.iteritems():
if isinstance(v, list):
rheaders += [(k, str(item)) for item in v]
elif not v is None:
rheaders.append((k, str(v)))
responder(status, rheaders)
if env.get('request_method', '') == 'HEAD':
return ['']
elif isinstance(body, str):
return [body]
elif hasattr(body, '__iter__'):
return body
else:
return [str(body)]
@property
def message(self):
"""
compose a message describing this exception
"status defined_status [web2py_error]"
message elements that are not defined are omitted
"""
msg = '%(status)d'
status_message = ''
if self.status_message:
status_message = self.status_message
elif self.status in defined_status:
status_message = defined_status.get(self.status)
if status_message:
msg = '%(status)d %(defined_status)s'
if 'web2py_error' in self.headers:
msg += ' [%(web2py_error)s]'
return msg % dict(status=self.status,
defined_status=status_message,
web2py_error=self.headers.get('web2py_error'))
def __str__(self):
"stringify me"
return self.message
def redirect(location='', how=303, client_side=False):
if location:
from gluon import current
loc = location.replace('\r', '%0D').replace('\n', '%0A')
if client_side and current.request.ajax:
raise HTTP(200, **{'web2py-redirect-location': loc})
else:
raise HTTP(how,
'You are being redirected <a href="%s">here</a>' % loc,
Location=loc)
else:
from gluon import current
if client_side and current.request.ajax:
raise HTTP(200, **{'web2py-component-command': 'window.location.reload(true)'})
| ajibawa-2023/Python-Code-Large/train/row_448 | 72 | 164 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_448:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0366, 0.0305, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis file is part of the web2py Web Framework\nCopyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>\nLicense: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Import_L10_C0", "label": "re import re", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.061, 0.0061, 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_448:Assign_L12_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.0732, 0.0061, 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__ = ['HTTP', 'redirect']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L14_C0", "label": "defined_status =", "type": "assigned_variable", "loc": [14, 52], "level": 0, "parent": null, "vector": [14, 0, 0.2012, 0.2378, 0, 0.66, 0.4286, 755, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "defined_status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "defined_status = {\n 200: 'OK',\n 201: 'CREATED',\n 202: 'ACCEPTED',\n 203: 'NON-AUTHORITATIVE INFORMATION',\n 204: 'NO CONTENT',\n 205: 'RESET CONTENT',\n 206: 'PARTIAL CONTENT',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Try_L57_C0", "label": "try", "type": "try", "loc": [57, 60], "level": 0, "parent": null, "vector": [7, 0, 0.3567, 0.0244, 0, 0.66, 0.5714, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n BaseException\nexcept NameError:\n BaseException = Exception"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Expr_L58_C4", "label": "expression", "type": "expression", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:Try_L57_C0", "vector": [8, 1, 0.3537, 0.0061, 1, 0.65, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " BaseException"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L60_C4", "label": "BaseException =", "type": "assigned_variable", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:Try_L57_C0", "vector": [14, 1, 0.3659, 0.0061, 1, 0.65, 0.0, 903, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "BaseException", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " BaseException = Exception"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L62_C0", "label": "regex_status = compile()", "type": "assigned_variable", "loc": [62, 62], "level": 0, "parent": null, "vector": [14, 0, 0.378, 0.0061, 0, 0.66, 0.7143, 833, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "regex_status", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "regex_status = re.compile('^\\d{3} \\w+$')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:ClassDef_L65_C0", "label": "HTTP", "type": "class", "loc": [65, 148], "level": 0, "parent": null, "vector": [3, 0, 0.6494, 0.5122, 0, 0.66, 0.8571, 806, 0, 5, 0, 0, 903, 0, 24], "semantic": {"name": "HTTP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class HTTP(BaseException):\n\n def __init__(\n self,\n status,\n body='',\n cookies=None,\n status_message='',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L67_C4", "label": "__init__", "type": "function", "loc": [67, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:ClassDef_L65_C0", "vector": [2, 1, 0.4451, 0.0793, 1, 0.46, 0.0, 555, 0, 6, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "status", "body", "cookies", "status_message", "headers"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(\n self,\n status,\n body='',\n cookies=None,\n status_message='',\n **headers\n ):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L75_C8", "label": "self.status =", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L67_C4", "vector": [14, 2, 0.4573, 0.0061, 2, 0.67, 0.0, 651, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.status = status"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L76_C8", "label": "self.body =", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L67_C4", "vector": [14, 2, 0.4634, 0.0061, 2, 0.67, 0.25, 523, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.body", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.body = body"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L77_C8", "label": "self.headers =", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L67_C4", "vector": [14, 2, 0.4695, 0.0061, 2, 0.67, 0.5, 131, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.headers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.headers = headers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Expr_L78_C8", "label": "cookies2headers()", "type": "expression", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L67_C4", "vector": [8, 2, 0.4756, 0.0061, 2, 0.67, 0.75, 822, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "cookies2headers", "arg_names": [], "import_names": [], "rhs_call_name": "cookies2headers", "annotation": ""}, "snippet": " self.cookies2headers(cookies)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L79_C8", "label": "self.status_message =", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L67_C4", "vector": [14, 2, 0.4817, 0.0061, 2, 0.67, 1.0, 616, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.status_message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.status_message = status_message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L81_C4", "label": "cookies2headers", "type": "function", "loc": [81, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:ClassDef_L65_C0", "vector": [2, 1, 0.503, 0.0244, 1, 0.46, 0.25, 822, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "cookies2headers", "arg_names": ["self", "cookies"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def cookies2headers(self, cookies):\n if cookies and len(cookies) > 0:\n self.headers['Set-Cookie'] = [\n str(cookie)[11:] for cookie in cookies.values()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:If_L82_C8", "label": "if", "type": "if", "loc": [82, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L81_C4", "vector": [4, 2, 0.5061, 0.0183, 2, 0.88, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cookies and len(cookies) > 0:\n self.headers['Set-Cookie'] = [\n str(cookie)[11:] for cookie in cookies.values()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L83_C12", "label": "assign", "type": "assigned_variable", "loc": [83, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L82_C8", "vector": [14, 3, 0.5091, 0.0122, 3, 0.2, 0.0, 0, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.headers['Set-Cookie'] = [\n str(cookie)[11:] for cookie in cookies.values()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "label": "to", "type": "function", "loc": [86, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:ClassDef_L65_C0", "vector": [2, 1, 0.6311, 0.2195, 1, 0.46, 0.5, 550, 0, 3, 1, 0, 0, 0, 17], "semantic": {"name": "to", "arg_names": ["self", "responder", "env"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def to(self, responder, env=None):\n env = env or {}\n status = self.status\n headers = self.headers\n status_message = status\n if status in defined_status:\n if status_message:\n status = str(status) + ' ' + str(status_message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L87_C8", "label": "env =", "type": "assigned_variable", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "vector": [14, 2, 0.5305, 0.0061, 2, 0.54, 0.0, 803, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "env", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " env = env or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L88_C8", "label": "status =", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "vector": [14, 2, 0.5366, 0.0061, 2, 0.54, 0.0909, 699, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " status = self.status"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L89_C8", "label": "headers =", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "vector": [14, 2, 0.5427, 0.0061, 2, 0.54, 0.1818, 950, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "headers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headers = self.headers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L90_C8", "label": "status_message =", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "vector": [14, 2, 0.5488, 0.0061, 2, 0.54, 0.2727, 653, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "status_message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " status_message = status"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:If_L91_C8", "label": "if", "type": "if", "loc": [91, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "vector": [4, 2, 0.5793, 0.0549, 2, 0.54, 0.3636, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if status in defined_status:\n if status_message:\n status = str(status) + ' ' + str(status_message)\n else:\n status = '%d %s' % (status, defined_status[status])\n else:\n status = str(status) + ' ' + status_message\n if not regex_status.match(status):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:If_L92_C12", "label": "if", "type": "if", "loc": [92, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L91_C8", "vector": [4, 3, 0.5701, 0.0244, 3, 0.71, 0.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if status_message:\n status = str(status) + ' ' + str(status_message)\n else:\n status = '%d %s' % (status, defined_status[status])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L93_C16", "label": "status =", "type": "assigned_variable", "loc": [93, 93], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L92_C12", "vector": [14, 4, 0.5671, 0.0061, 4, 0.09, 0.0, 699, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " status = str(status) + ' ' + str(status_message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L95_C16", "label": "status =", "type": "assigned_variable", "loc": [95, 95], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L92_C12", "vector": [14, 4, 0.5793, 0.0061, 4, 0.09, 1.0, 699, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " status = '%d %s' % (status, defined_status[status])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L97_C12", "label": "status =", "type": "assigned_variable", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L91_C8", "vector": [14, 3, 0.5915, 0.0061, 3, 0.71, 0.5, 699, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " status = str(status) + ' ' + status_message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:If_L98_C12", "label": "if", "type": "if", "loc": [98, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L91_C8", "vector": [4, 3, 0.6006, 0.0122, 3, 0.71, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not regex_status.match(status):\n status = '500 %s' % (defined_status[500])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L99_C16", "label": "status =", "type": "assigned_variable", "loc": [99, 99], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L98_C12", "vector": [14, 4, 0.6037, 0.0061, 4, 0.59, 0.0, 699, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " status = '500 %s' % (defined_status[500])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Expr_L100_C8", "label": "setdefault()", "type": "expression", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "vector": [8, 2, 0.6098, 0.0061, 2, 0.54, 0.4545, 262, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " headers.setdefault('Content-Type', 'text/html; charset=UTF-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L101_C8", "label": "body =", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "vector": [14, 2, 0.6159, 0.0061, 2, 0.54, 0.5455, 477, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "body", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " body = self.body"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:If_L102_C8", "label": "if", "type": "if", "loc": [102, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "vector": [4, 2, 0.6341, 0.0305, 2, 0.54, 0.6364, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if status[:1] == '4':\n if not body:\n body = status\n if isinstance(body, str):\n headers['Content-Length'] = len(body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:If_L103_C12", "label": "if", "type": "if", "loc": [103, 104], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L102_C8", "vector": [4, 3, 0.6311, 0.0122, 3, 0.36, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not body:\n body = status"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L104_C16", "label": "body =", "type": "assigned_variable", "loc": [104, 104], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L103_C12", "vector": [14, 4, 0.6341, 0.0061, 4, 0.32, 0.0, 477, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "body", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " body = status"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:If_L105_C12", "label": "if", "type": "if", "loc": [105, 106], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L102_C8", "vector": [4, 3, 0.6433, 0.0122, 3, 0.36, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(body, str):\n headers['Content-Length'] = len(body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L106_C16", "label": " = len()", "type": "assigned_variable", "loc": [106, 106], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L105_C12", "vector": [14, 4, 0.6463, 0.0061, 4, 0.25, 0.0, 0, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " headers['Content-Length'] = len(body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L107_C8", "label": "rheaders =", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "vector": [14, 2, 0.6524, 0.0061, 2, 0.54, 0.7273, 223, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "rheaders", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rheaders = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:For_L108_C8", "label": "for k, v", "type": "for", "loc": [108, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "vector": [6, 2, 0.6707, 0.0305, 2, 0.54, 0.8182, 867, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in headers.iteritems():\n if isinstance(v, list):\n rheaders += [(k, str(item)) for item in v]\n elif not v is None:\n rheaders.append((k, str(v)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:If_L109_C12", "label": "if", "type": "if", "loc": [109, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:For_L108_C8", "vector": [4, 3, 0.6738, 0.0244, 3, 0.75, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(v, list):\n rheaders += [(k, str(item)) for item in v]\n elif not v is None:\n rheaders.append((k, str(v)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:If_L111_C12", "label": "if", "type": "if", "loc": [111, 112], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L109_C12", "vector": [4, 4, 0.6799, 0.0122, 4, 0.35, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not v is None:\n rheaders.append((k, str(v)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Expr_L112_C16", "label": "append()", "type": "expression", "loc": [112, 112], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L111_C12", "vector": [8, 5, 0.6829, 0.0061, 5, 0.42, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " rheaders.append((k, str(v)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Expr_L113_C8", "label": "responder()", "type": "expression", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "vector": [8, 2, 0.689, 0.0061, 2, 0.54, 0.9091, 933, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "responder", "arg_names": [], "import_names": [], "rhs_call_name": "responder", "annotation": ""}, "snippet": " responder(status, rheaders)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:If_L114_C8", "label": "if", "type": "if", "loc": [114, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "vector": [4, 2, 0.7165, 0.0488, 2, 0.54, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if env.get('request_method', '') == 'HEAD':\n return ['']\n elif isinstance(body, str):\n return [body]\n elif hasattr(body, '__iter__'):\n return body\n else:\n return [str(body)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Return_L115_C12", "label": "return", "type": "return", "loc": [115, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L114_C8", "vector": [13, 3, 0.7012, 0.0061, 3, 0.89, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ['']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:If_L116_C8", "label": "if", "type": "if", "loc": [116, 121], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L114_C8", "vector": [4, 3, 0.7226, 0.0366, 3, 0.89, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(body, str):\n return [body]\n elif hasattr(body, '__iter__'):\n return body\n else:\n return [str(body)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Return_L117_C12", "label": "return", "type": "return", "loc": [117, 117], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L116_C8", "vector": [13, 4, 0.7134, 0.0061, 4, 0.33, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [body]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:If_L118_C8", "label": "if", "type": "if", "loc": [118, 121], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L116_C8", "vector": [4, 4, 0.7287, 0.0244, 4, 0.33, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif hasattr(body, '__iter__'):\n return body\n else:\n return [str(body)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Return_L119_C12", "label": "return", "type": "return", "loc": [119, 119], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L118_C8", "vector": [13, 5, 0.7256, 0.0061, 5, 0.71, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return body"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Return_L121_C12", "label": "return", "type": "return", "loc": [121, 121], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L118_C8", "vector": [13, 5, 0.7378, 0.0061, 5, 0.71, 1.0, 0, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [str(body)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L124_C4", "label": "message", "type": "function", "loc": [124, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:ClassDef_L65_C0", "vector": [2, 1, 0.8171, 0.128, 1, 0.46, 0.75, 635, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "message", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def message(self):\n \"\"\"\n compose a message describing this exception\n\n \"status defined_status [web2py_error]\"\n\n message elements that are not defined are omitted\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Expr_L125_C8", "label": "expression", "type": "expression", "loc": [125, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L124_C4", "vector": [8, 2, 0.7805, 0.0427, 2, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n compose a message describing this exception\n\n \"status defined_status [web2py_error]\"\n\n message elements that are not defined are omitted\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L132_C8", "label": "msg =", "type": "assigned_variable", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L124_C4", "vector": [14, 2, 0.8049, 0.0061, 2, 0.25, 0.1667, 712, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg = '%(status)d'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L133_C8", "label": "status_message =", "type": "assigned_variable", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L124_C4", "vector": [14, 2, 0.811, 0.0061, 2, 0.25, 0.3333, 653, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "status_message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " status_message = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:If_L134_C8", "label": "if", "type": "if", "loc": [134, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L124_C4", "vector": [4, 2, 0.8262, 0.0244, 2, 0.25, 0.5, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.status_message:\n status_message = self.status_message\n elif self.status in defined_status:\n status_message = defined_status.get(self.status)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L135_C12", "label": "status_message =", "type": "assigned_variable", "loc": [135, 135], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L134_C8", "vector": [14, 3, 0.8232, 0.0061, 3, 0.68, 0.0, 653, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "status_message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " status_message = self.status_message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:If_L136_C8", "label": "if", "type": "if", "loc": [136, 137], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L134_C8", "vector": [4, 3, 0.8323, 0.0122, 3, 0.68, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.status in defined_status:\n status_message = defined_status.get(self.status)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L137_C12", "label": "status_message = get()", "type": "assigned_variable", "loc": [137, 137], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L136_C8", "vector": [14, 4, 0.8354, 0.0061, 4, 0.34, 0.0, 653, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "status_message", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " status_message = defined_status.get(self.status)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:If_L138_C8", "label": "if", "type": "if", "loc": [138, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L124_C4", "vector": [4, 2, 0.8445, 0.0122, 2, 0.25, 0.6667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if status_message:\n msg = '%(status)d %(defined_status)s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L139_C12", "label": "msg =", "type": "assigned_variable", "loc": [139, 139], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L138_C8", "vector": [14, 3, 0.8476, 0.0061, 3, 0.6, 0.0, 712, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg = '%(status)d %(defined_status)s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:If_L140_C8", "label": "if", "type": "if", "loc": [140, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L124_C4", "vector": [4, 2, 0.8567, 0.0122, 2, 0.25, 0.8333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'web2py_error' in self.headers:\n msg += ' [%(web2py_error)s]'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Return_L142_C8", "label": "return", "type": "return", "loc": [142, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L124_C4", "vector": [13, 2, 0.872, 0.0183, 2, 0.25, 1.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return msg % dict(status=self.status,\n defined_status=status_message,\n web2py_error=self.headers.get('web2py_error'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L146_C4", "label": "__str__", "type": "function", "loc": [146, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:ClassDef_L65_C0", "vector": [2, 1, 0.8963, 0.0183, 1, 0.46, 1.0, 527, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n \"stringify me\"\n return self.message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Expr_L147_C8", "label": "expression", "type": "expression", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L146_C4", "vector": [8, 2, 0.8963, 0.0061, 2, 0.1, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"stringify me\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Return_L148_C8", "label": "return", "type": "return", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L146_C4", "vector": [13, 2, 0.9024, 0.0061, 2, 0.1, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L151_C0", "label": "redirect", "type": "function", "loc": [151, 164], "level": 0, "parent": null, "vector": [2, 0, 0.9604, 0.0854, 0, 0.66, 1.0, 206, 0, 3, 0, 0, 0, 0, 5], "semantic": {"name": "redirect", "arg_names": ["location", "how", "client_side"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def redirect(location='', how=303, client_side=False):\n if location:\n from gluon import current\n loc = location.replace('\\r', '%0D').replace('\\n', '%0A')\n if client_side and current.request.ajax:\n raise HTTP(200, **{'web2py-redirect-location': loc})\n else:\n raise HTTP(how,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:If_L152_C4", "label": "if", "type": "if", "loc": [152, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L151_C0", "vector": [4, 1, 0.9634, 0.0793, 1, 0.27, 0.0, 0, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if location:\n from gluon import current\n loc = location.replace('\\r', '%0D').replace('\\n', '%0A')\n if client_side and current.request.ajax:\n raise HTTP(200, **{'web2py-redirect-location': loc})\n else:\n raise HTTP(how,\n 'You are being redirected <a href=\"%s\">here</a>' % loc,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:ImportFrom_L153_C8", "label": "from gluon import current", "type": "import", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L152_C4", "vector": [1, 2, 0.9329, 0.0061, 2, 0.6, 0.0, 826, 0, 1, 0, 0, 826, 0, 0], "semantic": {"name": "gluon", "arg_names": [], "import_names": ["current"], "rhs_call_name": "", "annotation": ""}, "snippet": " from gluon import current"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L154_C8", "label": "loc = replace()", "type": "assigned_variable", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L152_C4", "vector": [14, 2, 0.939, 0.0061, 2, 0.6, 0.25, 822, 3, 2, 0, 0, 293, 10, 2], "semantic": {"name": "loc", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " loc = location.replace('\\r', '%0D').replace('\\n', '%0A')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:If_L155_C8", "label": "if", "type": "if", "loc": [155, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L152_C4", "vector": [4, 2, 0.9604, 0.0366, 2, 0.6, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if client_side and current.request.ajax:\n raise HTTP(200, **{'web2py-redirect-location': loc})\n else:\n raise HTTP(how,\n 'You are being redirected <a href=\"%s\">here</a>' % loc,\n Location=loc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:ImportFrom_L162_C8", "label": "from gluon import current", "type": "import", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L152_C4", "vector": [1, 2, 0.9878, 0.0061, 2, 0.6, 0.75, 826, 0, 1, 0, 0, 826, 0, 0], "semantic": {"name": "gluon", "arg_names": [], "import_names": ["current"], "rhs_call_name": "", "annotation": ""}, "snippet": " from gluon import current"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_448:If_L163_C8", "label": "if", "type": "if", "loc": [163, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_448:If_L152_C4", "vector": [4, 2, 0.997, 0.0122, 2, 0.6, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if client_side and current.request.ajax:\n raise HTTP(200, **{'web2py-component-command': 'window.location.reload(true)'})"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_448:Try_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:Try_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Expr_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:If_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L82_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L83_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:If_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_448:If_L92_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L92_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L93_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L92_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L95_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_448:If_L98_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L98_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L99_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Expr_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:If_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L102_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_448:If_L103_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L103_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L104_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L102_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_448:If_L105_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L105_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L106_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:For_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:For_L108_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_448:If_L109_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L109_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_448:If_L111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L111_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Expr_L112_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Expr_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:If_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L114_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Return_L115_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L114_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_448:If_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Return_L117_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L116_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_448:If_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L118_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Return_L119_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L118_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Return_L121_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Expr_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:If_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L134_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L135_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L134_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_448:If_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L136_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L137_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:If_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L139_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:If_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Return_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:ClassDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Expr_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Return_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:FunctionDef_L151_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_448:If_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:ImportFrom_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:Assign_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:If_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:ImportFrom_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_448:If_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_448:If_L163_C8"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu>,
limodou <limodou@gmail.com> and srackham <srackham@gmail.com>.
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
"""
import logging
import os
import pdb
import Queue
import sys
logger = logging.getLogger("web2py")
class Pipe(Queue.Queue):
def __init__(self, name, mode='r', *args, **kwargs):
self.__name = name
Queue.Queue.__init__(self, *args, **kwargs)
def write(self, data):
logger.debug("debug %s writting %s" % (self.__name, data))
self.put(data)
def flush(self):
# mark checkpoint (complete message)
logger.debug("debug %s flushing..." % self.__name)
self.put(None)
# wait until it is processed
self.join()
logger.debug("debug %s flush done" % self.__name)
def read(self, count=None, timeout=None):
logger.debug("debug %s reading..." % (self.__name, ))
data = self.get(block=True, timeout=timeout)
# signal that we are ready
self.task_done()
logger.debug("debug %s read %s" % (self.__name, data))
return data
def readline(self):
logger.debug("debug %s readline..." % (self.__name, ))
return self.read()
pipe_in = Pipe('in')
pipe_out = Pipe('out')
debugger = pdb.Pdb(completekey=None, stdin=pipe_in, stdout=pipe_out,)
def set_trace():
"breakpoint shortcut (like pdb)"
logger.info("DEBUG: set_trace!")
debugger.set_trace(sys._getframe().f_back)
def stop_trace():
"stop waiting for the debugger (called atexit)"
# this should prevent communicate is wait forever a command result
# and the main thread has finished
logger.info("DEBUG: stop_trace!")
pipe_out.write("debug finished!")
pipe_out.write(None)
#pipe_out.flush()
def communicate(command=None):
"send command to debbuger, wait result"
if command is not None:
logger.info("DEBUG: sending command %s" % command)
pipe_in.write(command)
#pipe_in.flush()
result = []
while True:
data = pipe_out.read()
if data is None:
break
result.append(data)
logger.info("DEBUG: result %s" % repr(result))
return ''.join(result)
# New debugger implementation using qdb and a web UI
import gluon.contrib.qdb as qdb
from threading import RLock
interact_lock = RLock()
run_lock = RLock()
def check_interaction(fn):
"Decorator to clean and prevent interaction when not available"
def check_fn(self, *args, **kwargs):
interact_lock.acquire()
try:
if self.filename:
self.clear_interaction()
return fn(self, *args, **kwargs)
finally:
interact_lock.release()
return check_fn
class WebDebugger(qdb.Frontend):
"Qdb web2py interface"
def __init__(self, pipe, completekey='tab', stdin=None, stdout=None):
qdb.Frontend.__init__(self, pipe)
self.clear_interaction()
def clear_interaction(self):
self.filename = None
self.lineno = None
self.exception_info = None
self.context = None
# redefine Frontend methods:
def run(self):
run_lock.acquire()
try:
while self.pipe.poll():
qdb.Frontend.run(self)
finally:
run_lock.release()
def interaction(self, filename, lineno, line, **context):
# store current status
interact_lock.acquire()
try:
self.filename = filename
self.lineno = lineno
self.context = context
finally:
interact_lock.release()
def exception(self, title, extype, exvalue, trace, request):
self.exception_info = {'title': title,
'extype': extype, 'exvalue': exvalue,
'trace': trace, 'request': request}
@check_interaction
def do_continue(self):
qdb.Frontend.do_continue(self)
@check_interaction
def do_step(self):
qdb.Frontend.do_step(self)
@check_interaction
def do_return(self):
qdb.Frontend.do_return(self)
@check_interaction
def do_next(self):
qdb.Frontend.do_next(self)
@check_interaction
def do_quit(self):
qdb.Frontend.do_quit(self)
def do_exec(self, statement):
interact_lock.acquire()
try:
# check to see if we're inside interaction
if self.filename:
# avoid spurious interaction notifications:
self.set_burst(2)
# execute the statement in the remote debugger:
return qdb.Frontend.do_exec(self, statement)
finally:
interact_lock.release()
# create the connection between threads:
parent_queue, child_queue = Queue.Queue(), Queue.Queue()
front_conn = qdb.QueuePipe("parent", parent_queue, child_queue)
child_conn = qdb.QueuePipe("child", child_queue, parent_queue)
web_debugger = WebDebugger(front_conn) # frontend
qdb_debugger = qdb.Qdb(
pipe=child_conn, redirect_stdio=False, skip=None) # backend
dbg = qdb_debugger
# enable getting context (stack, globals/locals) at interaction
qdb_debugger.set_params(dict(call_stack=True, environment=True))
import gluon.main
gluon.main.global_settings.debugging = True
| ajibawa-2023/Python-Code-Large/train/row_449 | 117 | 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_449:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0357, 0.0357, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis file is part of the web2py Web Framework\nDeveloped by Massimo Di Pierro <mdipierro@cs.depaul.edu>,\nlimodou <limodou@gmail.com> and srackham <srackham@gmail.com>.\nLicense: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)\n\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Import_L12_C0", "label": "logging import logging", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0612, 0.0051, 0, 0.66, 0.0357, 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_449:Import_L13_C0", "label": "os import os", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0663, 0.0051, 0, 0.66, 0.0714, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Import_L14_C0", "label": "pdb import pdb", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0714, 0.0051, 0, 0.66, 0.1071, 91, 0, 1, 0, 0, 91, 0, 0], "semantic": {"name": "pdb", "arg_names": [], "import_names": ["pdb"], "rhs_call_name": "", "annotation": ""}, "snippet": "import pdb"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Import_L15_C0", "label": "Queue import Queue", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0765, 0.0051, 0, 0.66, 0.1429, 952, 0, 1, 0, 0, 952, 0, 0], "semantic": {"name": "Queue", "arg_names": [], "import_names": ["Queue"], "rhs_call_name": "", "annotation": ""}, "snippet": "import Queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Import_L16_C0", "label": "sys import sys", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0816, 0.0051, 0, 0.66, 0.1786, 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_449:Assign_L18_C0", "label": "logger = getLogger()", "type": "assigned_variable", "loc": [18, 18], "level": 0, "parent": null, "vector": [14, 0, 0.0918, 0.0051, 0, 0.66, 0.2143, 532, 3, 1, 0, 0, 71, 10, 1], "semantic": {"name": "logger", "arg_names": [], "import_names": [], "rhs_call_name": "getLogger", "annotation": ""}, "snippet": "logger = logging.getLogger(\"web2py\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L21_C0", "label": "Pipe", "type": "class", "loc": [21, 48], "level": 0, "parent": null, "vector": [3, 0, 0.176, 0.1429, 0, 0.66, 0.25, 188, 0, 5, 0, 0, 26, 0, 13], "semantic": {"name": "Pipe", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Pipe(Queue.Queue):\n def __init__(self, name, mode='r', *args, **kwargs):\n self.__name = name\n Queue.Queue.__init__(self, *args, **kwargs)\n\n def write(self, data):\n logger.debug(\"debug %s writting %s\" % (self.__name, data))\n self.put(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L22_C4", "label": "__init__", "type": "function", "loc": [22, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L21_C0", "vector": [2, 1, 0.1173, 0.0153, 1, 0.18, 0.0, 555, 0, 5, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "name", "mode", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name, mode='r', *args, **kwargs):\n self.__name = name\n Queue.Queue.__init__(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L23_C8", "label": "self.__name =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L22_C4", "vector": [14, 2, 0.1173, 0.0051, 2, 0.12, 0.0, 64, 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_449:Expr_L24_C8", "label": "__init__()", "type": "expression", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L22_C4", "vector": [8, 2, 0.1224, 0.0051, 2, 0.12, 1.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " Queue.Queue.__init__(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L26_C4", "label": "write", "type": "function", "loc": [26, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L21_C0", "vector": [2, 1, 0.1378, 0.0153, 1, 0.18, 0.25, 837, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def write(self, data):\n logger.debug(\"debug %s writting %s\" % (self.__name, data))\n self.put(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L27_C8", "label": "debug()", "type": "expression", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L26_C4", "vector": [8, 2, 0.1378, 0.0051, 2, 0.86, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " logger.debug(\"debug %s writting %s\" % (self.__name, data))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L28_C8", "label": "put()", "type": "expression", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L26_C4", "vector": [8, 2, 0.1429, 0.0051, 2, 0.86, 1.0, 636, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " self.put(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L30_C4", "label": "flush", "type": "function", "loc": [30, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L21_C0", "vector": [2, 1, 0.1684, 0.0357, 1, 0.18, 0.5, 439, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "flush", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def flush(self):\n # mark checkpoint (complete message)\n logger.debug(\"debug %s flushing...\" % self.__name)\n self.put(None)\n # wait until it is processed\n self.join()\n logger.debug(\"debug %s flush done\" % self.__name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L32_C8", "label": "debug()", "type": "expression", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L30_C4", "vector": [8, 2, 0.1633, 0.0051, 2, 0.44, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " logger.debug(\"debug %s flushing...\" % self.__name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L33_C8", "label": "put()", "type": "expression", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L30_C4", "vector": [8, 2, 0.1684, 0.0051, 2, 0.44, 0.3333, 636, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " self.put(None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L35_C8", "label": "join()", "type": "expression", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L30_C4", "vector": [8, 2, 0.1786, 0.0051, 2, 0.44, 0.6667, 933, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "join", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " self.join()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L36_C8", "label": "debug()", "type": "expression", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L30_C4", "vector": [8, 2, 0.1837, 0.0051, 2, 0.44, 1.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " logger.debug(\"debug %s flush done\" % self.__name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L38_C4", "label": "read", "type": "function", "loc": [38, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L21_C0", "vector": [2, 1, 0.2092, 0.0357, 1, 0.18, 0.75, 453, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "read", "arg_names": ["self", "count", "timeout"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def read(self, count=None, timeout=None):\n logger.debug(\"debug %s reading...\" % (self.__name, ))\n data = self.get(block=True, timeout=timeout)\n # signal that we are ready\n self.task_done()\n logger.debug(\"debug %s read %s\" % (self.__name, data))\n return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L39_C8", "label": "debug()", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L38_C4", "vector": [8, 2, 0.199, 0.0051, 2, 0.56, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " logger.debug(\"debug %s reading...\" % (self.__name, ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L40_C8", "label": "data = get()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L38_C4", "vector": [14, 2, 0.2041, 0.0051, 2, 0.56, 0.25, 929, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " data = self.get(block=True, timeout=timeout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L42_C8", "label": "task_done()", "type": "expression", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L38_C4", "vector": [8, 2, 0.2143, 0.0051, 2, 0.56, 0.5, 393, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "task_done", "arg_names": [], "import_names": [], "rhs_call_name": "task_done", "annotation": ""}, "snippet": " self.task_done()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L43_C8", "label": "debug()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L38_C4", "vector": [8, 2, 0.2194, 0.0051, 2, 0.56, 0.75, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " logger.debug(\"debug %s read %s\" % (self.__name, data))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Return_L44_C8", "label": "return", "type": "return", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L38_C4", "vector": [13, 2, 0.2245, 0.0051, 2, 0.56, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L46_C4", "label": "readline", "type": "function", "loc": [46, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L21_C0", "vector": [2, 1, 0.2398, 0.0153, 1, 0.18, 1.0, 303, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "readline", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def readline(self):\n logger.debug(\"debug %s readline...\" % (self.__name, ))\n return self.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L47_C8", "label": "debug()", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L46_C4", "vector": [8, 2, 0.2398, 0.0051, 2, 0.79, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " logger.debug(\"debug %s readline...\" % (self.__name, ))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Return_L48_C8", "label": "return", "type": "return", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L46_C4", "vector": [13, 2, 0.2449, 0.0051, 2, 0.79, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L51_C0", "label": "pipe_in = Pipe()", "type": "assigned_variable", "loc": [51, 51], "level": 0, "parent": null, "vector": [14, 0, 0.2602, 0.0051, 0, 0.66, 0.2857, 533, 3, 1, 0, 0, 188, 10, 1], "semantic": {"name": "pipe_in", "arg_names": [], "import_names": [], "rhs_call_name": "Pipe", "annotation": ""}, "snippet": "pipe_in = Pipe('in')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L52_C0", "label": "pipe_out = Pipe()", "type": "assigned_variable", "loc": [52, 52], "level": 0, "parent": null, "vector": [14, 0, 0.2653, 0.0051, 0, 0.66, 0.3214, 603, 3, 1, 0, 0, 188, 10, 1], "semantic": {"name": "pipe_out", "arg_names": [], "import_names": [], "rhs_call_name": "Pipe", "annotation": ""}, "snippet": "pipe_out = Pipe('out')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L54_C0", "label": "debugger = Pdb()", "type": "assigned_variable", "loc": [54, 54], "level": 0, "parent": null, "vector": [14, 0, 0.2755, 0.0051, 0, 0.66, 0.3571, 533, 3, 3, 0, 0, 857, 10, 1], "semantic": {"name": "debugger", "arg_names": [], "import_names": [], "rhs_call_name": "Pdb", "annotation": ""}, "snippet": "debugger = pdb.Pdb(completekey=None, stdin=pipe_in, stdout=pipe_out,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L57_C0", "label": "set_trace", "type": "function", "loc": [57, 60], "level": 0, "parent": null, "vector": [2, 0, 0.2985, 0.0204, 0, 0.66, 0.3929, 796, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "set_trace", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def set_trace():\n \"breakpoint shortcut (like pdb)\"\n logger.info(\"DEBUG: set_trace!\")\n debugger.set_trace(sys._getframe().f_back)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L58_C4", "label": "expression", "type": "expression", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L57_C0", "vector": [8, 1, 0.2959, 0.0051, 1, 0.62, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"breakpoint shortcut (like pdb)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L59_C4", "label": "info()", "type": "expression", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L57_C0", "vector": [8, 1, 0.301, 0.0051, 1, 0.62, 0.5, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " logger.info(\"DEBUG: set_trace!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L60_C4", "label": "set_trace()", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L57_C0", "vector": [8, 1, 0.3061, 0.0051, 1, 0.62, 1.0, 796, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "set_trace", "arg_names": [], "import_names": [], "rhs_call_name": "set_trace", "annotation": ""}, "snippet": " debugger.set_trace(sys._getframe().f_back)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L63_C0", "label": "stop_trace", "type": "function", "loc": [63, 69], "level": 0, "parent": null, "vector": [2, 0, 0.3367, 0.0357, 0, 0.66, 0.4286, 653, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "stop_trace", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def stop_trace():\n \"stop waiting for the debugger (called atexit)\"\n # this should prevent communicate is wait forever a command result\n # and the main thread has finished\n logger.info(\"DEBUG: stop_trace!\")\n pipe_out.write(\"debug finished!\")\n pipe_out.write(None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L64_C4", "label": "expression", "type": "expression", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L63_C0", "vector": [8, 1, 0.3265, 0.0051, 1, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"stop waiting for the debugger (called atexit)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L67_C4", "label": "info()", "type": "expression", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L63_C0", "vector": [8, 1, 0.3418, 0.0051, 1, 0.97, 0.3333, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " logger.info(\"DEBUG: stop_trace!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L68_C4", "label": "write()", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L63_C0", "vector": [8, 1, 0.3469, 0.0051, 1, 0.97, 0.6667, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " pipe_out.write(\"debug finished!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L69_C4", "label": "write()", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L63_C0", "vector": [8, 1, 0.352, 0.0051, 1, 0.97, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " pipe_out.write(None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L73_C0", "label": "communicate", "type": "function", "loc": [73, 86], "level": 0, "parent": null, "vector": [2, 0, 0.4056, 0.0714, 0, 0.66, 0.4643, 768, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "communicate", "arg_names": ["command"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def communicate(command=None):\n \"send command to debbuger, wait result\"\n if command is not None:\n logger.info(\"DEBUG: sending command %s\" % command)\n pipe_in.write(command)\n #pipe_in.flush()\n result = []\n while True:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L74_C4", "label": "expression", "type": "expression", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L73_C0", "vector": [8, 1, 0.3776, 0.0051, 1, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"send command to debbuger, wait result\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:If_L75_C4", "label": "if", "type": "if", "loc": [75, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L73_C0", "vector": [4, 1, 0.3878, 0.0153, 1, 0.38, 0.2, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if command is not None:\n logger.info(\"DEBUG: sending command %s\" % command)\n pipe_in.write(command)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L76_C8", "label": "info()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:If_L75_C4", "vector": [8, 2, 0.3878, 0.0051, 2, 0.41, 0.0, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " logger.info(\"DEBUG: sending command %s\" % command)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L77_C8", "label": "write()", "type": "expression", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:If_L75_C4", "vector": [8, 2, 0.3929, 0.0051, 2, 0.41, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " pipe_in.write(command)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L79_C4", "label": "result =", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L73_C0", "vector": [14, 1, 0.4031, 0.0051, 1, 0.38, 0.4, 51, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:While_L80_C4", "label": "while", "type": "while", "loc": [80, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L73_C0", "vector": [5, 1, 0.4184, 0.0255, 1, 0.38, 0.6, 0, 1, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n data = pipe_out.read()\n if data is None:\n break\n result.append(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L81_C8", "label": "data = read()", "type": "assigned_variable", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:While_L80_C4", "vector": [14, 2, 0.4133, 0.0051, 2, 0.88, 0.0, 929, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " data = pipe_out.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:If_L82_C8", "label": "if", "type": "if", "loc": [82, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:While_L80_C4", "vector": [4, 2, 0.4209, 0.0102, 2, 0.88, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if data is None:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L84_C8", "label": "append()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:While_L80_C4", "vector": [8, 2, 0.4286, 0.0051, 2, 0.88, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " result.append(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L85_C4", "label": "info()", "type": "expression", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L73_C0", "vector": [8, 1, 0.4337, 0.0051, 1, 0.38, 0.8, 730, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " logger.info(\"DEBUG: result %s\" % repr(result))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Return_L86_C4", "label": "return", "type": "return", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L73_C0", "vector": [13, 1, 0.4388, 0.0051, 1, 0.38, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''.join(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Import_L91_C0", "label": "gluon.contrib.qdb import qdb", "type": "import", "loc": [91, 91], "level": 0, "parent": null, "vector": [1, 0, 0.4643, 0.0051, 0, 0.66, 0.5, 946, 0, 1, 0, 0, 946, 0, 0], "semantic": {"name": "gluon.contrib.qdb", "arg_names": [], "import_names": ["qdb"], "rhs_call_name": "", "annotation": ""}, "snippet": "import gluon.contrib.qdb as qdb"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:ImportFrom_L92_C0", "label": "from threading import RLock", "type": "import", "loc": [92, 92], "level": 0, "parent": null, "vector": [1, 0, 0.4694, 0.0051, 0, 0.66, 0.5357, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["RLock"], "rhs_call_name": "", "annotation": ""}, "snippet": "from threading import RLock"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L94_C0", "label": "interact_lock = RLock()", "type": "assigned_variable", "loc": [94, 94], "level": 0, "parent": null, "vector": [14, 0, 0.4796, 0.0051, 0, 0.66, 0.5714, 693, 3, 0, 0, 0, 207, 10, 1], "semantic": {"name": "interact_lock", "arg_names": [], "import_names": [], "rhs_call_name": "RLock", "annotation": ""}, "snippet": "interact_lock = RLock()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L95_C0", "label": "run_lock = RLock()", "type": "assigned_variable", "loc": [95, 95], "level": 0, "parent": null, "vector": [14, 0, 0.4847, 0.0051, 0, 0.66, 0.6071, 727, 3, 0, 0, 0, 207, 10, 1], "semantic": {"name": "run_lock", "arg_names": [], "import_names": [], "rhs_call_name": "RLock", "annotation": ""}, "snippet": "run_lock = RLock()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L98_C0", "label": "check_interaction", "type": "function", "loc": [98, 108], "level": 0, "parent": null, "vector": [2, 0, 0.5255, 0.0561, 0, 0.66, 0.6429, 946, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "check_interaction", "arg_names": ["fn"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def check_interaction(fn):\n \"Decorator to clean and prevent interaction when not available\"\n def check_fn(self, *args, **kwargs):\n interact_lock.acquire()\n try:\n if self.filename:\n self.clear_interaction()\n return fn(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L99_C4", "label": "expression", "type": "expression", "loc": [99, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L98_C0", "vector": [8, 1, 0.5051, 0.0051, 1, 0.3, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Decorator to clean and prevent interaction when not available\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L100_C4", "label": "check_fn", "type": "function", "loc": [100, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L98_C0", "vector": [2, 1, 0.5281, 0.0408, 1, 0.3, 0.5, 340, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "check_fn", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def check_fn(self, *args, **kwargs):\n interact_lock.acquire()\n try:\n if self.filename:\n self.clear_interaction()\n return fn(self, *args, **kwargs)\n finally:\n interact_lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L101_C8", "label": "acquire()", "type": "expression", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L100_C4", "vector": [8, 2, 0.5153, 0.0051, 2, 0.21, 0.0, 229, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "acquire", "arg_names": [], "import_names": [], "rhs_call_name": "acquire", "annotation": ""}, "snippet": " interact_lock.acquire()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L102_C8", "label": "try", "type": "try", "loc": [102, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L100_C4", "vector": [7, 2, 0.5332, 0.0306, 2, 0.21, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if self.filename:\n self.clear_interaction()\n return fn(self, *args, **kwargs)\n finally:\n interact_lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:If_L103_C12", "label": "if", "type": "if", "loc": [103, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L102_C8", "vector": [4, 3, 0.5306, 0.0153, 3, 0.68, 0.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.filename:\n self.clear_interaction()\n return fn(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L104_C16", "label": "clear_interaction()", "type": "expression", "loc": [104, 104], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:If_L103_C12", "vector": [8, 4, 0.5306, 0.0051, 4, 0.79, 0.0, 455, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear_interaction", "arg_names": [], "import_names": [], "rhs_call_name": "clear_interaction", "annotation": ""}, "snippet": " self.clear_interaction()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Return_L105_C16", "label": "return", "type": "return", "loc": [105, 105], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:If_L103_C12", "vector": [13, 4, 0.5357, 0.0051, 4, 0.79, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return fn(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L107_C12", "label": "release()", "type": "expression", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L102_C8", "vector": [8, 3, 0.5459, 0.0051, 3, 0.68, 1.0, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " interact_lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Return_L108_C4", "label": "return", "type": "return", "loc": [108, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L98_C0", "vector": [13, 1, 0.551, 0.0051, 1, 0.3, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return check_fn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "label": "WebDebugger", "type": "class", "loc": [111, 179], "level": 0, "parent": null, "vector": [3, 0, 0.7398, 0.352, 0, 0.66, 0.6786, 371, 0, 11, 0, 0, 642, 0, 17], "semantic": {"name": "WebDebugger", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WebDebugger(qdb.Frontend):\n \"Qdb web2py interface\"\n\n def __init__(self, pipe, completekey='tab', stdin=None, stdout=None):\n qdb.Frontend.__init__(self, pipe)\n self.clear_interaction()\n\n def clear_interaction(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L112_C4", "label": "expression", "type": "expression", "loc": [112, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "vector": [8, 1, 0.5714, 0.0051, 1, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Qdb web2py interface\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L114_C4", "label": "__init__", "type": "function", "loc": [114, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "vector": [2, 1, 0.5867, 0.0153, 1, 0.94, 0.0909, 555, 0, 5, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "pipe", "completekey", "stdin", "stdout"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, pipe, completekey='tab', stdin=None, stdout=None):\n qdb.Frontend.__init__(self, pipe)\n self.clear_interaction()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L115_C8", "label": "__init__()", "type": "expression", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L114_C4", "vector": [8, 2, 0.5867, 0.0051, 2, 0.21, 0.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " qdb.Frontend.__init__(self, pipe)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L116_C8", "label": "clear_interaction()", "type": "expression", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L114_C4", "vector": [8, 2, 0.5918, 0.0051, 2, 0.21, 1.0, 455, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear_interaction", "arg_names": [], "import_names": [], "rhs_call_name": "clear_interaction", "annotation": ""}, "snippet": " self.clear_interaction()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L118_C4", "label": "clear_interaction", "type": "function", "loc": [118, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "vector": [2, 1, 0.6122, 0.0255, 1, 0.94, 0.1818, 455, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "clear_interaction", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clear_interaction(self):\n self.filename = None\n self.lineno = None\n self.exception_info = None\n self.context = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L119_C8", "label": "self.filename =", "type": "assigned_variable", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L118_C4", "vector": [14, 2, 0.6071, 0.0051, 2, 0.29, 0.0, 942, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.filename = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L120_C8", "label": "self.lineno =", "type": "assigned_variable", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L118_C4", "vector": [14, 2, 0.6122, 0.0051, 2, 0.29, 0.3333, 66, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.lineno", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.lineno = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L121_C8", "label": "self.exception_info =", "type": "assigned_variable", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L118_C4", "vector": [14, 2, 0.6173, 0.0051, 2, 0.29, 0.6667, 478, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.exception_info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.exception_info = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L122_C8", "label": "self.context =", "type": "assigned_variable", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L118_C4", "vector": [14, 2, 0.6224, 0.0051, 2, 0.29, 1.0, 249, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.context = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L126_C4", "label": "run", "type": "function", "loc": [126, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "vector": [2, 1, 0.6582, 0.0357, 1, 0.94, 0.2727, 679, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "run", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def run(self):\n run_lock.acquire()\n try:\n while self.pipe.poll():\n qdb.Frontend.run(self)\n finally:\n run_lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L127_C8", "label": "acquire()", "type": "expression", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L126_C4", "vector": [8, 2, 0.648, 0.0051, 2, 0.91, 0.0, 229, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "acquire", "arg_names": [], "import_names": [], "rhs_call_name": "acquire", "annotation": ""}, "snippet": " run_lock.acquire()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L128_C8", "label": "try", "type": "try", "loc": [128, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L126_C4", "vector": [7, 2, 0.6633, 0.0255, 2, 0.91, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n while self.pipe.poll():\n qdb.Frontend.run(self)\n finally:\n run_lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:While_L129_C12", "label": "while", "type": "while", "loc": [129, 130], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L128_C8", "vector": [5, 3, 0.6607, 0.0102, 3, 0.5, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while self.pipe.poll():\n qdb.Frontend.run(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L130_C16", "label": "run()", "type": "expression", "loc": [130, 130], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:While_L129_C12", "vector": [8, 4, 0.6633, 0.0051, 4, 0.81, 0.0, 679, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " qdb.Frontend.run(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L132_C12", "label": "release()", "type": "expression", "loc": [132, 132], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L128_C8", "vector": [8, 3, 0.6735, 0.0051, 3, 0.5, 1.0, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " run_lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L134_C4", "label": "interaction", "type": "function", "loc": [134, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "vector": [2, 1, 0.7041, 0.0459, 1, 0.94, 0.3636, 397, 0, 5, 0, 0, 0, 0, 2], "semantic": {"name": "interaction", "arg_names": ["self", "filename", "lineno", "line", "context"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def interaction(self, filename, lineno, line, **context):\n # store current status\n interact_lock.acquire()\n try:\n self.filename = filename\n self.lineno = lineno\n self.context = context\n finally:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L136_C8", "label": "acquire()", "type": "expression", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L134_C4", "vector": [8, 2, 0.6939, 0.0051, 2, 0.58, 0.0, 229, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "acquire", "arg_names": [], "import_names": [], "rhs_call_name": "acquire", "annotation": ""}, "snippet": " interact_lock.acquire()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L137_C8", "label": "try", "type": "try", "loc": [137, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L134_C4", "vector": [7, 2, 0.7117, 0.0306, 2, 0.58, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.filename = filename\n self.lineno = lineno\n self.context = context\n finally:\n interact_lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L138_C12", "label": "self.filename =", "type": "assigned_variable", "loc": [138, 138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L137_C8", "vector": [14, 3, 0.7041, 0.0051, 3, 0.22, 0.0, 942, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.filename = filename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L139_C12", "label": "self.lineno =", "type": "assigned_variable", "loc": [139, 139], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L137_C8", "vector": [14, 3, 0.7092, 0.0051, 3, 0.22, 0.3333, 66, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.lineno", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.lineno = lineno"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L140_C12", "label": "self.context =", "type": "assigned_variable", "loc": [140, 140], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L137_C8", "vector": [14, 3, 0.7143, 0.0051, 3, 0.22, 0.6667, 249, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.context = context"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L142_C12", "label": "release()", "type": "expression", "loc": [142, 142], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L137_C8", "vector": [8, 3, 0.7245, 0.0051, 3, 0.22, 1.0, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " interact_lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L144_C4", "label": "exception", "type": "function", "loc": [144, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "vector": [2, 1, 0.7423, 0.0204, 1, 0.94, 0.4545, 69, 0, 6, 0, 0, 0, 0, 0], "semantic": {"name": "exception", "arg_names": ["self", "title", "extype", "exvalue", "trace", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def exception(self, title, extype, exvalue, trace, request):\n self.exception_info = {'title': title,\n 'extype': extype, 'exvalue': exvalue,\n 'trace': trace, 'request': request}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L145_C8", "label": "self.exception_info =", "type": "assigned_variable", "loc": [145, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L144_C4", "vector": [14, 2, 0.7449, 0.0153, 2, 0.79, 0.0, 478, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.exception_info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.exception_info = {'title': title,\n 'extype': extype, 'exvalue': exvalue,\n 'trace': trace, 'request': request}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L150_C4", "label": "do_continue", "type": "function", "loc": [150, 151], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "vector": [2, 1, 0.7679, 0.0102, 1, 0.94, 0.5455, 180, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "do_continue", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def do_continue(self):\n qdb.Frontend.do_continue(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L151_C8", "label": "do_continue()", "type": "expression", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L150_C4", "vector": [8, 2, 0.7704, 0.0051, 2, 0.92, 0.0, 180, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "do_continue", "arg_names": [], "import_names": [], "rhs_call_name": "do_continue", "annotation": ""}, "snippet": " qdb.Frontend.do_continue(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L154_C4", "label": "do_step", "type": "function", "loc": [154, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "vector": [2, 1, 0.7883, 0.0102, 1, 0.94, 0.6364, 705, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "do_step", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def do_step(self):\n qdb.Frontend.do_step(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L155_C8", "label": "do_step()", "type": "expression", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L154_C4", "vector": [8, 2, 0.7908, 0.0051, 2, 0.18, 0.0, 705, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "do_step", "arg_names": [], "import_names": [], "rhs_call_name": "do_step", "annotation": ""}, "snippet": " qdb.Frontend.do_step(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L158_C4", "label": "do_return", "type": "function", "loc": [158, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "vector": [2, 1, 0.8087, 0.0102, 1, 0.94, 0.7273, 596, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "do_return", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def do_return(self):\n qdb.Frontend.do_return(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L159_C8", "label": "do_return()", "type": "expression", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L158_C4", "vector": [8, 2, 0.8112, 0.0051, 2, 0.87, 0.0, 596, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "do_return", "arg_names": [], "import_names": [], "rhs_call_name": "do_return", "annotation": ""}, "snippet": " qdb.Frontend.do_return(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L162_C4", "label": "do_next", "type": "function", "loc": [162, 163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "vector": [2, 1, 0.8291, 0.0102, 1, 0.94, 0.8182, 938, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "do_next", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def do_next(self):\n qdb.Frontend.do_next(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L163_C8", "label": "do_next()", "type": "expression", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L162_C4", "vector": [8, 2, 0.8316, 0.0051, 2, 0.28, 0.0, 938, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "do_next", "arg_names": [], "import_names": [], "rhs_call_name": "do_next", "annotation": ""}, "snippet": " qdb.Frontend.do_next(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L166_C4", "label": "do_quit", "type": "function", "loc": [166, 167], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "vector": [2, 1, 0.8495, 0.0102, 1, 0.94, 0.9091, 634, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "do_quit", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def do_quit(self):\n qdb.Frontend.do_quit(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L167_C8", "label": "do_quit()", "type": "expression", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L166_C4", "vector": [8, 2, 0.852, 0.0051, 2, 0.03, 0.0, 634, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "do_quit", "arg_names": [], "import_names": [], "rhs_call_name": "do_quit", "annotation": ""}, "snippet": " qdb.Frontend.do_quit(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L169_C4", "label": "do_exec", "type": "function", "loc": [169, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "vector": [2, 1, 0.8878, 0.0561, 1, 0.94, 1.0, 553, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "do_exec", "arg_names": ["self", "statement"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def do_exec(self, statement):\n interact_lock.acquire()\n try:\n # check to see if we're inside interaction\n if self.filename:\n # avoid spurious interaction notifications:\n self.set_burst(2)\n # execute the statement in the remote debugger:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L170_C8", "label": "acquire()", "type": "expression", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L169_C4", "vector": [8, 2, 0.8673, 0.0051, 2, 0.84, 0.0, 229, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "acquire", "arg_names": [], "import_names": [], "rhs_call_name": "acquire", "annotation": ""}, "snippet": " interact_lock.acquire()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L171_C8", "label": "try", "type": "try", "loc": [171, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L169_C4", "vector": [7, 2, 0.8929, 0.0459, 2, 0.84, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # check to see if we're inside interaction\n if self.filename:\n # avoid spurious interaction notifications:\n self.set_burst(2)\n # execute the statement in the remote debugger:\n return qdb.Frontend.do_exec(self, statement)\n finally:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:If_L173_C12", "label": "if", "type": "if", "loc": [173, 177], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L171_C8", "vector": [4, 3, 0.8929, 0.0255, 3, 0.32, 0.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.filename:\n # avoid spurious interaction notifications:\n self.set_burst(2)\n # execute the statement in the remote debugger:\n return qdb.Frontend.do_exec(self, statement)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L175_C16", "label": "set_burst()", "type": "expression", "loc": [175, 175], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:If_L173_C12", "vector": [8, 4, 0.8929, 0.0051, 4, 0.89, 0.0, 815, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_burst", "arg_names": [], "import_names": [], "rhs_call_name": "set_burst", "annotation": ""}, "snippet": " self.set_burst(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Return_L177_C16", "label": "return", "type": "return", "loc": [177, 177], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:If_L173_C12", "vector": [13, 4, 0.9031, 0.0051, 4, 0.89, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return qdb.Frontend.do_exec(self, statement)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L179_C12", "label": "release()", "type": "expression", "loc": [179, 179], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L171_C8", "vector": [8, 3, 0.9133, 0.0051, 3, 0.32, 1.0, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " interact_lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L183_C0", "label": "parent_queue, child_queue =", "type": "assigned_variable", "loc": [183, 183], "level": 0, "parent": null, "vector": [14, 0, 0.9337, 0.0051, 0, 0.66, 0.7143, 804, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "parent_queue, child_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "parent_queue, child_queue = Queue.Queue(), Queue.Queue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L184_C0", "label": "front_conn = QueuePipe()", "type": "assigned_variable", "loc": [184, 184], "level": 0, "parent": null, "vector": [14, 0, 0.9388, 0.0051, 0, 0.66, 0.75, 718, 3, 3, 0, 0, 713, 10, 1], "semantic": {"name": "front_conn", "arg_names": [], "import_names": [], "rhs_call_name": "QueuePipe", "annotation": ""}, "snippet": "front_conn = qdb.QueuePipe(\"parent\", parent_queue, child_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L185_C0", "label": "child_conn = QueuePipe()", "type": "assigned_variable", "loc": [185, 185], "level": 0, "parent": null, "vector": [14, 0, 0.9439, 0.0051, 0, 0.66, 0.7857, 506, 3, 3, 0, 0, 713, 10, 1], "semantic": {"name": "child_conn", "arg_names": [], "import_names": [], "rhs_call_name": "QueuePipe", "annotation": ""}, "snippet": "child_conn = qdb.QueuePipe(\"child\", child_queue, parent_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L187_C0", "label": "web_debugger = WebDebugger()", "type": "assigned_variable", "loc": [187, 187], "level": 0, "parent": null, "vector": [14, 0, 0.9541, 0.0051, 0, 0.66, 0.8214, 609, 3, 1, 0, 0, 371, 10, 1], "semantic": {"name": "web_debugger", "arg_names": [], "import_names": [], "rhs_call_name": "WebDebugger", "annotation": ""}, "snippet": "web_debugger = WebDebugger(front_conn) # frontend"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L188_C0", "label": "qdb_debugger = Qdb()", "type": "assigned_variable", "loc": [188, 189], "level": 0, "parent": null, "vector": [14, 0, 0.9617, 0.0102, 0, 0.66, 0.8571, 238, 3, 3, 0, 0, 913, 10, 1], "semantic": {"name": "qdb_debugger", "arg_names": [], "import_names": [], "rhs_call_name": "Qdb", "annotation": ""}, "snippet": "qdb_debugger = qdb.Qdb(\n pipe=child_conn, redirect_stdio=False, skip=None) # backend"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L190_C0", "label": "dbg =", "type": "assigned_variable", "loc": [190, 190], "level": 0, "parent": null, "vector": [14, 0, 0.9694, 0.0051, 0, 0.66, 0.8929, 469, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dbg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "dbg = qdb_debugger"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L193_C0", "label": "set_params()", "type": "expression", "loc": [193, 193], "level": 0, "parent": null, "vector": [8, 0, 0.9847, 0.0051, 0, 0.66, 0.9286, 927, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "set_params", "arg_names": [], "import_names": [], "rhs_call_name": "set_params", "annotation": ""}, "snippet": "qdb_debugger.set_params(dict(call_stack=True, environment=True))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Import_L195_C0", "label": "gluon.main import gluon.main", "type": "import", "loc": [195, 195], "level": 0, "parent": null, "vector": [1, 0, 0.9949, 0.0051, 0, 0.66, 0.9643, 639, 0, 1, 0, 0, 639, 0, 0], "semantic": {"name": "gluon.main", "arg_names": [], "import_names": ["gluon.main"], "rhs_call_name": "", "annotation": ""}, "snippet": "import gluon.main"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L196_C0", "label": "gluon.main.global_settings.debugging =", "type": "assigned_variable", "loc": [196, 196], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.0051, 0, 0.66, 1.0, 814, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "gluon.main.global_settings.debugging", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "gluon.main.global_settings.debugging = True"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L27_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Return_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Return_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:If_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:If_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:If_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:While_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:While_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:While_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:If_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:While_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Return_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L102_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_449:If_L103_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:If_L103_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L104_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:If_L103_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Return_L105_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L102_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Return_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L128_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_449:While_L129_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:While_L129_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L130_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L128_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L132_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L137_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L138_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L137_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L139_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L137_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L140_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L137_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L142_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Assign_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L150_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L158_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L158_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:ClassDef_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L169_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:FunctionDef_L169_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L171_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L171_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_449:If_L173_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:If_L173_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L175_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:If_L173_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Return_L177_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_449:Try_L171_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_449:Expr_L179_C12"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
This file specifically includes utilities for security.
"""
import threading
import struct
import hashlib
import hmac
import uuid
import random
import time
import os
import re
import sys
import logging
import socket
import base64
import zlib
python_version = sys.version_info[0]
if python_version == 2:
import cPickle as pickle
else:
import pickle
try:
from Crypto.Cipher import AES
except ImportError:
import contrib.aes as AES
try:
from contrib.pbkdf2 import pbkdf2_hex
HAVE_PBKDF2 = True
except ImportError:
try:
from .pbkdf2 import pbkdf2_hex
HAVE_PBKDF2 = True
except (ImportError, ValueError):
HAVE_PBKDF2 = False
logger = logging.getLogger("web2py")
def AES_new(key, IV=None):
""" Returns an AES cipher object and random IV if None specified """
if IV is None:
IV = fast_urandom16()
return AES.new(key, AES.MODE_CBC, IV), IV
def compare(a, b):
""" compares two strings and not vulnerable to timing attacks """
if len(a) != len(b):
return False
result = 0
for x, y in zip(a, b):
result |= ord(x) ^ ord(y)
return result == 0
def md5_hash(text):
""" Generate a md5 hash with the given text """
return hashlib.md5(text).hexdigest()
def simple_hash(text, key='', salt='', digest_alg='md5'):
"""
Generates hash with the given text using the specified
digest hashing algorithm
"""
if not digest_alg:
raise RuntimeError("simple_hash with digest_alg=None")
elif not isinstance(digest_alg, str): # manual approach
h = digest_alg(text + key + salt)
elif digest_alg.startswith('pbkdf2'): # latest and coolest!
iterations, keylen, alg = digest_alg[7:-1].split(',')
return pbkdf2_hex(text, salt, int(iterations),
int(keylen), get_digest(alg))
elif key: # use hmac
digest_alg = get_digest(digest_alg)
h = hmac.new(key + salt, text, digest_alg)
else: # compatible with third party systems
h = hashlib.new(digest_alg)
h.update(text + salt)
return h.hexdigest()
def get_digest(value):
"""
Returns a hashlib digest algorithm from a string
"""
if not isinstance(value, str):
return value
value = value.lower()
if value == "md5":
return hashlib.md5
elif value == "sha1":
return hashlib.sha1
elif value == "sha224":
return hashlib.sha224
elif value == "sha256":
return hashlib.sha256
elif value == "sha384":
return hashlib.sha384
elif value == "sha512":
return hashlib.sha512
else:
raise ValueError("Invalid digest algorithm: %s" % value)
DIGEST_ALG_BY_SIZE = {
128 / 4: 'md5',
160 / 4: 'sha1',
224 / 4: 'sha224',
256 / 4: 'sha256',
384 / 4: 'sha384',
512 / 4: 'sha512',
}
def pad(s, n=32, padchar=' '):
return s + (32 - len(s) % 32) * padchar
def secure_dumps(data, encryption_key, hash_key=None, compression_level=None):
if not hash_key:
hash_key = hashlib.sha1(encryption_key).hexdigest()
dump = pickle.dumps(data)
if compression_level:
dump = zlib.compress(dump, compression_level)
key = pad(encryption_key[:32])
cipher, IV = AES_new(key)
encrypted_data = base64.urlsafe_b64encode(IV + cipher.encrypt(pad(dump)))
signature = hmac.new(hash_key, encrypted_data).hexdigest()
return signature + ':' + encrypted_data
def secure_loads(data, encryption_key, hash_key=None, compression_level=None):
if not ':' in data:
return None
if not hash_key:
hash_key = hashlib.sha1(encryption_key).hexdigest()
signature, encrypted_data = data.split(':', 1)
actual_signature = hmac.new(hash_key, encrypted_data).hexdigest()
if not compare(signature, actual_signature):
return None
key = pad(encryption_key[:32])
encrypted_data = base64.urlsafe_b64decode(encrypted_data)
IV, encrypted_data = encrypted_data[:16], encrypted_data[16:]
cipher, _ = AES_new(key, IV=IV)
try:
data = cipher.decrypt(encrypted_data)
data = data.rstrip(' ')
if compression_level:
data = zlib.decompress(data)
return pickle.loads(data)
except (TypeError, pickle.UnpicklingError):
return None
### compute constant CTOKENS
def initialize_urandom():
"""
This function and the web2py_uuid follow from the following discussion:
http://groups.google.com/group/web2py-developers/browse_thread/thread/7fd5789a7da3f09
At startup web2py compute a unique ID that identifies the machine by adding
uuid.getnode() + int(time.time() * 1e3)
This is a 48-bit number. It converts the number into 16 8-bit tokens.
It uses this value to initialize the entropy source ('/dev/urandom') and to seed random.
If os.random() is not supported, it falls back to using random and issues a warning.
"""
node_id = uuid.getnode()
microseconds = int(time.time() * 1e6)
ctokens = [((node_id + microseconds) >> ((i % 6) * 8)) %
256 for i in range(16)]
random.seed(node_id + microseconds)
try:
os.urandom(1)
have_urandom = True
try:
# try to add process-specific entropy
frandom = open('/dev/urandom', 'wb')
try:
if python_version == 2:
frandom.write(''.join(chr(t) for t in ctokens)) # python 2
else:
frandom.write(bytes([]).join(bytes([t]) for t in ctokens)) # python 3
finally:
frandom.close()
except IOError:
# works anyway
pass
except NotImplementedError:
have_urandom = False
logger.warning(
"""Cryptographically secure session management is not possible on your system because
your system does not provide a cryptographically secure entropy source.
This is not specific to web2py; consider deploying on a different operating system.""")
if python_version == 2:
packed = ''.join(chr(x) for x in ctokens) # python 2
else:
packed = bytes([]).join(bytes([x]) for x in ctokens) # python 3
unpacked_ctokens = struct.unpack('=QQ', packed)
return unpacked_ctokens, have_urandom
UNPACKED_CTOKENS, HAVE_URANDOM = initialize_urandom()
def fast_urandom16(urandom=[], locker=threading.RLock()):
"""
this is 4x faster than calling os.urandom(16) and prevents
the "too many files open" issue with concurrent access to os.urandom()
"""
try:
return urandom.pop()
except IndexError:
try:
locker.acquire()
ur = os.urandom(16 * 1024)
urandom += [ur[i:i + 16] for i in xrange(16, 1024 * 16, 16)]
return ur[0:16]
finally:
locker.release()
def web2py_uuid(ctokens=UNPACKED_CTOKENS):
"""
This function follows from the following discussion:
http://groups.google.com/group/web2py-developers/browse_thread/thread/7fd5789a7da3f09
It works like uuid.uuid4 except that tries to use os.urandom() if possible
and it XORs the output with the tokens uniquely associated with this machine.
"""
rand_longs = (random.getrandbits(64), random.getrandbits(64))
if HAVE_URANDOM:
urand_longs = struct.unpack('=QQ', fast_urandom16())
byte_s = struct.pack('=QQ',
rand_longs[0] ^ urand_longs[0] ^ ctokens[0],
rand_longs[1] ^ urand_longs[1] ^ ctokens[1])
else:
byte_s = struct.pack('=QQ',
rand_longs[0] ^ ctokens[0],
rand_longs[1] ^ ctokens[1])
return str(uuid.UUID(bytes=byte_s, version=4))
REGEX_IPv4 = re.compile('(\d+)\.(\d+)\.(\d+)\.(\d+)')
def is_valid_ip_address(address):
"""
>>> is_valid_ip_address('127.0')
False
>>> is_valid_ip_address('127.0.0.1')
True
>>> is_valid_ip_address('2001:660::1')
True
"""
# deal with special cases
if address.lower() in ('127.0.0.1', 'localhost', '::1', '::ffff:127.0.0.1'):
return True
elif address.lower() in ('unknown', ''):
return False
elif address.count('.') == 3: # assume IPv4
if address.startswith('::ffff:'):
address = address[7:]
if hasattr(socket, 'inet_aton'): # try validate using the OS
try:
socket.inet_aton(address)
return True
except socket.error: # invalid address
return False
else: # try validate using Regex
match = REGEX_IPv4.match(address)
if match and all(0 <= int(match.group(i)) < 256 for i in (1, 2, 3, 4)):
return True
return False
elif hasattr(socket, 'inet_pton'): # assume IPv6, try using the OS
try:
socket.inet_pton(socket.AF_INET6, address)
return True
except socket.error: # invalid address
return False
else: # do not know what to do? assume it is a valid address
return True
def is_loopback_ip_address(ip=None, addrinfo=None):
"""
Determines whether the address appears to be a loopback address.
This assumes that the IP is valid.
"""
if addrinfo: # see socket.getaddrinfo() for layout of addrinfo tuple
if addrinfo[0] == socket.AF_INET or addrinfo[0] == socket.AF_INET6:
ip = addrinfo[4]
if not isinstance(ip, basestring):
return False
# IPv4 or IPv6-embedded IPv4 or IPv4-compatible IPv6
if ip.count('.') == 3:
return ip.lower().startswith(('127', '::127', '0:0:0:0:0:0:127',
'::ffff:127', '0:0:0:0:0:ffff:127'))
return ip == '::1' or ip == '0:0:0:0:0:0:0:1' # IPv6 loopback
def getipaddrinfo(host):
"""
Filter out non-IP and bad IP addresses from getaddrinfo
"""
try:
return [addrinfo for addrinfo in socket.getaddrinfo(host, None)
if (addrinfo[0] == socket.AF_INET or
addrinfo[0] == socket.AF_INET6)
and isinstance(addrinfo[4][0], basestring)]
except socket.error:
return []
| ajibawa-2023/Python-Code-Large/train/row_450 | 191 | 325 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0215, 0.0215, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis file is part of the web2py Web Framework\nCopyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>\nLicense: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)\n\nThis file specifically includes utilities for security.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Import_L12_C0", "label": "threading import threading", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0369, 0.0031, 0, 0.66, 0.0278, 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_450:Import_L13_C0", "label": "struct import struct", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.04, 0.0031, 0, 0.66, 0.0556, 399, 0, 1, 0, 0, 399, 0, 0], "semantic": {"name": "struct", "arg_names": [], "import_names": ["struct"], "rhs_call_name": "", "annotation": ""}, "snippet": "import struct"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Import_L14_C0", "label": "hashlib import hashlib", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0431, 0.0031, 0, 0.66, 0.0833, 154, 0, 1, 0, 0, 154, 0, 0], "semantic": {"name": "hashlib", "arg_names": [], "import_names": ["hashlib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hashlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Import_L15_C0", "label": "hmac import hmac", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0462, 0.0031, 0, 0.66, 0.1111, 993, 0, 1, 0, 0, 993, 0, 0], "semantic": {"name": "hmac", "arg_names": [], "import_names": ["hmac"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hmac"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Import_L16_C0", "label": "uuid import uuid", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0492, 0.0031, 0, 0.66, 0.1389, 9, 0, 1, 0, 0, 9, 0, 0], "semantic": {"name": "uuid", "arg_names": [], "import_names": ["uuid"], "rhs_call_name": "", "annotation": ""}, "snippet": "import uuid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Import_L17_C0", "label": "random import random", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0523, 0.0031, 0, 0.66, 0.1667, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["random"], "rhs_call_name": "", "annotation": ""}, "snippet": "import random"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Import_L18_C0", "label": "time import time", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0554, 0.0031, 0, 0.66, 0.1944, 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_450:Import_L19_C0", "label": "os import os", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0585, 0.0031, 0, 0.66, 0.2222, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Import_L20_C0", "label": "re import re", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.0615, 0.0031, 0, 0.66, 0.25, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Import_L21_C0", "label": "sys import sys", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.0646, 0.0031, 0, 0.66, 0.2778, 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_450:Import_L22_C0", "label": "logging import logging", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.0677, 0.0031, 0, 0.66, 0.3056, 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_450:Import_L23_C0", "label": "socket import socket", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.0708, 0.0031, 0, 0.66, 0.3333, 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_450:Import_L24_C0", "label": "base64 import base64", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.0738, 0.0031, 0, 0.66, 0.3611, 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_450:Import_L25_C0", "label": "zlib import zlib", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0031, 0, 0.66, 0.3889, 373, 0, 1, 0, 0, 373, 0, 0], "semantic": {"name": "zlib", "arg_names": [], "import_names": ["zlib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import zlib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L27_C0", "label": "python_version =", "type": "assigned_variable", "loc": [27, 27], "level": 0, "parent": null, "vector": [14, 0, 0.0831, 0.0031, 0, 0.66, 0.4167, 250, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "python_version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "python_version = sys.version_info[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L29_C0", "label": "if", "type": "if", "loc": [29, 32], "level": 0, "parent": null, "vector": [4, 0, 0.0938, 0.0123, 0, 0.66, 0.4444, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if python_version == 2:\n import cPickle as pickle\nelse:\n import pickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Import_L30_C4", "label": "cPickle import pickle", "type": "import", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L29_C0", "vector": [1, 1, 0.0923, 0.0031, 1, 0.14, 0.0, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["pickle"], "rhs_call_name": "", "annotation": ""}, "snippet": " import cPickle as pickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Import_L32_C4", "label": "pickle import pickle", "type": "import", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L29_C0", "vector": [1, 1, 0.0985, 0.0031, 1, 0.14, 1.0, 848, 0, 1, 0, 0, 848, 0, 0], "semantic": {"name": "pickle", "arg_names": [], "import_names": ["pickle"], "rhs_call_name": "", "annotation": ""}, "snippet": " import pickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L35_C0", "label": "try", "type": "try", "loc": [35, 38], "level": 0, "parent": null, "vector": [7, 0, 0.1123, 0.0123, 0, 0.66, 0.4722, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from Crypto.Cipher import AES\nexcept ImportError:\n import contrib.aes as AES"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:ImportFrom_L36_C4", "label": "from Crypto.Cipher import AES", "type": "import", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L35_C0", "vector": [1, 1, 0.1108, 0.0031, 1, 0.61, 0.0, 663, 0, 1, 0, 0, 663, 0, 0], "semantic": {"name": "Crypto.Cipher", "arg_names": [], "import_names": ["AES"], "rhs_call_name": "", "annotation": ""}, "snippet": " from Crypto.Cipher import AES"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Import_L38_C4", "label": "contrib.aes import AES", "type": "import", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L35_C0", "vector": [1, 1, 0.1169, 0.0031, 1, 0.61, 0.0, 472, 0, 1, 0, 0, 472, 0, 0], "semantic": {"name": "contrib.aes", "arg_names": [], "import_names": ["AES"], "rhs_call_name": "", "annotation": ""}, "snippet": " import contrib.aes as AES"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L40_C0", "label": "try", "type": "try", "loc": [40, 48], "level": 0, "parent": null, "vector": [7, 0, 0.1354, 0.0277, 0, 0.66, 0.5, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from contrib.pbkdf2 import pbkdf2_hex\n HAVE_PBKDF2 = True\nexcept ImportError:\n try:\n from .pbkdf2 import pbkdf2_hex\n HAVE_PBKDF2 = True\n except (ImportError, ValueError):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:ImportFrom_L41_C4", "label": "from contrib.pbkdf2 import pbkdf2_hex", "type": "import", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L40_C0", "vector": [1, 1, 0.1262, 0.0031, 1, 0.38, 0.0, 629, 0, 1, 0, 0, 629, 0, 0], "semantic": {"name": "contrib.pbkdf2", "arg_names": [], "import_names": ["pbkdf2_hex"], "rhs_call_name": "", "annotation": ""}, "snippet": " from contrib.pbkdf2 import pbkdf2_hex"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L42_C4", "label": "HAVE_PBKDF2 =", "type": "assigned_variable", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L40_C0", "vector": [14, 1, 0.1292, 0.0031, 1, 0.38, 1.0, 284, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "HAVE_PBKDF2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " HAVE_PBKDF2 = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L44_C4", "label": "try", "type": "try", "loc": [44, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L40_C0", "vector": [7, 1, 0.1415, 0.0154, 1, 0.38, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n from .pbkdf2 import pbkdf2_hex\n HAVE_PBKDF2 = True\n except (ImportError, ValueError):\n HAVE_PBKDF2 = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:ImportFrom_L45_C8", "label": "from pbkdf2 import pbkdf2_hex", "type": "import", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L44_C4", "vector": [1, 2, 0.1385, 0.0031, 2, 0.91, 0.0, 872, 0, 1, 0, 0, 872, 0, 0], "semantic": {"name": "pbkdf2", "arg_names": [], "import_names": ["pbkdf2_hex"], "rhs_call_name": "", "annotation": ""}, "snippet": " from .pbkdf2 import pbkdf2_hex"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L46_C8", "label": "HAVE_PBKDF2 =", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L44_C4", "vector": [14, 2, 0.1415, 0.0031, 2, 0.91, 1.0, 284, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "HAVE_PBKDF2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " HAVE_PBKDF2 = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L48_C8", "label": "HAVE_PBKDF2 =", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L44_C4", "vector": [14, 2, 0.1477, 0.0031, 2, 0.91, 0.0, 284, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "HAVE_PBKDF2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " HAVE_PBKDF2 = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L50_C0", "label": "logger = getLogger()", "type": "assigned_variable", "loc": [50, 50], "level": 0, "parent": null, "vector": [14, 0, 0.1538, 0.0031, 0, 0.66, 0.5278, 532, 3, 1, 0, 0, 71, 10, 1], "semantic": {"name": "logger", "arg_names": [], "import_names": [], "rhs_call_name": "getLogger", "annotation": ""}, "snippet": "logger = logging.getLogger(\"web2py\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L52_C0", "label": "AES_new", "type": "function", "loc": [52, 57], "level": 0, "parent": null, "vector": [2, 0, 0.1677, 0.0185, 0, 0.66, 0.5556, 325, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "AES_new", "arg_names": ["key", "IV"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def AES_new(key, IV=None):\n \"\"\" Returns an AES cipher object and random IV if None specified \"\"\"\n if IV is None:\n IV = fast_urandom16()\n\n return AES.new(key, AES.MODE_CBC, IV), IV"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L53_C4", "label": "expression", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L52_C0", "vector": [8, 1, 0.1631, 0.0031, 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 AES cipher object and random IV if None specified \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L54_C4", "label": "if", "type": "if", "loc": [54, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L52_C0", "vector": [4, 1, 0.1677, 0.0062, 1, 0.71, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if IV is None:\n IV = fast_urandom16()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L55_C8", "label": "IV = fast_urandom16()", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L54_C4", "vector": [14, 2, 0.1692, 0.0031, 2, 0.74, 0.0, 44, 3, 0, 0, 0, 730, 10, 1], "semantic": {"name": "IV", "arg_names": [], "import_names": [], "rhs_call_name": "fast_urandom16", "annotation": ""}, "snippet": " IV = fast_urandom16()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L57_C4", "label": "return", "type": "return", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L52_C0", "vector": [13, 1, 0.1754, 0.0031, 1, 0.71, 1.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return AES.new(key, AES.MODE_CBC, IV), IV"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L60_C0", "label": "compare", "type": "function", "loc": [60, 67], "level": 0, "parent": null, "vector": [2, 0, 0.1954, 0.0246, 0, 0.66, 0.5833, 383, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "compare", "arg_names": ["a", "b"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def compare(a, b):\n \"\"\" compares two strings and not vulnerable to timing attacks \"\"\"\n if len(a) != len(b):\n return False\n result = 0\n for x, y in zip(a, b):\n result |= ord(x) ^ ord(y)\n return result == 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L61_C4", "label": "expression", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L60_C0", "vector": [8, 1, 0.1877, 0.0031, 1, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" compares two strings and not vulnerable to timing attacks \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L62_C4", "label": "if", "type": "if", "loc": [62, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L60_C0", "vector": [4, 1, 0.1923, 0.0062, 1, 0.67, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(a) != len(b):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L63_C8", "label": "return", "type": "return", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L62_C4", "vector": [13, 2, 0.1938, 0.0031, 2, 0.07, 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_450:Assign_L64_C4", "label": "result =", "type": "assigned_variable", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L60_C0", "vector": [14, 1, 0.1969, 0.0031, 1, 0.67, 0.5, 51, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:For_L65_C4", "label": "for x, y", "type": "for", "loc": [65, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L60_C0", "vector": [6, 1, 0.2015, 0.0062, 1, 0.67, 0.75, 855, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "x, y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for x, y in zip(a, b):\n result |= ord(x) ^ ord(y)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L67_C4", "label": "return", "type": "return", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L60_C0", "vector": [13, 1, 0.2062, 0.0031, 1, 0.67, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result == 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L70_C0", "label": "md5_hash", "type": "function", "loc": [70, 72], "level": 0, "parent": null, "vector": [2, 0, 0.2185, 0.0092, 0, 0.66, 0.6111, 897, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "md5_hash", "arg_names": ["text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def md5_hash(text):\n \"\"\" Generate a md5 hash with the given text \"\"\"\n return hashlib.md5(text).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L71_C4", "label": "expression", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L70_C0", "vector": [8, 1, 0.2185, 0.0031, 1, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Generate a md5 hash with the given text \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L72_C4", "label": "return", "type": "return", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L70_C0", "vector": [13, 1, 0.2215, 0.0031, 1, 0.05, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return hashlib.md5(text).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L75_C0", "label": "simple_hash", "type": "function", "loc": [75, 94], "level": 0, "parent": null, "vector": [2, 0, 0.26, 0.0615, 0, 0.66, 0.6389, 827, 0, 4, 1, 0, 0, 0, 14], "semantic": {"name": "simple_hash", "arg_names": ["text", "key", "salt", "digest_alg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def simple_hash(text, key='', salt='', digest_alg='md5'):\n \"\"\"\n Generates hash with the given text using the specified\n digest hashing algorithm\n \"\"\"\n if not digest_alg:\n raise RuntimeError(\"simple_hash with digest_alg=None\")\n elif not isinstance(digest_alg, str): # manual approach"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L76_C4", "label": "expression", "type": "expression", "loc": [76, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L75_C0", "vector": [8, 1, 0.2385, 0.0123, 1, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Generates hash with the given text using the specified\n digest hashing algorithm\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L80_C4", "label": "if", "type": "if", "loc": [80, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L75_C0", "vector": [4, 1, 0.2662, 0.0431, 1, 0.73, 0.5, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not digest_alg:\n raise RuntimeError(\"simple_hash with digest_alg=None\")\n elif not isinstance(digest_alg, str): # manual approach\n h = digest_alg(text + key + salt)\n elif digest_alg.startswith('pbkdf2'): # latest and coolest!\n iterations, keylen, alg = digest_alg[7:-1].split(',')\n return pbkdf2_hex(text, salt, int(iterations),\n int(keylen), get_digest(alg))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L82_C4", "label": "if", "type": "if", "loc": [82, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L80_C4", "vector": [4, 2, 0.2692, 0.0369, 2, 0.57, 0.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not isinstance(digest_alg, str): # manual approach\n h = digest_alg(text + key + salt)\n elif digest_alg.startswith('pbkdf2'): # latest and coolest!\n iterations, keylen, alg = digest_alg[7:-1].split(',')\n return pbkdf2_hex(text, salt, int(iterations),\n int(keylen), get_digest(alg))\n elif key: # use hmac\n digest_alg = get_digest(digest_alg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L83_C8", "label": "h = digest_alg()", "type": "assigned_variable", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L82_C4", "vector": [14, 3, 0.2554, 0.0031, 3, 0.73, 0.0, 686, 3, 1, 0, 0, 937, 10, 1], "semantic": {"name": "h", "arg_names": [], "import_names": [], "rhs_call_name": "digest_alg", "annotation": ""}, "snippet": " h = digest_alg(text + key + salt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L84_C4", "label": "if", "type": "if", "loc": [84, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L82_C4", "vector": [4, 3, 0.2723, 0.0308, 3, 0.73, 1.0, 0, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif digest_alg.startswith('pbkdf2'): # latest and coolest!\n iterations, keylen, alg = digest_alg[7:-1].split(',')\n return pbkdf2_hex(text, salt, int(iterations),\n int(keylen), get_digest(alg))\n elif key: # use hmac\n digest_alg = get_digest(digest_alg)\n h = hmac.new(key + salt, text, digest_alg)\n else: # compatible with third party systems"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L85_C8", "label": "iterations, keylen, alg = split()", "type": "assigned_variable", "loc": [85, 85], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L84_C4", "vector": [14, 4, 0.2615, 0.0031, 4, 0.43, 0.0, 733, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "iterations, keylen, alg", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " iterations, keylen, alg = digest_alg[7:-1].split(',')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L86_C8", "label": "return", "type": "return", "loc": [86, 87], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L84_C4", "vector": [13, 4, 0.2662, 0.0062, 4, 0.43, 0.5, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return pbkdf2_hex(text, salt, int(iterations),\n int(keylen), get_digest(alg))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L88_C4", "label": "if", "type": "if", "loc": [88, 93], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L84_C4", "vector": [4, 4, 0.2785, 0.0185, 4, 0.43, 1.0, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key: # use hmac\n digest_alg = get_digest(digest_alg)\n h = hmac.new(key + salt, text, digest_alg)\n else: # compatible with third party systems\n h = hashlib.new(digest_alg)\n h.update(text + salt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L89_C8", "label": "digest_alg = get_digest()", "type": "assigned_variable", "loc": [89, 89], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L88_C4", "vector": [14, 5, 0.2738, 0.0031, 5, 0.61, 0.0, 937, 3, 1, 0, 0, 61, 10, 1], "semantic": {"name": "digest_alg", "arg_names": [], "import_names": [], "rhs_call_name": "get_digest", "annotation": ""}, "snippet": " digest_alg = get_digest(digest_alg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L90_C8", "label": "h = new()", "type": "assigned_variable", "loc": [90, 90], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L88_C4", "vector": [14, 5, 0.2769, 0.0031, 5, 0.61, 0.3333, 686, 3, 3, 0, 0, 145, 10, 1], "semantic": {"name": "h", "arg_names": [], "import_names": [], "rhs_call_name": "new", "annotation": ""}, "snippet": " h = hmac.new(key + salt, text, digest_alg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L92_C8", "label": "h = new()", "type": "assigned_variable", "loc": [92, 92], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L88_C4", "vector": [14, 5, 0.2831, 0.0031, 5, 0.61, 0.6667, 686, 3, 1, 0, 0, 145, 10, 1], "semantic": {"name": "h", "arg_names": [], "import_names": [], "rhs_call_name": "new", "annotation": ""}, "snippet": " h = hashlib.new(digest_alg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L93_C8", "label": "update()", "type": "expression", "loc": [93, 93], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L88_C4", "vector": [8, 5, 0.2862, 0.0031, 5, 0.61, 1.0, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " h.update(text + salt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L94_C4", "label": "return", "type": "return", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L75_C0", "vector": [13, 1, 0.2892, 0.0031, 1, 0.73, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return h.hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L97_C0", "label": "get_digest", "type": "function", "loc": [97, 117], "level": 0, "parent": null, "vector": [2, 0, 0.3292, 0.0646, 0, 0.66, 0.6667, 61, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "get_digest", "arg_names": ["value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_digest(value):\n \"\"\"\n Returns a hashlib digest algorithm from a string\n \"\"\"\n if not isinstance(value, str):\n return value\n value = value.lower()\n if value == \"md5\":"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L98_C4", "label": "expression", "type": "expression", "loc": [98, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L97_C0", "vector": [8, 1, 0.3046, 0.0092, 1, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a hashlib digest algorithm from a string\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L101_C4", "label": "if", "type": "if", "loc": [101, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L97_C0", "vector": [4, 1, 0.3123, 0.0062, 1, 0.31, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(value, str):\n return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L102_C8", "label": "return", "type": "return", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L101_C4", "vector": [13, 2, 0.3138, 0.0031, 2, 0.65, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L103_C4", "label": "value = lower()", "type": "assigned_variable", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L97_C0", "vector": [14, 1, 0.3169, 0.0031, 1, 0.31, 0.6667, 441, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " value = value.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L104_C4", "label": "if", "type": "if", "loc": [104, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L97_C0", "vector": [4, 1, 0.34, 0.0431, 1, 0.31, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value == \"md5\":\n return hashlib.md5\n elif value == \"sha1\":\n return hashlib.sha1\n elif value == \"sha224\":\n return hashlib.sha224\n elif value == \"sha256\":\n return hashlib.sha256"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L105_C8", "label": "return", "type": "return", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L104_C4", "vector": [13, 2, 0.3231, 0.0031, 2, 0.61, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return hashlib.md5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L106_C4", "label": "if", "type": "if", "loc": [106, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L104_C4", "vector": [4, 2, 0.3431, 0.0369, 2, 0.61, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value == \"sha1\":\n return hashlib.sha1\n elif value == \"sha224\":\n return hashlib.sha224\n elif value == \"sha256\":\n return hashlib.sha256\n elif value == \"sha384\":\n return hashlib.sha384"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L107_C8", "label": "return", "type": "return", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L106_C4", "vector": [13, 3, 0.3292, 0.0031, 3, 0.85, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return hashlib.sha1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L108_C4", "label": "if", "type": "if", "loc": [108, 117], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L106_C4", "vector": [4, 3, 0.3462, 0.0308, 3, 0.85, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value == \"sha224\":\n return hashlib.sha224\n elif value == \"sha256\":\n return hashlib.sha256\n elif value == \"sha384\":\n return hashlib.sha384\n elif value == \"sha512\":\n return hashlib.sha512"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L109_C8", "label": "return", "type": "return", "loc": [109, 109], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L108_C4", "vector": [13, 4, 0.3354, 0.0031, 4, 0.48, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return hashlib.sha224"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L110_C4", "label": "if", "type": "if", "loc": [110, 117], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L108_C4", "vector": [4, 4, 0.3492, 0.0246, 4, 0.48, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value == \"sha256\":\n return hashlib.sha256\n elif value == \"sha384\":\n return hashlib.sha384\n elif value == \"sha512\":\n return hashlib.sha512\n else:\n raise ValueError(\"Invalid digest algorithm: %s\" % value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L111_C8", "label": "return", "type": "return", "loc": [111, 111], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L110_C4", "vector": [13, 5, 0.3415, 0.0031, 5, 0.33, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return hashlib.sha256"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L112_C4", "label": "if", "type": "if", "loc": [112, 117], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L110_C4", "vector": [4, 5, 0.3523, 0.0185, 5, 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 == \"sha384\":\n return hashlib.sha384\n elif value == \"sha512\":\n return hashlib.sha512\n else:\n raise ValueError(\"Invalid digest algorithm: %s\" % value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L113_C8", "label": "return", "type": "return", "loc": [113, 113], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L112_C4", "vector": [13, 6, 0.3477, 0.0031, 6, 0.28, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return hashlib.sha384"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L114_C4", "label": "if", "type": "if", "loc": [114, 117], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L112_C4", "vector": [4, 6, 0.3554, 0.0123, 6, 0.28, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value == \"sha512\":\n return hashlib.sha512\n else:\n raise ValueError(\"Invalid digest algorithm: %s\" % value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L115_C8", "label": "return", "type": "return", "loc": [115, 115], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L114_C4", "vector": [13, 7, 0.3538, 0.0031, 7, 0.31, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return hashlib.sha512"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L119_C0", "label": "DIGEST_ALG_BY_SIZE =", "type": "assigned_variable", "loc": [119, 126], "level": 0, "parent": null, "vector": [14, 0, 0.3769, 0.0246, 0, 0.66, 0.6944, 349, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "DIGEST_ALG_BY_SIZE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DIGEST_ALG_BY_SIZE = {\n 128 / 4: 'md5',\n 160 / 4: 'sha1',\n 224 / 4: 'sha224',\n 256 / 4: 'sha256',\n 384 / 4: 'sha384',\n 512 / 4: 'sha512',\n}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L129_C0", "label": "pad", "type": "function", "loc": [129, 130], "level": 0, "parent": null, "vector": [2, 0, 0.3985, 0.0062, 0, 0.66, 0.7222, 258, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "pad", "arg_names": ["s", "n", "padchar"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def pad(s, n=32, padchar=' '):\n return s + (32 - len(s) % 32) * padchar"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L130_C4", "label": "return", "type": "return", "loc": [130, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L129_C0", "vector": [13, 1, 0.4, 0.0031, 1, 0.67, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return s + (32 - len(s) % 32) * padchar"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L133_C0", "label": "secure_dumps", "type": "function", "loc": [133, 143], "level": 0, "parent": null, "vector": [2, 0, 0.4246, 0.0338, 0, 0.66, 0.75, 497, 0, 4, 1, 0, 0, 0, 11], "semantic": {"name": "secure_dumps", "arg_names": ["data", "encryption_key", "hash_key", "compression_level"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def secure_dumps(data, encryption_key, hash_key=None, compression_level=None):\n if not hash_key:\n hash_key = hashlib.sha1(encryption_key).hexdigest()\n dump = pickle.dumps(data)\n if compression_level:\n dump = zlib.compress(dump, compression_level)\n key = pad(encryption_key[:32])\n cipher, IV = AES_new(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L134_C4", "label": "if", "type": "if", "loc": [134, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L133_C0", "vector": [4, 1, 0.4138, 0.0062, 1, 0.49, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hash_key:\n hash_key = hashlib.sha1(encryption_key).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L135_C8", "label": "hash_key = hexdigest()", "type": "assigned_variable", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L134_C4", "vector": [14, 2, 0.4154, 0.0031, 2, 0.44, 0.0, 161, 3, 0, 0, 0, 89, 10, 2], "semantic": {"name": "hash_key", "arg_names": [], "import_names": [], "rhs_call_name": "hexdigest", "annotation": ""}, "snippet": " hash_key = hashlib.sha1(encryption_key).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L136_C4", "label": "dump = dumps()", "type": "assigned_variable", "loc": [136, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L133_C0", "vector": [14, 1, 0.4185, 0.0031, 1, 0.49, 0.1429, 952, 3, 1, 0, 0, 160, 10, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dumps", "annotation": ""}, "snippet": " dump = pickle.dumps(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L137_C4", "label": "if", "type": "if", "loc": [137, 138], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L133_C0", "vector": [4, 1, 0.4231, 0.0062, 1, 0.49, 0.2857, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if compression_level:\n dump = zlib.compress(dump, compression_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L138_C8", "label": "dump = compress()", "type": "assigned_variable", "loc": [138, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L137_C4", "vector": [14, 2, 0.4246, 0.0031, 2, 0.75, 0.0, 952, 3, 2, 0, 0, 657, 10, 1], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "compress", "annotation": ""}, "snippet": " dump = zlib.compress(dump, compression_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L139_C4", "label": "key = pad()", "type": "assigned_variable", "loc": [139, 139], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L133_C0", "vector": [14, 1, 0.4277, 0.0031, 1, 0.49, 0.4286, 230, 3, 1, 0, 0, 258, 10, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "pad", "annotation": ""}, "snippet": " key = pad(encryption_key[:32])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L140_C4", "label": "cipher, IV = AES_new()", "type": "assigned_variable", "loc": [140, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L133_C0", "vector": [14, 1, 0.4308, 0.0031, 1, 0.49, 0.5714, 224, 3, 1, 0, 0, 325, 10, 1], "semantic": {"name": "cipher, IV", "arg_names": [], "import_names": [], "rhs_call_name": "AES_new", "annotation": ""}, "snippet": " cipher, IV = AES_new(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L141_C4", "label": "encrypted_data = urlsafe_b64encode()", "type": "assigned_variable", "loc": [141, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L133_C0", "vector": [14, 1, 0.4338, 0.0031, 1, 0.49, 0.7143, 316, 3, 1, 0, 0, 122, 10, 3], "semantic": {"name": "encrypted_data", "arg_names": [], "import_names": [], "rhs_call_name": "urlsafe_b64encode", "annotation": ""}, "snippet": " encrypted_data = base64.urlsafe_b64encode(IV + cipher.encrypt(pad(dump)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L142_C4", "label": "signature = hexdigest()", "type": "assigned_variable", "loc": [142, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L133_C0", "vector": [14, 1, 0.4369, 0.0031, 1, 0.49, 0.8571, 932, 3, 0, 0, 0, 89, 10, 2], "semantic": {"name": "signature", "arg_names": [], "import_names": [], "rhs_call_name": "hexdigest", "annotation": ""}, "snippet": " signature = hmac.new(hash_key, encrypted_data).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L143_C4", "label": "return", "type": "return", "loc": [143, 143], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L133_C0", "vector": [13, 1, 0.44, 0.0031, 1, 0.49, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return signature + ':' + encrypted_data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L146_C0", "label": "secure_loads", "type": "function", "loc": [146, 166], "level": 0, "parent": null, "vector": [2, 0, 0.48, 0.0646, 0, 0.66, 0.7778, 991, 0, 4, 1, 0, 0, 0, 13], "semantic": {"name": "secure_loads", "arg_names": ["data", "encryption_key", "hash_key", "compression_level"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def secure_loads(data, encryption_key, hash_key=None, compression_level=None):\n if not ':' in data:\n return None\n if not hash_key:\n hash_key = hashlib.sha1(encryption_key).hexdigest()\n signature, encrypted_data = data.split(':', 1)\n actual_signature = hmac.new(hash_key, encrypted_data).hexdigest()\n if not compare(signature, actual_signature):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L147_C4", "label": "if", "type": "if", "loc": [147, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L146_C0", "vector": [4, 1, 0.4538, 0.0062, 1, 0.37, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not ':' in data:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L148_C8", "label": "return", "type": "return", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L147_C4", "vector": [13, 2, 0.4554, 0.0031, 2, 0.9, 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_450:If_L149_C4", "label": "if", "type": "if", "loc": [149, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L146_C0", "vector": [4, 1, 0.46, 0.0062, 1, 0.37, 0.1111, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hash_key:\n hash_key = hashlib.sha1(encryption_key).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L150_C8", "label": "hash_key = hexdigest()", "type": "assigned_variable", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L149_C4", "vector": [14, 2, 0.4615, 0.0031, 2, 0.05, 0.0, 161, 3, 0, 0, 0, 89, 10, 2], "semantic": {"name": "hash_key", "arg_names": [], "import_names": [], "rhs_call_name": "hexdigest", "annotation": ""}, "snippet": " hash_key = hashlib.sha1(encryption_key).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L151_C4", "label": "signature, encrypted_data = split()", "type": "assigned_variable", "loc": [151, 151], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L146_C0", "vector": [14, 1, 0.4646, 0.0031, 1, 0.37, 0.2222, 470, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "signature, encrypted_data", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " signature, encrypted_data = data.split(':', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L152_C4", "label": "actual_signature = hexdigest()", "type": "assigned_variable", "loc": [152, 152], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L146_C0", "vector": [14, 1, 0.4677, 0.0031, 1, 0.37, 0.3333, 343, 3, 0, 0, 0, 89, 10, 2], "semantic": {"name": "actual_signature", "arg_names": [], "import_names": [], "rhs_call_name": "hexdigest", "annotation": ""}, "snippet": " actual_signature = hmac.new(hash_key, encrypted_data).hexdigest()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L153_C4", "label": "if", "type": "if", "loc": [153, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L146_C0", "vector": [4, 1, 0.4723, 0.0062, 1, 0.37, 0.4444, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not compare(signature, actual_signature):\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L154_C8", "label": "return", "type": "return", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L153_C4", "vector": [13, 2, 0.4738, 0.0031, 2, 0.65, 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_450:Assign_L155_C4", "label": "key = pad()", "type": "assigned_variable", "loc": [155, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L146_C0", "vector": [14, 1, 0.4769, 0.0031, 1, 0.37, 0.5556, 230, 3, 1, 0, 0, 258, 10, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "pad", "annotation": ""}, "snippet": " key = pad(encryption_key[:32])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L156_C4", "label": "encrypted_data = urlsafe_b64decode()", "type": "assigned_variable", "loc": [156, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L146_C0", "vector": [14, 1, 0.48, 0.0031, 1, 0.37, 0.6667, 316, 3, 1, 0, 0, 860, 10, 1], "semantic": {"name": "encrypted_data", "arg_names": [], "import_names": [], "rhs_call_name": "urlsafe_b64decode", "annotation": ""}, "snippet": " encrypted_data = base64.urlsafe_b64decode(encrypted_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L157_C4", "label": "IV, encrypted_data =", "type": "assigned_variable", "loc": [157, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L146_C0", "vector": [14, 1, 0.4831, 0.0031, 1, 0.37, 0.7778, 373, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "IV, encrypted_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " IV, encrypted_data = encrypted_data[:16], encrypted_data[16:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L158_C4", "label": "cipher, _ = AES_new()", "type": "assigned_variable", "loc": [158, 158], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L146_C0", "vector": [14, 1, 0.4862, 0.0031, 1, 0.37, 0.8889, 379, 3, 2, 0, 0, 325, 10, 1], "semantic": {"name": "cipher, _", "arg_names": [], "import_names": [], "rhs_call_name": "AES_new", "annotation": ""}, "snippet": " cipher, _ = AES_new(key, IV=IV)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L159_C4", "label": "try", "type": "try", "loc": [159, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L146_C0", "vector": [7, 1, 0.5, 0.0246, 1, 0.37, 1.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n data = cipher.decrypt(encrypted_data)\n data = data.rstrip(' ')\n if compression_level:\n data = zlib.decompress(data)\n return pickle.loads(data)\n except (TypeError, pickle.UnpicklingError):\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L160_C8", "label": "data = decrypt()", "type": "assigned_variable", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L159_C4", "vector": [14, 2, 0.4923, 0.0031, 2, 0.41, 0.0, 929, 3, 1, 0, 0, 846, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "decrypt", "annotation": ""}, "snippet": " data = cipher.decrypt(encrypted_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L161_C8", "label": "data = rstrip()", "type": "assigned_variable", "loc": [161, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L159_C4", "vector": [14, 2, 0.4954, 0.0031, 2, 0.41, 0.3333, 929, 3, 1, 0, 0, 807, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "rstrip", "annotation": ""}, "snippet": " data = data.rstrip(' ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L162_C8", "label": "if", "type": "if", "loc": [162, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L159_C4", "vector": [4, 2, 0.5, 0.0062, 2, 0.41, 0.6667, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if compression_level:\n data = zlib.decompress(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L163_C12", "label": "data = decompress()", "type": "assigned_variable", "loc": [163, 163], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L162_C8", "vector": [14, 3, 0.5015, 0.0031, 3, 0.65, 0.0, 929, 3, 1, 0, 0, 979, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "decompress", "annotation": ""}, "snippet": " data = zlib.decompress(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L164_C8", "label": "return", "type": "return", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L159_C4", "vector": [13, 2, 0.5046, 0.0031, 2, 0.41, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return pickle.loads(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L166_C8", "label": "return", "type": "return", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L159_C4", "vector": [13, 2, 0.5108, 0.0031, 2, 0.41, 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_450:FunctionDef_L171_C0", "label": "initialize_urandom", "type": "function", "loc": [171, 216], "level": 0, "parent": null, "vector": [2, 0, 0.5954, 0.1415, 0, 0.66, 0.8056, 827, 0, 0, 1, 0, 0, 0, 22], "semantic": {"name": "initialize_urandom", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def initialize_urandom():\n \"\"\"\n This function and the web2py_uuid follow from the following discussion:\n http://groups.google.com/group/web2py-developers/browse_thread/thread/7fd5789a7da3f09\n\n At startup web2py compute a unique ID that identifies the machine by adding\n uuid.getnode() + int(time.time() * 1e3)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L172_C4", "label": "expression", "type": "expression", "loc": [172, 183], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L171_C0", "vector": [8, 1, 0.5462, 0.0369, 1, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n This function and the web2py_uuid follow from the following discussion:\n http://groups.google.com/group/web2py-developers/browse_thread/thread/7fd5789a7da3f09\n\n At startup web2py compute a unique ID that identifies the machine by adding\n uuid.getnode() + int(time.time() * 1e3)\n\n This is a 48-bit number. It converts the number into 16 8-bit tokens."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L184_C4", "label": "node_id = getnode()", "type": "assigned_variable", "loc": [184, 184], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L171_C0", "vector": [14, 1, 0.5662, 0.0031, 1, 0.75, 0.125, 655, 3, 0, 0, 0, 476, 10, 1], "semantic": {"name": "node_id", "arg_names": [], "import_names": [], "rhs_call_name": "getnode", "annotation": ""}, "snippet": " node_id = uuid.getnode()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L185_C4", "label": "microseconds = int()", "type": "assigned_variable", "loc": [185, 185], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L171_C0", "vector": [14, 1, 0.5692, 0.0031, 1, 0.75, 0.25, 409, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "microseconds", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " microseconds = int(time.time() * 1e6)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L186_C4", "label": "ctokens =", "type": "assigned_variable", "loc": [186, 187], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L171_C0", "vector": [14, 1, 0.5738, 0.0062, 1, 0.75, 0.375, 76, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ctokens", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ctokens = [((node_id + microseconds) >> ((i % 6) * 8)) %\n 256 for i in range(16)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L188_C4", "label": "seed()", "type": "expression", "loc": [188, 188], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L171_C0", "vector": [8, 1, 0.5785, 0.0031, 1, 0.75, 0.5, 365, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "seed", "arg_names": [], "import_names": [], "rhs_call_name": "seed", "annotation": ""}, "snippet": " random.seed(node_id + microseconds)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L189_C4", "label": "try", "type": "try", "loc": [189, 210], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L171_C0", "vector": [7, 1, 0.6138, 0.0677, 1, 0.75, 0.625, 0, 0, 1, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n os.urandom(1)\n have_urandom = True\n try:\n # try to add process-specific entropy\n frandom = open('/dev/urandom', 'wb')\n try:\n if python_version == 2:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L190_C8", "label": "urandom()", "type": "expression", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L189_C4", "vector": [8, 2, 0.5846, 0.0031, 2, 0.2, 0.0, 246, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "urandom", "arg_names": [], "import_names": [], "rhs_call_name": "urandom", "annotation": ""}, "snippet": " os.urandom(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L191_C8", "label": "have_urandom =", "type": "assigned_variable", "loc": [191, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L189_C4", "vector": [14, 2, 0.5877, 0.0031, 2, 0.2, 0.5, 589, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "have_urandom", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " have_urandom = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L192_C8", "label": "try", "type": "try", "loc": [192, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L189_C4", "vector": [7, 2, 0.6092, 0.04, 2, 0.2, 1.0, 0, 0, 1, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # try to add process-specific entropy\n frandom = open('/dev/urandom', 'wb')\n try:\n if python_version == 2:\n frandom.write(''.join(chr(t) for t in ctokens)) # python 2\n else:\n frandom.write(bytes([]).join(bytes([t]) for t in ctokens)) # python 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L194_C12", "label": "frandom = open()", "type": "assigned_variable", "loc": [194, 194], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L192_C8", "vector": [14, 3, 0.5969, 0.0031, 3, 0.99, 0.0, 953, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "frandom", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " frandom = open('/dev/urandom', 'wb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L195_C12", "label": "try", "type": "try", "loc": [195, 201], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L192_C8", "vector": [7, 3, 0.6092, 0.0215, 3, 0.99, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if python_version == 2:\n frandom.write(''.join(chr(t) for t in ctokens)) # python 2\n else:\n frandom.write(bytes([]).join(bytes([t]) for t in ctokens)) # python 3\n finally:\n frandom.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L196_C16", "label": "if", "type": "if", "loc": [196, 199], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L195_C12", "vector": [4, 4, 0.6077, 0.0123, 4, 0.5, 0.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if python_version == 2:\n frandom.write(''.join(chr(t) for t in ctokens)) # python 2\n else:\n frandom.write(bytes([]).join(bytes([t]) for t in ctokens)) # python 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L197_C20", "label": "write()", "type": "expression", "loc": [197, 197], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L196_C16", "vector": [8, 5, 0.6062, 0.0031, 5, 0.55, 0.0, 837, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " frandom.write(''.join(chr(t) for t in ctokens)) # python 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L199_C20", "label": "write()", "type": "expression", "loc": [199, 199], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L196_C16", "vector": [8, 5, 0.6123, 0.0031, 5, 0.55, 1.0, 837, 3, 1, 0, 0, 0, 0, 4], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " frandom.write(bytes([]).join(bytes([t]) for t in ctokens)) # python 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L201_C16", "label": "close()", "type": "expression", "loc": [201, 201], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L195_C12", "vector": [8, 4, 0.6185, 0.0031, 4, 0.5, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " frandom.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L206_C8", "label": "have_urandom =", "type": "assigned_variable", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L189_C4", "vector": [14, 2, 0.6338, 0.0031, 2, 0.2, 0.0, 589, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "have_urandom", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " have_urandom = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L207_C8", "label": "warning()", "type": "expression", "loc": [207, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L189_C4", "vector": [8, 2, 0.6415, 0.0123, 2, 0.2, 1.0, 320, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warning", "arg_names": [], "import_names": [], "rhs_call_name": "warning", "annotation": ""}, "snippet": " logger.warning(\n \"\"\"Cryptographically secure session management is not possible on your system because\nyour system does not provide a cryptographically secure entropy source.\nThis is not specific to web2py; consider deploying on a different operating system.\"\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L211_C4", "label": "if", "type": "if", "loc": [211, 214], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L171_C0", "vector": [4, 1, 0.6538, 0.0123, 1, 0.75, 0.75, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if python_version == 2:\n packed = ''.join(chr(x) for x in ctokens) # python 2\n else:\n packed = bytes([]).join(bytes([x]) for x in ctokens) # python 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L212_C8", "label": "packed = join()", "type": "assigned_variable", "loc": [212, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L211_C4", "vector": [14, 2, 0.6523, 0.0031, 2, 0.18, 0.0, 321, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "packed", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " packed = ''.join(chr(x) for x in ctokens) # python 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L214_C8", "label": "packed = join()", "type": "assigned_variable", "loc": [214, 214], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L211_C4", "vector": [14, 2, 0.6585, 0.0031, 2, 0.18, 1.0, 321, 3, 1, 0, 0, 933, 10, 3], "semantic": {"name": "packed", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " packed = bytes([]).join(bytes([x]) for x in ctokens) # python 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L215_C4", "label": "unpacked_ctokens = unpack()", "type": "assigned_variable", "loc": [215, 215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L171_C0", "vector": [14, 1, 0.6615, 0.0031, 1, 0.75, 0.875, 404, 3, 2, 0, 0, 621, 10, 1], "semantic": {"name": "unpacked_ctokens", "arg_names": [], "import_names": [], "rhs_call_name": "unpack", "annotation": ""}, "snippet": " unpacked_ctokens = struct.unpack('=QQ', packed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L216_C4", "label": "return", "type": "return", "loc": [216, 216], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L171_C0", "vector": [13, 1, 0.6646, 0.0031, 1, 0.75, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unpacked_ctokens, have_urandom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L217_C0", "label": "UNPACKED_CTOKENS, HAVE_URANDOM = initialize_urandom()", "type": "assigned_variable", "loc": [217, 217], "level": 0, "parent": null, "vector": [14, 0, 0.6677, 0.0031, 0, 0.66, 0.8333, 55, 3, 0, 0, 0, 827, 10, 1], "semantic": {"name": "UNPACKED_CTOKENS, HAVE_URANDOM", "arg_names": [], "import_names": [], "rhs_call_name": "initialize_urandom", "annotation": ""}, "snippet": "UNPACKED_CTOKENS, HAVE_URANDOM = initialize_urandom()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L220_C0", "label": "fast_urandom16", "type": "function", "loc": [220, 234], "level": 0, "parent": null, "vector": [2, 0, 0.6985, 0.0462, 0, 0.66, 0.8611, 730, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "fast_urandom16", "arg_names": ["urandom", "locker"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def fast_urandom16(urandom=[], locker=threading.RLock()):\n \"\"\"\n this is 4x faster than calling os.urandom(16) and prevents\n the \"too many files open\" issue with concurrent access to os.urandom()\n \"\"\"\n try:\n return urandom.pop()\n except IndexError:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L221_C4", "label": "expression", "type": "expression", "loc": [221, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L220_C0", "vector": [8, 1, 0.6846, 0.0123, 1, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n this is 4x faster than calling os.urandom(16) and prevents\n the \"too many files open\" issue with concurrent access to os.urandom()\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L225_C4", "label": "try", "type": "try", "loc": [225, 234], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L220_C0", "vector": [7, 1, 0.7062, 0.0308, 1, 0.86, 1.0, 0, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return urandom.pop()\n except IndexError:\n try:\n locker.acquire()\n ur = os.urandom(16 * 1024)\n urandom += [ur[i:i + 16] for i in xrange(16, 1024 * 16, 16)]\n return ur[0:16]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L226_C8", "label": "return", "type": "return", "loc": [226, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L225_C4", "vector": [13, 2, 0.6954, 0.0031, 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 urandom.pop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L228_C8", "label": "try", "type": "try", "loc": [228, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L225_C4", "vector": [7, 2, 0.7108, 0.0215, 2, 0.74, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n locker.acquire()\n ur = os.urandom(16 * 1024)\n urandom += [ur[i:i + 16] for i in xrange(16, 1024 * 16, 16)]\n return ur[0:16]\n finally:\n locker.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L229_C12", "label": "acquire()", "type": "expression", "loc": [229, 229], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L228_C8", "vector": [8, 3, 0.7046, 0.0031, 3, 0.01, 0.0, 229, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "acquire", "arg_names": [], "import_names": [], "rhs_call_name": "acquire", "annotation": ""}, "snippet": " locker.acquire()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L230_C12", "label": "ur = urandom()", "type": "assigned_variable", "loc": [230, 230], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L228_C8", "vector": [14, 3, 0.7077, 0.0031, 3, 0.01, 0.3333, 611, 3, 1, 0, 0, 246, 10, 1], "semantic": {"name": "ur", "arg_names": [], "import_names": [], "rhs_call_name": "urandom", "annotation": ""}, "snippet": " ur = os.urandom(16 * 1024)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L232_C12", "label": "return", "type": "return", "loc": [232, 232], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L228_C8", "vector": [13, 3, 0.7138, 0.0031, 3, 0.01, 0.6667, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ur[0:16]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L234_C12", "label": "release()", "type": "expression", "loc": [234, 234], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L228_C8", "vector": [8, 3, 0.72, 0.0031, 3, 0.01, 1.0, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " locker.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L237_C0", "label": "web2py_uuid", "type": "function", "loc": [237, 255], "level": 0, "parent": null, "vector": [2, 0, 0.7569, 0.0585, 0, 0.66, 0.8889, 583, 0, 1, 1, 0, 0, 0, 8], "semantic": {"name": "web2py_uuid", "arg_names": ["ctokens"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def web2py_uuid(ctokens=UNPACKED_CTOKENS):\n \"\"\"\n This function follows from the following discussion:\n http://groups.google.com/group/web2py-developers/browse_thread/thread/7fd5789a7da3f09\n\n It works like uuid.uuid4 except that tries to use os.urandom() if possible\n and it XORs the output with the tokens uniquely associated with this machine.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L238_C4", "label": "expression", "type": "expression", "loc": [238, 244], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L237_C0", "vector": [8, 1, 0.7415, 0.0215, 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 This function follows from the following discussion:\n http://groups.google.com/group/web2py-developers/browse_thread/thread/7fd5789a7da3f09\n\n It works like uuid.uuid4 except that tries to use os.urandom() if possible\n and it XORs the output with the tokens uniquely associated with this machine.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L245_C4", "label": "rand_longs =", "type": "assigned_variable", "loc": [245, 245], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L237_C0", "vector": [14, 1, 0.7538, 0.0031, 1, 0.42, 0.3333, 588, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "rand_longs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rand_longs = (random.getrandbits(64), random.getrandbits(64))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L246_C4", "label": "if", "type": "if", "loc": [246, 254], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L237_C0", "vector": [4, 1, 0.7692, 0.0277, 1, 0.42, 0.6667, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if HAVE_URANDOM:\n urand_longs = struct.unpack('=QQ', fast_urandom16())\n byte_s = struct.pack('=QQ',\n rand_longs[0] ^ urand_longs[0] ^ ctokens[0],\n rand_longs[1] ^ urand_longs[1] ^ ctokens[1])\n else:\n byte_s = struct.pack('=QQ',\n rand_longs[0] ^ ctokens[0],"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L247_C8", "label": "urand_longs = unpack()", "type": "assigned_variable", "loc": [247, 247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L246_C4", "vector": [14, 2, 0.76, 0.0031, 2, 0.18, 0.0, 157, 3, 2, 0, 0, 621, 10, 2], "semantic": {"name": "urand_longs", "arg_names": [], "import_names": [], "rhs_call_name": "unpack", "annotation": ""}, "snippet": " urand_longs = struct.unpack('=QQ', fast_urandom16())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L248_C8", "label": "byte_s = pack()", "type": "assigned_variable", "loc": [248, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L246_C4", "vector": [14, 2, 0.7662, 0.0092, 2, 0.18, 0.5, 461, 3, 3, 0, 0, 742, 10, 1], "semantic": {"name": "byte_s", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " byte_s = struct.pack('=QQ',\n rand_longs[0] ^ urand_longs[0] ^ ctokens[0],\n rand_longs[1] ^ urand_longs[1] ^ ctokens[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L252_C8", "label": "byte_s = pack()", "type": "assigned_variable", "loc": [252, 254], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L246_C4", "vector": [14, 2, 0.7785, 0.0092, 2, 0.18, 1.0, 461, 3, 3, 0, 0, 742, 10, 1], "semantic": {"name": "byte_s", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " byte_s = struct.pack('=QQ',\n rand_longs[0] ^ ctokens[0],\n rand_longs[1] ^ ctokens[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L255_C4", "label": "return", "type": "return", "loc": [255, 255], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L237_C0", "vector": [13, 1, 0.7846, 0.0031, 1, 0.42, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(uuid.UUID(bytes=byte_s, version=4))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L257_C0", "label": "REGEX_IPv4 = compile()", "type": "assigned_variable", "loc": [257, 257], "level": 0, "parent": null, "vector": [14, 0, 0.7908, 0.0031, 0, 0.66, 0.9167, 369, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "REGEX_IPv4", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "REGEX_IPv4 = re.compile('(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L260_C0", "label": "is_valid_ip_address", "type": "function", "loc": [260, 295], "level": 0, "parent": null, "vector": [2, 0, 0.8538, 0.1108, 0, 0.66, 0.9444, 293, 0, 1, 1, 0, 0, 0, 12], "semantic": {"name": "is_valid_ip_address", "arg_names": ["address"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def is_valid_ip_address(address):\n \"\"\"\n >>> is_valid_ip_address('127.0')\n False\n >>> is_valid_ip_address('127.0.0.1')\n True\n >>> is_valid_ip_address('2001:660::1')\n True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L261_C4", "label": "expression", "type": "expression", "loc": [261, 268], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L260_C0", "vector": [8, 1, 0.8138, 0.0246, 1, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n >>> is_valid_ip_address('127.0')\n False\n >>> is_valid_ip_address('127.0.0.1')\n True\n >>> is_valid_ip_address('2001:660::1')\n True\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L270_C4", "label": "if", "type": "if", "loc": [270, 295], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L260_C0", "vector": [4, 1, 0.8692, 0.08, 1, 0.37, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if address.lower() in ('127.0.0.1', 'localhost', '::1', '::ffff:127.0.0.1'):\n return True\n elif address.lower() in ('unknown', ''):\n return False\n elif address.count('.') == 3: # assume IPv4\n if address.startswith('::ffff:'):\n address = address[7:]\n if hasattr(socket, 'inet_aton'): # try validate using the OS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L271_C8", "label": "return", "type": "return", "loc": [271, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L270_C4", "vector": [13, 2, 0.8338, 0.0031, 2, 0.37, 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_450:If_L272_C4", "label": "if", "type": "if", "loc": [272, 295], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L270_C4", "vector": [4, 2, 0.8723, 0.0738, 2, 0.37, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif address.lower() in ('unknown', ''):\n return False\n elif address.count('.') == 3: # assume IPv4\n if address.startswith('::ffff:'):\n address = address[7:]\n if hasattr(socket, 'inet_aton'): # try validate using the OS\n try:\n socket.inet_aton(address)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L273_C8", "label": "return", "type": "return", "loc": [273, 273], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L272_C4", "vector": [13, 3, 0.84, 0.0031, 3, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L274_C4", "label": "if", "type": "if", "loc": [274, 295], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L272_C4", "vector": [4, 3, 0.8754, 0.0677, 3, 0.31, 1.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif address.count('.') == 3: # assume IPv4\n if address.startswith('::ffff:'):\n address = address[7:]\n if hasattr(socket, 'inet_aton'): # try validate using the OS\n try:\n socket.inet_aton(address)\n return True\n except socket.error: # invalid address"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L275_C8", "label": "if", "type": "if", "loc": [275, 276], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L274_C4", "vector": [4, 4, 0.8477, 0.0062, 4, 0.52, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if address.startswith('::ffff:'):\n address = address[7:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L276_C12", "label": "address =", "type": "assigned_variable", "loc": [276, 276], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L275_C8", "vector": [14, 5, 0.8492, 0.0031, 5, 0.37, 0.0, 666, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "address", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " address = address[7:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L277_C8", "label": "if", "type": "if", "loc": [277, 287], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L274_C4", "vector": [4, 4, 0.8677, 0.0338, 4, 0.52, 0.5, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(socket, 'inet_aton'): # try validate using the OS\n try:\n socket.inet_aton(address)\n return True\n except socket.error: # invalid address\n return False\n else: # try validate using Regex\n match = REGEX_IPv4.match(address)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L278_C12", "label": "try", "type": "try", "loc": [278, 282], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L277_C8", "vector": [7, 5, 0.8615, 0.0154, 5, 0.12, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n socket.inet_aton(address)\n return True\n except socket.error: # invalid address\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L279_C16", "label": "inet_aton()", "type": "expression", "loc": [279, 279], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L278_C12", "vector": [8, 6, 0.8585, 0.0031, 6, 0.1, 0.0, 53, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "inet_aton", "arg_names": [], "import_names": [], "rhs_call_name": "inet_aton", "annotation": ""}, "snippet": " socket.inet_aton(address)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L280_C16", "label": "return", "type": "return", "loc": [280, 280], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L278_C12", "vector": [13, 6, 0.8615, 0.0031, 6, 0.1, 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_450:Return_L282_C16", "label": "return", "type": "return", "loc": [282, 282], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L278_C12", "vector": [13, 6, 0.8677, 0.0031, 6, 0.1, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L284_C12", "label": "match = match()", "type": "assigned_variable", "loc": [284, 284], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L277_C8", "vector": [14, 5, 0.8738, 0.0031, 5, 0.12, 0.3333, 36, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "match", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " match = REGEX_IPv4.match(address)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L285_C12", "label": "if", "type": "if", "loc": [285, 286], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L277_C8", "vector": [4, 5, 0.8785, 0.0062, 5, 0.12, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if match and all(0 <= int(match.group(i)) < 256 for i in (1, 2, 3, 4)):\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L286_C16", "label": "return", "type": "return", "loc": [286, 286], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L285_C12", "vector": [13, 6, 0.88, 0.0031, 6, 0.35, 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_450:Return_L287_C12", "label": "return", "type": "return", "loc": [287, 287], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L277_C8", "vector": [13, 5, 0.8831, 0.0031, 5, 0.12, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L288_C4", "label": "if", "type": "if", "loc": [288, 295], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L274_C4", "vector": [4, 4, 0.8969, 0.0246, 4, 0.52, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif hasattr(socket, 'inet_pton'): # assume IPv6, try using the OS\n try:\n socket.inet_pton(socket.AF_INET6, address)\n return True\n except socket.error: # invalid address\n return False\n else: # do not know what to do? assume it is a valid address\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L289_C8", "label": "try", "type": "try", "loc": [289, 293], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L288_C4", "vector": [7, 5, 0.8954, 0.0154, 5, 0.58, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n socket.inet_pton(socket.AF_INET6, address)\n return True\n except socket.error: # invalid address\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L290_C12", "label": "inet_pton()", "type": "expression", "loc": [290, 290], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L289_C8", "vector": [8, 6, 0.8923, 0.0031, 6, 0.82, 0.0, 179, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "inet_pton", "arg_names": [], "import_names": [], "rhs_call_name": "inet_pton", "annotation": ""}, "snippet": " socket.inet_pton(socket.AF_INET6, address)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L291_C12", "label": "return", "type": "return", "loc": [291, 291], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L289_C8", "vector": [13, 6, 0.8954, 0.0031, 6, 0.82, 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_450:Return_L293_C12", "label": "return", "type": "return", "loc": [293, 293], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L289_C8", "vector": [13, 6, 0.9015, 0.0031, 6, 0.82, 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_450:Return_L295_C8", "label": "return", "type": "return", "loc": [295, 295], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L288_C4", "vector": [13, 5, 0.9077, 0.0031, 5, 0.58, 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_450:FunctionDef_L298_C0", "label": "is_loopback_ip_address", "type": "function", "loc": [298, 312], "level": 0, "parent": null, "vector": [2, 0, 0.9385, 0.0462, 0, 0.66, 0.9722, 561, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "is_loopback_ip_address", "arg_names": ["ip", "addrinfo"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def is_loopback_ip_address(ip=None, addrinfo=None):\n \"\"\"\n Determines whether the address appears to be a loopback address.\n This assumes that the IP is valid.\n \"\"\"\n if addrinfo: # see socket.getaddrinfo() for layout of addrinfo tuple\n if addrinfo[0] == socket.AF_INET or addrinfo[0] == socket.AF_INET6:\n ip = addrinfo[4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L299_C4", "label": "expression", "type": "expression", "loc": [299, 302], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L298_C0", "vector": [8, 1, 0.9246, 0.0123, 1, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Determines whether the address appears to be a loopback address.\n This assumes that the IP is valid.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L303_C4", "label": "if", "type": "if", "loc": [303, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L298_C0", "vector": [4, 1, 0.9354, 0.0092, 1, 0.97, 0.25, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if addrinfo: # see socket.getaddrinfo() for layout of addrinfo tuple\n if addrinfo[0] == socket.AF_INET or addrinfo[0] == socket.AF_INET6:\n ip = addrinfo[4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L304_C8", "label": "if", "type": "if", "loc": [304, 305], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L303_C4", "vector": [4, 2, 0.9369, 0.0062, 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 addrinfo[0] == socket.AF_INET or addrinfo[0] == socket.AF_INET6:\n ip = addrinfo[4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L305_C12", "label": "ip =", "type": "assigned_variable", "loc": [305, 305], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L304_C8", "vector": [14, 3, 0.9385, 0.0031, 3, 0.43, 0.0, 583, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ip = addrinfo[4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:If_L306_C4", "label": "if", "type": "if", "loc": [306, 307], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L298_C0", "vector": [4, 1, 0.9431, 0.0062, 1, 0.97, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(ip, basestring):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L307_C8", "label": "return", "type": "return", "loc": [307, 307], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L306_C4", "vector": [13, 2, 0.9446, 0.0031, 2, 0.79, 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_450:If_L309_C4", "label": "if", "type": "if", "loc": [309, 311], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L298_C0", "vector": [4, 1, 0.9538, 0.0092, 1, 0.97, 0.75, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ip.count('.') == 3: \n return ip.lower().startswith(('127', '::127', '0:0:0:0:0:0:127',\n '::ffff:127', '0:0:0:0:0:ffff:127'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L310_C8", "label": "return", "type": "return", "loc": [310, 311], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:If_L309_C4", "vector": [13, 2, 0.9554, 0.0062, 2, 0.84, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ip.lower().startswith(('127', '::127', '0:0:0:0:0:0:127',\n '::ffff:127', '0:0:0:0:0:ffff:127'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L312_C4", "label": "return", "type": "return", "loc": [312, 312], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L298_C0", "vector": [13, 1, 0.96, 0.0031, 1, 0.97, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ip == '::1' or ip == '0:0:0:0:0:0:0:1' # IPv6 loopback"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L315_C0", "label": "getipaddrinfo", "type": "function", "loc": [315, 325], "level": 0, "parent": null, "vector": [2, 0, 0.9846, 0.0338, 0, 0.66, 1.0, 830, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "getipaddrinfo", "arg_names": ["host"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getipaddrinfo(host):\n \"\"\"\n Filter out non-IP and bad IP addresses from getaddrinfo\n \"\"\"\n try:\n return [addrinfo for addrinfo in socket.getaddrinfo(host, None)\n if (addrinfo[0] == socket.AF_INET or \n addrinfo[0] == socket.AF_INET6)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L316_C4", "label": "expression", "type": "expression", "loc": [316, 318], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L315_C0", "vector": [8, 1, 0.9754, 0.0092, 1, 0.21, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Filter out non-IP and bad IP addresses from getaddrinfo\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L319_C4", "label": "try", "type": "try", "loc": [319, 325], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L315_C0", "vector": [7, 1, 0.9908, 0.0215, 1, 0.21, 1.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return [addrinfo for addrinfo in socket.getaddrinfo(host, None)\n if (addrinfo[0] == socket.AF_INET or \n addrinfo[0] == socket.AF_INET6)\n and isinstance(addrinfo[4][0], basestring)]\n except socket.error:\n return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L320_C8", "label": "return", "type": "return", "loc": [320, 323], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L319_C4", "vector": [13, 2, 0.9892, 0.0123, 2, 0.79, 0.0, 0, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [addrinfo for addrinfo in socket.getaddrinfo(host, None)\n if (addrinfo[0] == socket.AF_INET or \n addrinfo[0] == socket.AF_INET6)\n and isinstance(addrinfo[4][0], basestring)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L325_C8", "label": "return", "type": "return", "loc": [325, 325], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L319_C4", "vector": [13, 2, 1.0, 0.0031, 2, 0.79, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return []"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Import_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Import_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:ImportFrom_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Import_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:ImportFrom_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:ImportFrom_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L54_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:For_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L108_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L108_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L133_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L134_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L133_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L133_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L133_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L133_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L133_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L133_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L133_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L147_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L155_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L158_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L146_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L159_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L159_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L159_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L163_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L159_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L159_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L191_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L192_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L194_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L192_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L195_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L195_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L196_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L196_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L197_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L196_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L199_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L195_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L201_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L206_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L207_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L211_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L211_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L211_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L214_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L215_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L216_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L220_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L221_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L220_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L225_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L226_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L225_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L228_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L229_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L228_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L230_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L228_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L232_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L228_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L234_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L237_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L238_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L237_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L245_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L237_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L246_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L247_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L248_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L252_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L237_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L255_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L261_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L270_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L271_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L270_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L272_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L272_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L273_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L272_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L274_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L274_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L275_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L275_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L276_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L274_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L277_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L278_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L278_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L279_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L278_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L280_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L278_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L282_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L277_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L284_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L277_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L285_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L285_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L286_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L277_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L287_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L274_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L288_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L288_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L289_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L289_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L290_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L289_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L291_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L289_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L293_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L288_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L295_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L298_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L299_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L298_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L303_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L303_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L304_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L304_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Assign_L305_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L298_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L306_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L306_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L307_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L298_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:If_L309_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:If_L309_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L310_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L298_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L312_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L315_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Expr_L316_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:FunctionDef_L315_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L319_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L319_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L320_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_450:Try_L319_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_450:Return_L325_C8"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
Provides:
- List; like list but returns None instead of IndexOutOfBounds
- Storage; like dictionary allowing also for `obj.foo` for `obj['foo']`
"""
import cPickle
import portalocker
__all__ = ['List', 'Storage', 'Settings', 'Messages',
'StorageList', 'load_storage', 'save_storage']
DEFAULT = lambda:0
class Storage(dict):
"""
A Storage object is like a dictionary except `obj.foo` can be used
in addition to `obj['foo']`, and setting obj.foo = None deletes item foo.
>>> o = Storage(a=1)
>>> print o.a
1
>>> o['a']
1
>>> o.a = 2
>>> print o['a']
2
>>> del o.a
>>> print o.a
None
"""
__slots__ = ()
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__
__getitem__ = dict.get
__getattr__ = dict.get
__repr__ = lambda self: '<Storage %s>' % dict.__repr__(self)
# http://stackoverflow.com/questions/5247250/why-does-pickle-getstate-accept-as-a-return-value-the-very-instance-it-requi
__getstate__ = lambda self: None
__copy__ = lambda self: Storage(self)
def getlist(self, key):
"""
Return a Storage value as a list.
If the value is a list it will be returned as-is.
If object is None, an empty list will be returned.
Otherwise, [value] will be returned.
Example output for a query string of ?x=abc&y=abc&y=def
>>> request = Storage()
>>> request.vars = Storage()
>>> request.vars.x = 'abc'
>>> request.vars.y = ['abc', 'def']
>>> request.vars.getlist('x')
['abc']
>>> request.vars.getlist('y')
['abc', 'def']
>>> request.vars.getlist('z')
[]
"""
value = self.get(key, [])
if value is None or isinstance(value, (list, tuple)):
return value
else:
return [value]
def getfirst(self, key, default=None):
"""
Return the first or only value when given a request.vars-style key.
If the value is a list, its first item will be returned;
otherwise, the value will be returned as-is.
Example output for a query string of ?x=abc&y=abc&y=def
>>> request = Storage()
>>> request.vars = Storage()
>>> request.vars.x = 'abc'
>>> request.vars.y = ['abc', 'def']
>>> request.vars.getfirst('x')
'abc'
>>> request.vars.getfirst('y')
'abc'
>>> request.vars.getfirst('z')
"""
values = self.getlist(key)
return values[0] if values else default
def getlast(self, key, default=None):
"""
Returns the last or only single value when
given a request.vars-style key.
If the value is a list, the last item will be returned;
otherwise, the value will be returned as-is.
Simulated output with a query string of ?x=abc&y=abc&y=def
>>> request = Storage()
>>> request.vars = Storage()
>>> request.vars.x = 'abc'
>>> request.vars.y = ['abc', 'def']
>>> request.vars.getlast('x')
'abc'
>>> request.vars.getlast('y')
'def'
>>> request.vars.getlast('z')
"""
values = self.getlist(key)
return values[-1] if values else default
PICKABLE = (str, int, long, float, bool, list, dict, tuple, set)
class StorageList(Storage):
"""
like Storage but missing elements default to [] instead of None
"""
def __getitem__(self, key):
return self.__getattr__(key)
def __getattr__(self, key):
if key in self:
return getattr(self, key)
else:
r = []
setattr(self, key, r)
return r
def load_storage(filename):
fp = None
try:
fp = portalocker.LockedFile(filename, 'rb')
storage = cPickle.load(fp)
finally:
if fp:
fp.close()
return Storage(storage)
def save_storage(storage, filename):
fp = None
try:
fp = portalocker.LockedFile(filename, 'wb')
cPickle.dump(dict(storage), fp)
finally:
if fp:
fp.close()
class Settings(Storage):
def __setattr__(self, key, value):
if key != 'lock_keys' and self['lock_keys'] and key not in self:
raise SyntaxError('setting key \'%s\' does not exist' % key)
if key != 'lock_values' and self['lock_values']:
raise SyntaxError('setting value cannot be changed: %s' % key)
self[key] = value
class Messages(Settings):
def __init__(self, T):
Storage.__init__(self, T=T)
def __getattr__(self, key):
value = self[key]
if isinstance(value, str):
return str(self.T(value))
return value
class FastStorage(dict):
"""
Eventually this should replace class Storage but causes memory leak
because of http://bugs.python.org/issue1469629
>>> s = FastStorage()
>>> s.a = 1
>>> s.a
1
>>> s['a']
1
>>> s.b
>>> s['b']
>>> s['b']=2
>>> s['b']
2
>>> s.b
2
>>> isinstance(s,dict)
True
>>> dict(s)
{'a': 1, 'b': 2}
>>> dict(FastStorage(s))
{'a': 1, 'b': 2}
>>> import pickle
>>> s = pickle.loads(pickle.dumps(s))
>>> dict(s)
{'a': 1, 'b': 2}
>>> del s.b
>>> del s.a
>>> s.a
>>> s.b
>>> s['a']
>>> s['b']
"""
def __init__(self, *args, **kwargs):
dict.__init__(self, *args, **kwargs)
self.__dict__ = self
def __getattr__(self, key):
return getattr(self, key) if key in self else None
def __getitem__(self, key):
return dict.get(self, key, None)
def copy(self):
self.__dict__ = {}
s = FastStorage(self)
self.__dict__ = self
return s
def __repr__(self):
return '<Storage %s>' % dict.__repr__(self)
def __getstate__(self):
return dict(self)
def __setstate__(self, sdict):
dict.__init__(self, sdict)
self.__dict__ = self
def update(self, *args, **kwargs):
dict.__init__(self, *args, **kwargs)
self.__dict__ = self
class List(list):
"""
Like a regular python list but a[i] if i is out of bounds return None
instead of IndexOutOfBounds
"""
def __call__(self, i, default=DEFAULT, cast=None, otherwise=None):
"""
request.args(0,default=0,cast=int,otherwise='http://error_url')
request.args(0,default=0,cast=int,otherwise=lambda:...)
"""
n = len(self)
if 0 <= i < n or -n <= i < 0:
value = self[i]
elif default is DEFAULT:
value = None
else:
value, cast = default, False
if cast:
try:
value = cast(value)
except (ValueError, TypeError):
from http import HTTP, redirect
if otherwise is None:
raise HTTP(404)
elif isinstance(otherwise, str):
redirect(otherwise)
elif callable(otherwise):
return otherwise()
else:
raise RuntimeError("invalid otherwise")
return value
if __name__ == '__main__':
import doctest
doctest.testmod()
| ajibawa-2023/Python-Code-Large/train/row_451 | 115 | 284 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 13], "level": 0, "parent": null, "vector": [8, 0, 0.0299, 0.0352, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis file is part of the web2py Web Framework\nCopyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>\nLicense: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)\n\nProvides:\n\n- List; like list but returns None instead of IndexOutOfBounds"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Import_L15_C0", "label": "cPickle import cPickle", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0528, 0.0035, 0, 0.66, 0.0714, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["cPickle"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cPickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Import_L16_C0", "label": "portalocker import portalocker", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0563, 0.0035, 0, 0.66, 0.1429, 542, 0, 1, 0, 0, 542, 0, 0], "semantic": {"name": "portalocker", "arg_names": [], "import_names": ["portalocker"], "rhs_call_name": "", "annotation": ""}, "snippet": "import portalocker"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L18_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [18, 19], "level": 0, "parent": null, "vector": [14, 0, 0.0651, 0.007, 0, 0.66, 0.2143, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = ['List', 'Storage', 'Settings', 'Messages',\n 'StorageList', 'load_storage', 'save_storage']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L21_C0", "label": "DEFAULT =", "type": "assigned_variable", "loc": [21, 21], "level": 0, "parent": null, "vector": [14, 0, 0.0739, 0.0035, 0, 0.66, 0.2857, 570, 9, 0, 0, 0, 0, 0, 0], "semantic": {"name": "DEFAULT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DEFAULT = lambda:0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "label": "Storage", "type": "class", "loc": [23, 120], "level": 0, "parent": null, "vector": [3, 0, 0.2518, 0.3451, 0, 0.66, 0.3571, 850, 0, 3, 0, 0, 827, 0, 6], "semantic": {"name": "Storage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Storage(dict):\n \"\"\"\n A Storage object is like a dictionary except `obj.foo` can be used\n in addition to `obj['foo']`, and setting obj.foo = None deletes item foo.\n\n >>> o = Storage(a=1)\n >>> print o.a\n 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L24_C4", "label": "expression", "type": "expression", "loc": [24, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "vector": [8, 1, 0.1162, 0.0669, 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 A Storage object is like a dictionary except `obj.foo` can be used\n in addition to `obj['foo']`, and setting obj.foo = None deletes item foo.\n\n >>> o = Storage(a=1)\n >>> print o.a\n 1\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L43_C4", "label": "__slots__ =", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "vector": [14, 1, 0.1514, 0.0035, 1, 0.58, 0.0909, 596, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "__slots__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " __slots__ = ()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L44_C4", "label": "__setattr__ =", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "vector": [14, 1, 0.1549, 0.0035, 1, 0.58, 0.1818, 112, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "__setattr__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " __setattr__ = dict.__setitem__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L45_C4", "label": "__delattr__ =", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "vector": [14, 1, 0.1585, 0.0035, 1, 0.58, 0.2727, 431, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "__delattr__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " __delattr__ = dict.__delitem__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L46_C4", "label": "__getitem__ =", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "vector": [14, 1, 0.162, 0.0035, 1, 0.58, 0.3636, 698, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "__getitem__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " __getitem__ = dict.get"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L47_C4", "label": "__getattr__ =", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "vector": [14, 1, 0.1655, 0.0035, 1, 0.58, 0.4545, 210, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "__getattr__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " __getattr__ = dict.get"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L48_C4", "label": "__repr__ =", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "vector": [14, 1, 0.169, 0.0035, 1, 0.58, 0.5455, 204, 9, 0, 0, 0, 0, 0, 1], "semantic": {"name": "__repr__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " __repr__ = lambda self: '<Storage %s>' % dict.__repr__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L50_C4", "label": "__getstate__ =", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "vector": [14, 1, 0.1761, 0.0035, 1, 0.58, 0.6364, 250, 9, 0, 0, 0, 0, 0, 0], "semantic": {"name": "__getstate__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " __getstate__ = lambda self: None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L51_C4", "label": "__copy__ =", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "vector": [14, 1, 0.1796, 0.0035, 1, 0.58, 0.7273, 822, 9, 0, 0, 0, 0, 0, 1], "semantic": {"name": "__copy__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " __copy__ = lambda self: Storage(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L53_C4", "label": "getlist", "type": "function", "loc": [53, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "vector": [2, 1, 0.2289, 0.088, 1, 0.58, 0.8182, 585, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "getlist", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def getlist(self, key):\n \"\"\"\n Return a Storage value as a list.\n\n If the value is a list it will be returned as-is.\n If object is None, an empty list will be returned.\n Otherwise, [value] will be returned.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L54_C8", "label": "expression", "type": "expression", "loc": [54, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L53_C4", "vector": [8, 2, 0.2218, 0.0669, 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 Return a Storage value as a list.\n\n If the value is a list it will be returned as-is.\n If object is None, an empty list will be returned.\n Otherwise, [value] will be returned.\n\n Example output for a query string of ?x=abc&y=abc&y=def"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L73_C8", "label": "value = get()", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L53_C4", "vector": [14, 2, 0.257, 0.0035, 2, 0.47, 0.5, 441, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " value = self.get(key, [])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:If_L74_C8", "label": "if", "type": "if", "loc": [74, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L53_C4", "vector": [4, 2, 0.2658, 0.0141, 2, 0.47, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value is None or isinstance(value, (list, tuple)):\n return value\n else:\n return [value]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L75_C12", "label": "return", "type": "return", "loc": [75, 75], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:If_L74_C8", "vector": [13, 3, 0.2641, 0.0035, 3, 0.79, 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_451:Return_L77_C12", "label": "return", "type": "return", "loc": [77, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:If_L74_C8", "vector": [13, 3, 0.2711, 0.0035, 3, 0.79, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [value]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L79_C4", "label": "getfirst", "type": "function", "loc": [79, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "vector": [2, 1, 0.3116, 0.0704, 1, 0.58, 0.9091, 287, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "getfirst", "arg_names": ["self", "key", "default"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def getfirst(self, key, default=None):\n \"\"\"\n Return the first or only value when given a request.vars-style key.\n\n If the value is a list, its first item will be returned;\n otherwise, the value will be returned as-is.\n\n Example output for a query string of ?x=abc&y=abc&y=def"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L80_C8", "label": "expression", "type": "expression", "loc": [80, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L79_C4", "vector": [8, 2, 0.3099, 0.0599, 2, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Return the first or only value when given a request.vars-style key.\n\n If the value is a list, its first item will be returned;\n otherwise, the value will be returned as-is.\n\n Example output for a query string of ?x=abc&y=abc&y=def\n >>> request = Storage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L97_C8", "label": "values = getlist()", "type": "assigned_variable", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L79_C4", "vector": [14, 2, 0.3415, 0.0035, 2, 0.76, 0.5, 721, 3, 1, 0, 0, 585, 10, 1], "semantic": {"name": "values", "arg_names": [], "import_names": [], "rhs_call_name": "getlist", "annotation": ""}, "snippet": " values = self.getlist(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L98_C8", "label": "return", "type": "return", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L79_C4", "vector": [13, 2, 0.3451, 0.0035, 2, 0.76, 1.0, 0, 8, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return values[0] if values else default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L100_C4", "label": "getlast", "type": "function", "loc": [100, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "vector": [2, 1, 0.3873, 0.0739, 1, 0.58, 1.0, 123, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "getlast", "arg_names": ["self", "key", "default"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def getlast(self, key, default=None):\n \"\"\"\n Returns the last or only single value when\n given a request.vars-style key.\n\n If the value is a list, the last item will be returned;\n otherwise, the value will be returned as-is.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L101_C8", "label": "expression", "type": "expression", "loc": [101, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L100_C4", "vector": [8, 2, 0.3856, 0.0634, 2, 0.5, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the last or only single value when\n given a request.vars-style key.\n\n If the value is a list, the last item will be returned;\n otherwise, the value will be returned as-is.\n\n Simulated output with a query string of ?x=abc&y=abc&y=def"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L119_C8", "label": "values = getlist()", "type": "assigned_variable", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L100_C4", "vector": [14, 2, 0.419, 0.0035, 2, 0.5, 0.5, 721, 3, 1, 0, 0, 585, 10, 1], "semantic": {"name": "values", "arg_names": [], "import_names": [], "rhs_call_name": "getlist", "annotation": ""}, "snippet": " values = self.getlist(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L120_C8", "label": "return", "type": "return", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L100_C4", "vector": [13, 2, 0.4225, 0.0035, 2, 0.5, 1.0, 0, 8, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return values[-1] if values else default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L122_C0", "label": "PICKABLE =", "type": "assigned_variable", "loc": [122, 122], "level": 0, "parent": null, "vector": [14, 0, 0.4296, 0.0035, 0, 0.66, 0.4286, 915, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "PICKABLE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "PICKABLE = (str, int, long, float, bool, list, dict, tuple, set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L125_C0", "label": "StorageList", "type": "class", "loc": [125, 138], "level": 0, "parent": null, "vector": [3, 0, 0.463, 0.0493, 0, 0.66, 0.5, 995, 0, 2, 0, 0, 850, 0, 3], "semantic": {"name": "StorageList", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class StorageList(Storage):\n \"\"\"\n like Storage but missing elements default to [] instead of None\n \"\"\"\n def __getitem__(self, key):\n return self.__getattr__(key)\n\n def __getattr__(self, key):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L126_C4", "label": "expression", "type": "expression", "loc": [126, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L125_C0", "vector": [8, 1, 0.4472, 0.0106, 1, 0.04, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n like Storage but missing elements default to [] instead of None\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L129_C4", "label": "__getitem__", "type": "function", "loc": [129, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L125_C0", "vector": [2, 1, 0.456, 0.007, 1, 0.04, 0.5, 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.__getattr__(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L130_C8", "label": "return", "type": "return", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L129_C4", "vector": [13, 2, 0.4577, 0.0035, 2, 0.7, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.__getattr__(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L132_C4", "label": "__getattr__", "type": "function", "loc": [132, 138], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L125_C0", "vector": [2, 1, 0.4754, 0.0246, 1, 0.04, 1.0, 210, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__getattr__", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getattr__(self, key):\n if key in self:\n return getattr(self, key)\n else:\n r = []\n setattr(self, key, r)\n return r"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:If_L133_C8", "label": "if", "type": "if", "loc": [133, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L132_C4", "vector": [4, 2, 0.4771, 0.0211, 2, 0.28, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if key in self:\n return getattr(self, key)\n else:\n r = []\n setattr(self, key, r)\n return r"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L134_C12", "label": "return", "type": "return", "loc": [134, 134], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:If_L133_C8", "vector": [13, 3, 0.4718, 0.0035, 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 getattr(self, key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L136_C12", "label": "r =", "type": "assigned_variable", "loc": [136, 136], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:If_L133_C8", "vector": [14, 3, 0.4789, 0.0035, 3, 0.35, 0.3333, 436, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L137_C12", "label": "setattr()", "type": "expression", "loc": [137, 137], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:If_L133_C8", "vector": [8, 3, 0.4824, 0.0035, 3, 0.35, 0.6667, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(self, key, r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L138_C12", "label": "return", "type": "return", "loc": [138, 138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:If_L133_C8", "vector": [13, 3, 0.4859, 0.0035, 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 r"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L141_C0", "label": "load_storage", "type": "function", "loc": [141, 149], "level": 0, "parent": null, "vector": [2, 0, 0.5106, 0.0317, 0, 0.66, 0.5714, 741, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "load_storage", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def load_storage(filename):\n fp = None\n try:\n fp = portalocker.LockedFile(filename, 'rb')\n storage = cPickle.load(fp)\n finally:\n if fp:\n fp.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L142_C4", "label": "fp =", "type": "assigned_variable", "loc": [142, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L141_C0", "vector": [14, 1, 0.5, 0.0035, 1, 0.69, 0.0, 392, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "fp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fp = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L143_C4", "label": "try", "type": "try", "loc": [143, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L141_C0", "vector": [7, 1, 0.5123, 0.0211, 1, 0.69, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n fp = portalocker.LockedFile(filename, 'rb')\n storage = cPickle.load(fp)\n finally:\n if fp:\n fp.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L144_C8", "label": "fp = LockedFile()", "type": "assigned_variable", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L143_C4", "vector": [14, 2, 0.507, 0.0035, 2, 0.09, 0.0, 392, 3, 2, 0, 0, 1, 10, 1], "semantic": {"name": "fp", "arg_names": [], "import_names": [], "rhs_call_name": "LockedFile", "annotation": ""}, "snippet": " fp = portalocker.LockedFile(filename, 'rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L145_C8", "label": "storage = load()", "type": "assigned_variable", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L143_C4", "vector": [14, 2, 0.5106, 0.0035, 2, 0.09, 0.5, 864, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "storage", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " storage = cPickle.load(fp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:If_L147_C8", "label": "if", "type": "if", "loc": [147, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L143_C4", "vector": [4, 2, 0.5194, 0.007, 2, 0.09, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if fp:\n fp.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L148_C12", "label": "close()", "type": "expression", "loc": [148, 148], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:If_L147_C8", "vector": [8, 3, 0.5211, 0.0035, 3, 0.47, 0.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fp.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L149_C4", "label": "return", "type": "return", "loc": [149, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L141_C0", "vector": [13, 1, 0.5246, 0.0035, 1, 0.69, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Storage(storage)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L152_C0", "label": "save_storage", "type": "function", "loc": [152, 159], "level": 0, "parent": null, "vector": [2, 0, 0.5475, 0.0282, 0, 0.66, 0.6429, 36, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "save_storage", "arg_names": ["storage", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def save_storage(storage, filename):\n fp = None\n try:\n fp = portalocker.LockedFile(filename, 'wb')\n cPickle.dump(dict(storage), fp)\n finally:\n if fp:\n fp.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L153_C4", "label": "fp =", "type": "assigned_variable", "loc": [153, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L152_C0", "vector": [14, 1, 0.5387, 0.0035, 1, 0.11, 0.0, 392, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "fp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fp = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L154_C4", "label": "try", "type": "try", "loc": [154, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L152_C0", "vector": [7, 1, 0.5511, 0.0211, 1, 0.11, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n fp = portalocker.LockedFile(filename, 'wb')\n cPickle.dump(dict(storage), fp)\n finally:\n if fp:\n fp.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L155_C8", "label": "fp = LockedFile()", "type": "assigned_variable", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L154_C4", "vector": [14, 2, 0.5458, 0.0035, 2, 0.18, 0.0, 392, 3, 2, 0, 0, 1, 10, 1], "semantic": {"name": "fp", "arg_names": [], "import_names": [], "rhs_call_name": "LockedFile", "annotation": ""}, "snippet": " fp = portalocker.LockedFile(filename, 'wb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L156_C8", "label": "dump()", "type": "expression", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L154_C4", "vector": [8, 2, 0.5493, 0.0035, 2, 0.18, 0.5, 952, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "dump", "arg_names": [], "import_names": [], "rhs_call_name": "dump", "annotation": ""}, "snippet": " cPickle.dump(dict(storage), fp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:If_L158_C8", "label": "if", "type": "if", "loc": [158, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L154_C4", "vector": [4, 2, 0.5581, 0.007, 2, 0.18, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if fp:\n fp.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L159_C12", "label": "close()", "type": "expression", "loc": [159, 159], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:If_L158_C8", "vector": [8, 3, 0.5599, 0.0035, 3, 0.97, 0.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fp.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L162_C0", "label": "Settings", "type": "class", "loc": [162, 168], "level": 0, "parent": null, "vector": [3, 0, 0.581, 0.0246, 0, 0.66, 0.7143, 800, 0, 1, 0, 0, 850, 0, 2], "semantic": {"name": "Settings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Settings(Storage):\n def __setattr__(self, key, value):\n if key != 'lock_keys' and self['lock_keys'] and key not in self:\n raise SyntaxError('setting key \\'%s\\' does not exist' % key)\n if key != 'lock_values' and self['lock_values']:\n raise SyntaxError('setting value cannot be changed: %s' % key)\n self[key] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L163_C4", "label": "__setattr__", "type": "function", "loc": [163, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L162_C0", "vector": [2, 1, 0.5827, 0.0211, 1, 0.28, 0.0, 112, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__setattr__", "arg_names": ["self", "key", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __setattr__(self, key, value):\n if key != 'lock_keys' and self['lock_keys'] and key not in self:\n raise SyntaxError('setting key \\'%s\\' does not exist' % key)\n if key != 'lock_values' and self['lock_values']:\n raise SyntaxError('setting value cannot be changed: %s' % key)\n self[key] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:If_L164_C8", "label": "if", "type": "if", "loc": [164, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L163_C4", "vector": [4, 2, 0.5792, 0.007, 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 key != 'lock_keys' and self['lock_keys'] and key not in self:\n raise SyntaxError('setting key \\'%s\\' does not exist' % key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:If_L166_C8", "label": "if", "type": "if", "loc": [166, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L163_C4", "vector": [4, 2, 0.5863, 0.007, 2, 0.55, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if key != 'lock_values' and self['lock_values']:\n raise SyntaxError('setting value cannot be changed: %s' % key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L168_C8", "label": "assign", "type": "assigned_variable", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L163_C4", "vector": [14, 2, 0.5915, 0.0035, 2, 0.55, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self[key] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L171_C0", "label": "Messages", "type": "class", "loc": [171, 179], "level": 0, "parent": null, "vector": [3, 0, 0.6162, 0.0317, 0, 0.66, 0.7857, 268, 0, 2, 0, 0, 800, 0, 4], "semantic": {"name": "Messages", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Messages(Settings):\n def __init__(self, T):\n Storage.__init__(self, T=T)\n\n def __getattr__(self, key):\n value = self[key]\n if isinstance(value, str):\n return str(self.T(value))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L172_C4", "label": "__init__", "type": "function", "loc": [172, 173], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L171_C0", "vector": [2, 1, 0.6074, 0.007, 1, 0.84, 0.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "T"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, T):\n Storage.__init__(self, T=T)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L173_C8", "label": "__init__()", "type": "expression", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L172_C4", "vector": [8, 2, 0.6092, 0.0035, 2, 0.85, 0.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " Storage.__init__(self, T=T)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L175_C4", "label": "__getattr__", "type": "function", "loc": [175, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L171_C0", "vector": [2, 1, 0.6232, 0.0176, 1, 0.84, 1.0, 210, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "__getattr__", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getattr__(self, key):\n value = self[key]\n if isinstance(value, str):\n return str(self.T(value))\n return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L176_C8", "label": "value =", "type": "assigned_variable", "loc": [176, 176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L175_C4", "vector": [14, 2, 0.6197, 0.0035, 2, 0.26, 0.0, 441, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = self[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:If_L177_C8", "label": "if", "type": "if", "loc": [177, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L175_C4", "vector": [4, 2, 0.625, 0.007, 2, 0.26, 0.5, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, str):\n return str(self.T(value))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L178_C12", "label": "return", "type": "return", "loc": [178, 178], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:If_L177_C8", "vector": [13, 3, 0.6268, 0.0035, 3, 0.1, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(self.T(value))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L179_C8", "label": "return", "type": "return", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L175_C4", "vector": [13, 2, 0.6303, 0.0035, 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 value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L182_C0", "label": "FastStorage", "type": "class", "loc": [182, 245], "level": 0, "parent": null, "vector": [3, 0, 0.7518, 0.2254, 0, 0.66, 0.8571, 71, 0, 8, 0, 0, 827, 0, 8], "semantic": {"name": "FastStorage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FastStorage(dict):\n \"\"\"\n Eventually this should replace class Storage but causes memory leak\n because of http://bugs.python.org/issue1469629\n\n >>> s = FastStorage()\n >>> s.a = 1\n >>> s.a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L183_C4", "label": "expression", "type": "expression", "loc": [183, 216], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L182_C0", "vector": [8, 1, 0.7025, 0.1197, 1, 0.8, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Eventually this should replace class Storage but causes memory leak\n because of http://bugs.python.org/issue1469629\n\n >>> s = FastStorage()\n >>> s.a = 1\n >>> s.a\n 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L217_C4", "label": "__init__", "type": "function", "loc": [217, 219], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L182_C0", "vector": [2, 1, 0.7676, 0.0106, 1, 0.8, 0.125, 555, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *args, **kwargs):\n dict.__init__(self, *args, **kwargs)\n self.__dict__ = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L218_C8", "label": "__init__()", "type": "expression", "loc": [218, 218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L217_C4", "vector": [8, 2, 0.7676, 0.0035, 2, 0.83, 0.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " dict.__init__(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L219_C8", "label": "self.__dict__ =", "type": "assigned_variable", "loc": [219, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L217_C4", "vector": [14, 2, 0.7711, 0.0035, 2, 0.83, 1.0, 711, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.__dict__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__dict__ = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L221_C4", "label": "__getattr__", "type": "function", "loc": [221, 222], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L182_C0", "vector": [2, 1, 0.7799, 0.007, 1, 0.8, 0.25, 210, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__getattr__", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getattr__(self, key):\n return getattr(self, key) if key in self else None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L222_C8", "label": "return", "type": "return", "loc": [222, 222], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L221_C4", "vector": [13, 2, 0.7817, 0.0035, 2, 0.81, 0.0, 0, 8, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return getattr(self, key) if key in self else None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L224_C4", "label": "__getitem__", "type": "function", "loc": [224, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L182_C0", "vector": [2, 1, 0.7905, 0.007, 1, 0.8, 0.375, 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 dict.get(self, key, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L225_C8", "label": "return", "type": "return", "loc": [225, 225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L224_C4", "vector": [13, 2, 0.7923, 0.0035, 2, 0.95, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict.get(self, key, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L227_C4", "label": "copy", "type": "function", "loc": [227, 231], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L182_C0", "vector": [2, 1, 0.8063, 0.0176, 1, 0.8, 0.5, 739, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "copy", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def copy(self):\n self.__dict__ = {}\n s = FastStorage(self)\n self.__dict__ = self\n return s"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L228_C8", "label": "self.__dict__ =", "type": "assigned_variable", "loc": [228, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L227_C4", "vector": [14, 2, 0.8028, 0.0035, 2, 0.55, 0.0, 711, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.__dict__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__dict__ = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L229_C8", "label": "s = FastStorage()", "type": "assigned_variable", "loc": [229, 229], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L227_C4", "vector": [14, 2, 0.8063, 0.0035, 2, 0.55, 0.3333, 553, 3, 1, 0, 0, 71, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "FastStorage", "annotation": ""}, "snippet": " s = FastStorage(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L230_C8", "label": "self.__dict__ =", "type": "assigned_variable", "loc": [230, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L227_C4", "vector": [14, 2, 0.8099, 0.0035, 2, 0.55, 0.6667, 711, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.__dict__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__dict__ = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L231_C8", "label": "return", "type": "return", "loc": [231, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L227_C4", "vector": [13, 2, 0.8134, 0.0035, 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 s"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L233_C4", "label": "__repr__", "type": "function", "loc": [233, 234], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L182_C0", "vector": [2, 1, 0.8222, 0.007, 1, 0.8, 0.625, 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 '<Storage %s>' % dict.__repr__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L234_C8", "label": "return", "type": "return", "loc": [234, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L233_C4", "vector": [13, 2, 0.8239, 0.0035, 2, 0.66, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '<Storage %s>' % dict.__repr__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L236_C4", "label": "__getstate__", "type": "function", "loc": [236, 237], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L182_C0", "vector": [2, 1, 0.8327, 0.007, 1, 0.8, 0.75, 250, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__getstate__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getstate__(self):\n return dict(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L237_C8", "label": "return", "type": "return", "loc": [237, 237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L236_C4", "vector": [13, 2, 0.8345, 0.0035, 2, 0.31, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L239_C4", "label": "__setstate__", "type": "function", "loc": [239, 241], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L182_C0", "vector": [2, 1, 0.8451, 0.0106, 1, 0.8, 0.875, 698, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__setstate__", "arg_names": ["self", "sdict"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __setstate__(self, sdict):\n dict.__init__(self, sdict)\n self.__dict__ = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L240_C8", "label": "__init__()", "type": "expression", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L239_C4", "vector": [8, 2, 0.8451, 0.0035, 2, 0.67, 0.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " dict.__init__(self, sdict)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L241_C8", "label": "self.__dict__ =", "type": "assigned_variable", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L239_C4", "vector": [14, 2, 0.8486, 0.0035, 2, 0.67, 1.0, 711, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.__dict__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__dict__ = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L243_C4", "label": "update", "type": "function", "loc": [243, 245], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L182_C0", "vector": [2, 1, 0.8592, 0.0106, 1, 0.8, 1.0, 637, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update(self, *args, **kwargs):\n dict.__init__(self, *args, **kwargs)\n self.__dict__ = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L244_C8", "label": "__init__()", "type": "expression", "loc": [244, 244], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L243_C4", "vector": [8, 2, 0.8592, 0.0035, 2, 0.44, 0.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " dict.__init__(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L245_C8", "label": "self.__dict__ =", "type": "assigned_variable", "loc": [245, 245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L243_C4", "vector": [14, 2, 0.8627, 0.0035, 2, 0.44, 1.0, 711, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.__dict__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__dict__ = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L248_C0", "label": "List", "type": "class", "loc": [248, 279], "level": 0, "parent": null, "vector": [3, 0, 0.9278, 0.1127, 0, 0.66, 0.9286, 24, 0, 1, 0, 0, 430, 0, 8], "semantic": {"name": "List", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class List(list):\n \"\"\"\n Like a regular python list but a[i] if i is out of bounds return None\n instead of IndexOutOfBounds\n \"\"\"\n\n def __call__(self, i, default=DEFAULT, cast=None, otherwise=None):\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L249_C4", "label": "expression", "type": "expression", "loc": [249, 252], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L248_C0", "vector": [8, 1, 0.882, 0.0141, 1, 0.78, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Like a regular python list but a[i] if i is out of bounds return None\n instead of IndexOutOfBounds\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L254_C4", "label": "__call__", "type": "function", "loc": [254, 279], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L248_C0", "vector": [2, 1, 0.9384, 0.0915, 1, 0.78, 1.0, 319, 0, 5, 1, 0, 0, 0, 8], "semantic": {"name": "__call__", "arg_names": ["self", "i", "default", "cast", "otherwise"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __call__(self, i, default=DEFAULT, cast=None, otherwise=None):\n \"\"\"\n request.args(0,default=0,cast=int,otherwise='http://error_url')\n request.args(0,default=0,cast=int,otherwise=lambda:...)\n \"\"\"\n n = len(self)\n if 0 <= i < n or -n <= i < 0:\n value = self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L255_C8", "label": "expression", "type": "expression", "loc": [255, 258], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L254_C4", "vector": [8, 2, 0.9032, 0.0141, 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 request.args(0,default=0,cast=int,otherwise='http://error_url')\n request.args(0,default=0,cast=int,otherwise=lambda:...)\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L259_C8", "label": "n = len()", "type": "assigned_variable", "loc": [259, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L254_C4", "vector": [14, 2, 0.912, 0.0035, 2, 0.93, 0.25, 773, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "n", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " n = len(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:If_L260_C8", "label": "if", "type": "if", "loc": [260, 265], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L254_C4", "vector": [4, 2, 0.9243, 0.0211, 2, 0.93, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 0 <= i < n or -n <= i < 0:\n value = self[i]\n elif default is DEFAULT:\n value = None\n else:\n value, cast = default, False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L261_C12", "label": "value =", "type": "assigned_variable", "loc": [261, 261], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:If_L260_C8", "vector": [14, 3, 0.919, 0.0035, 3, 0.54, 0.0, 441, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:If_L262_C8", "label": "if", "type": "if", "loc": [262, 265], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:If_L260_C8", "vector": [4, 3, 0.9278, 0.0141, 3, 0.54, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif default is DEFAULT:\n value = None\n else:\n value, cast = default, False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L263_C12", "label": "value =", "type": "assigned_variable", "loc": [263, 263], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:If_L262_C8", "vector": [14, 4, 0.9261, 0.0035, 4, 0.63, 0.0, 441, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L265_C12", "label": "value, cast =", "type": "assigned_variable", "loc": [265, 265], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:If_L262_C8", "vector": [14, 4, 0.9331, 0.0035, 4, 0.63, 1.0, 861, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "value, cast", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value, cast = default, False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:If_L266_C8", "label": "if", "type": "if", "loc": [266, 278], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L254_C4", "vector": [4, 2, 0.9577, 0.0458, 2, 0.93, 0.75, 0, 2, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cast:\n try:\n value = cast(value)\n except (ValueError, TypeError):\n from http import HTTP, redirect\n if otherwise is None:\n raise HTTP(404)\n elif isinstance(otherwise, str):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L267_C12", "label": "try", "type": "try", "loc": [267, 278], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:If_L266_C8", "vector": [7, 3, 0.9595, 0.0423, 3, 0.28, 0.0, 0, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n value = cast(value)\n except (ValueError, TypeError):\n from http import HTTP, redirect\n if otherwise is None:\n raise HTTP(404)\n elif isinstance(otherwise, str):\n redirect(otherwise)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L268_C16", "label": "value = cast()", "type": "assigned_variable", "loc": [268, 268], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L267_C12", "vector": [14, 4, 0.9437, 0.0035, 4, 0.41, 0.0, 441, 3, 1, 0, 0, 590, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "cast", "annotation": ""}, "snippet": " value = cast(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:ImportFrom_L270_C16", "label": "from http import HTTP, redirect", "type": "import", "loc": [270, 270], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L267_C12", "vector": [1, 4, 0.9507, 0.0035, 4, 0.41, 0.0, 415, 0, 2, 0, 0, 415, 0, 0], "semantic": {"name": "http", "arg_names": [], "import_names": ["HTTP", "redirect"], "rhs_call_name": "", "annotation": ""}, "snippet": " from http import HTTP, redirect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:If_L271_C16", "label": "if", "type": "if", "loc": [271, 278], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L267_C12", "vector": [4, 4, 0.9665, 0.0282, 4, 0.41, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if otherwise is None:\n raise HTTP(404)\n elif isinstance(otherwise, str):\n redirect(otherwise)\n elif callable(otherwise):\n return otherwise()\n else:\n raise RuntimeError(\"invalid otherwise\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:If_L273_C16", "label": "if", "type": "if", "loc": [273, 278], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:If_L271_C16", "vector": [4, 5, 0.9701, 0.0211, 5, 0.57, 0.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(otherwise, str):\n redirect(otherwise)\n elif callable(otherwise):\n return otherwise()\n else:\n raise RuntimeError(\"invalid otherwise\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L274_C20", "label": "redirect()", "type": "expression", "loc": [274, 274], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:If_L273_C16", "vector": [8, 6, 0.9648, 0.0035, 6, 0.95, 0.0, 206, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(otherwise)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:If_L275_C16", "label": "if", "type": "if", "loc": [275, 278], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:If_L273_C16", "vector": [4, 6, 0.9736, 0.0141, 6, 0.95, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif callable(otherwise):\n return otherwise()\n else:\n raise RuntimeError(\"invalid otherwise\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L276_C20", "label": "return", "type": "return", "loc": [276, 276], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:If_L275_C16", "vector": [13, 7, 0.9718, 0.0035, 7, 0.83, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return otherwise()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L279_C8", "label": "return", "type": "return", "loc": [279, 279], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L254_C4", "vector": [13, 2, 0.9824, 0.0035, 2, 0.93, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:If_L282_C0", "label": "if", "type": "if", "loc": [282, 284], "level": 0, "parent": null, "vector": [4, 0, 0.9965, 0.0106, 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 import doctest\n doctest.testmod()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Import_L283_C4", "label": "doctest import doctest", "type": "import", "loc": [283, 283], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:If_L282_C0", "vector": [1, 1, 0.9965, 0.0035, 1, 0.87, 0.0, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "doctest", "arg_names": [], "import_names": ["doctest"], "rhs_call_name": "", "annotation": ""}, "snippet": " import doctest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L284_C4", "label": "testmod()", "type": "expression", "loc": [284, 284], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_451:If_L282_C0", "vector": [8, 1, 1.0, 0.0035, 1, 0.87, 1.0, 116, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "testmod", "arg_names": [], "import_names": [], "rhs_call_name": "testmod", "annotation": ""}, "snippet": " doctest.testmod()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:If_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:If_L74_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L75_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:If_L74_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L77_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L125_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L125_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L125_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L132_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:If_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:If_L133_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L134_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:If_L133_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L136_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:If_L133_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L137_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:If_L133_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L138_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L141_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L141_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L143_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L143_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L143_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:If_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:If_L147_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L148_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L141_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:If_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:If_L158_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L159_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L162_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:If_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:If_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L172_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L173_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L175_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L175_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:If_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:If_L177_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L178_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L175_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L219_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L221_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L221_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L222_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L224_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L224_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L225_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L229_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L230_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L231_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L233_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L233_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L234_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L236_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L236_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L237_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L239_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L239_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L239_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L241_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L243_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L244_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L243_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L245_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L248_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L249_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:ClassDef_L248_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L254_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L254_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L255_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L254_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L259_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L254_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:If_L260_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:If_L260_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L261_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:If_L260_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_451:If_L262_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:If_L262_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L263_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:If_L262_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L265_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L254_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:If_L266_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:If_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L267_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L267_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Assign_L268_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L267_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_451:ImportFrom_L270_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:Try_L267_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_451:If_L271_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:If_L271_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_451:If_L273_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:If_L273_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L274_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:If_L273_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_451:If_L275_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:If_L275_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L276_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:FunctionDef_L254_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Return_L279_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:If_L282_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Import_L283_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_451:If_L282_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_451:Expr_L284_C4"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
"""
import re
# pattern to find defined tables
regex_tables = re.compile(
"""^[\w]+\.define_table\(\s*[\'\"](?P<name>\w+)[\'\"]""",
flags=re.M)
# pattern to find exposed functions in controller
regex_expose = re.compile(
'^def\s+(?P<name>_?[a-zA-Z0-9]\w*)\( *\)\s*:',
flags=re.M)
regex_include = re.compile(
'(?P<all>\{\{\s*include\s+[\'"](?P<name>[^\'"]*)[\'"]\s*\}\})')
regex_extend = re.compile(
'^\s*(?P<all>\{\{\s*extend\s+[\'"](?P<name>[^\'"]+)[\'"]\s*\}\})', re.MULTILINE)
| ajibawa-2023/Python-Code-Large/train/row_452 | 6 | 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_452:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 8], "level": 0, "parent": null, "vector": [8, 0, 0.2143, 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": "\"\"\"\nThis file is part of the web2py Web Framework\nCopyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>\nLicense: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_452:Import_L10_C0", "label": "re import re", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.3571, 0.0357, 0, 0.66, 0.2, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_452:Assign_L14_C0", "label": "regex_tables = compile()", "type": "assigned_variable", "loc": [14, 16], "level": 0, "parent": null, "vector": [14, 0, 0.5357, 0.1071, 0, 0.66, 0.4, 738, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "regex_tables", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "regex_tables = re.compile(\n \"\"\"^[\\w]+\\.define_table\\(\\s*[\\'\\\"](?P<name>\\w+)[\\'\\\"]\"\"\",\n flags=re.M)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_452:Assign_L20_C0", "label": "regex_expose = compile()", "type": "assigned_variable", "loc": [20, 22], "level": 0, "parent": null, "vector": [14, 0, 0.75, 0.1071, 0, 0.66, 0.6, 920, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "regex_expose", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "regex_expose = re.compile(\n '^def\\s+(?P<name>_?[a-zA-Z0-9]\\w*)\\( *\\)\\s*:',\n flags=re.M)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_452:Assign_L24_C0", "label": "regex_include = compile()", "type": "assigned_variable", "loc": [24, 25], "level": 0, "parent": null, "vector": [14, 0, 0.875, 0.0714, 0, 0.66, 0.8, 79, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "regex_include", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "regex_include = re.compile(\n '(?P<all>\\{\\{\\s*include\\s+[\\'\"](?P<name>[^\\'\"]*)[\\'\"]\\s*\\}\\})')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_452:Assign_L27_C0", "label": "regex_extend = compile()", "type": "assigned_variable", "loc": [27, 28], "level": 0, "parent": null, "vector": [14, 0, 0.9821, 0.0714, 0, 0.66, 1.0, 957, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "regex_extend", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "regex_extend = re.compile(\n '^\\s*(?P<all>\\{\\{\\s*extend\\s+[\\'\"](?P<name>[^\\'\"]+)[\\'\"]\\s*\\}\\})', re.MULTILINE)"}] | [] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
Created by Vladyslav Kozlovskyy (Ukraine) <dbdevelop©gmail.com>
for Web2py project
Utilities and class for UTF8 strings managing
===========================================
"""
import __builtin__
__all__ = ['Utf8']
repr_escape_tab = {}
for i in range(1, 32):
repr_escape_tab[i] = ur'\x%02x' % i
repr_escape_tab[7] = u'\\a'
repr_escape_tab[8] = u'\\b'
repr_escape_tab[9] = u'\\t'
repr_escape_tab[10] = u'\\n'
repr_escape_tab[11] = u'\\v'
repr_escape_tab[12] = u'\\f'
repr_escape_tab[13] = u'\\r'
repr_escape_tab[ord('\\')] = u'\\\\'
repr_escape_tab2 = repr_escape_tab.copy()
repr_escape_tab2[ord('\'')] = u"\\'"
def sort_key(s):
""" Unicode Collation Algorithm (UCA) (http://www.unicode.org/reports/tr10/)
is used for utf-8 and unicode strings sorting and for utf-8 strings
comparison
NOTE: pyuca is a very memory cost module! It loads the whole
"allkey.txt" file (~2mb!) into the memory. But this
functionality is needed only when sort_key() is called as a
part of sort() function or when Utf8 strings are compared.
So, it is a lazy "sort_key" function which (ONLY ONCE, ON ITS
FIRST CALL) imports pyuca and replaces itself with a real
sort_key() function
"""
global sort_key
try:
from contrib.pyuca import unicode_collator
unicode_sort_key = unicode_collator.sort_key
sort_key = lambda s: unicode_sort_key(
unicode(s, 'utf-8') if isinstance(s, str) else s)
except:
sort_key = lambda s: (
unicode(s, 'utf-8') if isinstance(s, str) else s).lower()
return sort_key(s)
def ord(char):
""" returns unicode id for utf8 or unicode *char* character
SUPPOSE that *char* is an utf-8 or unicode character only
"""
if isinstance(char, unicode):
return __builtin__.ord(char)
return __builtin__.ord(unicode(char, 'utf-8'))
def chr(code):
""" return utf8-character with *code* unicode id """
return Utf8(unichr(code))
def size(string):
""" return length of utf-8 string in bytes
NOTE! The length of correspondent utf-8
string is returned for unicode string
"""
return Utf8(string).__size__()
def truncate(string, length, dots='...'):
""" returns string of length < *length* or truncate
string with adding *dots* suffix to the string's end
args:
length (int): max length of string
dots (str or unicode): string suffix, when string is cutted
returns:
(utf8-str): original or cutted string
"""
text = unicode(string, 'utf-8')
dots = unicode(dots, 'utf-8') if isinstance(dots, str) else dots
if len(text) > length:
text = text[:length - len(dots)] + dots
return str.__new__(Utf8, text.encode('utf-8'))
class Utf8(str):
"""
Class for utf8 string storing and manipulations
The base presupposition of this class usage is:
"ALL strings in the application are either of
utf-8 or unicode type, even when simple str
type is used. UTF-8 is only a "packed" version
of unicode, so Utf-8 and unicode strings are
interchangeable."
CAUTION! This class is slower than str/unicode!
Do NOT use it inside intensive loops. Simply
decode string(s) to unicode before loop and
encode it back to utf-8 string(s) after
intensive calculation.
You can see the benefit of this class in doctests() below
"""
def __new__(cls, content='', codepage='utf-8'):
if isinstance(content, unicode):
return str.__new__(cls, unicode.encode(content, 'utf-8'))
elif codepage in ('utf-8', 'utf8') or isinstance(content, cls):
return str.__new__(cls, content)
else:
return str.__new__(cls, unicode(content, codepage).encode('utf-8'))
def __repr__(self):
r''' # note that we use raw strings to avoid having to use double back slashes below
NOTE! This function is a clone of web2py:gluon.languages.utf_repl() function
utf8.__repr__() works same as str.repr() when processing ascii string
>>> repr(Utf8('abc')) == repr(Utf8("abc")) == repr('abc') == repr("abc") == "'abc'"
True
>>> repr(Utf8('a"b"c')) == repr('a"b"c') == '\'a"b"c\''
True
>>> repr(Utf8("a'b'c")) == repr("a'b'c") == '"a\'b\'c"'
True
>>> repr(Utf8('a\'b"c')) == repr('a\'b"c') == repr(Utf8("a'b\"c")) == repr("a'b\"c") == '\'a\\\'b"c\''
True
>>> repr(Utf8('a\r\nb')) == repr('a\r\nb') == "'a\\r\\nb'" # Test for \r, \n
True
Unlike str.repr(), Utf8.__repr__() remains utf8 content when processing utf8 string
>>> repr(Utf8('中文字')) == repr(Utf8("中文字")) == "'中文字'" != repr('中文字')
True
>>> repr(Utf8('中"文"字')) == "'中\"文\"字'" != repr('中"文"字')
True
>>> repr(Utf8("中'文'字")) == '"中\'文\'字"' != repr("中'文'字")
True
>>> repr(Utf8('中\'文"字')) == repr(Utf8("中'文\"字")) == '\'中\\\'文"字\'' != repr('中\'文"字') == repr("中'文\"字")
True
>>> repr(Utf8('中\r\n文')) == "'中\\r\\n文'" != repr('中\r\n文') # Test for \r, \n
True
'''
if str.find(self, "'") >= 0 and str.find(self, '"') < 0: # only single quote exists
return '"' + unicode(self, 'utf-8').translate(repr_escape_tab).encode('utf-8') + '"'
else:
return "'" + unicode(self, 'utf-8').translate(repr_escape_tab2).encode('utf-8') + "'"
def __size__(self):
""" length of utf-8 string in bytes """
return str.__len__(self)
def __contains__(self, other):
return str.__contains__(self, Utf8(other))
def __getitem__(self, index):
return str.__new__(Utf8, unicode(self, 'utf-8')[index].encode('utf-8'))
def __getslice__(self, begin, end):
return str.__new__(Utf8, unicode(self, 'utf-8')[begin:end].encode('utf-8'))
def __add__(self, other):
return str.__new__(Utf8, str.__add__(self, unicode.encode(other, 'utf-8')
if isinstance(other, unicode) else other))
def __len__(self):
return len(unicode(self, 'utf-8'))
def __mul__(self, integer):
return str.__new__(Utf8, str.__mul__(self, integer))
def __eq__(self, string):
return str.__eq__(self, Utf8(string))
def __ne__(self, string):
return str.__ne__(self, Utf8(string))
def capitalize(self):
return str.__new__(Utf8, unicode(self, 'utf-8').capitalize().encode('utf-8'))
def center(self, length):
return str.__new__(Utf8, unicode(self, 'utf-8').center(length).encode('utf-8'))
def upper(self):
return str.__new__(Utf8, unicode(self, 'utf-8').upper().encode('utf-8'))
def lower(self):
return str.__new__(Utf8, unicode(self, 'utf-8').lower().encode('utf-8'))
def title(self):
return str.__new__(Utf8, unicode(self, 'utf-8').title().encode('utf-8'))
def index(self, string):
return unicode(self, 'utf-8').index(string if isinstance(string, unicode) else unicode(string, 'utf-8'))
def isalnum(self):
return unicode(self, 'utf-8').isalnum()
def isalpha(self):
return unicode(self, 'utf-8').isalpha()
def isdigit(self):
return unicode(self, 'utf-8').isdigit()
def islower(self):
return unicode(self, 'utf-8').islower()
def isspace(self):
return unicode(self, 'utf-8').isspace()
def istitle(self):
return unicode(self, 'utf-8').istitle()
def isupper(self):
return unicode(self, 'utf-8').isupper()
def zfill(self, length):
return str.__new__(Utf8, unicode(self, 'utf-8').zfill(length).encode('utf-8'))
def join(self, iter):
return str.__new__(Utf8, str.join(self, [Utf8(c) for c in
list(unicode(iter, 'utf-8') if
isinstance(iter, str) else
iter)]))
def lstrip(self, chars=None):
return str.__new__(Utf8, str.lstrip(self, None if chars is None else Utf8(chars)))
def rstrip(self, chars=None):
return str.__new__(Utf8, str.rstrip(self, None if chars is None else Utf8(chars)))
def strip(self, chars=None):
return str.__new__(Utf8, str.strip(self, None if chars is None else Utf8(chars)))
def swapcase(self):
return str.__new__(Utf8, unicode(self, 'utf-8').swapcase().encode('utf-8'))
def count(self, sub, start=0, end=None):
unistr = unicode(self, 'utf-8')
return unistr.count(
unicode(sub, 'utf-8') if isinstance(sub, str) else sub,
start, len(unistr) if end is None else end)
def decode(self, encoding='utf-8', errors='strict'):
return str.decode(self, encoding, errors)
def encode(self, encoding, errors='strict'):
return unicode(self, 'utf-8').encode(encoding, errors)
def expandtabs(self, tabsize=8):
return str.__new__(Utf8, unicode(self, 'utf-8').expandtabs(tabsize).encode('utf-8'))
def find(self, sub, start=None, end=None):
return unicode(self, 'utf-8').find(unicode(sub, 'utf-8')
if isinstance(sub, str) else sub, start, end)
def ljust(self, width, fillchar=' '):
return str.__new__(Utf8, unicode(self, 'utf-8').ljust(width, unicode(fillchar, 'utf-8')
if isinstance(fillchar, str) else fillchar).encode('utf-8'))
def partition(self, sep):
(head, sep, tail) = str.partition(self, Utf8(sep))
return (str.__new__(Utf8, head),
str.__new__(Utf8, sep),
str.__new__(Utf8, tail))
def replace(self, old, new, count=-1):
return str.__new__(Utf8, str.replace(self, Utf8(old), Utf8(new), count))
def rfind(self, sub, start=None, end=None):
return unicode(self, 'utf-8').rfind(unicode(sub, 'utf-8')
if isinstance(sub, str) else sub, start, end)
def rindex(self, string):
return unicode(self, 'utf-8').rindex(string if isinstance(string, unicode)
else unicode(string, 'utf-8'))
def rjust(self, width, fillchar=' '):
return str.__new__(Utf8, unicode(self, 'utf-8').rjust(width, unicode(fillchar, 'utf-8')
if isinstance(fillchar, str) else fillchar).encode('utf-8'))
def rpartition(self, sep):
(head, sep, tail) = str.rpartition(self, Utf8(sep))
return (str.__new__(Utf8, head),
str.__new__(Utf8, sep),
str.__new__(Utf8, tail))
def rsplit(self, sep=None, maxsplit=-1):
return [str.__new__(Utf8, part) for part in str.rsplit(self,
None if sep is None else Utf8(sep), maxsplit)]
def split(self, sep=None, maxsplit=-1):
return [str.__new__(Utf8, part) for part in str.split(self,
None if sep is None else Utf8(sep), maxsplit)]
def splitlines(self, keepends=False):
return [str.__new__(Utf8, part) for part in str.splitlines(self, keepends)]
def startswith(self, prefix, start=0, end=None):
unistr = unicode(self, 'utf-8')
if isinstance(prefix, tuple):
prefix = tuple(unicode(
s, 'utf-8') if isinstance(s, str) else s for s in prefix)
elif isinstance(prefix, str):
prefix = unicode(prefix, 'utf-8')
return unistr.startswith(prefix, start, len(unistr) if end is None else end)
def translate(self, table, deletechars=''):
if isinstance(table, dict):
return str.__new__(Utf8, unicode(self, 'utf-8').translate(table).encode('utf-8'))
else:
return str.__new__(Utf8, str.translate(self, table, deletechars))
def endswith(self, prefix, start=0, end=None):
unistr = unicode(self, 'utf-8')
if isinstance(prefix, tuple):
prefix = tuple(unicode(
s, 'utf-8') if isinstance(s, str) else s for s in prefix)
elif isinstance(prefix, str):
prefix = unicode(prefix, 'utf-8')
return unistr.endswith(prefix, start, len(unistr) if end is None else end)
if hasattr(str, 'format'): # Python 2.5 hasn't got str.format() method
def format(self, *args, **kwargs):
args = [unicode(
s, 'utf-8') if isinstance(s, str) else s for s in args]
kwargs = dict((unicode(k, 'utf-8') if isinstance(k, str) else k,
unicode(v, 'utf-8') if isinstance(v, str) else v)
for k, v in kwargs.iteritems())
return str.__new__(Utf8, unicode(self, 'utf-8').
format(*args, **kwargs).encode('utf-8'))
def __mod__(self, right):
if isinstance(right, tuple):
right = tuple(unicode(v, 'utf-8') if isinstance(v, str) else v
for v in right)
elif isinstance(right, dict):
right = dict((unicode(k, 'utf-8') if isinstance(k, str) else k,
unicode(v, 'utf-8') if isinstance(v, str) else v)
for k, v in right.iteritems())
elif isinstance(right, str):
right = unicode(right, 'utf-8')
return str.__new__(Utf8, unicode(self, 'utf-8').__mod__(right).encode('utf-8'))
def __ge__(self, string):
return sort_key(self) >= sort_key(string)
def __gt__(self, string):
return sort_key(self) > sort_key(string)
def __le__(self, string):
return sort_key(self) <= sort_key(string)
def __lt__(self, string):
return sort_key(self) < sort_key(string)
if __name__ == '__main__':
def doctests():
u"""
doctests:
>>> test_unicode=u'ПРоба Є PRobe'
>>> test_unicode_word=u'ПРоба'
>>> test_number_str='12345'
>>> test_unicode
u'\\u041f\\u0420\\u043e\\u0431\\u0430 \\u0404 PRobe'
>>> print test_unicode
ПРоба Є PRobe
>>> test_word=test_unicode_word.encode('utf-8')
>>> test_str=test_unicode.encode('utf-8')
>>> s=Utf8(test_str)
>>> s
'ПРоба Є PRobe'
>>> type(s)
<class '__main__.Utf8'>
>>> s == test_str
True
>>> len(test_str) # wrong length of utf8-string!
19
>>> len(test_unicode) # RIGHT!
13
>>> len(s) # RIGHT!
13
>>> size(test_str) # size of utf-8 string (in bytes) == len(str)
19
>>> size(test_unicode) # size of unicode string in bytes (packed to utf-8 string)
19
>>> size(s) # size of utf-8 string in bytes
19
>>> try: # utf-8 is a multibyte string. Convert it to unicode for use with builtin ord()
... __builtin__.ord('б') # ascii string
... except Exception, e:
... print 'Exception:', e
Exception: ord() expected a character, but string of length 2 found
>>> ord('б') # utf8.ord() is used(!!!)
1073
>>> ord(u'б') # utf8.ord() is used(!!!)
1073
>>> ord(s[3]) # utf8.ord() is used(!!!)
1073
>>> chr(ord(s[3])) # utf8.chr() and utf8.chr() is used(!!!)
'б'
>>> type(chr(1073)) # utf8.chr() is used(!!!)
<class '__main__.Utf8'>
>>> s=Utf8(test_unicode)
>>> s
'ПРоба Є PRobe'
>>> s == test_str
True
>>> test_str == s
True
>>> s == test_unicode
True
>>> test_unicode == s
True
>>> print test_str.upper() # only ASCII characters uppered
ПРоба Є PROBE
>>> print test_unicode.upper() # unicode gives right result
ПРОБА Є PROBE
>>> s.upper() # utf8 class use unicode.upper()
'ПРОБА Є PROBE'
>>> type(s.upper())
<class '__main__.Utf8'>
>>> s.lower()
'проба є probe'
>>> type(s.lower())
<class '__main__.Utf8'>
>>> s.capitalize()
'Проба є probe'
>>> type(s.capitalize())
<class '__main__.Utf8'>
>>> len(s)
13
>>> len(test_unicode)
13
>>> s+'. Probe is проба'
'ПРоба Є PRobe. Probe is проба'
>>> type(s+'. Probe is проба')
<class '__main__.Utf8'>
>>> s+u'. Probe is проба'
'ПРоба Є PRobe. Probe is проба'
>>> type(s+u'. Probe is проба')
<class '__main__.Utf8'>
>>> s+s
'ПРоба Є PRobeПРоба Є PRobe'
>>> type(s+s)
<class '__main__.Utf8'>
>>> a=s
>>> a+=s
>>> a+=test_unicode
>>> a+=test_str
>>> a
'ПРоба Є PRobeПРоба Є PRobeПРоба Є PRobeПРоба Є PRobe'
>>> type(a)
<class '__main__.Utf8'>
>>> s*3
'ПРоба Є PRobeПРоба Є PRobeПРоба Є PRobe'
>>> type(s*3)
<class '__main__.Utf8'>
>>> a=Utf8("-проба-")
>>> a*=10
>>> a
'-проба--проба--проба--проба--проба--проба--проба--проба--проба--проба-'
>>> type(a)
<class '__main__.Utf8'>
>>> print "'"+test_str.center(17)+"'" # WRONG RESULT!
'ПРоба Є PRobe'
>>> s.center(17) # RIGHT!
' ПРоба Є PRobe '
>>> type(s.center(17))
<class '__main__.Utf8'>
>>> (test_word+test_number_str).isalnum() # WRONG RESULT! non ASCII chars are detected as non alpha
False
>>> Utf8(test_word+test_number_str).isalnum()
True
>>> s.isalnum()
False
>>> test_word.isalpha() # WRONG RESULT! Non ASCII characters are detected as non alpha
False
>>> Utf8(test_word).isalpha() # RIGHT!
True
>>> s.lower().islower()
True
>>> s.upper().isupper()
True
>>> print test_str.zfill(17) # WRONG RESULT!
ПРоба Є PRobe
>>> s.zfill(17) # RIGHT!
'0000ПРоба Є PRobe'
>>> type(s.zfill(17))
<class '__main__.Utf8'>
>>> s.istitle()
False
>>> s.title().istitle()
True
>>> Utf8('1234').isdigit()
True
>>> Utf8(' \t').isspace()
True
>>> s.join('•|•')
'•ПРоба Є PRobe|ПРоба Є PRobe•'
>>> s.join((str('(utf8 тест1)'), unicode('(unicode тест2)','utf-8'), '(ascii test3)'))
'(utf8 тест1)ПРоба Є PRobe(unicode тест2)ПРоба Є PRobe(ascii test3)'
>>> type(s)
<class '__main__.Utf8'>
>>> s==test_str
True
>>> s==test_unicode
True
>>> s.swapcase()
'прОБА є prOBE'
>>> type(s.swapcase())
<class '__main__.Utf8'>
>>> truncate(s, 10)
'ПРоба Є...'
>>> truncate(s, 20)
'ПРоба Є PRobe'
>>> truncate(s, 10, '•••') # utf-8 string as *dots*
'ПРоба Є•••'
>>> truncate(s, 10, u'®') # you can use unicode string as *dots*
'ПРоба Є P®'
>>> type(truncate(s, 10))
<class '__main__.Utf8'>
>>> Utf8(s.encode('koi8-u'), 'koi8-u')
'ПРоба Є PRobe'
>>> s.decode() # convert utf-8 string to unicode
u'\\u041f\\u0420\\u043e\\u0431\\u0430 \\u0404 PRobe'
>>> a='про\\tba'
>>> str_tmp=a.expandtabs()
>>> utf8_tmp=Utf8(a).expandtabs()
>>> utf8_tmp.replace(' ','.') # RIGHT! (default tabsize is 8)
'про.....ba'
>>> utf8_tmp.index('b')
8
>>> print "'"+str_tmp.replace(' ','.')+"'" # WRONG STRING LENGTH!
'про..ba'
>>> str_tmp.index('b') # WRONG index of 'b' character
8
>>> print "'"+a.expandtabs(4).replace(' ','.')+"'" # WRONG RESULT!
'про..ba'
>>> Utf8(a).expandtabs(4).replace(' ','.') # RIGHT!
'про.ba'
>>> s.find('Є')
6
>>> s.find(u'Є')
6
>>> s.find(' ', 6)
7
>>> s.rfind(' ')
7
>>> s.partition('Є')
('ПРоба ', 'Є', ' PRobe')
>>> s.partition(u'Є')
('ПРоба ', 'Є', ' PRobe')
>>> (a,b,c) = s.partition('Є')
>>> type(a), type(b), type(c)
(<class '__main__.Utf8'>, <class '__main__.Utf8'>, <class '__main__.Utf8'>)
>>> s.partition(' ')
('ПРоба', ' ', 'Є PRobe')
>>> s.rpartition(' ')
('ПРоба Є', ' ', 'PRobe')
>>> s.index('Є')
6
>>> s.rindex(u'Є')
6
>>> s.index(' ')
5
>>> s.rindex(' ')
7
>>> a=Utf8('а б ц д е а б ц д е а\\tб ц д е')
>>> a.split()
['а', 'б', 'ц', 'д', 'е', 'а', 'б', 'ц', 'д',
'е', 'а', 'б', 'ц', 'д', 'е']
>>> a.rsplit()
['а', 'б', 'ц', 'д', 'е', 'а', 'б', 'ц', 'д',
'е', 'а', 'б', 'ц', 'д', 'е']
>>> a.expandtabs().split('б')
['а ', ' ц д е а ', ' ц д е а ', ' ц д е']
>>> a.expandtabs().rsplit('б')
['а ', ' ц д е а ', ' ц д е а ', ' ц д е']
>>> a.expandtabs().split(u'б', 1)
['а ', ' ц д е а б ц д е а б ц д е']
>>> a.expandtabs().rsplit(u'б', 1)
['а б ц д е а б ц д е а ', ' ц д е']
>>> a=Utf8("рядок1\\nрядок2\\nрядок3")
>>> a.splitlines()
['рядок1', 'рядок2', 'рядок3']
>>> a.splitlines(True)
['рядок1\\n', 'рядок2\\n', 'рядок3']
>>> s[6]
'Є'
>>> s[0]
'П'
>>> s[-1]
'e'
>>> s[:10]
'ПРоба Є PR'
>>> s[2:-2:2]
'оаЄPo'
>>> s[::-1]
'eboRP Є абоРП'
>>> s.startswith('ПР')
True
>>> s.startswith(('ПР', u'об'),0)
True
>>> s.startswith(u'об', 2, 4)
True
>>> s.endswith('be')
True
>>> s.endswith(('be', 'PR', u'Є'))
True
>>> s.endswith('PR', 8, 10)
True
>>> s.endswith('Є', -7, -6)
True
>>> s.count(' ')
2
>>> s.count(' ',6)
1
>>> s.count(u'Є')
1
>>> s.count('Є', 0, 5)
0
>>> Utf8(
"Parameters: '%(проба)s', %(probe)04d, %(проба2)s") % { u"проба": s,
... "not used": "???", "probe": 2, "проба2": u"ПРоба Probe" }
"Parameters: 'ПРоба Є PRobe', 0002, ПРоба Probe"
>>> a=Utf8(u"Параметр: (%s)-(%s)-[%s]")
>>> a%=(s, s[::-1], 1000)
>>> a
'Параметр: (ПРоба Є PRobe)-(eboRP Є абоРП)-[1000]'
>>> if hasattr(Utf8, 'format'):
... Utf8("Проба <{0}>, {1}, {param1}, {param2}").format(s, u"中文字",
... param1="барабан", param2=1000) == 'Проба <ПРоба Є PRobe>, 中文字, барабан, 1000'
... else: # format() method is not used in python with version <2.6:
... print True
True
>>> u'Б'<u'Ї' # WRONG ORDER!
False
>>> 'Б'<'Ї' # WRONG ORDER!
False
>>> Utf8('Б')<'Ї' # RIGHT!
True
>>> u'д'>u'ґ' # WRONG ORDER!
False
>>> Utf8('д')>Utf8('ґ') # RIGHT!
True
>>> u'є'<=u'ж' # WRONG ORDER!
False
>>> Utf8('є')<=u'ж' # RIGHT!
True
>>> Utf8('є')<=u'є'
True
>>> u'Ї'>=u'И' # WRONG ORDER!
False
>>> Utf8(u'Ї') >= u'И' # RIGHT
True
>>> Utf8('Є') >= 'Є'
True
>>> a="яжертиуіопшщїасдфгґхйклчєзьцвбнмюЯЖЕРТИУІОПШЩЇАСДФГҐХЙКЛЧЗЬЦВБНМЮЄ" # str type
>>> b=u"яжертиуіопшщїасдфгґхйклчєзьцвбнмюЯЖЕРТИУІОПШЩЇАСДФГҐХЙКЛЧЗЬЦВБНМЮЄ" # unicode type
>>> c=Utf8("яжертиуіопшщїасдфгґхйклчєзьцвбнмюЯЖЕРТИУІОПШЩЇАСДФГҐХЙКЛЧЗЬЦВБНМЮЄ") # utf8 class
>>> result = "".join(sorted(a))
>>> result[0:20] # result is not utf8 string, because bytes, not utf8-characters were sorted
'\\x80\\x81\\x82\\x83\\x84\\x84\\x85\\x86\\x86\\x87\\x87\\x88\\x89\\x8c\\x8e\\x8f\\x90\\x90\\x91\\x91'
>>> try:
... unicode(result, 'utf-8') # try to convert result (utf-8?) to unicode
... except Exception, e:
... print 'Exception:', e
Exception: 'utf8' codec can't decode byte 0x80 in position 0: unexpected code byte
>>> try: # FAILED! (working with bytes, not with utf8-charactes)
... "".join( sorted(a, key=sort_key) ) # utf8.sort_key may be used with utf8 or unicode strings only!
... except Exception, e:
... print 'Exception:', e
Exception: 'utf8' codec can't decode byte 0xd1 in position 0: unexpected end of data
>>> print "".join( sorted(Utf8(a))) # converting *a* to unicode or utf8-string gives us correct result
аАбБвВгГґҐдДеЕєЄжЖзЗиИіІїЇйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩьЬюЮяЯ
>>> print u"".join( sorted(b) ) # WRONG ORDER! Default sort key is used
ЄІЇАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЮЯабвгдежзийклмнопрстуфхцчшщьюяєіїҐґ
>>> print u"".join( sorted(b, key=sort_key) ) # RIGHT ORDER! utf8.sort_key is used
аАбБвВгГґҐдДеЕєЄжЖзЗиИіІїЇйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩьЬюЮяЯ
>>> print "".join( sorted(c) ) # RIGHT ORDER! Utf8 "rich comparison" methods are used
аАбБвВгГґҐдДеЕєЄжЖзЗиИіІїЇйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩьЬюЮяЯ
>>> print "".join( sorted(c, key=sort_key) ) # RIGHT ORDER! utf8.sort_key is used
аАбБвВгГґҐдДеЕєЄжЖзЗиИіІїЇйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩьЬюЮяЯ
>>> Utf8().join(sorted(c.decode(), key=sort_key)) # convert to unicode for better performance
'аАбБвВгГґҐдДеЕєЄжЖзЗиИіІїЇйЙкКлЛмМнНоОпПрРсСтТуУфФхХцЦчЧшШщЩьЬюЮяЯ'
>>> for result in sorted(
["Іа", "Астро", u"гала", Utf8("Гоша"), "Єва", "шовк", "аякс", "Їжа",
... "ґанок", Utf8("Дар'я"), "білінг", "веб", u"Жужа", "проба", u"тест",
... "абетка", "яблуко", "Юляся", "Київ", "лимонад", "ложка", "Матриця",
... ], key=sort_key):
... print result.ljust(20), type(result)
абетка <type 'str'>
Астро <type 'str'>
аякс <type 'str'>
білінг <type 'str'>
веб <type 'str'>
гала <type 'unicode'>
ґанок <type 'str'>
Гоша <class '__main__.Utf8'>
Дар'я <class '__main__.Utf8'>
Єва <type 'str'>
Жужа <type 'unicode'>
Іа <type 'str'>
Їжа <type 'str'>
Київ <type 'str'>
лимонад <type 'str'>
ложка <type 'str'>
Матриця <type 'str'>
проба <type 'str'>
тест <type 'unicode'>
шовк <type 'str'>
Юляся <type 'str'>
яблуко <type 'str'>
>>> a=Utf8("中文字")
>>> L=list(a)
>>> L
['中', '文', '字']
>>> a="".join(L)
>>> print a
中文字
>>> type(a)
<type 'str'>
>>> a="中文字" # standard str type
>>> L=list(a)
>>> L
['\\xe4', '\\xb8', '\\xad', '\\xe6', '\\x96', '\\x87',
'\\xe5', '\\xad', '\\x97']
>>> from string import maketrans
>>> str_tab=maketrans('PRobe','12345')
>>> unicode_tab={ord(u'П'):ord(u'Ж'),
... ord(u'Р') : u'Ш',
... ord(Utf8('о')) : None, # utf8.ord() is used
... ord('б') : None, # -//-//-
... ord(u'а') : u"中文字",
... ord(u'Є') : Utf8('•').decode(), # only unicode type is supported
... }
>>> s.translate(unicode_tab).translate(str_tab, deletechars=' ')
'ЖШ中文字•12345'
"""
import sys
reload(sys)
sys.setdefaultencoding("UTF-8")
import doctest
print "DOCTESTS STARTED..."
doctest.testmod()
print "DOCTESTS FINISHED"
doctests()
| ajibawa-2023/Python-Code-Large/train/row_453 | 179 | 728 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_453:Import_L1_C0", "label": "__builtin__ import __builtin__", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0014, 0.0014, 0, 0.66, 0.0, 364, 0, 1, 0, 0, 364, 0, 0], "semantic": {"name": "__builtin__", "arg_names": [], "import_names": ["__builtin__"], "rhs_call_name": "", "annotation": ""}, "snippet": "import __builtin__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L2_C0", "label": "sort_key", "type": "function", "loc": [2, 25], "level": 0, "parent": null, "vector": [2, 0, 0.0185, 0.033, 0, 0.66, 0.1667, 916, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "sort_key", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def sort_key(s):\n \"\"\" Unicode Collation Algorithm (UCA) (http://www.unicode.org/reports/tr10/)\n is used for utf-8 and unicode strings sorting and for utf-8 strings\n comparison\n\n NOTE: pyuca is a very memory cost module! It loads the whole\n \"allkey.txt\" file (~2mb!) into the memory. But this\n functionality is needed only when sort_key() is called as a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L3_C4", "label": "expression", "type": "expression", "loc": [3, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L2_C0", "vector": [8, 1, 0.0124, 0.0179, 1, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Unicode Collation Algorithm (UCA) (http://www.unicode.org/reports/tr10/)\n is used for utf-8 and unicode strings sorting and for utf-8 strings\n comparison\n\n NOTE: pyuca is a very memory cost module! It loads the whole\n \"allkey.txt\" file (~2mb!) into the memory. But this\n functionality is needed only when sort_key() is called as a\n part of sort() function or when Utf8 strings are compared."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Try_L17_C4", "label": "try", "type": "try", "loc": [17, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L2_C0", "vector": [7, 1, 0.0282, 0.011, 1, 0.74, 0.5, 0, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n from contrib.pyuca import unicode_collator\n unicode_sort_key = unicode_collator.sort_key\n sort_key = lambda s: unicode_sort_key(\n unicode(s, 'utf-8') if isinstance(s, str) else s)\n except:\n sort_key = lambda s: (\n unicode(s, 'utf-8') if isinstance(s, str) else s).lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:ImportFrom_L18_C8", "label": "from contrib.pyuca import unicode_collator", "type": "import", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:Try_L17_C4", "vector": [1, 2, 0.0247, 0.0014, 2, 0.59, 0.0, 378, 0, 1, 0, 0, 378, 0, 0], "semantic": {"name": "contrib.pyuca", "arg_names": [], "import_names": ["unicode_collator"], "rhs_call_name": "", "annotation": ""}, "snippet": " from contrib.pyuca import unicode_collator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L19_C8", "label": "unicode_sort_key =", "type": "assigned_variable", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:Try_L17_C4", "vector": [14, 2, 0.0261, 0.0014, 2, 0.59, 0.5, 524, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "unicode_sort_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " unicode_sort_key = unicode_collator.sort_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L20_C8", "label": "sort_key =", "type": "assigned_variable", "loc": [20, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:Try_L17_C4", "vector": [14, 2, 0.0282, 0.0027, 2, 0.59, 1.0, 916, 9, 0, 0, 0, 0, 0, 3], "semantic": {"name": "sort_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sort_key = lambda s: unicode_sort_key(\n unicode(s, 'utf-8') if isinstance(s, str) else s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L23_C8", "label": "sort_key =", "type": "assigned_variable", "loc": [23, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:Try_L17_C4", "vector": [14, 2, 0.0323, 0.0027, 2, 0.59, 0.0, 916, 9, 0, 0, 0, 0, 0, 3], "semantic": {"name": "sort_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sort_key = lambda s: (\n unicode(s, 'utf-8') if isinstance(s, str) else s).lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L25_C4", "label": "return", "type": "return", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L2_C0", "vector": [13, 1, 0.0343, 0.0014, 1, 0.74, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sort_key(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L28_C0", "label": "ord", "type": "function", "loc": [28, 35], "level": 0, "parent": null, "vector": [2, 0, 0.0433, 0.011, 0, 0.66, 0.3333, 171, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "ord", "arg_names": ["char"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def ord(char):\n \"\"\" returns unicode id for utf8 or unicode *char* character\n\n SUPPOSE that *char* is an utf-8 or unicode character only\n \"\"\"\n if isinstance(char, unicode):\n return __builtin__.ord(char)\n return __builtin__.ord(unicode(char, 'utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L29_C4", "label": "expression", "type": "expression", "loc": [29, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L28_C0", "vector": [8, 1, 0.0419, 0.0055, 1, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" returns unicode id for utf8 or unicode *char* character\n\n SUPPOSE that *char* is an utf-8 or unicode character only\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:If_L33_C4", "label": "if", "type": "if", "loc": [33, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L28_C0", "vector": [4, 1, 0.046, 0.0027, 1, 0.44, 0.5, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(char, unicode):\n return __builtin__.ord(char)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L34_C8", "label": "return", "type": "return", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:If_L33_C4", "vector": [13, 2, 0.0467, 0.0014, 2, 0.7, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return __builtin__.ord(char)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L35_C4", "label": "return", "type": "return", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L28_C0", "vector": [13, 1, 0.0481, 0.0014, 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 __builtin__.ord(unicode(char, 'utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L38_C0", "label": "chr", "type": "function", "loc": [38, 40], "level": 0, "parent": null, "vector": [2, 0, 0.0536, 0.0041, 0, 0.66, 0.5, 915, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "chr", "arg_names": ["code"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def chr(code):\n \"\"\" return utf8-character with *code* unicode id \"\"\"\n return Utf8(unichr(code))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L39_C4", "label": "expression", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L38_C0", "vector": [8, 1, 0.0536, 0.0014, 1, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" return utf8-character with *code* unicode id \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L40_C4", "label": "return", "type": "return", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L38_C0", "vector": [13, 1, 0.0549, 0.0014, 1, 0.91, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Utf8(unichr(code))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L43_C0", "label": "size", "type": "function", "loc": [43, 48], "level": 0, "parent": null, "vector": [2, 0, 0.0625, 0.0082, 0, 0.66, 0.6667, 714, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "size", "arg_names": ["string"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def size(string):\n \"\"\" return length of utf-8 string in bytes\n NOTE! The length of correspondent utf-8\n string is returned for unicode string\n \"\"\"\n return Utf8(string).__size__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L44_C4", "label": "expression", "type": "expression", "loc": [44, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L43_C0", "vector": [8, 1, 0.0625, 0.0055, 1, 0.53, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" return length of utf-8 string in bytes\n NOTE! The length of correspondent utf-8\n string is returned for unicode string\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L48_C4", "label": "return", "type": "return", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L43_C0", "vector": [13, 1, 0.0659, 0.0014, 1, 0.53, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Utf8(string).__size__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L51_C0", "label": "truncate", "type": "function", "loc": [51, 66], "level": 0, "parent": null, "vector": [2, 0, 0.0804, 0.022, 0, 0.66, 0.8333, 39, 0, 3, 1, 0, 0, 0, 7], "semantic": {"name": "truncate", "arg_names": ["string", "length", "dots"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def truncate(string, length, dots='...'):\n \"\"\" returns string of length < *length* or truncate\n string with adding *dots* suffix to the string's end\n\n args:\n length (int): max length of string\n dots (str or unicode): string suffix, when string is cutted\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L52_C4", "label": "expression", "type": "expression", "loc": [52, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L51_C0", "vector": [8, 1, 0.0776, 0.0137, 1, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" returns string of length < *length* or truncate\n string with adding *dots* suffix to the string's end\n\n args:\n length (int): max length of string\n dots (str or unicode): string suffix, when string is cutted\n\n returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L62_C4", "label": "text = unicode()", "type": "assigned_variable", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L51_C0", "vector": [14, 1, 0.0852, 0.0014, 1, 0.97, 0.25, 439, 3, 2, 0, 0, 733, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "unicode", "annotation": ""}, "snippet": " text = unicode(string, 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L63_C4", "label": "dots =", "type": "assigned_variable", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L51_C0", "vector": [14, 1, 0.0865, 0.0014, 1, 0.97, 0.5, 917, 8, 0, 0, 0, 0, 0, 2], "semantic": {"name": "dots", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dots = unicode(dots, 'utf-8') if isinstance(dots, str) else dots"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:If_L64_C4", "label": "if", "type": "if", "loc": [64, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L51_C0", "vector": [4, 1, 0.0886, 0.0027, 1, 0.97, 0.75, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(text) > length:\n text = text[:length - len(dots)] + dots"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L65_C8", "label": "text =", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:If_L64_C4", "vector": [14, 2, 0.0893, 0.0014, 2, 0.38, 0.0, 439, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = text[:length - len(dots)] + dots"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L66_C4", "label": "return", "type": "return", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L51_C0", "vector": [13, 1, 0.0907, 0.0014, 1, 0.97, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, text.encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "label": "Utf8", "type": "class", "loc": [69, 728], "level": 0, "parent": null, "vector": [3, 0, 0.5474, 0.9066, 0, 0.66, 1.0, 590, 0, 55, 0, 0, 52, 0, 99], "semantic": {"name": "Utf8", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Utf8(str):\n \"\"\"\n Class for utf8 string storing and manipulations\n\n The base presupposition of this class usage is:\n \"ALL strings in the application are either of\n utf-8 or unicode type, even when simple str\n type is used. UTF-8 is only a \"packed\" version"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L70_C4", "label": "expression", "type": "expression", "loc": [70, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [8, 1, 0.1078, 0.0247, 1, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Class for utf8 string storing and manipulations\n\n The base presupposition of this class usage is:\n \"ALL strings in the application are either of\n utf-8 or unicode type, even when simple str\n type is used. UTF-8 is only a \"packed\" version\n of unicode, so Utf-8 and unicode strings are"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L88_C4", "label": "__new__", "type": "function", "loc": [88, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.125, 0.0096, 1, 0.59, 0.0179, 42, 0, 3, 1, 0, 0, 0, 8], "semantic": {"name": "__new__", "arg_names": ["cls", "content", "codepage"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __new__(cls, content='', codepage='utf-8'):\n if isinstance(content, unicode):\n return str.__new__(cls, unicode.encode(content, 'utf-8'))\n elif codepage in ('utf-8', 'utf8') or isinstance(content, cls):\n return str.__new__(cls, content)\n else:\n return str.__new__(cls, unicode(content, codepage).encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:If_L89_C8", "label": "if", "type": "if", "loc": [89, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L88_C4", "vector": [4, 2, 0.1257, 0.0082, 2, 0.26, 0.0, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(content, unicode):\n return str.__new__(cls, unicode.encode(content, 'utf-8'))\n elif codepage in ('utf-8', 'utf8') or isinstance(content, cls):\n return str.__new__(cls, content)\n else:\n return str.__new__(cls, unicode(content, codepage).encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L90_C12", "label": "return", "type": "return", "loc": [90, 90], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:If_L89_C8", "vector": [13, 3, 0.1236, 0.0014, 3, 0.14, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(cls, unicode.encode(content, 'utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:If_L91_C8", "label": "if", "type": "if", "loc": [91, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:If_L89_C8", "vector": [4, 3, 0.1271, 0.0055, 3, 0.14, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif codepage in ('utf-8', 'utf8') or isinstance(content, cls):\n return str.__new__(cls, content)\n else:\n return str.__new__(cls, unicode(content, codepage).encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L92_C12", "label": "return", "type": "return", "loc": [92, 92], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:If_L91_C8", "vector": [13, 4, 0.1264, 0.0014, 4, 0.49, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(cls, content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L94_C12", "label": "return", "type": "return", "loc": [94, 94], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:If_L91_C8", "vector": [13, 4, 0.1291, 0.0014, 4, 0.49, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(cls, unicode(content, codepage).encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L96_C4", "label": "__repr__", "type": "function", "loc": [96, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.1532, 0.044, 1, 0.59, 0.0357, 204, 0, 1, 1, 0, 0, 0, 8], "semantic": {"name": "__repr__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __repr__(self):\n r''' # note that we use raw strings to avoid having to use double back slashes below\n NOTE! This function is a clone of web2py:gluon.languages.utf_repl() function\n\n utf8.__repr__() works same as str.repr() when processing ascii string\n >>> repr(Utf8('abc')) == repr(Utf8(\"abc\")) == repr('abc') == repr(\"abc\") == \"'abc'\"\n True\n >>> repr(Utf8('a\"b\"c')) == repr('a\"b\"c') == '\\'a\"b\"c\\''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L97_C8", "label": "expression", "type": "expression", "loc": [97, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L96_C4", "vector": [8, 2, 0.1511, 0.0371, 2, 0.35, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r''' # note that we use raw strings to avoid having to use double back slashes below\n NOTE! This function is a clone of web2py:gluon.languages.utf_repl() function\n\n utf8.__repr__() works same as str.repr() when processing ascii string\n >>> repr(Utf8('abc')) == repr(Utf8(\"abc\")) == repr('abc') == repr(\"abc\") == \"'abc'\"\n True\n >>> repr(Utf8('a\"b\"c')) == repr('a\"b\"c') == '\\'a\"b\"c\\''\n True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:If_L124_C8", "label": "if", "type": "if", "loc": [124, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L96_C4", "vector": [4, 2, 0.1724, 0.0055, 2, 0.35, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if str.find(self, \"'\") >= 0 and str.find(self, '\"') < 0: # only single quote exists\n return '\"' + unicode(self, 'utf-8').translate(repr_escape_tab).encode('utf-8') + '\"'\n else:\n return \"'\" + unicode(self, 'utf-8').translate(repr_escape_tab2).encode('utf-8') + \"'\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L125_C12", "label": "return", "type": "return", "loc": [125, 125], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:If_L124_C8", "vector": [13, 3, 0.1717, 0.0014, 3, 0.47, 0.0, 0, 4, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\"' + unicode(self, 'utf-8').translate(repr_escape_tab).encode('utf-8') + '\"'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L127_C12", "label": "return", "type": "return", "loc": [127, 127], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:If_L124_C8", "vector": [13, 3, 0.1745, 0.0014, 3, 0.47, 1.0, 0, 4, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"'\" + unicode(self, 'utf-8').translate(repr_escape_tab2).encode('utf-8') + \"'\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L129_C4", "label": "__size__", "type": "function", "loc": [129, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.1786, 0.0041, 1, 0.59, 0.0536, 116, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__size__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __size__(self):\n \"\"\" length of utf-8 string in bytes \"\"\"\n return str.__len__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L130_C8", "label": "expression", "type": "expression", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L129_C4", "vector": [8, 2, 0.1786, 0.0014, 2, 0.62, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" length of utf-8 string in bytes \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L131_C8", "label": "return", "type": "return", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L129_C4", "vector": [13, 2, 0.1799, 0.0014, 2, 0.62, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__len__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L133_C4", "label": "__contains__", "type": "function", "loc": [133, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.1834, 0.0027, 1, 0.59, 0.0714, 456, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__contains__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __contains__(self, other):\n return str.__contains__(self, Utf8(other))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L134_C8", "label": "return", "type": "return", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L133_C4", "vector": [13, 2, 0.1841, 0.0014, 2, 0.99, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__contains__(self, Utf8(other))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L136_C4", "label": "__getitem__", "type": "function", "loc": [136, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.1875, 0.0027, 1, 0.59, 0.0893, 698, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "__getitem__", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, index):\n return str.__new__(Utf8, unicode(self, 'utf-8')[index].encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L137_C8", "label": "return", "type": "return", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L136_C4", "vector": [13, 2, 0.1882, 0.0014, 2, 0.38, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, unicode(self, 'utf-8')[index].encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L139_C4", "label": "__getslice__", "type": "function", "loc": [139, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.1916, 0.0027, 1, 0.59, 0.1071, 269, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "__getslice__", "arg_names": ["self", "begin", "end"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getslice__(self, begin, end):\n return str.__new__(Utf8, unicode(self, 'utf-8')[begin:end].encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L140_C8", "label": "return", "type": "return", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L139_C4", "vector": [13, 2, 0.1923, 0.0014, 2, 0.35, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, unicode(self, 'utf-8')[begin:end].encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L142_C4", "label": "__add__", "type": "function", "loc": [142, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.1964, 0.0041, 1, 0.59, 0.125, 899, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "__add__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __add__(self, other):\n return str.__new__(Utf8, str.__add__(self, unicode.encode(other, 'utf-8')\n if isinstance(other, unicode) else other))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L143_C8", "label": "return", "type": "return", "loc": [143, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L142_C4", "vector": [13, 2, 0.1971, 0.0027, 2, 0.09, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, str.__add__(self, unicode.encode(other, 'utf-8')\n if isinstance(other, unicode) else other))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L146_C4", "label": "__len__", "type": "function", "loc": [146, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.2012, 0.0027, 1, 0.59, 0.1429, 76, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "__len__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __len__(self):\n return len(unicode(self, 'utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L147_C8", "label": "return", "type": "return", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L146_C4", "vector": [13, 2, 0.2019, 0.0014, 2, 0.6, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(unicode(self, 'utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L149_C4", "label": "__mul__", "type": "function", "loc": [149, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.2054, 0.0027, 1, 0.59, 0.1607, 215, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__mul__", "arg_names": ["self", "integer"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __mul__(self, integer):\n return str.__new__(Utf8, str.__mul__(self, integer))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L150_C8", "label": "return", "type": "return", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L149_C4", "vector": [13, 2, 0.206, 0.0014, 2, 0.93, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, str.__mul__(self, integer))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L152_C4", "label": "__eq__", "type": "function", "loc": [152, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.2095, 0.0027, 1, 0.59, 0.1786, 763, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__eq__", "arg_names": ["self", "string"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __eq__(self, string):\n return str.__eq__(self, Utf8(string))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L153_C8", "label": "return", "type": "return", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L152_C4", "vector": [13, 2, 0.2102, 0.0014, 2, 0.0, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__eq__(self, Utf8(string))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L155_C4", "label": "__ne__", "type": "function", "loc": [155, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.2136, 0.0027, 1, 0.59, 0.1964, 254, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__ne__", "arg_names": ["self", "string"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __ne__(self, string):\n return str.__ne__(self, Utf8(string))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L156_C8", "label": "return", "type": "return", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L155_C4", "vector": [13, 2, 0.2143, 0.0014, 2, 0.07, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__ne__(self, Utf8(string))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L158_C4", "label": "capitalize", "type": "function", "loc": [158, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.2177, 0.0027, 1, 0.59, 0.2143, 353, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "capitalize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def capitalize(self):\n return str.__new__(Utf8, unicode(self, 'utf-8').capitalize().encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L159_C8", "label": "return", "type": "return", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L158_C4", "vector": [13, 2, 0.2184, 0.0014, 2, 0.17, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, unicode(self, 'utf-8').capitalize().encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L161_C4", "label": "center", "type": "function", "loc": [161, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.2218, 0.0027, 1, 0.59, 0.2321, 546, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "center", "arg_names": ["self", "length"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def center(self, length):\n return str.__new__(Utf8, unicode(self, 'utf-8').center(length).encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L162_C8", "label": "return", "type": "return", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L161_C4", "vector": [13, 2, 0.2225, 0.0014, 2, 0.67, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, unicode(self, 'utf-8').center(length).encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L164_C4", "label": "upper", "type": "function", "loc": [164, 165], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.226, 0.0027, 1, 0.59, 0.25, 347, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "upper", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def upper(self):\n return str.__new__(Utf8, unicode(self, 'utf-8').upper().encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L165_C8", "label": "return", "type": "return", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L164_C4", "vector": [13, 2, 0.2266, 0.0014, 2, 0.3, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, unicode(self, 'utf-8').upper().encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L167_C4", "label": "lower", "type": "function", "loc": [167, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.2301, 0.0027, 1, 0.59, 0.2679, 432, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "lower", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lower(self):\n return str.__new__(Utf8, unicode(self, 'utf-8').lower().encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L168_C8", "label": "return", "type": "return", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L167_C4", "vector": [13, 2, 0.2308, 0.0014, 2, 0.95, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, unicode(self, 'utf-8').lower().encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L170_C4", "label": "title", "type": "function", "loc": [170, 171], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.2342, 0.0027, 1, 0.59, 0.2857, 48, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "title", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def title(self):\n return str.__new__(Utf8, unicode(self, 'utf-8').title().encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L171_C8", "label": "return", "type": "return", "loc": [171, 171], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L170_C4", "vector": [13, 2, 0.2349, 0.0014, 2, 0.26, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, unicode(self, 'utf-8').title().encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L173_C4", "label": "index", "type": "function", "loc": [173, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.2383, 0.0027, 1, 0.59, 0.3036, 780, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "index", "arg_names": ["self", "string"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def index(self, string):\n return unicode(self, 'utf-8').index(string if isinstance(string, unicode) else unicode(string, 'utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L174_C8", "label": "return", "type": "return", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L173_C4", "vector": [13, 2, 0.239, 0.0014, 2, 0.96, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unicode(self, 'utf-8').index(string if isinstance(string, unicode) else unicode(string, 'utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L176_C4", "label": "isalnum", "type": "function", "loc": [176, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.2424, 0.0027, 1, 0.59, 0.3214, 553, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "isalnum", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def isalnum(self):\n return unicode(self, 'utf-8').isalnum()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L177_C8", "label": "return", "type": "return", "loc": [177, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L176_C4", "vector": [13, 2, 0.2431, 0.0014, 2, 0.47, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unicode(self, 'utf-8').isalnum()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L179_C4", "label": "isalpha", "type": "function", "loc": [179, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.2466, 0.0027, 1, 0.59, 0.3393, 987, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "isalpha", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def isalpha(self):\n return unicode(self, 'utf-8').isalpha()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L180_C8", "label": "return", "type": "return", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L179_C4", "vector": [13, 2, 0.2473, 0.0014, 2, 0.71, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unicode(self, 'utf-8').isalpha()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L182_C4", "label": "isdigit", "type": "function", "loc": [182, 183], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.2507, 0.0027, 1, 0.59, 0.3571, 481, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "isdigit", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def isdigit(self):\n return unicode(self, 'utf-8').isdigit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L183_C8", "label": "return", "type": "return", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L182_C4", "vector": [13, 2, 0.2514, 0.0014, 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 unicode(self, 'utf-8').isdigit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L185_C4", "label": "islower", "type": "function", "loc": [185, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.2548, 0.0027, 1, 0.59, 0.375, 199, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "islower", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def islower(self):\n return unicode(self, 'utf-8').islower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L186_C8", "label": "return", "type": "return", "loc": [186, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L185_C4", "vector": [13, 2, 0.2555, 0.0014, 2, 0.71, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unicode(self, 'utf-8').islower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L188_C4", "label": "isspace", "type": "function", "loc": [188, 189], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.2589, 0.0027, 1, 0.59, 0.3929, 43, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "isspace", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def isspace(self):\n return unicode(self, 'utf-8').isspace()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L189_C8", "label": "return", "type": "return", "loc": [189, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L188_C4", "vector": [13, 2, 0.2596, 0.0014, 2, 0.55, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unicode(self, 'utf-8').isspace()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L191_C4", "label": "istitle", "type": "function", "loc": [191, 192], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.263, 0.0027, 1, 0.59, 0.4107, 623, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "istitle", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def istitle(self):\n return unicode(self, 'utf-8').istitle()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L192_C8", "label": "return", "type": "return", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L191_C4", "vector": [13, 2, 0.2637, 0.0014, 2, 0.99, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unicode(self, 'utf-8').istitle()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L194_C4", "label": "isupper", "type": "function", "loc": [194, 195], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.2672, 0.0027, 1, 0.59, 0.4286, 460, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "isupper", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def isupper(self):\n return unicode(self, 'utf-8').isupper()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L195_C8", "label": "return", "type": "return", "loc": [195, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L194_C4", "vector": [13, 2, 0.2679, 0.0014, 2, 0.08, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unicode(self, 'utf-8').isupper()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L197_C4", "label": "zfill", "type": "function", "loc": [197, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.2713, 0.0027, 1, 0.59, 0.4464, 159, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "zfill", "arg_names": ["self", "length"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def zfill(self, length):\n return str.__new__(Utf8, unicode(self, 'utf-8').zfill(length).encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L198_C8", "label": "return", "type": "return", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L197_C4", "vector": [13, 2, 0.272, 0.0014, 2, 0.49, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, unicode(self, 'utf-8').zfill(length).encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L200_C4", "label": "join", "type": "function", "loc": [200, 204], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.2775, 0.0069, 1, 0.59, 0.4643, 933, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "join", "arg_names": ["self", "iter"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def join(self, iter):\n return str.__new__(Utf8, str.join(self, [Utf8(c) for c in\n list(unicode(iter, 'utf-8') if\n isinstance(iter, str) else\n iter)]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L201_C8", "label": "return", "type": "return", "loc": [201, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L200_C4", "vector": [13, 2, 0.2782, 0.0055, 2, 0.72, 0.0, 0, 3, 0, 0, 0, 0, 10, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, str.join(self, [Utf8(c) for c in\n list(unicode(iter, 'utf-8') if\n isinstance(iter, str) else\n iter)]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L206_C4", "label": "lstrip", "type": "function", "loc": [206, 207], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.2837, 0.0027, 1, 0.59, 0.4821, 313, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "lstrip", "arg_names": ["self", "chars"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lstrip(self, chars=None):\n return str.__new__(Utf8, str.lstrip(self, None if chars is None else Utf8(chars)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L207_C8", "label": "return", "type": "return", "loc": [207, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L206_C4", "vector": [13, 2, 0.2843, 0.0014, 2, 0.36, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, str.lstrip(self, None if chars is None else Utf8(chars)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L209_C4", "label": "rstrip", "type": "function", "loc": [209, 210], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.2878, 0.0027, 1, 0.59, 0.5, 807, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "rstrip", "arg_names": ["self", "chars"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def rstrip(self, chars=None):\n return str.__new__(Utf8, str.rstrip(self, None if chars is None else Utf8(chars)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L210_C8", "label": "return", "type": "return", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L209_C4", "vector": [13, 2, 0.2885, 0.0014, 2, 0.83, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, str.rstrip(self, None if chars is None else Utf8(chars)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L212_C4", "label": "strip", "type": "function", "loc": [212, 213], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.2919, 0.0027, 1, 0.59, 0.5179, 973, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "strip", "arg_names": ["self", "chars"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def strip(self, chars=None):\n return str.__new__(Utf8, str.strip(self, None if chars is None else Utf8(chars)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L213_C8", "label": "return", "type": "return", "loc": [213, 213], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L212_C4", "vector": [13, 2, 0.2926, 0.0014, 2, 0.17, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, str.strip(self, None if chars is None else Utf8(chars)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L215_C4", "label": "swapcase", "type": "function", "loc": [215, 216], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.296, 0.0027, 1, 0.59, 0.5357, 120, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "swapcase", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def swapcase(self):\n return str.__new__(Utf8, unicode(self, 'utf-8').swapcase().encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L216_C8", "label": "return", "type": "return", "loc": [216, 216], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L215_C4", "vector": [13, 2, 0.2967, 0.0014, 2, 0.96, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, unicode(self, 'utf-8').swapcase().encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L218_C4", "label": "count", "type": "function", "loc": [218, 222], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.3022, 0.0069, 1, 0.59, 0.5536, 778, 0, 4, 1, 0, 0, 0, 5], "semantic": {"name": "count", "arg_names": ["self", "sub", "start", "end"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def count(self, sub, start=0, end=None):\n unistr = unicode(self, 'utf-8')\n return unistr.count(\n unicode(sub, 'utf-8') if isinstance(sub, str) else sub,\n start, len(unistr) if end is None else end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L219_C8", "label": "unistr = unicode()", "type": "assigned_variable", "loc": [219, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L218_C4", "vector": [14, 2, 0.3008, 0.0014, 2, 0.76, 0.0, 215, 3, 2, 0, 0, 733, 10, 1], "semantic": {"name": "unistr", "arg_names": [], "import_names": [], "rhs_call_name": "unicode", "annotation": ""}, "snippet": " unistr = unicode(self, 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L220_C8", "label": "return", "type": "return", "loc": [220, 222], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L218_C4", "vector": [13, 2, 0.3036, 0.0041, 2, 0.76, 1.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unistr.count(\n unicode(sub, 'utf-8') if isinstance(sub, str) else sub,\n start, len(unistr) if end is None else end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L224_C4", "label": "decode", "type": "function", "loc": [224, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.3084, 0.0027, 1, 0.59, 0.5714, 528, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "decode", "arg_names": ["self", "encoding", "errors"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def decode(self, encoding='utf-8', errors='strict'):\n return str.decode(self, encoding, errors)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L225_C8", "label": "return", "type": "return", "loc": [225, 225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L224_C4", "vector": [13, 2, 0.3091, 0.0014, 2, 0.25, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.decode(self, encoding, errors)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L227_C4", "label": "encode", "type": "function", "loc": [227, 228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.3125, 0.0027, 1, 0.59, 0.5893, 623, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "encode", "arg_names": ["self", "encoding", "errors"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def encode(self, encoding, errors='strict'):\n return unicode(self, 'utf-8').encode(encoding, errors)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L228_C8", "label": "return", "type": "return", "loc": [228, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L227_C4", "vector": [13, 2, 0.3132, 0.0014, 2, 0.77, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unicode(self, 'utf-8').encode(encoding, errors)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L230_C4", "label": "expandtabs", "type": "function", "loc": [230, 231], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.3166, 0.0027, 1, 0.59, 0.6071, 645, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "expandtabs", "arg_names": ["self", "tabsize"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def expandtabs(self, tabsize=8):\n return str.__new__(Utf8, unicode(self, 'utf-8').expandtabs(tabsize).encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L231_C8", "label": "return", "type": "return", "loc": [231, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L230_C4", "vector": [13, 2, 0.3173, 0.0014, 2, 0.15, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, unicode(self, 'utf-8').expandtabs(tabsize).encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L233_C4", "label": "find", "type": "function", "loc": [233, 235], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.3214, 0.0041, 1, 0.59, 0.625, 340, 0, 4, 1, 0, 0, 0, 4], "semantic": {"name": "find", "arg_names": ["self", "sub", "start", "end"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def find(self, sub, start=None, end=None):\n return unicode(self, 'utf-8').find(unicode(sub, 'utf-8')\n if isinstance(sub, str) else sub, start, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L234_C8", "label": "return", "type": "return", "loc": [234, 235], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L233_C4", "vector": [13, 2, 0.3221, 0.0027, 2, 0.48, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unicode(self, 'utf-8').find(unicode(sub, 'utf-8')\n if isinstance(sub, str) else sub, start, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L237_C4", "label": "ljust", "type": "function", "loc": [237, 239], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.3269, 0.0041, 1, 0.59, 0.6429, 629, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "ljust", "arg_names": ["self", "width", "fillchar"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def ljust(self, width, fillchar=' '):\n return str.__new__(Utf8, unicode(self, 'utf-8').ljust(width, unicode(fillchar, 'utf-8')\n if isinstance(fillchar, str) else fillchar).encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L238_C8", "label": "return", "type": "return", "loc": [238, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L237_C4", "vector": [13, 2, 0.3276, 0.0027, 2, 0.98, 0.0, 0, 3, 0, 0, 0, 0, 10, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, unicode(self, 'utf-8').ljust(width, unicode(fillchar, 'utf-8')\n if isinstance(fillchar, str) else fillchar).encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L241_C4", "label": "partition", "type": "function", "loc": [241, 245], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.3338, 0.0069, 1, 0.59, 0.6607, 320, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "partition", "arg_names": ["self", "sep"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def partition(self, sep):\n (head, sep, tail) = str.partition(self, Utf8(sep))\n return (str.__new__(Utf8, head),\n str.__new__(Utf8, sep),\n str.__new__(Utf8, tail))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L242_C8", "label": "head, sep, tail = partition()", "type": "assigned_variable", "loc": [242, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L241_C4", "vector": [14, 2, 0.3324, 0.0014, 2, 0.16, 0.0, 377, 3, 2, 0, 0, 320, 10, 2], "semantic": {"name": "head, sep, tail", "arg_names": [], "import_names": [], "rhs_call_name": "partition", "annotation": ""}, "snippet": " (head, sep, tail) = str.partition(self, Utf8(sep))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L243_C8", "label": "return", "type": "return", "loc": [243, 245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L241_C4", "vector": [13, 2, 0.3352, 0.0041, 2, 0.16, 1.0, 0, 0, 0, 0, 0, 0, 8, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (str.__new__(Utf8, head),\n str.__new__(Utf8, sep),\n str.__new__(Utf8, tail))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L247_C4", "label": "replace", "type": "function", "loc": [247, 248], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.34, 0.0027, 1, 0.59, 0.6786, 293, 0, 4, 1, 0, 0, 0, 4], "semantic": {"name": "replace", "arg_names": ["self", "old", "new", "count"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def replace(self, old, new, count=-1):\n return str.__new__(Utf8, str.replace(self, Utf8(old), Utf8(new), count))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L248_C8", "label": "return", "type": "return", "loc": [248, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L247_C4", "vector": [13, 2, 0.3407, 0.0014, 2, 0.42, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, str.replace(self, Utf8(old), Utf8(new), count))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L250_C4", "label": "rfind", "type": "function", "loc": [250, 252], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.3448, 0.0041, 1, 0.59, 0.6964, 634, 0, 4, 1, 0, 0, 0, 4], "semantic": {"name": "rfind", "arg_names": ["self", "sub", "start", "end"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def rfind(self, sub, start=None, end=None):\n return unicode(self, 'utf-8').rfind(unicode(sub, 'utf-8')\n if isinstance(sub, str) else sub, start, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L251_C8", "label": "return", "type": "return", "loc": [251, 252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L250_C4", "vector": [13, 2, 0.3455, 0.0027, 2, 0.66, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unicode(self, 'utf-8').rfind(unicode(sub, 'utf-8')\n if isinstance(sub, str) else sub, start, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L254_C4", "label": "rindex", "type": "function", "loc": [254, 256], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.3503, 0.0041, 1, 0.59, 0.7143, 69, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "rindex", "arg_names": ["self", "string"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def rindex(self, string):\n return unicode(self, 'utf-8').rindex(string if isinstance(string, unicode)\n else unicode(string, 'utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L255_C8", "label": "return", "type": "return", "loc": [255, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L254_C4", "vector": [13, 2, 0.351, 0.0027, 2, 0.75, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unicode(self, 'utf-8').rindex(string if isinstance(string, unicode)\n else unicode(string, 'utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L258_C4", "label": "rjust", "type": "function", "loc": [258, 260], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.3558, 0.0041, 1, 0.59, 0.7321, 301, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "rjust", "arg_names": ["self", "width", "fillchar"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def rjust(self, width, fillchar=' '):\n return str.__new__(Utf8, unicode(self, 'utf-8').rjust(width, unicode(fillchar, 'utf-8')\n if isinstance(fillchar, str) else fillchar).encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L259_C8", "label": "return", "type": "return", "loc": [259, 260], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L258_C4", "vector": [13, 2, 0.3565, 0.0027, 2, 0.4, 0.0, 0, 3, 0, 0, 0, 0, 10, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, unicode(self, 'utf-8').rjust(width, unicode(fillchar, 'utf-8')\n if isinstance(fillchar, str) else fillchar).encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L262_C4", "label": "rpartition", "type": "function", "loc": [262, 266], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.3626, 0.0069, 1, 0.59, 0.75, 572, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "rpartition", "arg_names": ["self", "sep"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def rpartition(self, sep):\n (head, sep, tail) = str.rpartition(self, Utf8(sep))\n return (str.__new__(Utf8, head),\n str.__new__(Utf8, sep),\n str.__new__(Utf8, tail))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L263_C8", "label": "head, sep, tail = rpartition()", "type": "assigned_variable", "loc": [263, 263], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L262_C4", "vector": [14, 2, 0.3613, 0.0014, 2, 0.96, 0.0, 377, 3, 2, 0, 0, 572, 10, 2], "semantic": {"name": "head, sep, tail", "arg_names": [], "import_names": [], "rhs_call_name": "rpartition", "annotation": ""}, "snippet": " (head, sep, tail) = str.rpartition(self, Utf8(sep))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L264_C8", "label": "return", "type": "return", "loc": [264, 266], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L262_C4", "vector": [13, 2, 0.364, 0.0041, 2, 0.96, 1.0, 0, 0, 0, 0, 0, 0, 8, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (str.__new__(Utf8, head),\n str.__new__(Utf8, sep),\n str.__new__(Utf8, tail))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L268_C4", "label": "rsplit", "type": "function", "loc": [268, 270], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.3695, 0.0041, 1, 0.59, 0.7679, 310, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "rsplit", "arg_names": ["self", "sep", "maxsplit"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def rsplit(self, sep=None, maxsplit=-1):\n return [str.__new__(Utf8, part) for part in str.rsplit(self,\n None if sep is None else Utf8(sep), maxsplit)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L269_C8", "label": "return", "type": "return", "loc": [269, 270], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L268_C4", "vector": [13, 2, 0.3702, 0.0027, 2, 0.26, 0.0, 0, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [str.__new__(Utf8, part) for part in str.rsplit(self,\n None if sep is None else Utf8(sep), maxsplit)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L272_C4", "label": "split", "type": "function", "loc": [272, 274], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.375, 0.0041, 1, 0.59, 0.7857, 908, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "split", "arg_names": ["self", "sep", "maxsplit"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def split(self, sep=None, maxsplit=-1):\n return [str.__new__(Utf8, part) for part in str.split(self,\n None if sep is None else Utf8(sep), maxsplit)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L273_C8", "label": "return", "type": "return", "loc": [273, 274], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L272_C4", "vector": [13, 2, 0.3757, 0.0027, 2, 0.58, 0.0, 0, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [str.__new__(Utf8, part) for part in str.split(self,\n None if sep is None else Utf8(sep), maxsplit)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L276_C4", "label": "splitlines", "type": "function", "loc": [276, 277], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.3798, 0.0027, 1, 0.59, 0.8036, 296, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "splitlines", "arg_names": ["self", "keepends"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def splitlines(self, keepends=False):\n return [str.__new__(Utf8, part) for part in str.splitlines(self, keepends)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L277_C8", "label": "return", "type": "return", "loc": [277, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L276_C4", "vector": [13, 2, 0.3805, 0.0014, 2, 0.73, 0.0, 0, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [str.__new__(Utf8, part) for part in str.splitlines(self, keepends)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L279_C4", "label": "startswith", "type": "function", "loc": [279, 286], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.388, 0.011, 1, 0.59, 0.8214, 193, 0, 4, 1, 0, 0, 0, 9], "semantic": {"name": "startswith", "arg_names": ["self", "prefix", "start", "end"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def startswith(self, prefix, start=0, end=None):\n unistr = unicode(self, 'utf-8')\n if isinstance(prefix, tuple):\n prefix = tuple(unicode(\n s, 'utf-8') if isinstance(s, str) else s for s in prefix)\n elif isinstance(prefix, str):\n prefix = unicode(prefix, 'utf-8')\n return unistr.startswith(prefix, start, len(unistr) if end is None else end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L280_C8", "label": "unistr = unicode()", "type": "assigned_variable", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L279_C4", "vector": [14, 2, 0.3846, 0.0014, 2, 0.71, 0.0, 215, 3, 2, 0, 0, 733, 10, 1], "semantic": {"name": "unistr", "arg_names": [], "import_names": [], "rhs_call_name": "unicode", "annotation": ""}, "snippet": " unistr = unicode(self, 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:If_L281_C8", "label": "if", "type": "if", "loc": [281, 285], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L279_C4", "vector": [4, 2, 0.3887, 0.0069, 2, 0.71, 0.5, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(prefix, tuple):\n prefix = tuple(unicode(\n s, 'utf-8') if isinstance(s, str) else s for s in prefix)\n elif isinstance(prefix, str):\n prefix = unicode(prefix, 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L282_C12", "label": "prefix = tuple()", "type": "assigned_variable", "loc": [282, 283], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:If_L281_C8", "vector": [14, 3, 0.388, 0.0027, 3, 0.0, 0.0, 284, 3, 1, 0, 0, 259, 10, 3], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "tuple", "annotation": ""}, "snippet": " prefix = tuple(unicode(\n s, 'utf-8') if isinstance(s, str) else s for s in prefix)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:If_L284_C8", "label": "if", "type": "if", "loc": [284, 285], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:If_L281_C8", "vector": [4, 3, 0.3908, 0.0027, 3, 0.0, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(prefix, str):\n prefix = unicode(prefix, 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L285_C12", "label": "prefix = unicode()", "type": "assigned_variable", "loc": [285, 285], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:If_L284_C8", "vector": [14, 4, 0.3915, 0.0014, 4, 0.06, 0.0, 284, 3, 2, 0, 0, 733, 10, 1], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "unicode", "annotation": ""}, "snippet": " prefix = unicode(prefix, 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L286_C8", "label": "return", "type": "return", "loc": [286, 286], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L279_C4", "vector": [13, 2, 0.3929, 0.0014, 2, 0.71, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unistr.startswith(prefix, start, len(unistr) if end is None else end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L288_C4", "label": "translate", "type": "function", "loc": [288, 292], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.3984, 0.0069, 1, 0.59, 0.8393, 384, 0, 3, 1, 0, 0, 0, 7], "semantic": {"name": "translate", "arg_names": ["self", "table", "deletechars"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def translate(self, table, deletechars=''):\n if isinstance(table, dict):\n return str.__new__(Utf8, unicode(self, 'utf-8').translate(table).encode('utf-8'))\n else:\n return str.__new__(Utf8, str.translate(self, table, deletechars))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:If_L289_C8", "label": "if", "type": "if", "loc": [289, 292], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L288_C4", "vector": [4, 2, 0.399, 0.0055, 2, 0.19, 0.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(table, dict):\n return str.__new__(Utf8, unicode(self, 'utf-8').translate(table).encode('utf-8'))\n else:\n return str.__new__(Utf8, str.translate(self, table, deletechars))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L290_C12", "label": "return", "type": "return", "loc": [290, 290], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:If_L289_C8", "vector": [13, 3, 0.3984, 0.0014, 3, 0.47, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, unicode(self, 'utf-8').translate(table).encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L292_C12", "label": "return", "type": "return", "loc": [292, 292], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:If_L289_C8", "vector": [13, 3, 0.4011, 0.0014, 3, 0.47, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, str.translate(self, table, deletechars))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L294_C4", "label": "endswith", "type": "function", "loc": [294, 301], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.4087, 0.011, 1, 0.59, 0.8571, 487, 0, 4, 1, 0, 0, 0, 9], "semantic": {"name": "endswith", "arg_names": ["self", "prefix", "start", "end"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def endswith(self, prefix, start=0, end=None):\n unistr = unicode(self, 'utf-8')\n if isinstance(prefix, tuple):\n prefix = tuple(unicode(\n s, 'utf-8') if isinstance(s, str) else s for s in prefix)\n elif isinstance(prefix, str):\n prefix = unicode(prefix, 'utf-8')\n return unistr.endswith(prefix, start, len(unistr) if end is None else end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L295_C8", "label": "unistr = unicode()", "type": "assigned_variable", "loc": [295, 295], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L294_C4", "vector": [14, 2, 0.4052, 0.0014, 2, 0.5, 0.0, 215, 3, 2, 0, 0, 733, 10, 1], "semantic": {"name": "unistr", "arg_names": [], "import_names": [], "rhs_call_name": "unicode", "annotation": ""}, "snippet": " unistr = unicode(self, 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:If_L296_C8", "label": "if", "type": "if", "loc": [296, 300], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L294_C4", "vector": [4, 2, 0.4093, 0.0069, 2, 0.5, 0.5, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(prefix, tuple):\n prefix = tuple(unicode(\n s, 'utf-8') if isinstance(s, str) else s for s in prefix)\n elif isinstance(prefix, str):\n prefix = unicode(prefix, 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L297_C12", "label": "prefix = tuple()", "type": "assigned_variable", "loc": [297, 298], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:If_L296_C8", "vector": [14, 3, 0.4087, 0.0027, 3, 0.66, 0.0, 284, 3, 1, 0, 0, 259, 10, 3], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "tuple", "annotation": ""}, "snippet": " prefix = tuple(unicode(\n s, 'utf-8') if isinstance(s, str) else s for s in prefix)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:If_L299_C8", "label": "if", "type": "if", "loc": [299, 300], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:If_L296_C8", "vector": [4, 3, 0.4114, 0.0027, 3, 0.66, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(prefix, str):\n prefix = unicode(prefix, 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L300_C12", "label": "prefix = unicode()", "type": "assigned_variable", "loc": [300, 300], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:If_L299_C8", "vector": [14, 4, 0.4121, 0.0014, 4, 0.87, 0.0, 284, 3, 2, 0, 0, 733, 10, 1], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "unicode", "annotation": ""}, "snippet": " prefix = unicode(prefix, 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L301_C8", "label": "return", "type": "return", "loc": [301, 301], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L294_C4", "vector": [13, 2, 0.4135, 0.0014, 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 unistr.endswith(prefix, start, len(unistr) if end is None else end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:If_L302_C4", "label": "if", "type": "if", "loc": [302, 310], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [4, 1, 0.4203, 0.0124, 1, 0.59, 0.875, 0, 3, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(str, 'format'): # Python 2.5 hasn't got str.format() method\n def format(self, *args, **kwargs):\n args = [unicode(\n s, 'utf-8') if isinstance(s, str) else s for s in args]\n kwargs = dict((unicode(k, 'utf-8') if isinstance(k, str) else k,\n unicode(v, 'utf-8') if isinstance(v, str) else v)\n for k, v in kwargs.iteritems())\n return str.__new__(Utf8, unicode(self, 'utf-8')."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L303_C8", "label": "format", "type": "function", "loc": [303, 310], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:If_L302_C4", "vector": [2, 2, 0.421, 0.011, 2, 0.29, 0.0, 293, 0, 3, 1, 0, 0, 0, 12], "semantic": {"name": "format", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def format(self, *args, **kwargs):\n args = [unicode(\n s, 'utf-8') if isinstance(s, str) else s for s in args]\n kwargs = dict((unicode(k, 'utf-8') if isinstance(k, str) else k,\n unicode(v, 'utf-8') if isinstance(v, str) else v)\n for k, v in kwargs.iteritems())\n return str.__new__(Utf8, unicode(self, 'utf-8').\n format(*args, **kwargs).encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L304_C12", "label": "args =", "type": "assigned_variable", "loc": [304, 305], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L303_C8", "vector": [14, 3, 0.4183, 0.0027, 3, 0.46, 0.0, 805, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = [unicode(\n s, 'utf-8') if isinstance(s, str) else s for s in args]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L306_C12", "label": "kwargs = dict()", "type": "assigned_variable", "loc": [306, 308], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L303_C8", "vector": [14, 3, 0.4217, 0.0041, 3, 0.46, 0.5, 987, 3, 1, 0, 0, 827, 10, 6], "semantic": {"name": "kwargs", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " kwargs = dict((unicode(k, 'utf-8') if isinstance(k, str) else k,\n unicode(v, 'utf-8') if isinstance(v, str) else v)\n for k, v in kwargs.iteritems())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L309_C12", "label": "return", "type": "return", "loc": [309, 310], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L303_C8", "vector": [13, 3, 0.4251, 0.0027, 3, 0.46, 1.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, unicode(self, 'utf-8').\n format(*args, **kwargs).encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L312_C4", "label": "__mod__", "type": "function", "loc": [312, 322], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.4354, 0.0151, 1, 0.59, 0.8929, 476, 0, 2, 1, 0, 0, 0, 17], "semantic": {"name": "__mod__", "arg_names": ["self", "right"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __mod__(self, right):\n if isinstance(right, tuple):\n right = tuple(unicode(v, 'utf-8') if isinstance(v, str) else v\n for v in right)\n elif isinstance(right, dict):\n right = dict((unicode(k, 'utf-8') if isinstance(k, str) else k,\n unicode(v, 'utf-8') if isinstance(v, str) else v)\n for k, v in right.iteritems())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:If_L313_C8", "label": "if", "type": "if", "loc": [313, 321], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L312_C4", "vector": [4, 2, 0.4354, 0.0124, 2, 0.6, 0.0, 0, 3, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(right, tuple):\n right = tuple(unicode(v, 'utf-8') if isinstance(v, str) else v\n for v in right)\n elif isinstance(right, dict):\n right = dict((unicode(k, 'utf-8') if isinstance(k, str) else k,\n unicode(v, 'utf-8') if isinstance(v, str) else v)\n for k, v in right.iteritems())\n elif isinstance(right, str):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L314_C12", "label": "right = tuple()", "type": "assigned_variable", "loc": [314, 315], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:If_L313_C8", "vector": [14, 3, 0.432, 0.0027, 3, 0.89, 0.0, 724, 3, 1, 0, 0, 259, 10, 3], "semantic": {"name": "right", "arg_names": [], "import_names": [], "rhs_call_name": "tuple", "annotation": ""}, "snippet": " right = tuple(unicode(v, 'utf-8') if isinstance(v, str) else v\n for v in right)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:If_L316_C8", "label": "if", "type": "if", "loc": [316, 321], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:If_L313_C8", "vector": [4, 3, 0.4375, 0.0082, 3, 0.89, 1.0, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(right, dict):\n right = dict((unicode(k, 'utf-8') if isinstance(k, str) else k,\n unicode(v, 'utf-8') if isinstance(v, str) else v)\n for k, v in right.iteritems())\n elif isinstance(right, str):\n right = unicode(right, 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L317_C12", "label": "right = dict()", "type": "assigned_variable", "loc": [317, 319], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:If_L316_C8", "vector": [14, 4, 0.4368, 0.0041, 4, 0.1, 0.0, 724, 3, 1, 0, 0, 827, 10, 6], "semantic": {"name": "right", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " right = dict((unicode(k, 'utf-8') if isinstance(k, str) else k,\n unicode(v, 'utf-8') if isinstance(v, str) else v)\n for k, v in right.iteritems())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:If_L320_C8", "label": "if", "type": "if", "loc": [320, 321], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:If_L316_C8", "vector": [4, 4, 0.4402, 0.0027, 4, 0.1, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(right, str):\n right = unicode(right, 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L321_C12", "label": "right = unicode()", "type": "assigned_variable", "loc": [321, 321], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:If_L320_C8", "vector": [14, 5, 0.4409, 0.0014, 5, 0.69, 0.0, 724, 3, 2, 0, 0, 733, 10, 1], "semantic": {"name": "right", "arg_names": [], "import_names": [], "rhs_call_name": "unicode", "annotation": ""}, "snippet": " right = unicode(right, 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L322_C8", "label": "return", "type": "return", "loc": [322, 322], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L312_C4", "vector": [13, 2, 0.4423, 0.0014, 2, 0.6, 1.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str.__new__(Utf8, unicode(self, 'utf-8').__mod__(right).encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L324_C4", "label": "__ge__", "type": "function", "loc": [324, 325], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.4457, 0.0027, 1, 0.59, 0.9107, 518, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__ge__", "arg_names": ["self", "string"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __ge__(self, string):\n return sort_key(self) >= sort_key(string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L325_C8", "label": "return", "type": "return", "loc": [325, 325], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L324_C4", "vector": [13, 2, 0.4464, 0.0014, 2, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sort_key(self) >= sort_key(string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L327_C4", "label": "__gt__", "type": "function", "loc": [327, 328], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.4499, 0.0027, 1, 0.59, 0.9286, 974, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__gt__", "arg_names": ["self", "string"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __gt__(self, string):\n return sort_key(self) > sort_key(string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L328_C8", "label": "return", "type": "return", "loc": [328, 328], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L327_C4", "vector": [13, 2, 0.4505, 0.0014, 2, 0.91, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sort_key(self) > sort_key(string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L330_C4", "label": "__le__", "type": "function", "loc": [330, 331], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.454, 0.0027, 1, 0.59, 0.9464, 308, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__le__", "arg_names": ["self", "string"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __le__(self, string):\n return sort_key(self) <= sort_key(string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L331_C8", "label": "return", "type": "return", "loc": [331, 331], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L330_C4", "vector": [13, 2, 0.4547, 0.0014, 2, 0.28, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sort_key(self) <= sort_key(string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L333_C4", "label": "__lt__", "type": "function", "loc": [333, 334], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.4581, 0.0027, 1, 0.59, 0.9643, 217, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__lt__", "arg_names": ["self", "string"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __lt__(self, string):\n return sort_key(self) < sort_key(string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L334_C8", "label": "return", "type": "return", "loc": [334, 334], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L333_C4", "vector": [13, 2, 0.4588, 0.0014, 2, 0.46, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sort_key(self) < sort_key(string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L337_C4", "label": "doctests", "type": "function", "loc": [337, 726], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [2, 1, 0.7301, 0.5357, 1, 0.59, 0.9821, 425, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "doctests", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def doctests():\n u\"\"\"\n doctests:\n >>> test_unicode=u'\u041f\u0420\u043e\u0431\u0430 \u0404 PRobe'\n >>> test_unicode_word=u'\u041f\u0420\u043e\u0431\u0430'\n >>> test_number_str='12345'\n >>> test_unicode\n u'\\\\u041f\\\\u0420\\\\u043e\\\\u0431\\\\u0430 \\\\u0404 PRobe'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L338_C8", "label": "expression", "type": "expression", "loc": [338, 719], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L337_C4", "vector": [8, 2, 0.726, 0.5247, 2, 0.16, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " u\"\"\"\n doctests:\n >>> test_unicode=u'\u041f\u0420\u043e\u0431\u0430 \u0404 PRobe'\n >>> test_unicode_word=u'\u041f\u0420\u043e\u0431\u0430'\n >>> test_number_str='12345'\n >>> test_unicode\n u'\\\\u041f\\\\u0420\\\\u043e\\\\u0431\\\\u0430 \\\\u0404 PRobe'\n >>> print test_unicode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Import_L720_C8", "label": "sys import sys", "type": "import", "loc": [720, 720], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L337_C4", "vector": [1, 2, 0.989, 0.0014, 2, 0.16, 0.1429, 509, 0, 1, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys"], "rhs_call_name": "", "annotation": ""}, "snippet": " import sys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L721_C8", "label": "reload()", "type": "expression", "loc": [721, 721], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L337_C4", "vector": [8, 2, 0.9904, 0.0014, 2, 0.16, 0.2857, 959, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "reload", "arg_names": [], "import_names": [], "rhs_call_name": "reload", "annotation": ""}, "snippet": " reload(sys)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L722_C8", "label": "setdefaultencoding()", "type": "expression", "loc": [722, 722], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L337_C4", "vector": [8, 2, 0.9918, 0.0014, 2, 0.16, 0.4286, 600, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setdefaultencoding", "arg_names": [], "import_names": [], "rhs_call_name": "setdefaultencoding", "annotation": ""}, "snippet": " sys.setdefaultencoding(\"UTF-8\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Import_L723_C8", "label": "doctest import doctest", "type": "import", "loc": [723, 723], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L337_C4", "vector": [1, 2, 0.9931, 0.0014, 2, 0.16, 0.5714, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "doctest", "arg_names": [], "import_names": ["doctest"], "rhs_call_name": "", "annotation": ""}, "snippet": " import doctest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L724_C8", "label": "print()", "type": "expression", "loc": [724, 724], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L337_C4", "vector": [8, 2, 0.9945, 0.0014, 2, 0.16, 0.7143, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"DOCTESTS STARTED...\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L725_C8", "label": "testmod()", "type": "expression", "loc": [725, 725], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L337_C4", "vector": [8, 2, 0.9959, 0.0014, 2, 0.16, 0.8571, 116, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "testmod", "arg_names": [], "import_names": [], "rhs_call_name": "testmod", "annotation": ""}, "snippet": " doctest.testmod()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L726_C8", "label": "print()", "type": "expression", "loc": [726, 726], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L337_C4", "vector": [8, 2, 0.9973, 0.0014, 2, 0.16, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"DOCTESTS FINISHED\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L728_C4", "label": "doctests()", "type": "expression", "loc": [728, 728], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "vector": [8, 1, 1.0, 0.0014, 1, 0.59, 1.0, 425, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "doctests", "arg_names": [], "import_names": [], "rhs_call_name": "doctests", "annotation": ""}, "snippet": " doctests()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L3_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Try_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:Try_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:ImportFrom_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:Try_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:Try_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:Try_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:If_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:If_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:If_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:If_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:If_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L90_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_453:If_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:If_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L92_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:If_L91_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L94_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:If_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L125_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L127_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L142_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L155_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L155_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L158_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L158_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L167_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L170_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L171_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L173_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L176_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L179_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L185_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L186_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L191_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L191_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L194_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L194_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L195_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L197_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L200_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L200_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L201_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L206_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L207_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L209_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L209_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L210_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L212_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L213_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L215_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L215_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L216_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L218_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L218_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L219_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L218_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L220_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L224_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L224_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L225_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L230_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L230_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L231_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L233_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L233_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L234_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L237_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L237_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L238_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L241_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L241_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L242_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L241_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L243_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L247_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L247_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L248_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L250_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L250_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L254_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L254_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L255_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L258_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L258_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L259_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L262_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L262_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L263_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L262_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L264_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L268_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L268_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L269_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L272_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L272_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L273_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L276_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L276_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L279_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L280_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:If_L281_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:If_L281_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L282_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:If_L281_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_453:If_L284_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:If_L284_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L285_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L286_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L288_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L288_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:If_L289_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:If_L289_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L290_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:If_L289_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L292_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L294_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L294_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L295_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L294_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:If_L296_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:If_L296_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L297_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:If_L296_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_453:If_L299_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:If_L299_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L300_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L294_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L301_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:If_L302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:If_L302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L303_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L303_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L304_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L303_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L306_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L303_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L309_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L312_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L312_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:If_L313_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:If_L313_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L314_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:If_L313_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_453:If_L316_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:If_L316_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L317_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:If_L316_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_453:If_L320_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:If_L320_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Assign_L321_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L312_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L322_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L324_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L324_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L325_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L327_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L327_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L328_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L330_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L330_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L331_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L333_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L333_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Return_L334_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L337_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L337_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L338_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L337_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Import_L720_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L337_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L721_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L337_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L722_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L337_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Import_L723_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L337_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L724_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L337_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L725_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:FunctionDef_L337_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L726_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_453:ClassDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_453:Expr_L728_C4"}] |
# this file exists for backward compatibility
__all__ = ['DAL', 'Field', 'DRIVERS']
from dal import DAL, Field, Table, Query, Set, Expression, Row, Rows, DRIVERS, BaseAdapter, SQLField, SQLTable, SQLXorable, SQLQuery, SQLSet, SQLRows, SQLStorage, SQLDB, GQLDB, SQLALL, SQLCustomType
| ajibawa-2023/Python-Code-Large/train/row_458 | 2 | 5 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_458:Assign_L3_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.6, 0.2, 0, 0.66, 0.0, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = ['DAL', 'Field', 'DRIVERS']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_458:ImportFrom_L5_C0", "label": "from dal import DAL, Field, Table\u2026", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 1.0, 0.2, 0, 0.66, 1.0, 4, 0, 21, 0, 0, 4, 0, 0], "semantic": {"name": "dal", "arg_names": [], "import_names": ["DAL", "Field", "Table", "Query", "Set", "Expression", "Row", "Rows", "DRIVERS", "BaseAdapter", "SQLField", "SQLTable", "SQLXorable", "SQLQuery", "SQLSet", "SQLRows", "SQLStorage", "SQLDB", "GQLDB", "SQLALL", "SQLCustomType"], "rhs_call_name": "", "annotation": ""}, "snippet": "from dal import DAL, Field, Table, Query, Set, Expression, Row, Rows, DRIVERS, BaseAdapter, SQLField, SQLTable, SQLXorable, SQLQuery, SQLSet, SQLRows, SQLStorage, SQLDB, GQLDB, SQLALL, SQLCustomType"}] | [] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
::
# from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496942
# Title: Cross-site scripting (XSS) defense
# Submitter: Josh Goldfoot (other recipes)
# Last Updated: 2006/08/05
# Version no: 1.0
"""
from htmllib import HTMLParser
from cgi import escape
from urlparse import urlparse
from formatter import AbstractFormatter
from htmlentitydefs import entitydefs
from xml.sax.saxutils import quoteattr
__all__ = ['sanitize']
def xssescape(text):
"""Gets rid of < and > and & and, for good measure, :"""
return escape(text, quote=True).replace(':', ':')
class XssCleaner(HTMLParser):
def __init__(
self,
permitted_tags=[
'a',
'b',
'blockquote',
'br/',
'i',
'li',
'ol',
'ul',
'p',
'cite',
'code',
'pre',
'img/',
],
allowed_attributes={'a': ['href', 'title'], 'img': ['src', 'alt'
], 'blockquote': ['type']},
fmt=AbstractFormatter,
strip_disallowed=False
):
HTMLParser.__init__(self, fmt)
self.result = ''
self.open_tags = []
self.permitted_tags = [i for i in permitted_tags if i[-1] != '/']
self.requires_no_close = [i[:-1] for i in permitted_tags
if i[-1] == '/']
self.permitted_tags += self.requires_no_close
self.allowed_attributes = allowed_attributes
# The only schemes allowed in URLs (for href and src attributes).
# Adding "javascript" or "vbscript" to this list would not be smart.
self.allowed_schemes = ['http', 'https', 'ftp', 'mailto']
#to strip or escape disallowed tags?
self.strip_disallowed = strip_disallowed
self.in_disallowed = False
def handle_data(self, data):
if data and not self.in_disallowed:
self.result += xssescape(data)
def handle_charref(self, ref):
if self.in_disallowed:
return
elif len(ref) < 7 and ref.isdigit():
self.result += '&#%s;' % ref
else:
self.result += xssescape('&#%s' % ref)
def handle_entityref(self, ref):
if self.in_disallowed:
return
elif ref in entitydefs:
self.result += '&%s;' % ref
else:
self.result += xssescape('&%s' % ref)
def handle_comment(self, comment):
if self.in_disallowed:
return
elif comment:
self.result += xssescape('<!--%s-->' % comment)
def handle_starttag(
self,
tag,
method,
attrs,
):
if tag not in self.permitted_tags:
if self.strip_disallowed:
self.in_disallowed = True
else:
self.result += xssescape('<%s>' % tag)
else:
bt = '<' + tag
if tag in self.allowed_attributes:
attrs = dict(attrs)
self.allowed_attributes_here = [x for x in
self.allowed_attributes[tag] if x in attrs
and len(attrs[x]) > 0]
for attribute in self.allowed_attributes_here:
if attribute in ['href', 'src', 'background']:
if self.url_is_acceptable(attrs[attribute]):
bt += ' %s="%s"' % (attribute,
attrs[attribute])
else:
bt += ' %s=%s' % (xssescape(attribute),
quoteattr(attrs[attribute]))
if bt == '<a' or bt == '<img':
return
if tag in self.requires_no_close:
bt += ' /'
bt += '>'
self.result += bt
self.open_tags.insert(0, tag)
def handle_endtag(self, tag, attrs):
bracketed = '</%s>' % tag
if tag not in self.permitted_tags:
if self.strip_disallowed:
self.in_disallowed = False
else:
self.result += xssescape(bracketed)
elif tag in self.open_tags:
self.result += bracketed
self.open_tags.remove(tag)
def unknown_starttag(self, tag, attributes):
self.handle_starttag(tag, None, attributes)
def unknown_endtag(self, tag):
self.handle_endtag(tag, None)
def url_is_acceptable(self, url):
"""
Accepts relative, absolute, and mailto urls
"""
parsed = urlparse(url)
return (parsed[0] in self.allowed_schemes and '.' in parsed[1]) \
or (parsed[0] in self.allowed_schemes and '@' in parsed[2]) \
or (parsed[0] == '' and parsed[2].startswith('/'))
def strip(self, rawstring, escape=True):
"""
Returns the argument stripped of potentially harmful
HTML or Javascript code
@type escape: boolean
@param escape: If True (default) it escapes the potentially harmful
content, otherwise remove it
"""
if not isinstance(rawstring, str):
return str(rawstring)
for tag in self.requires_no_close:
rawstring = rawstring.replace("<%s/>" % tag, "<%s />" % tag)
if not escape:
self.strip_disallowed = True
self.result = ''
self.feed(rawstring)
for endtag in self.open_tags:
if endtag not in self.requires_no_close:
self.result += '</%s>' % endtag
return self.result
def xtags(self):
"""
Returns a printable string informing the user which tags are allowed
"""
tg = ''
for x in sorted(self.permitted_tags):
tg += '<' + x
if x in self.allowed_attributes:
for y in self.allowed_attributes[x]:
tg += ' %s=""' % y
tg += '> '
return xssescape(tg.strip())
def sanitize(text, permitted_tags=[
'a',
'b',
'blockquote',
'br/',
'i',
'li',
'ol',
'ul',
'p',
'cite',
'code',
'pre',
'img/',
'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
'table', 'tbody', 'thead', 'tfoot', 'tr', 'td', 'div',
'strong', 'span',
],
allowed_attributes={
'a': ['href', 'title'],
'img': ['src', 'alt'],
'blockquote': ['type'],
'td': ['colspan'],
},
escape=True):
if not isinstance(text, basestring):
return str(text)
return XssCleaner(permitted_tags=permitted_tags,
allowed_attributes=allowed_attributes).strip(text, escape)
| ajibawa-2023/Python-Code-Large/train/row_459 | 90 | 228 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_459:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 13], "level": 0, "parent": null, "vector": [8, 0, 0.0373, 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": "\"\"\"\n::\n\n # from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496942\n # Title: Cross-site scripting (XSS) defense\n # Submitter: Josh Goldfoot (other recipes)\n # Last Updated: 2006/08/05\n # Version no: 1.0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:ImportFrom_L16_C0", "label": "from htmllib import HTMLParser", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0702, 0.0044, 0, 0.66, 0.1, 193, 0, 1, 0, 0, 193, 0, 0], "semantic": {"name": "htmllib", "arg_names": [], "import_names": ["HTMLParser"], "rhs_call_name": "", "annotation": ""}, "snippet": "from htmllib import HTMLParser"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:ImportFrom_L17_C0", "label": "from cgi import escape", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0746, 0.0044, 0, 0.66, 0.2, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["escape"], "rhs_call_name": "", "annotation": ""}, "snippet": "from cgi import escape"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:ImportFrom_L18_C0", "label": "from urlparse import urlparse", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0789, 0.0044, 0, 0.66, 0.3, 857, 0, 1, 0, 0, 857, 0, 0], "semantic": {"name": "urlparse", "arg_names": [], "import_names": ["urlparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "from urlparse import urlparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:ImportFrom_L19_C0", "label": "from formatter import AbstractFormatter", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0044, 0, 0.66, 0.4, 791, 0, 1, 0, 0, 791, 0, 0], "semantic": {"name": "formatter", "arg_names": [], "import_names": ["AbstractFormatter"], "rhs_call_name": "", "annotation": ""}, "snippet": "from formatter import AbstractFormatter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:ImportFrom_L20_C0", "label": "from htmlentitydefs import entitydefs", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.0877, 0.0044, 0, 0.66, 0.5, 744, 0, 1, 0, 0, 744, 0, 0], "semantic": {"name": "htmlentitydefs", "arg_names": [], "import_names": ["entitydefs"], "rhs_call_name": "", "annotation": ""}, "snippet": "from htmlentitydefs import entitydefs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:ImportFrom_L21_C0", "label": "from xml.sax.saxutils import quoteattr", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.0921, 0.0044, 0, 0.66, 0.6, 759, 0, 1, 0, 0, 759, 0, 0], "semantic": {"name": "xml.sax.saxutils", "arg_names": [], "import_names": ["quoteattr"], "rhs_call_name": "", "annotation": ""}, "snippet": "from xml.sax.saxutils import quoteattr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L23_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [23, 23], "level": 0, "parent": null, "vector": [14, 0, 0.1009, 0.0044, 0, 0.66, 0.7, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = ['sanitize']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L26_C0", "label": "xssescape", "type": "function", "loc": [26, 29], "level": 0, "parent": null, "vector": [2, 0, 0.1206, 0.0175, 0, 0.66, 0.8, 291, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "xssescape", "arg_names": ["text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def xssescape(text):\n \"\"\"Gets rid of < and > and & and, for good measure, :\"\"\"\n\n return escape(text, quote=True).replace(':', ':')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Expr_L27_C4", "label": "expression", "type": "expression", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L26_C0", "vector": [8, 1, 0.1184, 0.0044, 1, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Gets rid of < and > and & and, for good measure, :\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Return_L29_C4", "label": "return", "type": "return", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L26_C0", "vector": [13, 1, 0.1272, 0.0044, 1, 0.56, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return escape(text, quote=True).replace(':', ':')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "label": "XssCleaner", "type": "class", "loc": [32, 197], "level": 0, "parent": null, "vector": [3, 0, 0.5022, 0.7281, 0, 0.66, 0.9, 596, 0, 12, 0, 0, 217, 0, 27], "semantic": {"name": "XssCleaner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class XssCleaner(HTMLParser):\n\n def __init__(\n self,\n permitted_tags=[\n 'a',\n 'b',\n 'blockquote',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L34_C4", "label": "__init__", "type": "function", "loc": [34, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "vector": [2, 1, 0.2346, 0.1754, 1, 0.04, 0.0, 555, 0, 5, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "permitted_tags", "allowed_attributes", "fmt", "strip_disallowed"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(\n self,\n permitted_tags=[\n 'a',\n 'b',\n 'blockquote',\n 'br/',\n 'i',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Expr_L57_C8", "label": "__init__()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L34_C4", "vector": [8, 2, 0.25, 0.0044, 2, 0.94, 0.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " HTMLParser.__init__(self, fmt)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L58_C8", "label": "self.result =", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L34_C4", "vector": [14, 2, 0.2544, 0.0044, 2, 0.94, 0.125, 341, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.result = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L59_C8", "label": "self.open_tags =", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L34_C4", "vector": [14, 2, 0.2588, 0.0044, 2, 0.94, 0.25, 273, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.open_tags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.open_tags = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L60_C8", "label": "self.permitted_tags =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L34_C4", "vector": [14, 2, 0.2632, 0.0044, 2, 0.94, 0.375, 918, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.permitted_tags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.permitted_tags = [i for i in permitted_tags if i[-1] != '/']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L61_C8", "label": "self.requires_no_close =", "type": "assigned_variable", "loc": [61, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L34_C4", "vector": [14, 2, 0.2697, 0.0088, 2, 0.94, 0.5, 256, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.requires_no_close", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.requires_no_close = [i[:-1] for i in permitted_tags\n if i[-1] == '/']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L64_C8", "label": "self.allowed_attributes =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L34_C4", "vector": [14, 2, 0.2807, 0.0044, 2, 0.94, 0.625, 704, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.allowed_attributes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.allowed_attributes = allowed_attributes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L69_C8", "label": "self.allowed_schemes =", "type": "assigned_variable", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L34_C4", "vector": [14, 2, 0.3026, 0.0044, 2, 0.94, 0.75, 266, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.allowed_schemes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.allowed_schemes = ['http', 'https', 'ftp', 'mailto']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L72_C8", "label": "self.strip_disallowed =", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L34_C4", "vector": [14, 2, 0.3158, 0.0044, 2, 0.94, 0.875, 188, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.strip_disallowed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.strip_disallowed = strip_disallowed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L73_C8", "label": "self.in_disallowed =", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L34_C4", "vector": [14, 2, 0.3202, 0.0044, 2, 0.94, 1.0, 328, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.in_disallowed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.in_disallowed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L75_C4", "label": "handle_data", "type": "function", "loc": [75, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "vector": [2, 1, 0.3333, 0.0132, 1, 0.04, 0.0909, 645, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "handle_data", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_data(self, data):\n if data and not self.in_disallowed:\n self.result += xssescape(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:If_L76_C8", "label": "if", "type": "if", "loc": [76, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L75_C4", "vector": [4, 2, 0.3355, 0.0088, 2, 0.77, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if data and not self.in_disallowed:\n self.result += xssescape(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L79_C4", "label": "handle_charref", "type": "function", "loc": [79, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "vector": [2, 1, 0.3596, 0.0307, 1, 0.04, 0.1818, 26, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "handle_charref", "arg_names": ["self", "ref"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_charref(self, ref):\n if self.in_disallowed:\n return\n elif len(ref) < 7 and ref.isdigit():\n self.result += '&#%s;' % ref\n else:\n self.result += xssescape('&#%s' % ref)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:If_L80_C8", "label": "if", "type": "if", "loc": [80, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L79_C4", "vector": [4, 2, 0.3618, 0.0263, 2, 0.9, 0.0, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.in_disallowed:\n return\n elif len(ref) < 7 and ref.isdigit():\n self.result += '&#%s;' % ref\n else:\n self.result += xssescape('&#%s' % ref)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Return_L81_C12", "label": "return", "type": "return", "loc": [81, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L80_C8", "vector": [13, 3, 0.3553, 0.0044, 3, 0.52, 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_459:If_L82_C8", "label": "if", "type": "if", "loc": [82, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L80_C8", "vector": [4, 3, 0.3662, 0.0175, 3, 0.52, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif len(ref) < 7 and ref.isdigit():\n self.result += '&#%s;' % ref\n else:\n self.result += xssescape('&#%s' % ref)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L87_C4", "label": "handle_entityref", "type": "function", "loc": [87, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "vector": [2, 1, 0.3947, 0.0307, 1, 0.04, 0.2727, 733, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "handle_entityref", "arg_names": ["self", "ref"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_entityref(self, ref):\n if self.in_disallowed:\n return\n elif ref in entitydefs:\n self.result += '&%s;' % ref\n else:\n self.result += xssescape('&%s' % ref)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:If_L88_C8", "label": "if", "type": "if", "loc": [88, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L87_C4", "vector": [4, 2, 0.3969, 0.0263, 2, 0.42, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.in_disallowed:\n return\n elif ref in entitydefs:\n self.result += '&%s;' % ref\n else:\n self.result += xssescape('&%s' % ref)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Return_L89_C12", "label": "return", "type": "return", "loc": [89, 89], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L88_C8", "vector": [13, 3, 0.3904, 0.0044, 3, 0.36, 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_459:If_L90_C8", "label": "if", "type": "if", "loc": [90, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L88_C8", "vector": [4, 3, 0.4013, 0.0175, 3, 0.36, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif ref in entitydefs:\n self.result += '&%s;' % ref\n else:\n self.result += xssescape('&%s' % ref)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L95_C4", "label": "handle_comment", "type": "function", "loc": [95, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "vector": [2, 1, 0.4254, 0.0219, 1, 0.04, 0.3636, 933, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "handle_comment", "arg_names": ["self", "comment"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_comment(self, comment):\n if self.in_disallowed:\n return\n elif comment:\n self.result += xssescape('<!--%s-->' % comment)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:If_L96_C8", "label": "if", "type": "if", "loc": [96, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L95_C4", "vector": [4, 2, 0.4276, 0.0175, 2, 0.69, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.in_disallowed:\n return\n elif comment:\n self.result += xssescape('<!--%s-->' % comment)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Return_L97_C12", "label": "return", "type": "return", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L96_C8", "vector": [13, 3, 0.4254, 0.0044, 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_459:If_L98_C8", "label": "if", "type": "if", "loc": [98, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L96_C8", "vector": [4, 3, 0.432, 0.0088, 3, 0.22, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif comment:\n self.result += xssescape('<!--%s-->' % comment)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L101_C4", "label": "handle_starttag", "type": "function", "loc": [101, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "vector": [2, 1, 0.5132, 0.1447, 1, 0.04, 0.4545, 761, 0, 4, 0, 0, 0, 0, 7], "semantic": {"name": "handle_starttag", "arg_names": ["self", "tag", "method", "attrs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_starttag(\n self,\n tag,\n method,\n attrs,\n ):\n if tag not in self.permitted_tags:\n if self.strip_disallowed:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:If_L107_C8", "label": "if", "type": "if", "loc": [107, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L101_C4", "vector": [4, 2, 0.5263, 0.1184, 2, 0.62, 0.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag not in self.permitted_tags:\n if self.strip_disallowed:\n self.in_disallowed = True\n else:\n self.result += xssescape('<%s>' % tag)\n else:\n bt = '<' + tag\n if tag in self.allowed_attributes:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:If_L108_C12", "label": "if", "type": "if", "loc": [108, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L107_C8", "vector": [4, 3, 0.4803, 0.0175, 3, 0.89, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.strip_disallowed:\n self.in_disallowed = True\n else:\n self.result += xssescape('<%s>' % tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L109_C16", "label": "self.in_disallowed =", "type": "assigned_variable", "loc": [109, 109], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L108_C12", "vector": [14, 4, 0.4781, 0.0044, 4, 0.47, 0.0, 328, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.in_disallowed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.in_disallowed = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L113_C12", "label": "bt =", "type": "assigned_variable", "loc": [113, 113], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L107_C8", "vector": [14, 3, 0.4956, 0.0044, 3, 0.89, 0.2, 250, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "bt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bt = '<' + tag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:If_L114_C12", "label": "if", "type": "if", "loc": [114, 126], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L107_C8", "vector": [4, 3, 0.5263, 0.057, 3, 0.89, 0.4, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag in self.allowed_attributes:\n attrs = dict(attrs)\n self.allowed_attributes_here = [x for x in\n self.allowed_attributes[tag] if x in attrs\n and len(attrs[x]) > 0]\n for attribute in self.allowed_attributes_here:\n if attribute in ['href', 'src', 'background']:\n if self.url_is_acceptable(attrs[attribute]):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L115_C16", "label": "attrs = dict()", "type": "assigned_variable", "loc": [115, 115], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L114_C12", "vector": [14, 4, 0.5044, 0.0044, 4, 0.47, 0.0, 251, 3, 1, 0, 0, 827, 10, 1], "semantic": {"name": "attrs", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " attrs = dict(attrs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L116_C16", "label": "self.allowed_attributes_here =", "type": "assigned_variable", "loc": [116, 118], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L114_C12", "vector": [14, 4, 0.5132, 0.0132, 4, 0.47, 0.5, 947, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.allowed_attributes_here", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.allowed_attributes_here = [x for x in\n self.allowed_attributes[tag] if x in attrs\n and len(attrs[x]) > 0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:For_L119_C16", "label": "for attribute", "type": "for", "loc": [119, 126], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L114_C12", "vector": [6, 4, 0.5373, 0.0351, 4, 0.47, 1.0, 355, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "attribute", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for attribute in self.allowed_attributes_here:\n if attribute in ['href', 'src', 'background']:\n if self.url_is_acceptable(attrs[attribute]):\n bt += ' %s=\"%s\"' % (attribute,\n attrs[attribute])\n else:\n bt += ' %s=%s' % (xssescape(attribute),\n quoteattr(attrs[attribute]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:If_L120_C20", "label": "if", "type": "if", "loc": [120, 126], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:For_L119_C16", "vector": [4, 5, 0.5395, 0.0307, 5, 0.57, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if attribute in ['href', 'src', 'background']:\n if self.url_is_acceptable(attrs[attribute]):\n bt += ' %s=\"%s\"' % (attribute,\n attrs[attribute])\n else:\n bt += ' %s=%s' % (xssescape(attribute),\n quoteattr(attrs[attribute]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:If_L121_C24", "label": "if", "type": "if", "loc": [121, 123], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L120_C20", "vector": [4, 6, 0.5351, 0.0132, 6, 0.49, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.url_is_acceptable(attrs[attribute]):\n bt += ' %s=\"%s\"' % (attribute,\n attrs[attribute])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:If_L127_C12", "label": "if", "type": "if", "loc": [127, 128], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L107_C8", "vector": [4, 3, 0.5592, 0.0088, 3, 0.89, 0.6, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if bt == '<a' or bt == '<img':\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Return_L128_C16", "label": "return", "type": "return", "loc": [128, 128], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L127_C12", "vector": [13, 4, 0.5614, 0.0044, 4, 0.61, 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_459:If_L129_C12", "label": "if", "type": "if", "loc": [129, 130], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L107_C8", "vector": [4, 3, 0.568, 0.0088, 3, 0.89, 0.8, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag in self.requires_no_close:\n bt += ' /'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Expr_L133_C12", "label": "insert()", "type": "expression", "loc": [133, 133], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L107_C8", "vector": [8, 3, 0.5833, 0.0044, 3, 0.89, 1.0, 368, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " self.open_tags.insert(0, tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L135_C4", "label": "handle_endtag", "type": "function", "loc": [135, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "vector": [2, 1, 0.6118, 0.0439, 1, 0.04, 0.5455, 63, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "handle_endtag", "arg_names": ["self", "tag", "attrs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_endtag(self, tag, attrs):\n bracketed = '</%s>' % tag\n if tag not in self.permitted_tags:\n if self.strip_disallowed:\n self.in_disallowed = False\n else:\n self.result += xssescape(bracketed)\n elif tag in self.open_tags:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L136_C8", "label": "bracketed =", "type": "assigned_variable", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L135_C4", "vector": [14, 2, 0.5965, 0.0044, 2, 0.26, 0.0, 704, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "bracketed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bracketed = '</%s>' % tag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:If_L137_C8", "label": "if", "type": "if", "loc": [137, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L135_C4", "vector": [4, 2, 0.6162, 0.0351, 2, 0.26, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag not in self.permitted_tags:\n if self.strip_disallowed:\n self.in_disallowed = False\n else:\n self.result += xssescape(bracketed)\n elif tag in self.open_tags:\n self.result += bracketed\n self.open_tags.remove(tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:If_L138_C12", "label": "if", "type": "if", "loc": [138, 141], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L137_C8", "vector": [4, 3, 0.6118, 0.0175, 3, 0.79, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.strip_disallowed:\n self.in_disallowed = False\n else:\n self.result += xssescape(bracketed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L139_C16", "label": "self.in_disallowed =", "type": "assigned_variable", "loc": [139, 139], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L138_C12", "vector": [14, 4, 0.6096, 0.0044, 4, 0.58, 0.0, 328, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.in_disallowed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.in_disallowed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:If_L142_C8", "label": "if", "type": "if", "loc": [142, 144], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L137_C8", "vector": [4, 3, 0.6272, 0.0132, 3, 0.79, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif tag in self.open_tags:\n self.result += bracketed\n self.open_tags.remove(tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Expr_L144_C12", "label": "remove()", "type": "expression", "loc": [144, 144], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L142_C8", "vector": [8, 4, 0.6316, 0.0044, 4, 0.37, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " self.open_tags.remove(tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L146_C4", "label": "unknown_starttag", "type": "function", "loc": [146, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "vector": [2, 1, 0.6425, 0.0088, 1, 0.04, 0.6364, 568, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "unknown_starttag", "arg_names": ["self", "tag", "attributes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def unknown_starttag(self, tag, attributes):\n self.handle_starttag(tag, None, attributes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Expr_L147_C8", "label": "handle_starttag()", "type": "expression", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L146_C4", "vector": [8, 2, 0.6447, 0.0044, 2, 0.25, 0.0, 761, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "handle_starttag", "arg_names": [], "import_names": [], "rhs_call_name": "handle_starttag", "annotation": ""}, "snippet": " self.handle_starttag(tag, None, attributes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L149_C4", "label": "unknown_endtag", "type": "function", "loc": [149, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "vector": [2, 1, 0.6557, 0.0088, 1, 0.04, 0.7273, 199, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "unknown_endtag", "arg_names": ["self", "tag"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def unknown_endtag(self, tag):\n self.handle_endtag(tag, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Expr_L150_C8", "label": "handle_endtag()", "type": "expression", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L149_C4", "vector": [8, 2, 0.6579, 0.0044, 2, 0.24, 0.0, 63, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "handle_endtag", "arg_names": [], "import_names": [], "rhs_call_name": "handle_endtag", "annotation": ""}, "snippet": " self.handle_endtag(tag, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L152_C4", "label": "url_is_acceptable", "type": "function", "loc": [152, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "vector": [2, 1, 0.6842, 0.0395, 1, 0.04, 0.8182, 724, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "url_is_acceptable", "arg_names": ["self", "url"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def url_is_acceptable(self, url):\n \"\"\"\n Accepts relative, absolute, and mailto urls\n \"\"\"\n\n parsed = urlparse(url)\n return (parsed[0] in self.allowed_schemes and '.' in parsed[1]) \\\n or (parsed[0] in self.allowed_schemes and '@' in parsed[2]) \\"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Expr_L153_C8", "label": "expression", "type": "expression", "loc": [153, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L152_C4", "vector": [8, 2, 0.6754, 0.0132, 2, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Accepts relative, absolute, and mailto urls\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L157_C8", "label": "parsed = urlparse()", "type": "assigned_variable", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L152_C4", "vector": [14, 2, 0.6886, 0.0044, 2, 0.07, 0.5, 313, 3, 1, 0, 0, 857, 10, 1], "semantic": {"name": "parsed", "arg_names": [], "import_names": [], "rhs_call_name": "urlparse", "annotation": ""}, "snippet": " parsed = urlparse(url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Return_L158_C8", "label": "return", "type": "return", "loc": [158, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L152_C4", "vector": [13, 2, 0.6974, 0.0132, 2, 0.07, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (parsed[0] in self.allowed_schemes and '.' in parsed[1]) \\\n or (parsed[0] in self.allowed_schemes and '@' in parsed[2]) \\\n or (parsed[0] == '' and parsed[2].startswith('/'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L162_C4", "label": "strip", "type": "function", "loc": [162, 183], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "vector": [2, 1, 0.7566, 0.0965, 1, 0.04, 0.9091, 973, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "strip", "arg_names": ["self", "rawstring", "escape"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def strip(self, rawstring, escape=True):\n \"\"\"\n Returns the argument stripped of potentially harmful\n HTML or Javascript code\n\n @type escape: boolean\n @param escape: If True (default) it escapes the potentially harmful\n content, otherwise remove it"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Expr_L163_C8", "label": "expression", "type": "expression", "loc": [163, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L162_C4", "vector": [8, 2, 0.7303, 0.0351, 2, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the argument stripped of potentially harmful\n HTML or Javascript code\n\n @type escape: boolean\n @param escape: If True (default) it escapes the potentially harmful\n content, otherwise remove it\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:If_L172_C8", "label": "if", "type": "if", "loc": [172, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L162_C4", "vector": [4, 2, 0.7566, 0.0088, 2, 0.38, 0.1429, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(rawstring, str):\n return str(rawstring)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Return_L173_C12", "label": "return", "type": "return", "loc": [173, 173], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L172_C8", "vector": [13, 3, 0.7588, 0.0044, 3, 0.11, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(rawstring)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:For_L174_C8", "label": "for tag", "type": "for", "loc": [174, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L162_C4", "vector": [6, 2, 0.7654, 0.0088, 2, 0.38, 0.2857, 732, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for tag in self.requires_no_close:\n rawstring = rawstring.replace(\"<%s/>\" % tag, \"<%s />\" % tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L175_C12", "label": "rawstring = replace()", "type": "assigned_variable", "loc": [175, 175], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:For_L174_C8", "vector": [14, 3, 0.7675, 0.0044, 3, 0.18, 0.0, 112, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "rawstring", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " rawstring = rawstring.replace(\"<%s/>\" % tag, \"<%s />\" % tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:If_L176_C8", "label": "if", "type": "if", "loc": [176, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L162_C4", "vector": [4, 2, 0.7741, 0.0088, 2, 0.38, 0.4286, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not escape:\n self.strip_disallowed = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L177_C12", "label": "self.strip_disallowed =", "type": "assigned_variable", "loc": [177, 177], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L176_C8", "vector": [14, 3, 0.7763, 0.0044, 3, 0.52, 0.0, 188, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.strip_disallowed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.strip_disallowed = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L178_C8", "label": "self.result =", "type": "assigned_variable", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L162_C4", "vector": [14, 2, 0.7807, 0.0044, 2, 0.38, 0.5714, 341, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.result = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Expr_L179_C8", "label": "feed()", "type": "expression", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L162_C4", "vector": [8, 2, 0.7851, 0.0044, 2, 0.38, 0.7143, 87, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "feed", "arg_names": [], "import_names": [], "rhs_call_name": "feed", "annotation": ""}, "snippet": " self.feed(rawstring)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:For_L180_C8", "label": "for endtag", "type": "for", "loc": [180, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L162_C4", "vector": [6, 2, 0.7939, 0.0132, 2, 0.38, 0.8571, 630, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "endtag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for endtag in self.open_tags:\n if endtag not in self.requires_no_close:\n self.result += '</%s>' % endtag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:If_L181_C12", "label": "if", "type": "if", "loc": [181, 182], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:For_L180_C8", "vector": [4, 3, 0.7961, 0.0088, 3, 0.37, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if endtag not in self.requires_no_close:\n self.result += '</%s>' % endtag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Return_L183_C8", "label": "return", "type": "return", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L162_C4", "vector": [13, 2, 0.8026, 0.0044, 2, 0.38, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L185_C4", "label": "xtags", "type": "function", "loc": [185, 197], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "vector": [2, 1, 0.8377, 0.057, 1, 0.04, 1.0, 528, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "xtags", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def xtags(self):\n \"\"\"\n Returns a printable string informing the user which tags are allowed\n \"\"\"\n\n tg = ''\n for x in sorted(self.permitted_tags):\n tg += '<' + x"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Expr_L186_C8", "label": "expression", "type": "expression", "loc": [186, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L185_C4", "vector": [8, 2, 0.8202, 0.0132, 2, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns a printable string informing the user which tags are allowed\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L190_C8", "label": "tg =", "type": "assigned_variable", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L185_C4", "vector": [14, 2, 0.8333, 0.0044, 2, 0.94, 0.3333, 870, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tg = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:For_L191_C8", "label": "for x", "type": "for", "loc": [191, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L185_C4", "vector": [6, 2, 0.8487, 0.0263, 2, 0.94, 0.6667, 190, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for x in sorted(self.permitted_tags):\n tg += '<' + x\n if x in self.allowed_attributes:\n for y in self.allowed_attributes[x]:\n tg += ' %s=\"\"' % y\n tg += '> '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:If_L193_C12", "label": "if", "type": "if", "loc": [193, 195], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:For_L191_C8", "vector": [4, 3, 0.8509, 0.0132, 3, 0.89, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if x in self.allowed_attributes:\n for y in self.allowed_attributes[x]:\n tg += ' %s=\"\"' % y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:For_L194_C16", "label": "for y", "type": "for", "loc": [194, 195], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L193_C12", "vector": [6, 4, 0.8531, 0.0088, 4, 0.58, 0.0, 304, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for y in self.allowed_attributes[x]:\n tg += ' %s=\"\"' % y"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Return_L197_C8", "label": "return", "type": "return", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L185_C4", "vector": [13, 2, 0.864, 0.0044, 2, 0.94, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return xssescape(tg.strip())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L200_C0", "label": "sanitize", "type": "function", "loc": [200, 228], "level": 0, "parent": null, "vector": [2, 0, 0.9386, 0.1272, 0, 0.66, 1.0, 151, 0, 4, 1, 0, 0, 0, 4], "semantic": {"name": "sanitize", "arg_names": ["text", "permitted_tags", "allowed_attributes", "escape"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def sanitize(text, permitted_tags=[\n 'a',\n 'b',\n 'blockquote',\n 'br/',\n 'i',\n 'li',\n 'ol',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:If_L225_C4", "label": "if", "type": "if", "loc": [225, 226], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L200_C0", "vector": [4, 1, 0.989, 0.0088, 1, 0.52, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(text, basestring):\n return str(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Return_L226_C8", "label": "return", "type": "return", "loc": [226, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:If_L225_C4", "vector": [13, 2, 0.9912, 0.0044, 2, 0.8, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_459:Return_L227_C4", "label": "return", "type": "return", "loc": [227, 228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L200_C0", "vector": [13, 1, 0.9978, 0.0088, 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 XssCleaner(permitted_tags=permitted_tags,\n allowed_attributes=allowed_attributes).strip(text, escape)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Expr_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Return_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Expr_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:If_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:If_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L80_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Return_L81_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L80_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_459:If_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:If_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Return_L89_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L88_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_459:If_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L95_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:If_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L96_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Return_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L96_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_459:If_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:If_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_459:If_L108_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L108_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L109_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L113_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_459:If_L114_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L114_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L115_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L114_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L116_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L114_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_459:For_L119_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:For_L119_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_459:If_L120_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L120_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_459:If_L121_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_459:If_L127_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L127_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Return_L128_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_459:If_L129_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Expr_L133_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:If_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L137_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_459:If_L138_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L138_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L139_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L137_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_459:If_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Expr_L144_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Expr_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Expr_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Expr_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Return_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Expr_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:If_L172_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L172_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Return_L173_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:For_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:For_L174_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L175_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:If_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L176_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L177_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Expr_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:For_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:For_L180_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_459:If_L181_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L162_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Return_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:ClassDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L185_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Expr_L186_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L185_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Assign_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L185_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:For_L191_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:For_L191_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_459:If_L193_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L193_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_459:For_L194_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L185_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Return_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L200_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_459:If_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:If_L225_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Return_L226_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_459:FunctionDef_L200_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_459:Return_L227_C4"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework (Copyrighted, 2007-2011).
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
Author: Thadeus Burgess
Contributors:
- Thank you to Massimo Di Pierro for creating the original gluon/template.py
- Thank you to Jonathan Lundell for extensively testing the regex on Jython.
- Thank you to Limodou (creater of uliweb) who inspired the block-element support for web2py.
"""
import os
import cgi
import logging
from re import compile, sub, escape, DOTALL
try:
import cStringIO as StringIO
except:
from io import StringIO
try:
# have web2py
from restricted import RestrictedError
from globals import current
except ImportError:
# do not have web2py
current = None
def RestrictedError(a, b, c):
logging.error(str(a) + ':' + str(b) + ':' + str(c))
return RuntimeError
class Node(object):
"""
Basic Container Object
"""
def __init__(self, value=None, pre_extend=False):
self.value = value
self.pre_extend = pre_extend
def __str__(self):
return str(self.value)
class SuperNode(Node):
def __init__(self, name='', pre_extend=False):
self.name = name
self.value = None
self.pre_extend = pre_extend
def __str__(self):
if self.value:
return str(self.value)
else:
# raise SyntaxError("Undefined parent block ``%s``. \n" % self.name + "You must define a block before referencing it.\nMake sure you have not left out an ``{{end}}`` tag." )
return ''
def __repr__(self):
return "%s->%s" % (self.name, self.value)
def output_aux(node, blocks):
# If we have a block level
# If we can override this block.
# Override block from vars.
# Else we take the default
# Else its just a string
return (blocks[node.name].output(blocks)
if node.name in blocks else
node.output(blocks)) \
if isinstance(node, BlockNode) \
else str(node)
class BlockNode(Node):
"""
Block Container.
This Node can contain other Nodes and will render in a hierarchical order
of when nodes were added.
ie::
{{ block test }}
This is default block test
{{ end }}
"""
def __init__(self, name='', pre_extend=False, delimiters=('{{', '}}')):
"""
name - Name of this Node.
"""
self.nodes = []
self.name = name
self.pre_extend = pre_extend
self.left, self.right = delimiters
def __repr__(self):
lines = ['%sblock %s%s' % (self.left, self.name, self.right)]
lines += [str(node) for node in self.nodes]
lines.append('%send%s' % (self.left, self.right))
return ''.join(lines)
def __str__(self):
"""
Get this BlockNodes content, not including child Nodes
"""
return ''.join(str(node) for node in self.nodes
if not isinstance(node, BlockNode))
def append(self, node):
"""
Add an element to the nodes.
Keyword Arguments
- node -- Node object or string to append.
"""
if isinstance(node, str) or isinstance(node, Node):
self.nodes.append(node)
else:
raise TypeError("Invalid type; must be instance of ``str`` or ``BlockNode``. %s" % node)
def extend(self, other):
"""
Extend the list of nodes with another BlockNode class.
Keyword Arguments
- other -- BlockNode or Content object to extend from.
"""
if isinstance(other, BlockNode):
self.nodes.extend(other.nodes)
else:
raise TypeError(
"Invalid type; must be instance of ``BlockNode``. %s" % other)
def output(self, blocks):
"""
Merges all nodes into a single string.
blocks -- Dictionary of blocks that are extending
from this template.
"""
return ''.join(output_aux(node, blocks) for node in self.nodes)
class Content(BlockNode):
"""
Parent Container -- Used as the root level BlockNode.
Contains functions that operate as such.
"""
def __init__(self, name="ContentBlock", pre_extend=False):
"""
Keyword Arguments
name -- Unique name for this BlockNode
"""
self.name = name
self.nodes = []
self.blocks = {}
self.pre_extend = pre_extend
def __str__(self):
return ''.join(output_aux(node, self.blocks) for node in self.nodes)
def _insert(self, other, index=0):
"""
Inserts object at index.
"""
if isinstance(other, (str, Node)):
self.nodes.insert(index, other)
else:
raise TypeError(
"Invalid type, must be instance of ``str`` or ``Node``.")
def insert(self, other, index=0):
"""
Inserts object at index.
You may pass a list of objects and have them inserted.
"""
if isinstance(other, (list, tuple)):
# Must reverse so the order stays the same.
other.reverse()
for item in other:
self._insert(item, index)
else:
self._insert(other, index)
def append(self, node):
"""
Adds a node to list. If it is a BlockNode then we assign a block for it.
"""
if isinstance(node, (str, Node)):
self.nodes.append(node)
if isinstance(node, BlockNode):
self.blocks[node.name] = node
else:
raise TypeError("Invalid type, must be instance of ``str`` or ``BlockNode``. %s" % node)
def extend(self, other):
"""
Extends the objects list of nodes with another objects nodes
"""
if isinstance(other, BlockNode):
self.nodes.extend(other.nodes)
self.blocks.update(other.blocks)
else:
raise TypeError(
"Invalid type; must be instance of ``BlockNode``. %s" % other)
def clear_content(self):
self.nodes = []
class TemplateParser(object):
default_delimiters = ('{{', '}}')
r_tag = compile(r'(\{\{.*?\}\})', DOTALL)
r_multiline = compile(r'(""".*?""")|(\'\'\'.*?\'\'\')', DOTALL)
# These are used for re-indentation.
# Indent + 1
re_block = compile('^(elif |else:|except:|except |finally:).*$', DOTALL)
# Indent - 1
re_unblock = compile('^(return|continue|break|raise)( .*)?$', DOTALL)
# Indent - 1
re_pass = compile('^pass( .*)?$', DOTALL)
def __init__(self, text,
name="ParserContainer",
context=dict(),
path='views/',
writer='response.write',
lexers={},
delimiters=('{{', '}}'),
_super_nodes = [],
):
"""
text -- text to parse
context -- context to parse in
path -- folder path to templates
writer -- string of writer class to use
lexers -- dict of custom lexers to use.
delimiters -- for example ('{{','}}')
_super_nodes -- a list of nodes to check for inclusion
this should only be set by "self.extend"
It contains a list of SuperNodes from a child
template that need to be handled.
"""
# Keep a root level name.
self.name = name
# Raw text to start parsing.
self.text = text
# Writer to use (refer to the default for an example).
# This will end up as
# "%s(%s, escape=False)" % (self.writer, value)
self.writer = writer
# Dictionary of custom name lexers to use.
if isinstance(lexers, dict):
self.lexers = lexers
else:
self.lexers = {}
# Path of templates
self.path = path
# Context for templates.
self.context = context
# allow optional alternative delimiters
self.delimiters = delimiters
if delimiters != self.default_delimiters:
escaped_delimiters = (escape(delimiters[0]),
escape(delimiters[1]))
self.r_tag = compile(r'(%s.*?%s)' % escaped_delimiters, DOTALL)
elif hasattr(context.get('response', None), 'delimiters'):
if context['response'].delimiters != self.default_delimiters:
escaped_delimiters = (
escape(context['response'].delimiters[0]),
escape(context['response'].delimiters[1]))
self.r_tag = compile(r'(%s.*?%s)' % escaped_delimiters,
DOTALL)
# Create a root level Content that everything will go into.
self.content = Content(name=name)
# Stack will hold our current stack of nodes.
# As we descend into a node, it will be added to the stack
# And when we leave, it will be removed from the stack.
# self.content should stay on the stack at all times.
self.stack = [self.content]
# This variable will hold a reference to every super block
# that we come across in this template.
self.super_nodes = []
# This variable will hold a reference to the child
# super nodes that need handling.
self.child_super_nodes = _super_nodes
# This variable will hold a reference to every block
# that we come across in this template
self.blocks = {}
# Begin parsing.
self.parse(text)
def to_string(self):
"""
Return the parsed template with correct indentation.
Used to make it easier to port to python3.
"""
return self.reindent(str(self.content))
def __str__(self):
"Make sure str works exactly the same as python 3"
return self.to_string()
def __unicode__(self):
"Make sure str works exactly the same as python 3"
return self.to_string()
def reindent(self, text):
"""
Reindents a string of unindented python code.
"""
# Get each of our lines into an array.
lines = text.split('\n')
# Our new lines
new_lines = []
# Keeps track of how many indents we have.
# Used for when we need to drop a level of indentation
# only to reindent on the next line.
credit = 0
# Current indentation
k = 0
#################
# THINGS TO KNOW
#################
# k += 1 means indent
# k -= 1 means unindent
# credit = 1 means unindent on the next line.
for raw_line in lines:
line = raw_line.strip()
# ignore empty lines
if not line:
continue
# If we have a line that contains python code that
# should be unindented for this line of code.
# and then reindented for the next line.
if TemplateParser.re_block.match(line):
k = k + credit - 1
# We obviously can't have a negative indentation
k = max(k, 0)
# Add the indentation!
new_lines.append(' ' * (4 * k) + line)
# Bank account back to 0 again :(
credit = 0
# If we are a pass block, we obviously de-dent.
if TemplateParser.re_pass.match(line):
k -= 1
# If we are any of the following, de-dent.
# However, we should stay on the same level
# But the line right after us will be de-dented.
# So we add one credit to keep us at the level
# while moving back one indentation level.
if TemplateParser.re_unblock.match(line):
credit = 1
k -= 1
# If we are an if statement, a try, or a semi-colon we
# probably need to indent the next line.
if line.endswith(':') and not line.startswith('#'):
k += 1
# This must come before so that we can raise an error with the
# right content.
new_text = '\n'.join(new_lines)
if k > 0:
self._raise_error('missing "pass" in view', new_text)
elif k < 0:
self._raise_error('too many "pass" in view', new_text)
return new_text
def _raise_error(self, message='', text=None):
"""
Raise an error using itself as the filename and textual content.
"""
raise RestrictedError(self.name, text or self.text, message)
def _get_file_text(self, filename):
"""
Attempt to open ``filename`` and retrieve its text.
This will use self.path to search for the file.
"""
# If they didn't specify a filename, how can we find one!
if not filename.strip():
self._raise_error('Invalid template filename')
# Allow Views to include other views dynamically
context = self.context
if current and not "response" in context:
context["response"] = getattr(current, 'response', None)
# Get the filename; filename looks like ``"template.html"``.
# We need to eval to remove the quotes and get the string type.
filename = eval(filename, context)
# Get the path of the file on the system.
filepath = self.path and os.path.join(self.path, filename) or filename
# try to read the text.
try:
fileobj = open(filepath, 'rb')
text = fileobj.read()
fileobj.close()
except IOError:
self._raise_error('Unable to open included view file: ' + filepath)
return text
def include(self, content, filename):
"""
Include ``filename`` here.
"""
text = self._get_file_text(filename)
t = TemplateParser(text,
name=filename,
context=self.context,
path=self.path,
writer=self.writer,
delimiters=self.delimiters)
content.append(t.content)
def extend(self, filename):
"""
Extend ``filename``. Anything not declared in a block defined by the
parent will be placed in the parent templates ``{{include}}`` block.
"""
text = self._get_file_text(filename)
# Create out nodes list to send to the parent
super_nodes = []
# We want to include any non-handled nodes.
super_nodes.extend(self.child_super_nodes)
# And our nodes as well.
super_nodes.extend(self.super_nodes)
t = TemplateParser(text,
name=filename,
context=self.context,
path=self.path,
writer=self.writer,
delimiters=self.delimiters,
_super_nodes=super_nodes)
# Make a temporary buffer that is unique for parent
# template.
buf = BlockNode(
name='__include__' + filename, delimiters=self.delimiters)
pre = []
# Iterate through each of our nodes
for node in self.content.nodes:
# If a node is a block
if isinstance(node, BlockNode):
# That happens to be in the parent template
if node.name in t.content.blocks:
# Do not include it
continue
if isinstance(node, Node):
# Or if the node was before the extension
# we should not include it
if node.pre_extend:
pre.append(node)
continue
# Otherwise, it should go int the
# Parent templates {{include}} section.
buf.append(node)
else:
buf.append(node)
# Clear our current nodes. We will be replacing this with
# the parent nodes.
self.content.nodes = []
t_content = t.content
# Set our include, unique by filename
t_content.blocks['__include__' + filename] = buf
# Make sure our pre_extended nodes go first
t_content.insert(pre)
# Then we extend our blocks
t_content.extend(self.content)
# Work off the parent node.
self.content = t_content
def parse(self, text):
# Basically, r_tag.split will split the text into
# an array containing, 'non-tag', 'tag', 'non-tag', 'tag'
# so if we alternate this variable, we know
# what to look for. This is alternate to
# line.startswith("{{")
in_tag = False
extend = None
pre_extend = True
# Use a list to store everything in
# This is because later the code will "look ahead"
# for missing strings or brackets.
ij = self.r_tag.split(text)
# j = current index
# i = current item
stack = self.stack
for j in range(len(ij)):
i = ij[j]
if i:
if not stack:
self._raise_error('The "end" tag is unmatched, please check if you have a starting "block" tag')
# Our current element in the stack.
top = stack[-1]
if in_tag:
line = i
# Get rid of '{{' and '}}'
line = line[2:-2].strip()
# This is bad juju, but let's do it anyway
if not line:
continue
# We do not want to replace the newlines in code,
# only in block comments.
def remove_newline(re_val):
# Take the entire match and replace newlines with
# escaped newlines.
return re_val.group(0).replace('\n', '\\n')
# Perform block comment escaping.
# This performs escaping ON anything
# in between """ and """
line = sub(TemplateParser.r_multiline,
remove_newline,
line)
if line.startswith('='):
# IE: {{=response.title}}
name, value = '=', line[1:].strip()
else:
v = line.split(' ', 1)
if len(v) == 1:
# Example
# {{ include }}
# {{ end }}
name = v[0]
value = ''
else:
# Example
# {{ block pie }}
# {{ include "layout.html" }}
# {{ for i in range(10): }}
name = v[0]
value = v[1]
# This will replace newlines in block comments
# with the newline character. This is so that they
# retain their formatting, but squish down to one
# line in the rendered template.
# First check if we have any custom lexers
if name in self.lexers:
# Pass the information to the lexer
# and allow it to inject in the environment
# You can define custom names such as
# '{{<<variable}}' which could potentially
# write unescaped version of the variable.
self.lexers[name](parser=self,
value=value,
top=top,
stack=stack)
elif name == '=':
# So we have a variable to insert into
# the template
buf = "\n%s(%s)" % (self.writer, value)
top.append(Node(buf, pre_extend=pre_extend))
elif name == 'block' and not value.startswith('='):
# Make a new node with name.
node = BlockNode(name=value.strip(),
pre_extend=pre_extend,
delimiters=self.delimiters)
# Append this node to our active node
top.append(node)
# Make sure to add the node to the stack.
# so anything after this gets added
# to this node. This allows us to
# "nest" nodes.
stack.append(node)
elif name == 'end' and not value.startswith('='):
# We are done with this node.
# Save an instance of it
self.blocks[top.name] = top
# Pop it.
stack.pop()
elif name == 'super' and not value.startswith('='):
# Get our correct target name
# If they just called {{super}} without a name
# attempt to assume the top blocks name.
if value:
target_node = value
else:
target_node = top.name
# Create a SuperNode instance
node = SuperNode(name=target_node,
pre_extend=pre_extend)
# Add this to our list to be taken care of
self.super_nodes.append(node)
# And put in in the tree
top.append(node)
elif name == 'include' and not value.startswith('='):
# If we know the target file to include
if value:
self.include(top, value)
# Otherwise, make a temporary include node
# That the child node will know to hook into.
else:
include_node = BlockNode(
name='__include__' + self.name,
pre_extend=pre_extend,
delimiters=self.delimiters)
top.append(include_node)
elif name == 'extend' and not value.startswith('='):
# We need to extend the following
# template.
extend = value
pre_extend = False
else:
# If we don't know where it belongs
# we just add it anyways without formatting.
if line and in_tag:
# Split on the newlines >.<
tokens = line.split('\n')
# We need to look for any instances of
# for i in range(10):
# = i
# pass
# So we can properly put a response.write() in place.
continuation = False
len_parsed = 0
for k, token in enumerate(tokens):
token = tokens[k] = token.strip()
len_parsed += len(token)
if token.startswith('='):
if token.endswith('\\'):
continuation = True
tokens[k] = "\n%s(%s" % (
self.writer, token[1:].strip())
else:
tokens[k] = "\n%s(%s)" % (
self.writer, token[1:].strip())
elif continuation:
tokens[k] += ')'
continuation = False
buf = "\n%s" % '\n'.join(tokens)
top.append(Node(buf, pre_extend=pre_extend))
else:
# It is HTML so just include it.
buf = "\n%s(%r, escape=False)" % (self.writer, i)
top.append(Node(buf, pre_extend=pre_extend))
# Remember: tag, not tag, tag, not tag
in_tag = not in_tag
# Make a list of items to remove from child
to_rm = []
# Go through each of the children nodes
for node in self.child_super_nodes:
# If we declared a block that this node wants to include
if node.name in self.blocks:
# Go ahead and include it!
node.value = self.blocks[node.name]
# Since we processed this child, we don't need to
# pass it along to the parent
to_rm.append(node)
# Remove some of the processed nodes
for node in to_rm:
# Since this is a pointer, it works beautifully.
# Sometimes I miss C-Style pointers... I want my asterisk...
self.child_super_nodes.remove(node)
# If we need to extend a template.
if extend:
self.extend(extend)
# We need this for integration with gluon
def parse_template(filename,
path='views/',
context=dict(),
lexers={},
delimiters=('{{', '}}')
):
"""
filename can be a view filename in the views folder or an input stream
path is the path of a views folder
context is a dictionary of symbols used to render the template
"""
# First, if we have a str try to open the file
if isinstance(filename, str):
try:
fp = open(os.path.join(path, filename), 'rb')
text = fp.read()
fp.close()
except IOError:
raise RestrictedError(filename, '', 'Unable to find the file')
else:
text = filename.read()
# Use the file contents to get a parsed template and return it.
return str(TemplateParser(text, context=context, path=path, lexers=lexers, delimiters=delimiters))
def get_parsed(text):
"""
Returns the indented python code of text. Useful for unit testing.
"""
return str(TemplateParser(text))
class DummyResponse():
def __init__(self):
self.body = StringIO.StringIO()
def write(self, data, escape=True):
if not escape:
self.body.write(str(data))
elif hasattr(data, 'as_html') and callable(data.as_html):
self.body.write(data.as_html())
else:
# make it a string
if not isinstance(data, (str, unicode)):
data = str(data)
elif isinstance(data, unicode):
data = data.encode('utf8', 'xmlcharrefreplace')
data = cgi.escape(data, True).replace("'", "'")
self.body.write(data)
class NOESCAPE():
"""
A little helper to avoid escaping.
"""
def __init__(self, text):
self.text = text
def xml(self):
return self.text
# And this is a generic render function.
# Here for integration with gluon.
def render(content="hello world",
stream=None,
filename=None,
path=None,
context={},
lexers={},
delimiters=('{{', '}}')
):
"""
>>> render()
'hello world'
>>> render(content='abc')
'abc'
>>> render(content='abc\\'')
"abc'"
>>> render(content='a"\\'bc')
'a"\\'bc'
>>> render(content='a\\nbc')
'a\\nbc'
>>> render(content='a"bcd"e')
'a"bcd"e'
>>> render(content="'''a\\nc'''")
"'''a\\nc'''"
>>> render(content="'''a\\'c'''")
"'''a\'c'''"
>>> render(content='{{for i in range(a):}}{{=i}}<br />{{pass}}', context=dict(a=5))
'0<br />1<br />2<br />3<br />4<br />'
>>> render(content='{%for i in range(a):%}{%=i%}<br />{%pass%}', context=dict(a=5),delimiters=('{%','%}'))
'0<br />1<br />2<br />3<br />4<br />'
>>> render(content="{{='''hello\\nworld'''}}")
'hello\\nworld'
>>> render(content='{{for i in range(3):\\n=i\\npass}}')
'012'
"""
# here to avoid circular Imports
try:
from globals import Response
except ImportError:
# Working standalone. Build a mock Response object.
Response = DummyResponse
# Add it to the context so we can use it.
if not 'NOESCAPE' in context:
context['NOESCAPE'] = NOESCAPE
# save current response class
if context and 'response' in context:
old_response_body = context['response'].body
context['response'].body = StringIO.StringIO()
else:
old_response_body = None
context['response'] = Response()
# If we don't have anything to render, why bother?
if not content and not stream and not filename:
raise SyntaxError("Must specify a stream or filename or content")
# Here for legacy purposes, probably can be reduced to
# something more simple.
close_stream = False
if not stream:
if filename:
stream = open(filename, 'rb')
close_stream = True
elif content:
stream = StringIO.StringIO(content)
# Execute the template.
code = str(TemplateParser(stream.read(
), context=context, path=path, lexers=lexers, delimiters=delimiters))
try:
exec(code) in context
except Exception:
# for i,line in enumerate(code.split('\n')): print i,line
raise
if close_stream:
stream.close()
# Returned the rendered content.
text = context['response'].body.getvalue()
if old_response_body is not None:
context['response'].body = old_response_body
return text
if __name__ == '__main__':
import doctest
doctest.testmod()
| ajibawa-2023/Python-Code-Large/train/row_462 | 349 | 917 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 15], "level": 0, "parent": null, "vector": [8, 0, 0.0104, 0.0131, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis file is part of the web2py Web Framework (Copyrighted, 2007-2011).\nLicense: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)\n\nAuthor: Thadeus Burgess\n\nContributors:\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Import_L17_C0", "label": "os import os", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0185, 0.0011, 0, 0.66, 0.0556, 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_462:Import_L18_C0", "label": "cgi import cgi", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0196, 0.0011, 0, 0.66, 0.1111, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Import_L19_C0", "label": "logging import logging", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0207, 0.0011, 0, 0.66, 0.1667, 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_462:ImportFrom_L20_C0", "label": "from re import compile, sub, escape\u2026", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.0218, 0.0011, 0, 0.66, 0.2222, 540, 0, 4, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["compile", "sub", "escape", "DOTALL"], "rhs_call_name": "", "annotation": ""}, "snippet": "from re import compile, sub, escape, DOTALL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L21_C0", "label": "try", "type": "try", "loc": [21, 24], "level": 0, "parent": null, "vector": [7, 0, 0.0245, 0.0044, 0, 0.66, 0.2778, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n import cStringIO as StringIO\nexcept:\n from io import StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Import_L22_C4", "label": "cStringIO import StringIO", "type": "import", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L21_C0", "vector": [1, 1, 0.024, 0.0011, 1, 0.0, 0.0, 764, 0, 1, 0, 0, 764, 0, 0], "semantic": {"name": "cStringIO", "arg_names": [], "import_names": ["StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": " import cStringIO as StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:ImportFrom_L24_C4", "label": "from io import StringIO", "type": "import", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L21_C0", "vector": [1, 1, 0.0262, 0.0011, 1, 0.0, 0.0, 518, 0, 1, 0, 0, 518, 0, 0], "semantic": {"name": "io", "arg_names": [], "import_names": ["StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": " from io import StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L26_C0", "label": "try", "type": "try", "loc": [26, 36], "level": 0, "parent": null, "vector": [7, 0, 0.0338, 0.012, 0, 0.66, 0.3333, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n # have web2py\n from restricted import RestrictedError\n from globals import current\nexcept ImportError:\n # do not have web2py\n current = None\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:ImportFrom_L28_C4", "label": "from restricted import RestrictedError", "type": "import", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L26_C0", "vector": [1, 1, 0.0305, 0.0011, 1, 0.33, 0.0, 844, 0, 1, 0, 0, 844, 0, 0], "semantic": {"name": "restricted", "arg_names": [], "import_names": ["RestrictedError"], "rhs_call_name": "", "annotation": ""}, "snippet": " from restricted import RestrictedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:ImportFrom_L29_C4", "label": "from globals import current", "type": "import", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L26_C0", "vector": [1, 1, 0.0316, 0.0011, 1, 0.33, 1.0, 926, 0, 1, 0, 0, 926, 0, 0], "semantic": {"name": "globals", "arg_names": [], "import_names": ["current"], "rhs_call_name": "", "annotation": ""}, "snippet": " from globals import current"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L32_C4", "label": "current =", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L26_C0", "vector": [14, 1, 0.0349, 0.0011, 1, 0.33, 0.0, 32, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "current", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " current = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L34_C4", "label": "RestrictedError", "type": "function", "loc": [34, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L26_C0", "vector": [2, 1, 0.0382, 0.0033, 1, 0.33, 1.0, 461, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "RestrictedError", "arg_names": ["a", "b", "c"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def RestrictedError(a, b, c):\n logging.error(str(a) + ':' + str(b) + ':' + str(c))\n return RuntimeError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L35_C8", "label": "error()", "type": "expression", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L34_C4", "vector": [8, 2, 0.0382, 0.0011, 2, 0.06, 0.0, 771, 3, 1, 0, 0, 0, 0, 4], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " logging.error(str(a) + ':' + str(b) + ':' + str(c))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L36_C8", "label": "return", "type": "return", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L34_C4", "vector": [13, 2, 0.0393, 0.0011, 2, 0.06, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return RuntimeError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L39_C0", "label": "Node", "type": "class", "loc": [39, 48], "level": 0, "parent": null, "vector": [3, 0, 0.0474, 0.0109, 0, 0.66, 0.3889, 345, 0, 2, 0, 0, 186, 0, 1], "semantic": {"name": "Node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Node(object):\n \"\"\"\n Basic Container Object\n \"\"\"\n def __init__(self, value=None, pre_extend=False):\n self.value = value\n self.pre_extend = pre_extend\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L40_C4", "label": "expression", "type": "expression", "loc": [40, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L39_C0", "vector": [8, 1, 0.0447, 0.0033, 1, 0.63, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Basic Container Object\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L43_C4", "label": "__init__", "type": "function", "loc": [43, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L39_C0", "vector": [2, 1, 0.048, 0.0033, 1, 0.63, 0.5, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "value", "pre_extend"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, value=None, pre_extend=False):\n self.value = value\n self.pre_extend = pre_extend"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L44_C8", "label": "self.value =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L43_C4", "vector": [14, 2, 0.048, 0.0011, 2, 0.18, 0.0, 966, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.value = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L45_C8", "label": "self.pre_extend =", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L43_C4", "vector": [14, 2, 0.0491, 0.0011, 2, 0.18, 1.0, 492, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.pre_extend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pre_extend = pre_extend"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L47_C4", "label": "__str__", "type": "function", "loc": [47, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L39_C0", "vector": [2, 1, 0.0518, 0.0022, 1, 0.63, 1.0, 527, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n return str(self.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L48_C8", "label": "return", "type": "return", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L47_C4", "vector": [13, 2, 0.0523, 0.0011, 2, 0.61, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(self.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L51_C0", "label": "SuperNode", "type": "class", "loc": [51, 65], "level": 0, "parent": null, "vector": [3, 0, 0.0632, 0.0164, 0, 0.66, 0.4444, 784, 0, 3, 0, 0, 345, 0, 1], "semantic": {"name": "SuperNode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SuperNode(Node):\n def __init__(self, name='', pre_extend=False):\n self.name = name\n self.value = None\n self.pre_extend = pre_extend\n\n def __str__(self):\n if self.value:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L52_C4", "label": "__init__", "type": "function", "loc": [52, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L51_C0", "vector": [2, 1, 0.0583, 0.0044, 1, 0.95, 0.0, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "name", "pre_extend"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name='', pre_extend=False):\n self.name = name\n self.value = None\n self.pre_extend = pre_extend"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L53_C8", "label": "self.name =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L52_C4", "vector": [14, 2, 0.0578, 0.0011, 2, 0.83, 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_462:Assign_L54_C8", "label": "self.value =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L52_C4", "vector": [14, 2, 0.0589, 0.0011, 2, 0.83, 0.5, 966, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.value = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L55_C8", "label": "self.pre_extend =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L52_C4", "vector": [14, 2, 0.06, 0.0011, 2, 0.83, 1.0, 492, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.pre_extend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pre_extend = pre_extend"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L57_C4", "label": "__str__", "type": "function", "loc": [57, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L51_C0", "vector": [2, 1, 0.0649, 0.0065, 1, 0.95, 0.5, 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 if self.value:\n return str(self.value)\n else:\n # raise SyntaxError(\"Undefined parent block ``%s``. \\n\" % self.name + \"You must define a block before referencing it.\\nMake sure you have not left out an ``{{end}}`` tag.\" )\n return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L58_C8", "label": "if", "type": "if", "loc": [58, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L57_C4", "vector": [4, 2, 0.0654, 0.0055, 2, 0.21, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.value:\n return str(self.value)\n else:\n # raise SyntaxError(\"Undefined parent block ``%s``. \\n\" % self.name + \"You must define a block before referencing it.\\nMake sure you have not left out an ``{{end}}`` tag.\" )\n return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L59_C12", "label": "return", "type": "return", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L58_C8", "vector": [13, 3, 0.0643, 0.0011, 3, 0.21, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(self.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L62_C12", "label": "return", "type": "return", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L58_C8", "vector": [13, 3, 0.0676, 0.0011, 3, 0.21, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L64_C4", "label": "__repr__", "type": "function", "loc": [64, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L51_C0", "vector": [2, 1, 0.0703, 0.0022, 1, 0.95, 1.0, 204, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__repr__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __repr__(self):\n return \"%s->%s\" % (self.name, self.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L65_C8", "label": "return", "type": "return", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L64_C4", "vector": [13, 2, 0.0709, 0.0011, 2, 0.31, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"%s->%s\" % (self.name, self.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L68_C0", "label": "output_aux", "type": "function", "loc": [68, 78], "level": 0, "parent": null, "vector": [2, 0, 0.0796, 0.012, 0, 0.66, 0.5, 407, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "output_aux", "arg_names": ["node", "blocks"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def output_aux(node, blocks):\n # If we have a block level\n # If we can override this block.\n # Override block from vars.\n # Else we take the default\n # Else its just a string\n return (blocks[node.name].output(blocks)\n if node.name in blocks else"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L74_C4", "label": "return", "type": "return", "loc": [74, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L68_C0", "vector": [13, 1, 0.0829, 0.0055, 1, 0.19, 0.0, 0, 8, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (blocks[node.name].output(blocks)\n if node.name in blocks else\n node.output(blocks)) \\\n if isinstance(node, BlockNode) \\\n else str(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L81_C0", "label": "BlockNode", "type": "class", "loc": [81, 149], "level": 0, "parent": null, "vector": [3, 0, 0.1254, 0.0752, 0, 0.66, 0.5556, 680, 0, 6, 0, 0, 345, 0, 15], "semantic": {"name": "BlockNode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BlockNode(Node):\n \"\"\"\n Block Container.\n\n This Node can contain other Nodes and will render in a hierarchical order\n of when nodes were added.\n\n ie::"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L82_C4", "label": "expression", "type": "expression", "loc": [82, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L81_C0", "vector": [8, 1, 0.0954, 0.0131, 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 Block Container.\n\n This Node can contain other Nodes and will render in a hierarchical order\n of when nodes were added.\n\n ie::\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L94_C4", "label": "__init__", "type": "function", "loc": [94, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L81_C0", "vector": [2, 1, 0.1063, 0.0087, 1, 0.42, 0.1667, 555, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "name", "pre_extend", "delimiters"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name='', pre_extend=False, delimiters=('{{', '}}')):\n \"\"\"\n name - Name of this Node.\n \"\"\"\n self.nodes = []\n self.name = name\n self.pre_extend = pre_extend\n self.left, self.right = delimiters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L95_C8", "label": "expression", "type": "expression", "loc": [95, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L94_C4", "vector": [8, 2, 0.1047, 0.0033, 2, 0.35, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n name - Name of this Node.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L98_C8", "label": "self.nodes =", "type": "assigned_variable", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L94_C4", "vector": [14, 2, 0.1069, 0.0011, 2, 0.35, 0.25, 186, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.nodes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.nodes = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L99_C8", "label": "self.name =", "type": "assigned_variable", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L94_C4", "vector": [14, 2, 0.108, 0.0011, 2, 0.35, 0.5, 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_462:Assign_L100_C8", "label": "self.pre_extend =", "type": "assigned_variable", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L94_C4", "vector": [14, 2, 0.1091, 0.0011, 2, 0.35, 0.75, 492, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.pre_extend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pre_extend = pre_extend"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L101_C8", "label": "assign", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L94_C4", "vector": [14, 2, 0.1101, 0.0011, 2, 0.35, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.left, self.right = delimiters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L103_C4", "label": "__repr__", "type": "function", "loc": [103, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L81_C0", "vector": [2, 1, 0.1145, 0.0055, 1, 0.42, 0.3333, 204, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "__repr__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __repr__(self):\n lines = ['%sblock %s%s' % (self.left, self.name, self.right)]\n lines += [str(node) for node in self.nodes]\n lines.append('%send%s' % (self.left, self.right))\n return ''.join(lines)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L104_C8", "label": "lines =", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L103_C4", "vector": [14, 2, 0.1134, 0.0011, 2, 0.01, 0.0, 73, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "lines", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lines = ['%sblock %s%s' % (self.left, self.name, self.right)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L106_C8", "label": "append()", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L103_C4", "vector": [8, 2, 0.1156, 0.0011, 2, 0.01, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " lines.append('%send%s' % (self.left, self.right))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L107_C8", "label": "return", "type": "return", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L103_C4", "vector": [13, 2, 0.1167, 0.0011, 2, 0.01, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''.join(lines)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L109_C4", "label": "__str__", "type": "function", "loc": [109, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L81_C0", "vector": [2, 1, 0.1216, 0.0065, 1, 0.42, 0.5, 527, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n \"\"\"\n Get this BlockNodes content, not including child Nodes\n \"\"\"\n return ''.join(str(node) for node in self.nodes\n if not isinstance(node, BlockNode))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L110_C8", "label": "expression", "type": "expression", "loc": [110, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L109_C4", "vector": [8, 2, 0.121, 0.0033, 2, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Get this BlockNodes content, not including child Nodes\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L113_C8", "label": "return", "type": "return", "loc": [113, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L109_C4", "vector": [13, 2, 0.1238, 0.0022, 2, 0.49, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''.join(str(node) for node in self.nodes\n if not isinstance(node, BlockNode))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L116_C4", "label": "append", "type": "function", "loc": [116, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L81_C0", "vector": [2, 1, 0.1325, 0.0131, 1, 0.42, 0.6667, 243, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "append", "arg_names": ["self", "node"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def append(self, node):\n \"\"\"\n Add an element to the nodes.\n\n Keyword Arguments\n\n - node -- Node object or string to append.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L117_C8", "label": "expression", "type": "expression", "loc": [117, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L116_C4", "vector": [8, 2, 0.1309, 0.0076, 2, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Add an element to the nodes.\n\n Keyword Arguments\n\n - node -- Node object or string to append.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L124_C8", "label": "if", "type": "if", "loc": [124, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L116_C4", "vector": [4, 2, 0.1369, 0.0044, 2, 0.76, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(node, str) or isinstance(node, Node):\n self.nodes.append(node)\n else:\n raise TypeError(\"Invalid type; must be instance of ``str`` or ``BlockNode``. %s\" % node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L125_C12", "label": "append()", "type": "expression", "loc": [125, 125], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L124_C8", "vector": [8, 3, 0.1363, 0.0011, 3, 0.67, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.nodes.append(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L129_C4", "label": "extend", "type": "function", "loc": [129, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L81_C0", "vector": [2, 1, 0.1472, 0.0142, 1, 0.42, 0.8333, 660, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "extend", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def extend(self, other):\n \"\"\"\n Extend the list of nodes with another BlockNode class.\n\n Keyword Arguments\n\n - other -- BlockNode or Content object to extend from.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L130_C8", "label": "expression", "type": "expression", "loc": [130, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L129_C4", "vector": [8, 2, 0.145, 0.0076, 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 Extend the list of nodes with another BlockNode class.\n\n Keyword Arguments\n\n - other -- BlockNode or Content object to extend from.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L137_C8", "label": "if", "type": "if", "loc": [137, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L129_C4", "vector": [4, 2, 0.1516, 0.0055, 2, 0.33, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, BlockNode):\n self.nodes.extend(other.nodes)\n else:\n raise TypeError(\n \"Invalid type; must be instance of ``BlockNode``. %s\" % other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L138_C12", "label": "extend()", "type": "expression", "loc": [138, 138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L137_C8", "vector": [8, 3, 0.1505, 0.0011, 3, 0.44, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " self.nodes.extend(other.nodes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L143_C4", "label": "output", "type": "function", "loc": [143, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L81_C0", "vector": [2, 1, 0.1592, 0.0076, 1, 0.42, 1.0, 886, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "output", "arg_names": ["self", "blocks"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def output(self, blocks):\n \"\"\"\n Merges all nodes into a single string.\n blocks -- Dictionary of blocks that are extending\n from this template.\n \"\"\"\n return ''.join(output_aux(node, blocks) for node in self.nodes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L144_C8", "label": "expression", "type": "expression", "loc": [144, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L143_C4", "vector": [8, 2, 0.1592, 0.0055, 2, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Merges all nodes into a single string.\n blocks -- Dictionary of blocks that are extending\n from this template.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L149_C8", "label": "return", "type": "return", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L143_C4", "vector": [13, 2, 0.1625, 0.0011, 2, 0.82, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''.join(output_aux(node, blocks) for node in self.nodes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L152_C0", "label": "Content", "type": "class", "loc": [152, 219], "level": 0, "parent": null, "vector": [3, 0, 0.2023, 0.0742, 0, 0.66, 0.6111, 758, 0, 7, 0, 0, 680, 0, 17], "semantic": {"name": "Content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Content(BlockNode):\n \"\"\"\n Parent Container -- Used as the root level BlockNode.\n\n Contains functions that operate as such.\n \"\"\"\n def __init__(self, name=\"ContentBlock\", pre_extend=False):\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L153_C4", "label": "expression", "type": "expression", "loc": [153, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L152_C0", "vector": [8, 1, 0.169, 0.0055, 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 Parent Container -- Used as the root level BlockNode.\n\n Contains functions that operate as such.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L158_C4", "label": "__init__", "type": "function", "loc": [158, 167], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L152_C0", "vector": [2, 1, 0.1772, 0.0109, 1, 0.55, 0.1429, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "name", "pre_extend"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name=\"ContentBlock\", pre_extend=False):\n \"\"\"\n Keyword Arguments\n\n name -- Unique name for this BlockNode\n \"\"\"\n self.name = name\n self.nodes = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L159_C8", "label": "expression", "type": "expression", "loc": [159, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L158_C4", "vector": [8, 2, 0.1756, 0.0055, 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 Keyword Arguments\n\n name -- Unique name for this BlockNode\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L164_C8", "label": "self.name =", "type": "assigned_variable", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L158_C4", "vector": [14, 2, 0.1788, 0.0011, 2, 0.91, 0.25, 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_462:Assign_L165_C8", "label": "self.nodes =", "type": "assigned_variable", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L158_C4", "vector": [14, 2, 0.1799, 0.0011, 2, 0.91, 0.5, 186, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.nodes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.nodes = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L166_C8", "label": "self.blocks =", "type": "assigned_variable", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L158_C4", "vector": [14, 2, 0.181, 0.0011, 2, 0.91, 0.75, 356, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.blocks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.blocks = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L167_C8", "label": "self.pre_extend =", "type": "assigned_variable", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L158_C4", "vector": [14, 2, 0.1821, 0.0011, 2, 0.91, 1.0, 492, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.pre_extend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.pre_extend = pre_extend"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L169_C4", "label": "__str__", "type": "function", "loc": [169, 170], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L152_C0", "vector": [2, 1, 0.1848, 0.0022, 1, 0.55, 0.2857, 527, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n return ''.join(output_aux(node, self.blocks) for node in self.nodes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L170_C8", "label": "return", "type": "return", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L169_C4", "vector": [13, 2, 0.1854, 0.0011, 2, 0.18, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''.join(output_aux(node, self.blocks) for node in self.nodes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L172_C4", "label": "_insert", "type": "function", "loc": [172, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L152_C0", "vector": [2, 1, 0.1919, 0.0098, 1, 0.55, 0.4286, 343, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "_insert", "arg_names": ["self", "other", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _insert(self, other, index=0):\n \"\"\"\n Inserts object at index.\n \"\"\"\n if isinstance(other, (str, Node)):\n self.nodes.insert(index, other)\n else:\n raise TypeError("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L173_C8", "label": "expression", "type": "expression", "loc": [173, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L172_C4", "vector": [8, 2, 0.1897, 0.0033, 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 Inserts object at index.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L176_C8", "label": "if", "type": "if", "loc": [176, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L172_C4", "vector": [4, 2, 0.1941, 0.0055, 2, 0.3, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, (str, Node)):\n self.nodes.insert(index, other)\n else:\n raise TypeError(\n \"Invalid type, must be instance of ``str`` or ``Node``.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L177_C12", "label": "insert()", "type": "expression", "loc": [177, 177], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L176_C8", "vector": [8, 3, 0.193, 0.0011, 3, 0.31, 0.0, 368, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " self.nodes.insert(index, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L182_C4", "label": "insert", "type": "function", "loc": [182, 194], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L152_C0", "vector": [2, 1, 0.205, 0.0142, 1, 0.55, 0.5714, 368, 0, 3, 0, 0, 0, 0, 4], "semantic": {"name": "insert", "arg_names": ["self", "other", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def insert(self, other, index=0):\n \"\"\"\n Inserts object at index.\n\n You may pass a list of objects and have them inserted.\n \"\"\"\n if isinstance(other, (list, tuple)):\n # Must reverse so the order stays the same."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L183_C8", "label": "expression", "type": "expression", "loc": [183, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L182_C4", "vector": [8, 2, 0.2017, 0.0055, 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 Inserts object at index.\n\n You may pass a list of objects and have them inserted.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L188_C8", "label": "if", "type": "if", "loc": [188, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L182_C4", "vector": [4, 2, 0.2083, 0.0076, 2, 0.7, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, (list, tuple)):\n # Must reverse so the order stays the same.\n other.reverse()\n for item in other:\n self._insert(item, index)\n else:\n self._insert(other, index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L190_C12", "label": "reverse()", "type": "expression", "loc": [190, 190], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L188_C8", "vector": [8, 3, 0.2072, 0.0011, 3, 0.15, 0.0, 109, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reverse", "arg_names": [], "import_names": [], "rhs_call_name": "reverse", "annotation": ""}, "snippet": " other.reverse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:For_L191_C12", "label": "for item", "type": "for", "loc": [191, 192], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L188_C8", "vector": [6, 3, 0.2088, 0.0022, 3, 0.15, 0.5, 434, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in other:\n self._insert(item, index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L192_C16", "label": "_insert()", "type": "expression", "loc": [192, 192], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:For_L191_C12", "vector": [8, 4, 0.2094, 0.0011, 4, 0.82, 0.0, 343, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_insert", "arg_names": [], "import_names": [], "rhs_call_name": "_insert", "annotation": ""}, "snippet": " self._insert(item, index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L194_C12", "label": "_insert()", "type": "expression", "loc": [194, 194], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L188_C8", "vector": [8, 3, 0.2116, 0.0011, 3, 0.15, 1.0, 343, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_insert", "arg_names": [], "import_names": [], "rhs_call_name": "_insert", "annotation": ""}, "snippet": " self._insert(other, index)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L196_C4", "label": "append", "type": "function", "loc": [196, 205], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L152_C0", "vector": [2, 1, 0.2186, 0.0109, 1, 0.55, 0.7143, 243, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "append", "arg_names": ["self", "node"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def append(self, node):\n \"\"\"\n Adds a node to list. If it is a BlockNode then we assign a block for it.\n \"\"\"\n if isinstance(node, (str, Node)):\n self.nodes.append(node)\n if isinstance(node, BlockNode):\n self.blocks[node.name] = node"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L197_C8", "label": "expression", "type": "expression", "loc": [197, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L196_C4", "vector": [8, 2, 0.2159, 0.0033, 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 Adds a node to list. If it is a BlockNode then we assign a block for it.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L200_C8", "label": "if", "type": "if", "loc": [200, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L196_C4", "vector": [4, 2, 0.2208, 0.0065, 2, 0.03, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(node, (str, Node)):\n self.nodes.append(node)\n if isinstance(node, BlockNode):\n self.blocks[node.name] = node\n else:\n raise TypeError(\"Invalid type, must be instance of ``str`` or ``BlockNode``. %s\" % node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L201_C12", "label": "append()", "type": "expression", "loc": [201, 201], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L200_C8", "vector": [8, 3, 0.2192, 0.0011, 3, 0.55, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.nodes.append(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L202_C12", "label": "if", "type": "if", "loc": [202, 203], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L200_C8", "vector": [4, 3, 0.2208, 0.0022, 3, 0.55, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(node, BlockNode):\n self.blocks[node.name] = node"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L203_C16", "label": "assign", "type": "assigned_variable", "loc": [203, 203], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L202_C12", "vector": [14, 4, 0.2214, 0.0011, 4, 0.85, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.blocks[node.name] = node"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L207_C4", "label": "extend", "type": "function", "loc": [207, 216], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L152_C0", "vector": [2, 1, 0.2306, 0.0109, 1, 0.55, 0.8571, 660, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "extend", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def extend(self, other):\n \"\"\"\n Extends the objects list of nodes with another objects nodes\n \"\"\"\n if isinstance(other, BlockNode):\n self.nodes.extend(other.nodes)\n self.blocks.update(other.blocks)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L208_C8", "label": "expression", "type": "expression", "loc": [208, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L207_C4", "vector": [8, 2, 0.2279, 0.0033, 2, 0.52, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Extends the objects list of nodes with another objects nodes\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L211_C8", "label": "if", "type": "if", "loc": [211, 216], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L207_C4", "vector": [4, 2, 0.2328, 0.0065, 2, 0.52, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, BlockNode):\n self.nodes.extend(other.nodes)\n self.blocks.update(other.blocks)\n else:\n raise TypeError(\n \"Invalid type; must be instance of ``BlockNode``. %s\" % other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L212_C12", "label": "extend()", "type": "expression", "loc": [212, 212], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L211_C8", "vector": [8, 3, 0.2312, 0.0011, 3, 0.22, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " self.nodes.extend(other.nodes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L213_C12", "label": "update()", "type": "expression", "loc": [213, 213], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L211_C8", "vector": [8, 3, 0.2323, 0.0011, 3, 0.22, 1.0, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.blocks.update(other.blocks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L218_C4", "label": "clear_content", "type": "function", "loc": [218, 219], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L152_C0", "vector": [2, 1, 0.2383, 0.0022, 1, 0.55, 1.0, 875, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "clear_content", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clear_content(self):\n self.nodes = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L219_C8", "label": "self.nodes =", "type": "assigned_variable", "loc": [219, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L218_C4", "vector": [14, 2, 0.2388, 0.0011, 2, 0.64, 0.0, 186, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.nodes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.nodes = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "label": "TemplateParser", "type": "class", "loc": [222, 756], "level": 0, "parent": null, "vector": [3, 0, 0.5333, 0.5834, 0, 0.66, 0.6667, 732, 0, 11, 0, 0, 186, 0, 99], "semantic": {"name": "TemplateParser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TemplateParser(object):\n\n default_delimiters = ('{{', '}}')\n r_tag = compile(r'(\\{\\{.*?\\}\\})', DOTALL)\n\n r_multiline = compile(r'(\"\"\".*?\"\"\")|(\\'\\'\\'.*?\\'\\'\\')', DOTALL)\n\n # These are used for re-indentation."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L224_C4", "label": "default_delimiters =", "type": "assigned_variable", "loc": [224, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "vector": [14, 1, 0.2443, 0.0011, 1, 0.1, 0.0, 70, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "default_delimiters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " default_delimiters = ('{{', '}}')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L225_C4", "label": "r_tag = compile()", "type": "assigned_variable", "loc": [225, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "vector": [14, 1, 0.2454, 0.0011, 1, 0.1, 0.0667, 605, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "r_tag", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " r_tag = compile(r'(\\{\\{.*?\\}\\})', DOTALL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L227_C4", "label": "r_multiline = compile()", "type": "assigned_variable", "loc": [227, 227], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "vector": [14, 1, 0.2475, 0.0011, 1, 0.1, 0.1333, 414, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "r_multiline", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " r_multiline = compile(r'(\"\"\".*?\"\"\")|(\\'\\'\\'.*?\\'\\'\\')', DOTALL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L231_C4", "label": "re_block = compile()", "type": "assigned_variable", "loc": [231, 231], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "vector": [14, 1, 0.2519, 0.0011, 1, 0.1, 0.2, 467, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "re_block", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " re_block = compile('^(elif |else:|except:|except |finally:).*$', DOTALL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L234_C4", "label": "re_unblock = compile()", "type": "assigned_variable", "loc": [234, 234], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "vector": [14, 1, 0.2552, 0.0011, 1, 0.1, 0.2667, 16, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "re_unblock", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " re_unblock = compile('^(return|continue|break|raise)( .*)?$', DOTALL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L236_C4", "label": "re_pass = compile()", "type": "assigned_variable", "loc": [236, 236], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "vector": [14, 1, 0.2574, 0.0011, 1, 0.1, 0.3333, 480, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "re_pass", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " re_pass = compile('^pass( .*)?$', DOTALL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "label": "__init__", "type": "function", "loc": [238, 316], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "vector": [2, 1, 0.3021, 0.0862, 1, 0.1, 0.4, 555, 0, 9, 0, 0, 0, 0, 12], "semantic": {"name": "__init__", "arg_names": ["self", "text", "name", "context", "path", "writer", "lexers", "delimiters", "_super_nodes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, text,\n name=\"ParserContainer\",\n context=dict(),\n path='views/',\n writer='response.write',\n lexers={},\n delimiters=('{{', '}}'),\n _super_nodes = [],"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L247_C8", "label": "expression", "type": "expression", "loc": [247, 258], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "vector": [8, 2, 0.2754, 0.0131, 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 text -- text to parse\n context -- context to parse in\n path -- folder path to templates\n writer -- string of writer class to use\n lexers -- dict of custom lexers to use.\n delimiters -- for example ('{{','}}')\n _super_nodes -- a list of nodes to check for inclusion"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L261_C8", "label": "self.name =", "type": "assigned_variable", "loc": [261, 261], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "vector": [14, 2, 0.2846, 0.0011, 2, 0.41, 0.0714, 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_462:Assign_L263_C8", "label": "self.text =", "type": "assigned_variable", "loc": [263, 263], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "vector": [14, 2, 0.2868, 0.0011, 2, 0.41, 0.1429, 320, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.text = text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L267_C8", "label": "self.writer =", "type": "assigned_variable", "loc": [267, 267], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "vector": [14, 2, 0.2912, 0.0011, 2, 0.41, 0.2143, 205, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.writer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.writer = writer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L270_C8", "label": "if", "type": "if", "loc": [270, 273], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "vector": [4, 2, 0.2961, 0.0044, 2, 0.41, 0.2857, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(lexers, dict):\n self.lexers = lexers\n else:\n self.lexers = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L271_C12", "label": "self.lexers =", "type": "assigned_variable", "loc": [271, 271], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L270_C8", "vector": [14, 3, 0.2955, 0.0011, 3, 0.05, 0.0, 158, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.lexers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.lexers = lexers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L273_C12", "label": "self.lexers =", "type": "assigned_variable", "loc": [273, 273], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L270_C8", "vector": [14, 3, 0.2977, 0.0011, 3, 0.05, 1.0, 158, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.lexers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.lexers = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L276_C8", "label": "self.path =", "type": "assigned_variable", "loc": [276, 276], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "vector": [14, 2, 0.301, 0.0011, 2, 0.41, 0.3571, 425, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.path = path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L278_C8", "label": "self.context =", "type": "assigned_variable", "loc": [278, 278], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "vector": [14, 2, 0.3032, 0.0011, 2, 0.41, 0.4286, 249, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.context = context"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L281_C8", "label": "self.delimiters =", "type": "assigned_variable", "loc": [281, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "vector": [14, 2, 0.3064, 0.0011, 2, 0.41, 0.5, 614, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.delimiters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.delimiters = delimiters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L282_C8", "label": "if", "type": "if", "loc": [282, 292], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "vector": [4, 2, 0.313, 0.012, 2, 0.41, 0.5714, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if delimiters != self.default_delimiters:\n escaped_delimiters = (escape(delimiters[0]),\n escape(delimiters[1]))\n self.r_tag = compile(r'(%s.*?%s)' % escaped_delimiters, DOTALL)\n elif hasattr(context.get('response', None), 'delimiters'):\n if context['response'].delimiters != self.default_delimiters:\n escaped_delimiters = (\n escape(context['response'].delimiters[0]),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L283_C12", "label": "escaped_delimiters =", "type": "assigned_variable", "loc": [283, 284], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L282_C8", "vector": [14, 3, 0.3092, 0.0022, 3, 0.94, 0.0, 389, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "escaped_delimiters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " escaped_delimiters = (escape(delimiters[0]),\n escape(delimiters[1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L285_C12", "label": "self.r_tag = compile()", "type": "assigned_variable", "loc": [285, 285], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L282_C8", "vector": [14, 3, 0.3108, 0.0011, 3, 0.94, 0.5, 794, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "self.r_tag", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " self.r_tag = compile(r'(%s.*?%s)' % escaped_delimiters, DOTALL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L286_C8", "label": "if", "type": "if", "loc": [286, 292], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L282_C8", "vector": [4, 3, 0.3152, 0.0076, 3, 0.94, 1.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif hasattr(context.get('response', None), 'delimiters'):\n if context['response'].delimiters != self.default_delimiters:\n escaped_delimiters = (\n escape(context['response'].delimiters[0]),\n escape(context['response'].delimiters[1]))\n self.r_tag = compile(r'(%s.*?%s)' % escaped_delimiters,\n DOTALL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L287_C12", "label": "if", "type": "if", "loc": [287, 292], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L286_C8", "vector": [4, 4, 0.3157, 0.0065, 4, 0.52, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if context['response'].delimiters != self.default_delimiters:\n escaped_delimiters = (\n escape(context['response'].delimiters[0]),\n escape(context['response'].delimiters[1]))\n self.r_tag = compile(r'(%s.*?%s)' % escaped_delimiters,\n DOTALL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L288_C16", "label": "escaped_delimiters =", "type": "assigned_variable", "loc": [288, 290], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L287_C12", "vector": [14, 5, 0.3152, 0.0033, 5, 0.86, 0.0, 389, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "escaped_delimiters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " escaped_delimiters = (\n escape(context['response'].delimiters[0]),\n escape(context['response'].delimiters[1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L291_C16", "label": "self.r_tag = compile()", "type": "assigned_variable", "loc": [291, 292], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L287_C12", "vector": [14, 5, 0.3179, 0.0022, 5, 0.86, 1.0, 794, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "self.r_tag", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " self.r_tag = compile(r'(%s.*?%s)' % escaped_delimiters,\n DOTALL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L295_C8", "label": "self.content = Content()", "type": "assigned_variable", "loc": [295, 295], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "vector": [14, 2, 0.3217, 0.0011, 2, 0.41, 0.6429, 943, 3, 1, 0, 0, 758, 10, 1], "semantic": {"name": "self.content", "arg_names": [], "import_names": [], "rhs_call_name": "Content", "annotation": ""}, "snippet": " self.content = Content(name=name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L301_C8", "label": "self.stack =", "type": "assigned_variable", "loc": [301, 301], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "vector": [14, 2, 0.3282, 0.0011, 2, 0.41, 0.7143, 75, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.stack", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.stack = [self.content]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L305_C8", "label": "self.super_nodes =", "type": "assigned_variable", "loc": [305, 305], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "vector": [14, 2, 0.3326, 0.0011, 2, 0.41, 0.7857, 523, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.super_nodes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.super_nodes = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L309_C8", "label": "self.child_super_nodes =", "type": "assigned_variable", "loc": [309, 309], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "vector": [14, 2, 0.337, 0.0011, 2, 0.41, 0.8571, 964, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.child_super_nodes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.child_super_nodes = _super_nodes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L313_C8", "label": "self.blocks =", "type": "assigned_variable", "loc": [313, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "vector": [14, 2, 0.3413, 0.0011, 2, 0.41, 0.9286, 356, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.blocks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.blocks = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L316_C8", "label": "parse()", "type": "expression", "loc": [316, 316], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "vector": [8, 2, 0.3446, 0.0011, 2, 0.41, 1.0, 678, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "parse", "arg_names": [], "import_names": [], "rhs_call_name": "parse", "annotation": ""}, "snippet": " self.parse(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L318_C4", "label": "to_string", "type": "function", "loc": [318, 324], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "vector": [2, 1, 0.3501, 0.0076, 1, 0.1, 0.4667, 549, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "to_string", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def to_string(self):\n \"\"\"\n Return the parsed template with correct indentation.\n\n Used to make it easier to port to python3.\n \"\"\"\n return self.reindent(str(self.content))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L319_C8", "label": "expression", "type": "expression", "loc": [319, 323], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L318_C4", "vector": [8, 2, 0.3501, 0.0055, 2, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Return the parsed template with correct indentation.\n\n Used to make it easier to port to python3.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L324_C8", "label": "return", "type": "return", "loc": [324, 324], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L318_C4", "vector": [13, 2, 0.3533, 0.0011, 2, 0.49, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.reindent(str(self.content))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L326_C4", "label": "__str__", "type": "function", "loc": [326, 328], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "vector": [2, 1, 0.3566, 0.0033, 1, 0.1, 0.5333, 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 \"Make sure str works exactly the same as python 3\"\n return self.to_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L327_C8", "label": "expression", "type": "expression", "loc": [327, 327], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L326_C4", "vector": [8, 2, 0.3566, 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": " \"Make sure str works exactly the same as python 3\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L328_C8", "label": "return", "type": "return", "loc": [328, 328], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L326_C4", "vector": [13, 2, 0.3577, 0.0011, 2, 0.6, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.to_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L330_C4", "label": "__unicode__", "type": "function", "loc": [330, 332], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "vector": [2, 1, 0.361, 0.0033, 1, 0.1, 0.6, 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 \"Make sure str works exactly the same as python 3\"\n return self.to_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L331_C8", "label": "expression", "type": "expression", "loc": [331, 331], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L330_C4", "vector": [8, 2, 0.361, 0.0011, 2, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Make sure str works exactly the same as python 3\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L332_C8", "label": "return", "type": "return", "loc": [332, 332], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L330_C4", "vector": [13, 2, 0.3621, 0.0011, 2, 0.76, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.to_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L334_C4", "label": "reindent", "type": "function", "loc": [334, 410], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "vector": [2, 1, 0.4057, 0.084, 1, 0.1, 0.6667, 707, 0, 2, 1, 0, 0, 0, 12], "semantic": {"name": "reindent", "arg_names": ["self", "text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def reindent(self, text):\n \"\"\"\n Reindents a string of unindented python code.\n \"\"\"\n\n # Get each of our lines into an array.\n lines = text.split('\\n')\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L335_C8", "label": "expression", "type": "expression", "loc": [335, 337], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L334_C4", "vector": [8, 2, 0.3664, 0.0033, 2, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Reindents a string of unindented python code.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L340_C8", "label": "lines = split()", "type": "assigned_variable", "loc": [340, 340], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L334_C4", "vector": [14, 2, 0.3708, 0.0011, 2, 0.43, 0.125, 73, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "lines", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " lines = text.split('\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L343_C8", "label": "new_lines =", "type": "assigned_variable", "loc": [343, 343], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L334_C4", "vector": [14, 2, 0.374, 0.0011, 2, 0.43, 0.25, 675, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_lines", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_lines = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L348_C8", "label": "credit =", "type": "assigned_variable", "loc": [348, 348], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L334_C4", "vector": [14, 2, 0.3795, 0.0011, 2, 0.43, 0.375, 989, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "credit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " credit = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L351_C8", "label": "k =", "type": "assigned_variable", "loc": [351, 351], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L334_C4", "vector": [14, 2, 0.3828, 0.0011, 2, 0.43, 0.5, 954, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " k = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:For_L361_C8", "label": "for raw_line", "type": "for", "loc": [361, 399], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L334_C4", "vector": [6, 2, 0.4144, 0.0425, 2, 0.43, 0.625, 133, 2, 0, 0, 0, 0, 0, 8], "semantic": {"name": "raw_line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for raw_line in lines:\n line = raw_line.strip()\n\n # ignore empty lines\n if not line:\n continue\n\n # If we have a line that contains python code that"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L362_C12", "label": "line = strip()", "type": "assigned_variable", "loc": [362, 362], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:For_L361_C8", "vector": [14, 3, 0.3948, 0.0011, 3, 0.32, 0.0, 373, 3, 0, 0, 0, 973, 10, 1], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "strip", "annotation": ""}, "snippet": " line = raw_line.strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L365_C12", "label": "if", "type": "if", "loc": [365, 366], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:For_L361_C8", "vector": [4, 3, 0.3986, 0.0022, 3, 0.32, 0.125, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not line:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L371_C12", "label": "if", "type": "if", "loc": [371, 372], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:For_L361_C8", "vector": [4, 3, 0.4051, 0.0022, 3, 0.32, 0.25, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if TemplateParser.re_block.match(line):\n k = k + credit - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L372_C16", "label": "k =", "type": "assigned_variable", "loc": [372, 372], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L371_C12", "vector": [14, 4, 0.4057, 0.0011, 4, 0.74, 0.0, 954, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " k = k + credit - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L375_C12", "label": "k = max()", "type": "assigned_variable", "loc": [375, 375], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:For_L361_C8", "vector": [14, 3, 0.4089, 0.0011, 3, 0.32, 0.375, 954, 3, 2, 0, 0, 442, 10, 1], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "max", "annotation": ""}, "snippet": " k = max(k, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L378_C12", "label": "append()", "type": "expression", "loc": [378, 378], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:For_L361_C8", "vector": [8, 3, 0.4122, 0.0011, 3, 0.32, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_lines.append(' ' * (4 * k) + line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L381_C12", "label": "credit =", "type": "assigned_variable", "loc": [381, 381], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:For_L361_C8", "vector": [14, 3, 0.4155, 0.0011, 3, 0.32, 0.625, 989, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "credit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " credit = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L384_C12", "label": "if", "type": "if", "loc": [384, 385], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:For_L361_C8", "vector": [4, 3, 0.4193, 0.0022, 3, 0.32, 0.75, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if TemplateParser.re_pass.match(line):\n k -= 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L392_C12", "label": "if", "type": "if", "loc": [392, 394], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:For_L361_C8", "vector": [4, 3, 0.4286, 0.0033, 3, 0.32, 0.875, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if TemplateParser.re_unblock.match(line):\n credit = 1\n k -= 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L393_C16", "label": "credit =", "type": "assigned_variable", "loc": [393, 393], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L392_C12", "vector": [14, 4, 0.4286, 0.0011, 4, 0.14, 0.0, 989, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "credit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " credit = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L398_C12", "label": "if", "type": "if", "loc": [398, 399], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:For_L361_C8", "vector": [4, 3, 0.4346, 0.0022, 3, 0.32, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if line.endswith(':') and not line.startswith('#'):\n k += 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L403_C8", "label": "new_text = join()", "type": "assigned_variable", "loc": [403, 403], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L334_C4", "vector": [14, 2, 0.4395, 0.0011, 2, 0.43, 0.75, 845, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "new_text", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " new_text = '\\n'.join(new_lines)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L405_C8", "label": "if", "type": "if", "loc": [405, 408], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L334_C4", "vector": [4, 2, 0.4433, 0.0044, 2, 0.43, 0.875, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k > 0:\n self._raise_error('missing \"pass\" in view', new_text)\n elif k < 0:\n self._raise_error('too many \"pass\" in view', new_text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L406_C12", "label": "_raise_error()", "type": "expression", "loc": [406, 406], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L405_C8", "vector": [8, 3, 0.4427, 0.0011, 3, 0.12, 0.0, 145, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_raise_error", "arg_names": [], "import_names": [], "rhs_call_name": "_raise_error", "annotation": ""}, "snippet": " self._raise_error('missing \"pass\" in view', new_text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L407_C8", "label": "if", "type": "if", "loc": [407, 408], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L405_C8", "vector": [4, 3, 0.4444, 0.0022, 3, 0.12, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif k < 0:\n self._raise_error('too many \"pass\" in view', new_text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L408_C12", "label": "_raise_error()", "type": "expression", "loc": [408, 408], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L407_C8", "vector": [8, 4, 0.4449, 0.0011, 4, 0.12, 0.0, 145, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_raise_error", "arg_names": [], "import_names": [], "rhs_call_name": "_raise_error", "annotation": ""}, "snippet": " self._raise_error('too many \"pass\" in view', new_text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L410_C8", "label": "return", "type": "return", "loc": [410, 410], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L334_C4", "vector": [13, 2, 0.4471, 0.0011, 2, 0.43, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return new_text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L412_C4", "label": "_raise_error", "type": "function", "loc": [412, 416], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "vector": [2, 1, 0.4515, 0.0055, 1, 0.1, 0.7333, 145, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "_raise_error", "arg_names": ["self", "message", "text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _raise_error(self, message='', text=None):\n \"\"\"\n Raise an error using itself as the filename and textual content.\n \"\"\"\n raise RestrictedError(self.name, text or self.text, message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L413_C8", "label": "expression", "type": "expression", "loc": [413, 415], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L412_C4", "vector": [8, 2, 0.4515, 0.0033, 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 Raise an error using itself as the filename and textual content.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L418_C4", "label": "_get_file_text", "type": "function", "loc": [418, 449], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "vector": [2, 1, 0.4727, 0.0349, 1, 0.1, 0.8, 390, 0, 2, 1, 0, 0, 0, 9], "semantic": {"name": "_get_file_text", "arg_names": ["self", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_file_text(self, filename):\n \"\"\"\n Attempt to open ``filename`` and retrieve its text.\n\n This will use self.path to search for the file.\n \"\"\"\n\n # If they didn't specify a filename, how can we find one!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L419_C8", "label": "expression", "type": "expression", "loc": [419, 423], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L418_C4", "vector": [8, 2, 0.4591, 0.0055, 2, 0.1, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Attempt to open ``filename`` and retrieve its text.\n\n This will use self.path to search for the file.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L426_C8", "label": "if", "type": "if", "loc": [426, 427], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L418_C4", "vector": [4, 2, 0.4651, 0.0022, 2, 0.1, 0.1429, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not filename.strip():\n self._raise_error('Invalid template filename')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L427_C12", "label": "_raise_error()", "type": "expression", "loc": [427, 427], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L426_C8", "vector": [8, 3, 0.4656, 0.0011, 3, 0.67, 0.0, 145, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_raise_error", "arg_names": [], "import_names": [], "rhs_call_name": "_raise_error", "annotation": ""}, "snippet": " self._raise_error('Invalid template filename')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L430_C8", "label": "context =", "type": "assigned_variable", "loc": [430, 430], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L418_C4", "vector": [14, 2, 0.4689, 0.0011, 2, 0.1, 0.2857, 954, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " context = self.context"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L431_C8", "label": "if", "type": "if", "loc": [431, 432], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L418_C4", "vector": [4, 2, 0.4706, 0.0022, 2, 0.1, 0.4286, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if current and not \"response\" in context:\n context[\"response\"] = getattr(current, 'response', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L432_C12", "label": " = getattr()", "type": "assigned_variable", "loc": [432, 432], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L431_C8", "vector": [14, 3, 0.4711, 0.0011, 3, 0.62, 0.0, 0, 3, 3, 0, 0, 121, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " context[\"response\"] = getattr(current, 'response', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L436_C8", "label": "filename = eval()", "type": "assigned_variable", "loc": [436, 436], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L418_C4", "vector": [14, 2, 0.4755, 0.0011, 2, 0.1, 0.5714, 275, 3, 2, 0, 0, 776, 10, 1], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "eval", "annotation": ""}, "snippet": " filename = eval(filename, context)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L439_C8", "label": "filepath =", "type": "assigned_variable", "loc": [439, 439], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L418_C4", "vector": [14, 2, 0.4787, 0.0011, 2, 0.1, 0.7143, 137, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "filepath", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filepath = self.path and os.path.join(self.path, filename) or filename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L442_C8", "label": "try", "type": "try", "loc": [442, 447], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L418_C4", "vector": [7, 2, 0.4847, 0.0065, 2, 0.1, 0.8571, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n fileobj = open(filepath, 'rb')\n text = fileobj.read()\n fileobj.close()\n except IOError:\n self._raise_error('Unable to open included view file: ' + filepath)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L443_C12", "label": "fileobj = open()", "type": "assigned_variable", "loc": [443, 443], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L442_C8", "vector": [14, 3, 0.4831, 0.0011, 3, 0.68, 0.0, 115, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fileobj", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " fileobj = open(filepath, 'rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L444_C12", "label": "text = read()", "type": "assigned_variable", "loc": [444, 444], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L442_C8", "vector": [14, 3, 0.4842, 0.0011, 3, 0.68, 0.5, 439, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " text = fileobj.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L445_C12", "label": "close()", "type": "expression", "loc": [445, 445], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L442_C8", "vector": [8, 3, 0.4853, 0.0011, 3, 0.68, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fileobj.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L447_C12", "label": "_raise_error()", "type": "expression", "loc": [447, 447], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L442_C8", "vector": [8, 3, 0.4875, 0.0011, 3, 0.68, 0.0, 145, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_raise_error", "arg_names": [], "import_names": [], "rhs_call_name": "_raise_error", "annotation": ""}, "snippet": " self._raise_error('Unable to open included view file: ' + filepath)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L449_C8", "label": "return", "type": "return", "loc": [449, 449], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L418_C4", "vector": [13, 2, 0.4896, 0.0011, 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 text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L451_C4", "label": "include", "type": "function", "loc": [451, 464], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "vector": [2, 1, 0.4989, 0.0153, 1, 0.1, 0.8667, 142, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "include", "arg_names": ["self", "content", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def include(self, content, filename):\n \"\"\"\n Include ``filename`` here.\n \"\"\"\n text = self._get_file_text(filename)\n\n t = TemplateParser(text,\n name=filename,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L452_C8", "label": "expression", "type": "expression", "loc": [452, 454], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L451_C4", "vector": [8, 2, 0.494, 0.0033, 2, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Include ``filename`` here.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L455_C8", "label": "text = _get_file_text()", "type": "assigned_variable", "loc": [455, 455], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L451_C4", "vector": [14, 2, 0.4962, 0.0011, 2, 0.74, 0.3333, 439, 3, 1, 0, 0, 390, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "_get_file_text", "annotation": ""}, "snippet": " text = self._get_file_text(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L457_C8", "label": "t = TemplateParser()", "type": "assigned_variable", "loc": [457, 462], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L451_C4", "vector": [14, 2, 0.5011, 0.0065, 2, 0.74, 0.6667, 15, 3, 6, 0, 0, 732, 10, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "TemplateParser", "annotation": ""}, "snippet": " t = TemplateParser(text,\n name=filename,\n context=self.context,\n path=self.path,\n writer=self.writer,\n delimiters=self.delimiters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L464_C8", "label": "append()", "type": "expression", "loc": [464, 464], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L451_C4", "vector": [8, 2, 0.506, 0.0011, 2, 0.74, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " content.append(t.content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "label": "extend", "type": "function", "loc": [466, 532], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "vector": [2, 1, 0.5442, 0.0731, 1, 0.1, 0.9333, 660, 0, 2, 0, 0, 0, 0, 12], "semantic": {"name": "extend", "arg_names": ["self", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def extend(self, filename):\n \"\"\"\n Extend ``filename``. Anything not declared in a block defined by the\n parent will be placed in the parent templates ``{{include}}`` block.\n \"\"\"\n text = self._get_file_text(filename)\n\n # Create out nodes list to send to the parent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L467_C8", "label": "expression", "type": "expression", "loc": [467, 470], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "vector": [8, 2, 0.5109, 0.0044, 2, 0.0, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Extend ``filename``. Anything not declared in a block defined by the\n parent will be placed in the parent templates ``{{include}}`` block.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L471_C8", "label": "text = _get_file_text()", "type": "assigned_variable", "loc": [471, 471], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "vector": [14, 2, 0.5136, 0.0011, 2, 0.0, 0.0714, 439, 3, 1, 0, 0, 390, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "_get_file_text", "annotation": ""}, "snippet": " text = self._get_file_text(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L474_C8", "label": "super_nodes =", "type": "assigned_variable", "loc": [474, 474], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "vector": [14, 2, 0.5169, 0.0011, 2, 0.0, 0.1429, 141, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "super_nodes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " super_nodes = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L476_C8", "label": "extend()", "type": "expression", "loc": [476, 476], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "vector": [8, 2, 0.5191, 0.0011, 2, 0.0, 0.2143, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " super_nodes.extend(self.child_super_nodes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L478_C8", "label": "extend()", "type": "expression", "loc": [478, 478], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "vector": [8, 2, 0.5213, 0.0011, 2, 0.0, 0.2857, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " super_nodes.extend(self.super_nodes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L480_C8", "label": "t = TemplateParser()", "type": "assigned_variable", "loc": [480, 486], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "vector": [14, 2, 0.5267, 0.0076, 2, 0.0, 0.3571, 15, 3, 7, 0, 0, 732, 10, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "TemplateParser", "annotation": ""}, "snippet": " t = TemplateParser(text,\n name=filename,\n context=self.context,\n path=self.path,\n writer=self.writer,\n delimiters=self.delimiters,\n _super_nodes=super_nodes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L490_C8", "label": "buf = BlockNode()", "type": "assigned_variable", "loc": [490, 491], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "vector": [14, 2, 0.5349, 0.0022, 2, 0.0, 0.4286, 840, 3, 2, 0, 0, 680, 10, 1], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "BlockNode", "annotation": ""}, "snippet": " buf = BlockNode(\n name='__include__' + filename, delimiters=self.delimiters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L492_C8", "label": "pre =", "type": "assigned_variable", "loc": [492, 492], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "vector": [14, 2, 0.5365, 0.0011, 2, 0.0, 0.5, 793, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "pre", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pre = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:For_L495_C8", "label": "for node", "type": "for", "loc": [495, 514], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "vector": [6, 2, 0.5502, 0.0218, 2, 0.0, 0.5714, 772, 7, 0, 0, 0, 0, 0, 5], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for node in self.content.nodes:\n # If a node is a block\n if isinstance(node, BlockNode):\n # That happens to be in the parent template\n if node.name in t.content.blocks:\n # Do not include it\n continue\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L497_C12", "label": "if", "type": "if", "loc": [497, 501], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:For_L495_C8", "vector": [4, 3, 0.5442, 0.0055, 3, 0.82, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(node, BlockNode):\n # That happens to be in the parent template\n if node.name in t.content.blocks:\n # Do not include it\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L499_C16", "label": "if", "type": "if", "loc": [499, 501], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L497_C12", "vector": [4, 4, 0.5453, 0.0033, 4, 0.41, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if node.name in t.content.blocks:\n # Do not include it\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L503_C12", "label": "if", "type": "if", "loc": [503, 514], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:For_L495_C8", "vector": [4, 3, 0.5545, 0.0131, 3, 0.82, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(node, Node):\n # Or if the node was before the extension\n # we should not include it\n if node.pre_extend:\n pre.append(node)\n continue\n\n # Otherwise, it should go int the"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L506_C16", "label": "if", "type": "if", "loc": [506, 508], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L503_C12", "vector": [4, 4, 0.5529, 0.0033, 4, 0.36, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if node.pre_extend:\n pre.append(node)\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L507_C20", "label": "append()", "type": "expression", "loc": [507, 507], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L506_C16", "vector": [8, 5, 0.5529, 0.0011, 5, 0.34, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " pre.append(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L512_C16", "label": "append()", "type": "expression", "loc": [512, 512], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L503_C12", "vector": [8, 4, 0.5583, 0.0011, 4, 0.36, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " buf.append(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L514_C16", "label": "append()", "type": "expression", "loc": [514, 514], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L503_C12", "vector": [8, 4, 0.5605, 0.0011, 4, 0.36, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " buf.append(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L518_C8", "label": "self.content.nodes =", "type": "assigned_variable", "loc": [518, 518], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "vector": [14, 2, 0.5649, 0.0011, 2, 0.0, 0.6429, 36, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.content.nodes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.content.nodes = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L520_C8", "label": "t_content =", "type": "assigned_variable", "loc": [520, 520], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "vector": [14, 2, 0.5671, 0.0011, 2, 0.0, 0.7143, 466, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "t_content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t_content = t.content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L523_C8", "label": "assign", "type": "assigned_variable", "loc": [523, 523], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "vector": [14, 2, 0.5703, 0.0011, 2, 0.0, 0.7857, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t_content.blocks['__include__' + filename] = buf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L526_C8", "label": "insert()", "type": "expression", "loc": [526, 526], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "vector": [8, 2, 0.5736, 0.0011, 2, 0.0, 0.8571, 368, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " t_content.insert(pre)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L529_C8", "label": "extend()", "type": "expression", "loc": [529, 529], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "vector": [8, 2, 0.5769, 0.0011, 2, 0.0, 0.9286, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " t_content.extend(self.content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L532_C8", "label": "self.content =", "type": "assigned_variable", "loc": [532, 532], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "vector": [14, 2, 0.5802, 0.0011, 2, 0.0, 1.0, 943, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.content = t_content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L534_C4", "label": "parse", "type": "function", "loc": [534, 756], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "vector": [2, 1, 0.7034, 0.2432, 1, 0.1, 1.0, 678, 0, 2, 1, 0, 0, 0, 47], "semantic": {"name": "parse", "arg_names": ["self", "text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parse(self, text):\n\n # Basically, r_tag.split will split the text into\n # an array containing, 'non-tag', 'tag', 'non-tag', 'tag'\n # so if we alternate this variable, we know\n # what to look for. This is alternate to\n # line.startswith(\"{{\")\n in_tag = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L541_C8", "label": "in_tag =", "type": "assigned_variable", "loc": [541, 541], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L534_C4", "vector": [14, 2, 0.59, 0.0011, 2, 0.71, 0.0, 810, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "in_tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " in_tag = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L542_C8", "label": "extend =", "type": "assigned_variable", "loc": [542, 542], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L534_C4", "vector": [14, 2, 0.5911, 0.0011, 2, 0.71, 0.1111, 660, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " extend = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L543_C8", "label": "pre_extend =", "type": "assigned_variable", "loc": [543, 543], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L534_C4", "vector": [14, 2, 0.5921, 0.0011, 2, 0.71, 0.2222, 684, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "pre_extend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pre_extend = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L548_C8", "label": "ij = split()", "type": "assigned_variable", "loc": [548, 548], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L534_C4", "vector": [14, 2, 0.5976, 0.0011, 2, 0.71, 0.3333, 953, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "ij", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " ij = self.r_tag.split(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L551_C8", "label": "stack =", "type": "assigned_variable", "loc": [551, 551], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L534_C4", "vector": [14, 2, 0.6009, 0.0011, 2, 0.71, 0.4444, 540, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "stack", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " stack = self.stack"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:For_L552_C8", "label": "for j", "type": "for", "loc": [552, 733], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L534_C4", "vector": [6, 2, 0.7007, 0.1985, 2, 0.71, 0.5556, 100, 3, 0, 0, 0, 0, 0, 43], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for j in range(len(ij)):\n i = ij[j]\n\n if i:\n if not stack:\n self._raise_error('The \"end\" tag is unmatched, please check if you have a starting \"block\" tag')\n\n # Our current element in the stack."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L553_C12", "label": "i =", "type": "assigned_variable", "loc": [553, 553], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:For_L552_C8", "vector": [14, 3, 0.6031, 0.0011, 3, 0.47, 0.0, 826, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i = ij[j]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L555_C12", "label": "if", "type": "if", "loc": [555, 730], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:For_L552_C8", "vector": [4, 3, 0.7007, 0.1919, 3, 0.47, 0.5, 0, 2, 0, 0, 0, 0, 0, 41], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i:\n if not stack:\n self._raise_error('The \"end\" tag is unmatched, please check if you have a starting \"block\" tag')\n\n # Our current element in the stack.\n top = stack[-1]\n\n if in_tag:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L556_C16", "label": "if", "type": "if", "loc": [556, 557], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L555_C12", "vector": [4, 4, 0.6069, 0.0022, 4, 0.7, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not stack:\n self._raise_error('The \"end\" tag is unmatched, please check if you have a starting \"block\" tag')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L557_C20", "label": "_raise_error()", "type": "expression", "loc": [557, 557], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L556_C16", "vector": [8, 5, 0.6074, 0.0011, 5, 0.24, 0.0, 145, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_raise_error", "arg_names": [], "import_names": [], "rhs_call_name": "_raise_error", "annotation": ""}, "snippet": " self._raise_error('The \"end\" tag is unmatched, please check if you have a starting \"block\" tag')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L560_C16", "label": "top =", "type": "assigned_variable", "loc": [560, 560], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L555_C12", "vector": [14, 4, 0.6107, 0.0011, 4, 0.7, 0.5, 208, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "top", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " top = stack[-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L562_C16", "label": "if", "type": "if", "loc": [562, 730], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L555_C12", "vector": [4, 4, 0.7045, 0.1843, 4, 0.7, 1.0, 0, 2, 0, 0, 0, 0, 0, 40], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if in_tag:\n line = i\n\n # Get rid of '{{' and '}}'\n line = line[2:-2].strip()\n\n # This is bad juju, but let's do it anyway\n if not line:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L563_C20", "label": "line =", "type": "assigned_variable", "loc": [563, 563], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L562_C16", "vector": [14, 5, 0.614, 0.0011, 5, 0.62, 0.0, 373, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " line = i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L566_C20", "label": "line = strip()", "type": "assigned_variable", "loc": [566, 566], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L562_C16", "vector": [14, 5, 0.6172, 0.0011, 5, 0.62, 0.125, 373, 3, 0, 0, 0, 973, 10, 1], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "strip", "annotation": ""}, "snippet": " line = line[2:-2].strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L569_C20", "label": "if", "type": "if", "loc": [569, 570], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L562_C16", "vector": [4, 5, 0.621, 0.0022, 5, 0.62, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not line:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L574_C20", "label": "remove_newline", "type": "function", "loc": [574, 577], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L562_C16", "vector": [2, 5, 0.6276, 0.0044, 5, 0.62, 0.375, 55, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "remove_newline", "arg_names": ["re_val"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remove_newline(re_val):\n # Take the entire match and replace newlines with\n # escaped newlines.\n return re_val.group(0).replace('\\n', '\\\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L577_C24", "label": "return", "type": "return", "loc": [577, 577], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L574_C20", "vector": [13, 6, 0.6292, 0.0011, 6, 0.0, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return re_val.group(0).replace('\\n', '\\\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L582_C20", "label": "line = sub()", "type": "assigned_variable", "loc": [582, 584], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L562_C16", "vector": [14, 5, 0.6358, 0.0033, 5, 0.62, 0.5, 373, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " line = sub(TemplateParser.r_multiline,\n remove_newline,\n line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L586_C20", "label": "if", "type": "if", "loc": [586, 603], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L562_C16", "vector": [4, 5, 0.6483, 0.0196, 5, 0.62, 0.625, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if line.startswith('='):\n # IE: {{=response.title}}\n name, value = '=', line[1:].strip()\n else:\n v = line.split(' ', 1)\n if len(v) == 1:\n # Example\n # {{ include }}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L588_C24", "label": "name, value =", "type": "assigned_variable", "loc": [588, 588], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L586_C20", "vector": [14, 6, 0.6412, 0.0011, 6, 0.05, 0.0, 509, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "name, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name, value = '=', line[1:].strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L590_C24", "label": "v = split()", "type": "assigned_variable", "loc": [590, 590], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L586_C20", "vector": [14, 6, 0.6434, 0.0011, 6, 0.05, 0.5, 553, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "v", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " v = line.split(' ', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L591_C24", "label": "if", "type": "if", "loc": [591, 603], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L586_C20", "vector": [4, 6, 0.651, 0.0142, 6, 0.05, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(v) == 1:\n # Example\n # {{ include }}\n # {{ end }}\n name = v[0]\n value = ''\n else:\n # Example"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L595_C28", "label": "name =", "type": "assigned_variable", "loc": [595, 595], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L591_C24", "vector": [14, 7, 0.6489, 0.0011, 7, 0.05, 0.0, 57, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = v[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L596_C28", "label": "value =", "type": "assigned_variable", "loc": [596, 596], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L591_C24", "vector": [14, 7, 0.6499, 0.0011, 7, 0.05, 0.3333, 441, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L602_C28", "label": "name =", "type": "assigned_variable", "loc": [602, 602], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L591_C24", "vector": [14, 7, 0.6565, 0.0011, 7, 0.05, 0.6667, 57, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = v[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L603_C28", "label": "value =", "type": "assigned_variable", "loc": [603, 603], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L591_C24", "vector": [14, 7, 0.6576, 0.0011, 7, 0.05, 1.0, 441, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = v[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L611_C20", "label": "if", "type": "if", "loc": [611, 725], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L562_C16", "vector": [4, 5, 0.7285, 0.1254, 5, 0.62, 0.75, 0, 0, 0, 0, 0, 0, 0, 30], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name in self.lexers:\n # Pass the information to the lexer\n # and allow it to inject in the environment\n\n # You can define custom names such as\n # '{{<<variable}}' which could potentially\n # write unescaped version of the variable.\n self.lexers[name](parser=self,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L618_C24", "label": "expression", "type": "expression", "loc": [618, 621], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L611_C20", "vector": [8, 6, 0.6756, 0.0044, 6, 0.42, 0.0, 0, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.lexers[name](parser=self,\n value=value,\n top=top,\n stack=stack)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L623_C20", "label": "if", "type": "if", "loc": [623, 725], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L611_C20", "vector": [4, 6, 0.735, 0.1123, 6, 0.42, 1.0, 0, 0, 0, 0, 0, 0, 0, 29], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif name == '=':\n # So we have a variable to insert into\n # the template\n buf = \"\\n%s(%s)\" % (self.writer, value)\n top.append(Node(buf, pre_extend=pre_extend))\n\n elif name == 'block' and not value.startswith('='):\n # Make a new node with name."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L626_C24", "label": "buf =", "type": "assigned_variable", "loc": [626, 626], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L623_C20", "vector": [14, 7, 0.6827, 0.0011, 7, 0.45, 0.0, 840, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " buf = \"\\n%s(%s)\" % (self.writer, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L627_C24", "label": "append()", "type": "expression", "loc": [627, 627], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L623_C20", "vector": [8, 7, 0.6838, 0.0011, 7, 0.45, 0.5, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " top.append(Node(buf, pre_extend=pre_extend))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L629_C20", "label": "if", "type": "if", "loc": [629, 725], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L623_C20", "vector": [4, 7, 0.7383, 0.1058, 7, 0.45, 1.0, 0, 0, 0, 0, 0, 0, 0, 27], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif name == 'block' and not value.startswith('='):\n # Make a new node with name.\n node = BlockNode(name=value.strip(),\n pre_extend=pre_extend,\n delimiters=self.delimiters)\n\n # Append this node to our active node\n top.append(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L631_C24", "label": "node = BlockNode()", "type": "assigned_variable", "loc": [631, 633], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L629_C20", "vector": [14, 8, 0.6892, 0.0033, 8, 0.32, 0.0, 772, 3, 3, 0, 0, 680, 10, 2], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "BlockNode", "annotation": ""}, "snippet": " node = BlockNode(name=value.strip(),\n pre_extend=pre_extend,\n delimiters=self.delimiters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L636_C24", "label": "append()", "type": "expression", "loc": [636, 636], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L629_C20", "vector": [8, 8, 0.6936, 0.0011, 8, 0.32, 0.3333, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " top.append(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L642_C24", "label": "append()", "type": "expression", "loc": [642, 642], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L629_C20", "vector": [8, 8, 0.7001, 0.0011, 8, 0.32, 0.6667, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " stack.append(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L644_C20", "label": "if", "type": "if", "loc": [644, 725], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L629_C20", "vector": [4, 8, 0.7465, 0.0894, 8, 0.32, 1.0, 0, 0, 0, 0, 0, 0, 0, 22], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif name == 'end' and not value.startswith('='):\n # We are done with this node.\n\n # Save an instance of it\n self.blocks[top.name] = top\n\n # Pop it.\n stack.pop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L648_C24", "label": "assign", "type": "assigned_variable", "loc": [648, 648], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L644_C20", "vector": [14, 9, 0.7067, 0.0011, 9, 0.55, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.blocks[top.name] = top"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L651_C24", "label": "pop()", "type": "expression", "loc": [651, 651], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L644_C20", "vector": [8, 9, 0.7099, 0.0011, 9, 0.55, 0.5, 969, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pop", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " stack.pop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L653_C20", "label": "if", "type": "if", "loc": [653, 725], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L644_C20", "vector": [4, 9, 0.7514, 0.0796, 9, 0.55, 1.0, 0, 0, 0, 0, 0, 0, 0, 20], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif name == 'super' and not value.startswith('='):\n # Get our correct target name\n # If they just called {{super}} without a name\n # attempt to assume the top blocks name.\n if value:\n target_node = value\n else:\n target_node = top.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L657_C24", "label": "if", "type": "if", "loc": [657, 660], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L653_C20", "vector": [4, 10, 0.7181, 0.0044, 10, 0.56, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value:\n target_node = value\n else:\n target_node = top.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L658_C28", "label": "target_node =", "type": "assigned_variable", "loc": [658, 658], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L657_C24", "vector": [14, 11, 0.7176, 0.0011, 11, 0.52, 0.0, 367, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "target_node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " target_node = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L660_C28", "label": "target_node =", "type": "assigned_variable", "loc": [660, 660], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L657_C24", "vector": [14, 11, 0.7197, 0.0011, 11, 0.52, 1.0, 367, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "target_node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " target_node = top.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L663_C24", "label": "node = SuperNode()", "type": "assigned_variable", "loc": [663, 664], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L653_C20", "vector": [14, 10, 0.7236, 0.0022, 10, 0.56, 0.25, 772, 3, 2, 0, 0, 784, 10, 1], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "SuperNode", "annotation": ""}, "snippet": " node = SuperNode(name=target_node,\n pre_extend=pre_extend)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L667_C24", "label": "append()", "type": "expression", "loc": [667, 667], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L653_C20", "vector": [8, 10, 0.7274, 0.0011, 10, 0.56, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.super_nodes.append(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L670_C24", "label": "append()", "type": "expression", "loc": [670, 670], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L653_C20", "vector": [8, 10, 0.7306, 0.0011, 10, 0.56, 0.75, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " top.append(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L672_C20", "label": "if", "type": "if", "loc": [672, 725], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L653_C20", "vector": [4, 10, 0.7617, 0.0589, 10, 0.56, 1.0, 0, 0, 0, 0, 0, 0, 0, 16], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif name == 'include' and not value.startswith('='):\n # If we know the target file to include\n if value:\n self.include(top, value)\n\n # Otherwise, make a temporary include node\n # That the child node will know to hook into.\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L674_C24", "label": "if", "type": "if", "loc": [674, 684], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L672_C20", "vector": [4, 11, 0.7405, 0.012, 11, 0.67, 0.0, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value:\n self.include(top, value)\n\n # Otherwise, make a temporary include node\n # That the child node will know to hook into.\n else:\n include_node = BlockNode(\n name='__include__' + self.name,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L675_C28", "label": "include()", "type": "expression", "loc": [675, 675], "level": 12, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L674_C24", "vector": [8, 12, 0.7361, 0.0011, 12, 0.54, 0.0, 142, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "include", "arg_names": [], "import_names": [], "rhs_call_name": "include", "annotation": ""}, "snippet": " self.include(top, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L680_C28", "label": "include_node = BlockNode()", "type": "assigned_variable", "loc": [680, 683], "level": 12, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L674_C24", "vector": [14, 12, 0.7432, 0.0044, 12, 0.54, 0.5, 207, 3, 3, 0, 0, 680, 10, 1], "semantic": {"name": "include_node", "arg_names": [], "import_names": [], "rhs_call_name": "BlockNode", "annotation": ""}, "snippet": " include_node = BlockNode(\n name='__include__' + self.name,\n pre_extend=pre_extend,\n delimiters=self.delimiters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L684_C28", "label": "append()", "type": "expression", "loc": [684, 684], "level": 12, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L674_C24", "vector": [8, 12, 0.7459, 0.0011, 12, 0.54, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " top.append(include_node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L686_C20", "label": "if", "type": "if", "loc": [686, 725], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L672_C20", "vector": [4, 11, 0.7694, 0.0436, 11, 0.67, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif name == 'extend' and not value.startswith('='):\n # We need to extend the following\n # template.\n extend = value\n pre_extend = False\n\n else:\n # If we don't know where it belongs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L689_C24", "label": "extend =", "type": "assigned_variable", "loc": [689, 689], "level": 12, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L686_C20", "vector": [14, 12, 0.7514, 0.0011, 12, 0.19, 0.0, 660, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " extend = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L690_C24", "label": "pre_extend =", "type": "assigned_variable", "loc": [690, 690], "level": 12, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L686_C20", "vector": [14, 12, 0.7525, 0.0011, 12, 0.19, 0.5, 684, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "pre_extend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pre_extend = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L695_C24", "label": "if", "type": "if", "loc": [695, 725], "level": 12, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L686_C20", "vector": [4, 12, 0.7743, 0.0338, 12, 0.19, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if line and in_tag:\n\n # Split on the newlines >.<\n tokens = line.split('\\n')\n\n # We need to look for any instances of\n # for i in range(10):\n # = i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L698_C28", "label": "tokens = split()", "type": "assigned_variable", "loc": [698, 698], "level": 13, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L695_C24", "vector": [14, 13, 0.7612, 0.0011, 13, 0.55, 0.0, 700, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "tokens", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " tokens = line.split('\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L705_C28", "label": "continuation =", "type": "assigned_variable", "loc": [705, 705], "level": 13, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L695_C24", "vector": [14, 13, 0.7688, 0.0011, 13, 0.55, 0.2, 735, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "continuation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " continuation = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L706_C28", "label": "len_parsed =", "type": "assigned_variable", "loc": [706, 706], "level": 13, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L695_C24", "vector": [14, 13, 0.7699, 0.0011, 13, 0.55, 0.4, 360, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "len_parsed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " len_parsed = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:For_L707_C28", "label": "for k, token", "type": "for", "loc": [707, 722], "level": 13, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L695_C24", "vector": [6, 13, 0.7792, 0.0174, 13, 0.55, 0.6, 120, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "k, token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, token in enumerate(tokens):\n\n token = tokens[k] = token.strip()\n len_parsed += len(token)\n\n if token.startswith('='):\n if token.endswith('\\\\'):\n continuation = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L709_C32", "label": "token = strip()", "type": "assigned_variable", "loc": [709, 709], "level": 14, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:For_L707_C28", "vector": [14, 14, 0.7732, 0.0011, 14, 0.79, 0.0, 129, 3, 0, 0, 0, 973, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "strip", "annotation": ""}, "snippet": " token = tokens[k] = token.strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L712_C32", "label": "if", "type": "if", "loc": [712, 722], "level": 14, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:For_L707_C28", "vector": [4, 14, 0.7819, 0.012, 14, 0.79, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if token.startswith('='):\n if token.endswith('\\\\'):\n continuation = True\n tokens[k] = \"\\n%s(%s\" % (\n self.writer, token[1:].strip())\n else:\n tokens[k] = \"\\n%s(%s)\" % (\n self.writer, token[1:].strip())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L713_C36", "label": "if", "type": "if", "loc": [713, 719], "level": 15, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L712_C32", "vector": [4, 15, 0.7808, 0.0076, 15, 0.65, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if token.endswith('\\\\'):\n continuation = True\n tokens[k] = \"\\n%s(%s\" % (\n self.writer, token[1:].strip())\n else:\n tokens[k] = \"\\n%s(%s)\" % (\n self.writer, token[1:].strip())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L714_C40", "label": "continuation =", "type": "assigned_variable", "loc": [714, 714], "level": 16, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L713_C36", "vector": [14, 16, 0.7786, 0.0011, 16, 0.23, 0.0, 735, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "continuation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " continuation = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L715_C40", "label": "assign", "type": "assigned_variable", "loc": [715, 716], "level": 16, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L713_C36", "vector": [14, 16, 0.7803, 0.0022, 16, 0.23, 0.5, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tokens[k] = \"\\n%s(%s\" % (\n self.writer, token[1:].strip())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L718_C40", "label": "assign", "type": "assigned_variable", "loc": [718, 719], "level": 16, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L713_C36", "vector": [14, 16, 0.7835, 0.0022, 16, 0.23, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tokens[k] = \"\\n%s(%s)\" % (\n self.writer, token[1:].strip())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L720_C32", "label": "if", "type": "if", "loc": [720, 722], "level": 15, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L712_C32", "vector": [4, 15, 0.7863, 0.0033, 15, 0.65, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif continuation:\n tokens[k] += ')'\n continuation = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L722_C36", "label": "continuation =", "type": "assigned_variable", "loc": [722, 722], "level": 16, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L720_C32", "vector": [14, 16, 0.7874, 0.0011, 16, 0.13, 0.0, 735, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "continuation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " continuation = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L724_C28", "label": "buf =", "type": "assigned_variable", "loc": [724, 724], "level": 13, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L695_C24", "vector": [14, 13, 0.7895, 0.0011, 13, 0.55, 0.8, 840, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " buf = \"\\n%s\" % '\\n'.join(tokens)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L725_C28", "label": "append()", "type": "expression", "loc": [725, 725], "level": 13, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L695_C24", "vector": [8, 13, 0.7906, 0.0011, 13, 0.55, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " top.append(Node(buf, pre_extend=pre_extend))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L729_C20", "label": "buf =", "type": "assigned_variable", "loc": [729, 729], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L562_C16", "vector": [14, 5, 0.795, 0.0011, 5, 0.62, 0.875, 840, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " buf = \"\\n%s(%r, escape=False)\" % (self.writer, i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L730_C20", "label": "append()", "type": "expression", "loc": [730, 730], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L562_C16", "vector": [8, 5, 0.7961, 0.0011, 5, 0.62, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " top.append(Node(buf, pre_extend=pre_extend))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L733_C12", "label": "in_tag =", "type": "assigned_variable", "loc": [733, 733], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:For_L552_C8", "vector": [14, 3, 0.7993, 0.0011, 3, 0.47, 1.0, 810, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "in_tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " in_tag = not in_tag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L736_C8", "label": "to_rm =", "type": "assigned_variable", "loc": [736, 736], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L534_C4", "vector": [14, 2, 0.8026, 0.0011, 2, 0.71, 0.6667, 974, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "to_rm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " to_rm = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:For_L739_C8", "label": "for node", "type": "for", "loc": [739, 746], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L534_C4", "vector": [6, 2, 0.8097, 0.0087, 2, 0.71, 0.7778, 772, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for node in self.child_super_nodes:\n # If we declared a block that this node wants to include\n if node.name in self.blocks:\n # Go ahead and include it!\n node.value = self.blocks[node.name]\n # Since we processed this child, we don't need to\n # pass it along to the parent\n to_rm.append(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L741_C12", "label": "if", "type": "if", "loc": [741, 746], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:For_L739_C8", "vector": [4, 3, 0.8108, 0.0065, 3, 0.69, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if node.name in self.blocks:\n # Go ahead and include it!\n node.value = self.blocks[node.name]\n # Since we processed this child, we don't need to\n # pass it along to the parent\n to_rm.append(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L743_C16", "label": "node.value =", "type": "assigned_variable", "loc": [743, 743], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L741_C12", "vector": [14, 4, 0.8103, 0.0011, 4, 0.54, 0.0, 376, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "node.value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " node.value = self.blocks[node.name]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L746_C16", "label": "append()", "type": "expression", "loc": [746, 746], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L741_C12", "vector": [8, 4, 0.8135, 0.0011, 4, 0.54, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " to_rm.append(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:For_L749_C8", "label": "for node", "type": "for", "loc": [749, 752], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L534_C4", "vector": [6, 2, 0.8184, 0.0044, 2, 0.71, 0.8889, 772, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for node in to_rm:\n # Since this is a pointer, it works beautifully.\n # Sometimes I miss C-Style pointers... I want my asterisk...\n self.child_super_nodes.remove(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L752_C12", "label": "remove()", "type": "expression", "loc": [752, 752], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:For_L749_C8", "vector": [8, 3, 0.8201, 0.0011, 3, 0.32, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " self.child_super_nodes.remove(node)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L755_C8", "label": "if", "type": "if", "loc": [755, 756], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L534_C4", "vector": [4, 2, 0.8239, 0.0022, 2, 0.71, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if extend:\n self.extend(extend)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L756_C12", "label": "extend()", "type": "expression", "loc": [756, 756], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L755_C8", "vector": [8, 3, 0.8244, 0.0011, 3, 0.07, 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(extend)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L761_C0", "label": "parse_template", "type": "function", "loc": [761, 785], "level": 0, "parent": null, "vector": [2, 0, 0.843, 0.0273, 0, 0.66, 0.7222, 669, 0, 5, 1, 0, 0, 0, 10], "semantic": {"name": "parse_template", "arg_names": ["filename", "path", "context", "lexers", "delimiters"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_template(filename,\n path='views/',\n context=dict(),\n lexers={},\n delimiters=('{{', '}}')\n ):\n \"\"\"\n filename can be a view filename in the views folder or an input stream"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L767_C4", "label": "expression", "type": "expression", "loc": [767, 771], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L761_C0", "vector": [8, 1, 0.8386, 0.0055, 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 filename can be a view filename in the views folder or an input stream\n path is the path of a views folder\n context is a dictionary of symbols used to render the template\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L774_C4", "label": "if", "type": "if", "loc": [774, 782], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L761_C0", "vector": [4, 1, 0.8484, 0.0098, 1, 0.0, 0.5, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(filename, str):\n try:\n fp = open(os.path.join(path, filename), 'rb')\n text = fp.read()\n fp.close()\n except IOError:\n raise RestrictedError(filename, '', 'Unable to find the file')\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L775_C8", "label": "try", "type": "try", "loc": [775, 780], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L774_C4", "vector": [7, 2, 0.8479, 0.0065, 2, 0.79, 0.0, 0, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n fp = open(os.path.join(path, filename), 'rb')\n text = fp.read()\n fp.close()\n except IOError:\n raise RestrictedError(filename, '', 'Unable to find the file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L776_C12", "label": "fp = open()", "type": "assigned_variable", "loc": [776, 776], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L775_C8", "vector": [14, 3, 0.8462, 0.0011, 3, 0.34, 0.0, 392, 3, 2, 0, 0, 693, 10, 2], "semantic": {"name": "fp", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " fp = open(os.path.join(path, filename), 'rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L777_C12", "label": "text = read()", "type": "assigned_variable", "loc": [777, 777], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L775_C8", "vector": [14, 3, 0.8473, 0.0011, 3, 0.34, 0.5, 439, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " text = fp.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L778_C12", "label": "close()", "type": "expression", "loc": [778, 778], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L775_C8", "vector": [8, 3, 0.8484, 0.0011, 3, 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": " fp.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L782_C8", "label": "text = read()", "type": "assigned_variable", "loc": [782, 782], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L774_C4", "vector": [14, 2, 0.8528, 0.0011, 2, 0.79, 1.0, 439, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " text = filename.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L785_C4", "label": "return", "type": "return", "loc": [785, 785], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L761_C0", "vector": [13, 1, 0.8561, 0.0011, 1, 0.0, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(TemplateParser(text, context=context, path=path, lexers=lexers, delimiters=delimiters))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L788_C0", "label": "get_parsed", "type": "function", "loc": [788, 793], "level": 0, "parent": null, "vector": [2, 0, 0.8621, 0.0065, 0, 0.66, 0.7778, 422, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "get_parsed", "arg_names": ["text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_parsed(text):\n \"\"\"\n Returns the indented python code of text. Useful for unit testing.\n\n \"\"\"\n return str(TemplateParser(text))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L789_C4", "label": "expression", "type": "expression", "loc": [789, 792], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L788_C0", "vector": [8, 1, 0.8621, 0.0044, 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 Returns the indented python code of text. Useful for unit testing.\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L793_C4", "label": "return", "type": "return", "loc": [793, 793], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L788_C0", "vector": [13, 1, 0.8648, 0.0011, 1, 0.09, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(TemplateParser(text))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L796_C0", "label": "DummyResponse", "type": "class", "loc": [796, 812], "level": 0, "parent": null, "vector": [3, 0, 0.8768, 0.0185, 0, 0.66, 0.8333, 487, 0, 2, 0, 0, 0, 0, 14], "semantic": {"name": "DummyResponse", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DummyResponse():\n def __init__(self):\n self.body = StringIO.StringIO()\n\n def write(self, data, escape=True):\n if not escape:\n self.body.write(str(data))\n elif hasattr(data, 'as_html') and callable(data.as_html):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L797_C4", "label": "__init__", "type": "function", "loc": [797, 798], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L796_C0", "vector": [2, 1, 0.8697, 0.0022, 1, 0.89, 0.0, 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.body = StringIO.StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L798_C8", "label": "self.body = StringIO()", "type": "assigned_variable", "loc": [798, 798], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L797_C4", "vector": [14, 2, 0.8702, 0.0011, 2, 0.89, 0.0, 523, 3, 0, 0, 0, 609, 10, 1], "semantic": {"name": "self.body", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": " self.body = StringIO.StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L800_C4", "label": "write", "type": "function", "loc": [800, 812], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L796_C0", "vector": [2, 1, 0.879, 0.0142, 1, 0.89, 1.0, 837, 0, 3, 0, 0, 0, 0, 13], "semantic": {"name": "write", "arg_names": ["self", "data", "escape"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def write(self, data, escape=True):\n if not escape:\n self.body.write(str(data))\n elif hasattr(data, 'as_html') and callable(data.as_html):\n self.body.write(data.as_html())\n else:\n # make it a string\n if not isinstance(data, (str, unicode)):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L801_C8", "label": "if", "type": "if", "loc": [801, 812], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L800_C4", "vector": [4, 2, 0.8795, 0.0131, 2, 0.54, 0.0, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not escape:\n self.body.write(str(data))\n elif hasattr(data, 'as_html') and callable(data.as_html):\n self.body.write(data.as_html())\n else:\n # make it a string\n if not isinstance(data, (str, unicode)):\n data = str(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L802_C12", "label": "write()", "type": "expression", "loc": [802, 802], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L801_C8", "vector": [8, 3, 0.8746, 0.0011, 3, 0.9, 0.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.body.write(str(data))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L803_C8", "label": "if", "type": "if", "loc": [803, 812], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L801_C8", "vector": [4, 3, 0.8806, 0.0109, 3, 0.9, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif hasattr(data, 'as_html') and callable(data.as_html):\n self.body.write(data.as_html())\n else:\n # make it a string\n if not isinstance(data, (str, unicode)):\n data = str(data)\n elif isinstance(data, unicode):\n data = data.encode('utf8', 'xmlcharrefreplace')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L804_C12", "label": "write()", "type": "expression", "loc": [804, 804], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L803_C8", "vector": [8, 4, 0.8768, 0.0011, 4, 0.29, 0.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.body.write(data.as_html())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L807_C12", "label": "if", "type": "if", "loc": [807, 810], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L803_C8", "vector": [4, 4, 0.8817, 0.0044, 4, 0.29, 0.3333, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(data, (str, unicode)):\n data = str(data)\n elif isinstance(data, unicode):\n data = data.encode('utf8', 'xmlcharrefreplace')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L808_C16", "label": "data = str()", "type": "assigned_variable", "loc": [808, 808], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L807_C12", "vector": [14, 5, 0.8811, 0.0011, 5, 0.05, 0.0, 929, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " data = str(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L809_C12", "label": "if", "type": "if", "loc": [809, 810], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L807_C12", "vector": [4, 5, 0.8828, 0.0022, 5, 0.05, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(data, unicode):\n data = data.encode('utf8', 'xmlcharrefreplace')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L810_C16", "label": "data = encode()", "type": "assigned_variable", "loc": [810, 810], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L809_C12", "vector": [14, 6, 0.8833, 0.0011, 6, 0.33, 0.0, 929, 3, 2, 0, 0, 623, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": " data = data.encode('utf8', 'xmlcharrefreplace')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L811_C12", "label": "data = replace()", "type": "assigned_variable", "loc": [811, 811], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L803_C8", "vector": [14, 4, 0.8844, 0.0011, 4, 0.29, 0.6667, 929, 3, 2, 0, 0, 293, 10, 2], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " data = cgi.escape(data, True).replace(\"'\", \"'\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L812_C12", "label": "write()", "type": "expression", "loc": [812, 812], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L803_C8", "vector": [8, 4, 0.8855, 0.0011, 4, 0.29, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.body.write(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L815_C0", "label": "NOESCAPE", "type": "class", "loc": [815, 823], "level": 0, "parent": null, "vector": [3, 0, 0.8931, 0.0098, 0, 0.66, 0.8889, 477, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "NOESCAPE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class NOESCAPE():\n \"\"\"\n A little helper to avoid escaping.\n \"\"\"\n def __init__(self, text):\n self.text = text\n\n def xml(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L816_C4", "label": "expression", "type": "expression", "loc": [816, 818], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L815_C0", "vector": [8, 1, 0.8909, 0.0033, 1, 0.92, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n A little helper to avoid escaping.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L819_C4", "label": "__init__", "type": "function", "loc": [819, 820], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L815_C0", "vector": [2, 1, 0.8937, 0.0022, 1, 0.92, 0.5, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, text):\n self.text = text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L820_C8", "label": "self.text =", "type": "assigned_variable", "loc": [820, 820], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L819_C4", "vector": [14, 2, 0.8942, 0.0011, 2, 0.89, 0.0, 320, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.text = text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L822_C4", "label": "xml", "type": "function", "loc": [822, 823], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L815_C0", "vector": [2, 1, 0.8969, 0.0022, 1, 0.92, 1.0, 324, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "xml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def xml(self):\n return self.text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L823_C8", "label": "return", "type": "return", "loc": [823, 823], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L822_C4", "vector": [13, 2, 0.8975, 0.0011, 2, 0.59, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "label": "render", "type": "function", "loc": [829, 912], "level": 0, "parent": null, "vector": [2, 0, 0.9493, 0.0916, 0, 0.66, 0.9444, 24, 0, 7, 1, 0, 0, 0, 11], "semantic": {"name": "render", "arg_names": ["content", "stream", "filename", "path", "context", "lexers", "delimiters"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def render(content=\"hello world\",\n stream=None,\n filename=None,\n path=None,\n context={},\n lexers={},\n delimiters=('{{', '}}')\n ):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L837_C4", "label": "expression", "type": "expression", "loc": [837, 862], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "vector": [8, 1, 0.9264, 0.0284, 1, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n >>> render()\n 'hello world'\n >>> render(content='abc')\n 'abc'\n >>> render(content='abc\\\\'')\n \"abc'\"\n >>> render(content='a\"\\\\'bc')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L864_C4", "label": "try", "type": "try", "loc": [864, 872], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "vector": [7, 1, 0.9466, 0.0098, 1, 0.86, 0.0909, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n from globals import Response\n except ImportError:\n # Working standalone. Build a mock Response object.\n Response = DummyResponse\n\n # Add it to the context so we can use it.\n if not 'NOESCAPE' in context:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:ImportFrom_L865_C8", "label": "from globals import Response", "type": "import", "loc": [865, 865], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L864_C4", "vector": [1, 2, 0.9433, 0.0011, 2, 0.43, 0.0, 926, 0, 1, 0, 0, 926, 0, 0], "semantic": {"name": "globals", "arg_names": [], "import_names": ["Response"], "rhs_call_name": "", "annotation": ""}, "snippet": " from globals import Response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L868_C8", "label": "Response =", "type": "assigned_variable", "loc": [868, 868], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L864_C4", "vector": [14, 2, 0.9466, 0.0011, 2, 0.43, 0.0, 818, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Response", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " Response = DummyResponse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L871_C8", "label": "if", "type": "if", "loc": [871, 872], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L864_C4", "vector": [4, 2, 0.9504, 0.0022, 2, 0.43, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not 'NOESCAPE' in context:\n context['NOESCAPE'] = NOESCAPE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L872_C12", "label": "assign", "type": "assigned_variable", "loc": [872, 872], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L871_C8", "vector": [14, 3, 0.9509, 0.0011, 3, 0.73, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " context['NOESCAPE'] = NOESCAPE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L875_C4", "label": "if", "type": "if", "loc": [875, 880], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "vector": [4, 1, 0.9569, 0.0065, 1, 0.86, 0.1818, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if context and 'response' in context:\n old_response_body = context['response'].body\n context['response'].body = StringIO.StringIO()\n else:\n old_response_body = None\n context['response'] = Response()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L876_C8", "label": "old_response_body =", "type": "assigned_variable", "loc": [876, 876], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L875_C4", "vector": [14, 2, 0.9553, 0.0011, 2, 0.24, 0.0, 137, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "old_response_body", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_response_body = context['response'].body"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L877_C8", "label": "context['response'].body = StringIO()", "type": "assigned_variable", "loc": [877, 877], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L875_C4", "vector": [14, 2, 0.9564, 0.0011, 2, 0.24, 0.3333, 698, 3, 0, 0, 0, 609, 10, 1], "semantic": {"name": "context['response'].body", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": " context['response'].body = StringIO.StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L879_C8", "label": "old_response_body =", "type": "assigned_variable", "loc": [879, 879], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L875_C4", "vector": [14, 2, 0.9586, 0.0011, 2, 0.24, 0.6667, 137, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "old_response_body", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_response_body = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L880_C8", "label": " = Response()", "type": "assigned_variable", "loc": [880, 880], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L875_C4", "vector": [14, 2, 0.9597, 0.0011, 2, 0.24, 1.0, 0, 3, 0, 0, 0, 818, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "Response", "annotation": ""}, "snippet": " context['response'] = Response()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L883_C4", "label": "if", "type": "if", "loc": [883, 884], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "vector": [4, 1, 0.9635, 0.0022, 1, 0.86, 0.2727, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not content and not stream and not filename:\n raise SyntaxError(\"Must specify a stream or filename or content\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L888_C4", "label": "close_stream =", "type": "assigned_variable", "loc": [888, 888], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "vector": [14, 1, 0.9684, 0.0011, 1, 0.86, 0.3636, 642, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "close_stream", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " close_stream = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L889_C4", "label": "if", "type": "if", "loc": [889, 894], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "vector": [4, 1, 0.9722, 0.0065, 1, 0.86, 0.4545, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not stream:\n if filename:\n stream = open(filename, 'rb')\n close_stream = True\n elif content:\n stream = StringIO.StringIO(content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L890_C8", "label": "if", "type": "if", "loc": [890, 894], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L889_C4", "vector": [4, 2, 0.9727, 0.0055, 2, 0.12, 0.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if filename:\n stream = open(filename, 'rb')\n close_stream = True\n elif content:\n stream = StringIO.StringIO(content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L891_C12", "label": "stream = open()", "type": "assigned_variable", "loc": [891, 891], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L890_C8", "vector": [14, 3, 0.9716, 0.0011, 3, 0.18, 0.0, 517, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "stream", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " stream = open(filename, 'rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L892_C12", "label": "close_stream =", "type": "assigned_variable", "loc": [892, 892], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L890_C8", "vector": [14, 3, 0.9727, 0.0011, 3, 0.18, 0.5, 642, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "close_stream", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " close_stream = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L893_C8", "label": "if", "type": "if", "loc": [893, 894], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L890_C8", "vector": [4, 3, 0.9744, 0.0022, 3, 0.18, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif content:\n stream = StringIO.StringIO(content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L894_C12", "label": "stream = StringIO()", "type": "assigned_variable", "loc": [894, 894], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L893_C8", "vector": [14, 4, 0.9749, 0.0011, 4, 0.33, 0.0, 517, 3, 1, 0, 0, 609, 10, 1], "semantic": {"name": "stream", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": " stream = StringIO.StringIO(content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L897_C4", "label": "code = str()", "type": "assigned_variable", "loc": [897, 898], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "vector": [14, 1, 0.9787, 0.0022, 1, 0.86, 0.5455, 44, 3, 1, 0, 0, 52, 10, 3], "semantic": {"name": "code", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " code = str(TemplateParser(stream.read(\n ), context=context, path=path, lexers=lexers, delimiters=delimiters))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L899_C4", "label": "try", "type": "try", "loc": [899, 903], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "vector": [7, 1, 0.9826, 0.0055, 1, 0.86, 0.6364, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n exec(code) in context\n except Exception:\n # for i,line in enumerate(code.split('\\n')): print i,line\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L900_C8", "label": "expression", "type": "expression", "loc": [900, 900], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L899_C4", "vector": [8, 2, 0.9815, 0.0011, 2, 0.48, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " exec(code) in context"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L905_C4", "label": "if", "type": "if", "loc": [905, 906], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "vector": [4, 1, 0.9875, 0.0022, 1, 0.86, 0.7273, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if close_stream:\n stream.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L906_C8", "label": "close()", "type": "expression", "loc": [906, 906], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L905_C4", "vector": [8, 2, 0.988, 0.0011, 2, 0.86, 0.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " stream.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L909_C4", "label": "text = getvalue()", "type": "assigned_variable", "loc": [909, 909], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "vector": [14, 1, 0.9913, 0.0011, 1, 0.86, 0.8182, 439, 3, 0, 0, 0, 626, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "getvalue", "annotation": ""}, "snippet": " text = context['response'].body.getvalue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L910_C4", "label": "if", "type": "if", "loc": [910, 911], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "vector": [4, 1, 0.9929, 0.0022, 1, 0.86, 0.9091, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if old_response_body is not None:\n context['response'].body = old_response_body"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L911_C8", "label": "context['response'].body =", "type": "assigned_variable", "loc": [911, 911], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L910_C4", "vector": [14, 2, 0.9935, 0.0011, 2, 0.76, 0.0, 698, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "context['response'].body", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " context['response'].body = old_response_body"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L912_C4", "label": "return", "type": "return", "loc": [912, 912], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "vector": [13, 1, 0.9945, 0.0011, 1, 0.86, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:If_L915_C0", "label": "if", "type": "if", "loc": [915, 917], "level": 0, "parent": null, "vector": [4, 0, 0.9989, 0.0033, 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 import doctest\n doctest.testmod()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Import_L916_C4", "label": "doctest import doctest", "type": "import", "loc": [916, 916], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L915_C0", "vector": [1, 1, 0.9989, 0.0011, 1, 0.9, 0.0, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "doctest", "arg_names": [], "import_names": ["doctest"], "rhs_call_name": "", "annotation": ""}, "snippet": " import doctest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L917_C4", "label": "testmod()", "type": "expression", "loc": [917, 917], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_462:If_L915_C0", "vector": [8, 1, 1.0, 0.0011, 1, 0.9, 1.0, 116, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "testmod", "arg_names": [], "import_names": [], "rhs_call_name": "testmod", "annotation": ""}, "snippet": " doctest.testmod()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Import_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:ImportFrom_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:ImportFrom_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:ImportFrom_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L62_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L64_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L116_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L125_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L129_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L137_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L138_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L143_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L143_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L158_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L158_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L158_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L158_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L158_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L158_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L169_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L172_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L173_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L172_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L176_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L177_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L182_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L188_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L190_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L188_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:For_L191_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:For_L191_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L192_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L188_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L194_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L196_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L196_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L196_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L201_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L202_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L202_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L203_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L207_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L207_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L208_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L207_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L211_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L211_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L212_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L211_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L213_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L152_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L218_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L218_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L219_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L224_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L231_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L234_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L236_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L247_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L261_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L263_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L267_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L270_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L270_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L271_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L270_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L273_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L276_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L278_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L281_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L282_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L282_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L283_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L282_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L285_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L282_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L286_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L286_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L287_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L287_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L288_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L287_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L291_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L295_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L301_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L305_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L309_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L313_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L238_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L316_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L318_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L318_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L319_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L318_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L324_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L326_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L327_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L328_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L330_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L330_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L331_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L330_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L332_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L334_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L335_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L340_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L343_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L348_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L351_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:For_L361_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:For_L361_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L362_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:For_L361_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L365_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:For_L361_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L371_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L371_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L372_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:For_L361_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L375_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:For_L361_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L378_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:For_L361_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L381_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:For_L361_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L384_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:For_L361_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L392_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L392_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L393_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:For_L361_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L398_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L403_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L405_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L405_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L406_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L405_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L407_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L407_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L408_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L410_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L412_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L412_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L413_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L418_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L418_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L419_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L418_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L426_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L426_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L427_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L418_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L430_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L418_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L431_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L431_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L432_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L418_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L436_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L418_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L439_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L418_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L442_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L442_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L443_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L442_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L444_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L442_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L445_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L442_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L447_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L418_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L449_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L451_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L451_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L452_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L451_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L455_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L451_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L457_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L451_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L464_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L467_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L471_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L474_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L476_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L478_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L480_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L490_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L492_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:For_L495_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:For_L495_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L497_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L497_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L499_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:For_L495_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L503_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L503_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L506_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L506_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L507_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L503_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L512_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L503_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L514_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L518_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L520_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L523_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L526_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L529_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L466_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L532_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L222_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L534_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L534_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L541_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L534_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L542_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L534_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L543_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L534_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L548_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L534_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L551_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L534_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:For_L552_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:For_L552_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L553_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:For_L552_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L555_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L555_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L556_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L556_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L557_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L555_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L560_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L555_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L562_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L562_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L563_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L562_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L566_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L562_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L569_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L562_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L574_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L574_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L577_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L562_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L582_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L562_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L586_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L586_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L588_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L586_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L590_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L586_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L591_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L591_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L595_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L591_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L596_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L591_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L602_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L591_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L603_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L562_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L611_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L611_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L618_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L611_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L623_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L623_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L626_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L623_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L627_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L623_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L629_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L629_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L631_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L629_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L636_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L629_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L642_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L629_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L644_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L644_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L648_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L644_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L651_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L644_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L653_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L653_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L657_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L657_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L658_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L657_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L660_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L653_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L663_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L653_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L667_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L653_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L670_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L653_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L672_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L672_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L674_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L674_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L675_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L674_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L680_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L674_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L684_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L672_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L686_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L686_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L689_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L686_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L690_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L686_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L695_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L695_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L698_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L695_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L705_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L695_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L706_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L695_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_462:For_L707_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:For_L707_C28", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L709_C32"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:For_L707_C28", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L712_C32"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L712_C32", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L713_C36"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L713_C36", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L714_C40"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L713_C36", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L715_C40"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L713_C36", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L718_C40"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L712_C32", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L720_C32"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L720_C32", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L722_C36"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L695_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L724_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L695_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L725_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L562_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L729_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L562_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L730_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:For_L552_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L733_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L534_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L736_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L534_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:For_L739_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:For_L739_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L741_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L741_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L743_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L741_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L746_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L534_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:For_L749_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:For_L749_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L752_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L534_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L755_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L755_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L756_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L761_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L767_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L761_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L774_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L774_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L775_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L775_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L776_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L775_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L777_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L775_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L778_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L774_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L782_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L761_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L785_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L788_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L789_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L788_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L793_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L796_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L797_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L797_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L798_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L796_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L800_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L800_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L801_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L801_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L802_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L801_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L803_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L803_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L804_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L803_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L807_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L807_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L808_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L807_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L809_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L809_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L810_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L803_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L811_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L803_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L812_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L815_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L816_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L815_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L819_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L819_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L820_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:ClassDef_L815_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L822_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L822_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L823_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L837_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L864_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L864_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:ImportFrom_L865_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L864_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L868_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L864_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L871_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L871_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L872_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L875_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L875_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L876_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L875_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L877_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L875_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L879_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L875_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L880_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L883_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L888_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L889_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L889_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L890_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L890_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L891_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L890_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L892_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L890_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L893_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L893_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L894_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L897_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L899_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:Try_L899_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L900_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L905_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L905_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L906_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L909_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:If_L910_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L910_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Assign_L911_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:FunctionDef_L829_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Return_L912_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L915_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Import_L916_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_462:If_L915_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_462:Expr_L917_C4"}] |
import codecs
import encodings
"""Caller will hand this library a buffer and ask it to either convert
it or auto-detect the type.
Based on http://code.activestate.com/recipes/52257/
Licensed under the PSF License
"""
# None represents a potentially variable byte. "##" in the XML spec...
autodetect_dict = { # bytepattern : ("name",
(0x00, 0x00, 0xFE, 0xFF): ("ucs4_be"),
(0xFF, 0xFE, 0x00, 0x00): ("ucs4_le"),
(0xFE, 0xFF, None, None): ("utf_16_be"),
(0xFF, 0xFE, None, None): ("utf_16_le"),
(0x00, 0x3C, 0x00, 0x3F): ("utf_16_be"),
(0x3C, 0x00, 0x3F, 0x00): ("utf_16_le"),
(0x3C, 0x3F, 0x78, 0x6D): ("utf_8"),
(0x4C, 0x6F, 0xA7, 0x94): ("EBCDIC")
}
def autoDetectXMLEncoding(buffer):
""" buffer -> encoding_name
The buffer should be at least 4 bytes long.
Returns None if encoding cannot be detected.
Note that encoding_name might not have an installed
decoder (e.g. EBCDIC)
"""
# a more efficient implementation would not decode the whole
# buffer at once but otherwise we'd have to decode a character at
# a time looking for the quote character...that's a pain
encoding = "utf_8" # according to the XML spec, this is the default
# this code successively tries to refine the default
# whenever it fails to refine, it falls back to
# the last place encoding was set.
if len(buffer) >= 4:
bytes = (byte1, byte2, byte3, byte4) = tuple(map(ord, buffer[0:4]))
enc_info = autodetect_dict.get(bytes, None)
if not enc_info: # try autodetection again removing potentially
# variable bytes
bytes = (byte1, byte2, None, None)
enc_info = autodetect_dict.get(bytes)
else:
enc_info = None
if enc_info:
encoding = enc_info # we've got a guess... these are
#the new defaults
# try to find a more precise encoding using xml declaration
secret_decoder_ring = codecs.lookup(encoding)[1]
(decoded, length) = secret_decoder_ring(buffer)
first_line = decoded.split("\n")[0]
if first_line and first_line.startswith(u"<?xml"):
encoding_pos = first_line.find(u"encoding")
if encoding_pos != -1:
# look for double quote
quote_pos = first_line.find('"', encoding_pos)
if quote_pos == -1: # look for single quote
quote_pos = first_line.find("'", encoding_pos)
if quote_pos > -1:
quote_char, rest = (first_line[quote_pos],
first_line[quote_pos + 1:])
encoding = rest[:rest.find(quote_char)]
return encoding
def decoder(buffer):
encoding = autoDetectXMLEncoding(buffer)
return buffer.decode(encoding).encode('utf8')
| ajibawa-2023/Python-Code-Large/train/row_463 | 32 | 77 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_463:Import_L1_C0", "label": "codecs import codecs", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.013, 0.013, 0, 0.66, 0.0, 220, 0, 1, 0, 0, 220, 0, 0], "semantic": {"name": "codecs", "arg_names": [], "import_names": ["codecs"], "rhs_call_name": "", "annotation": ""}, "snippet": "import codecs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:Import_L2_C0", "label": "encodings import encodings", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.026, 0.013, 0, 0.66, 0.2, 786, 0, 1, 0, 0, 786, 0, 0], "semantic": {"name": "encodings", "arg_names": [], "import_names": ["encodings"], "rhs_call_name": "", "annotation": ""}, "snippet": "import encodings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0909, 0.0909, 0, 0.66, 0.4, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Caller will hand this library a buffer and ask it to either convert\nit or auto-detect the type.\n\nBased on http://code.activestate.com/recipes/52257/\n\nLicensed under the PSF License\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L13_C0", "label": "autodetect_dict =", "type": "assigned_variable", "loc": [13, 22], "level": 0, "parent": null, "vector": [14, 0, 0.2273, 0.1299, 0, 0.66, 0.6, 943, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "autodetect_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "autodetect_dict = { # bytepattern : (\"name\",\n (0x00, 0x00, 0xFE, 0xFF): (\"ucs4_be\"),\n (0xFF, 0xFE, 0x00, 0x00): (\"ucs4_le\"),\n (0xFE, 0xFF, None, None): (\"utf_16_be\"),\n (0xFF, 0xFE, None, None): (\"utf_16_le\"),\n (0x00, 0x3C, 0x00, 0x3F): (\"utf_16_be\"),\n (0x3C, 0x00, 0x3F, 0x00): (\"utf_16_le\"),\n (0x3C, 0x3F, 0x78, 0x6D): (\"utf_8\"),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:FunctionDef_L25_C0", "label": "autoDetectXMLEncoding", "type": "function", "loc": [25, 72], "level": 0, "parent": null, "vector": [2, 0, 0.6299, 0.6234, 0, 0.66, 0.8, 556, 0, 1, 1, 0, 0, 0, 13], "semantic": {"name": "autoDetectXMLEncoding", "arg_names": ["buffer"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def autoDetectXMLEncoding(buffer):\n \"\"\" buffer -> encoding_name\n The buffer should be at least 4 bytes long.\n Returns None if encoding cannot be detected.\n Note that encoding_name might not have an installed\n decoder (e.g. EBCDIC)\n \"\"\"\n # a more efficient implementation would not decode the whole"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:Expr_L26_C4", "label": "expression", "type": "expression", "loc": [26, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:FunctionDef_L25_C0", "vector": [8, 1, 0.3701, 0.0779, 1, 0.01, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" buffer -> encoding_name\n The buffer should be at least 4 bytes long.\n Returns None if encoding cannot be detected.\n Note that encoding_name might not have an installed\n decoder (e.g. EBCDIC)\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L36_C4", "label": "encoding =", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:FunctionDef_L25_C0", "vector": [14, 1, 0.4675, 0.013, 1, 0.01, 0.25, 325, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " encoding = \"utf_8\" # according to the XML spec, this is the default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:If_L40_C4", "label": "if", "type": "if", "loc": [40, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:FunctionDef_L25_C0", "vector": [4, 1, 0.5714, 0.1169, 1, 0.01, 0.5, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(buffer) >= 4:\n bytes = (byte1, byte2, byte3, byte4) = tuple(map(ord, buffer[0:4]))\n enc_info = autodetect_dict.get(bytes, None)\n if not enc_info: # try autodetection again removing potentially\n # variable bytes\n bytes = (byte1, byte2, None, None)\n enc_info = autodetect_dict.get(bytes)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L41_C8", "label": "bytes = tuple()", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:If_L40_C4", "vector": [14, 2, 0.5325, 0.013, 2, 0.2, 0.0, 297, 3, 1, 0, 0, 259, 10, 2], "semantic": {"name": "bytes", "arg_names": [], "import_names": [], "rhs_call_name": "tuple", "annotation": ""}, "snippet": " bytes = (byte1, byte2, byte3, byte4) = tuple(map(ord, buffer[0:4]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L42_C8", "label": "enc_info = get()", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:If_L40_C4", "vector": [14, 2, 0.5455, 0.013, 2, 0.2, 0.3333, 723, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "enc_info", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " enc_info = autodetect_dict.get(bytes, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:If_L43_C8", "label": "if", "type": "if", "loc": [43, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:If_L40_C4", "vector": [4, 2, 0.5779, 0.0519, 2, 0.2, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not enc_info: # try autodetection again removing potentially\n # variable bytes\n bytes = (byte1, byte2, None, None)\n enc_info = autodetect_dict.get(bytes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L45_C12", "label": "bytes =", "type": "assigned_variable", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:If_L43_C8", "vector": [14, 3, 0.5844, 0.013, 3, 0.72, 0.0, 297, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "bytes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bytes = (byte1, byte2, None, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L46_C12", "label": "enc_info = get()", "type": "assigned_variable", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:If_L43_C8", "vector": [14, 3, 0.5974, 0.013, 3, 0.72, 1.0, 723, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "enc_info", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " enc_info = autodetect_dict.get(bytes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L48_C8", "label": "enc_info =", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:If_L40_C4", "vector": [14, 2, 0.6234, 0.013, 2, 0.2, 1.0, 723, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "enc_info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " enc_info = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:If_L50_C4", "label": "if", "type": "if", "loc": [50, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:FunctionDef_L25_C0", "vector": [4, 1, 0.7792, 0.2727, 1, 0.01, 0.75, 0, 2, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if enc_info:\n encoding = enc_info # we've got a guess... these are\n #the new defaults\n\n # try to find a more precise encoding using xml declaration\n secret_decoder_ring = codecs.lookup(encoding)[1]\n (decoded, length) = secret_decoder_ring(buffer)\n first_line = decoded.split(\"\\n\")[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L51_C8", "label": "encoding =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:If_L50_C4", "vector": [14, 2, 0.6623, 0.013, 2, 0.08, 0.0, 325, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " encoding = enc_info # we've got a guess... these are"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L55_C8", "label": "secret_decoder_ring =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:If_L50_C4", "vector": [14, 2, 0.7143, 0.013, 2, 0.08, 0.25, 601, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "secret_decoder_ring", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " secret_decoder_ring = codecs.lookup(encoding)[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L56_C8", "label": "decoded, length = secret_decoder_ring()", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:If_L50_C4", "vector": [14, 2, 0.7273, 0.013, 2, 0.08, 0.5, 867, 3, 1, 0, 0, 601, 10, 1], "semantic": {"name": "decoded, length", "arg_names": [], "import_names": [], "rhs_call_name": "secret_decoder_ring", "annotation": ""}, "snippet": " (decoded, length) = secret_decoder_ring(buffer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L57_C8", "label": "first_line =", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:If_L50_C4", "vector": [14, 2, 0.7403, 0.013, 2, 0.08, 0.75, 206, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "first_line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first_line = decoded.split(\"\\n\")[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:If_L58_C8", "label": "if", "type": "if", "loc": [58, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:If_L50_C4", "vector": [4, 2, 0.8312, 0.1688, 2, 0.08, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if first_line and first_line.startswith(u\"<?xml\"):\n encoding_pos = first_line.find(u\"encoding\")\n if encoding_pos != -1:\n # look for double quote\n quote_pos = first_line.find('\"', encoding_pos)\n\n if quote_pos == -1: # look for single quote\n quote_pos = first_line.find(\"'\", encoding_pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L59_C12", "label": "encoding_pos = find()", "type": "assigned_variable", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:If_L58_C8", "vector": [14, 3, 0.7662, 0.013, 3, 0.0, 0.0, 876, 3, 1, 0, 0, 340, 10, 1], "semantic": {"name": "encoding_pos", "arg_names": [], "import_names": [], "rhs_call_name": "find", "annotation": ""}, "snippet": " encoding_pos = first_line.find(u\"encoding\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:If_L60_C12", "label": "if", "type": "if", "loc": [60, 70], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:If_L58_C8", "vector": [4, 3, 0.8442, 0.1429, 3, 0.0, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if encoding_pos != -1:\n # look for double quote\n quote_pos = first_line.find('\"', encoding_pos)\n\n if quote_pos == -1: # look for single quote\n quote_pos = first_line.find(\"'\", encoding_pos)\n\n if quote_pos > -1:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L62_C16", "label": "quote_pos = find()", "type": "assigned_variable", "loc": [62, 62], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:If_L60_C12", "vector": [14, 4, 0.8052, 0.013, 4, 0.41, 0.0, 620, 3, 2, 0, 0, 340, 10, 1], "semantic": {"name": "quote_pos", "arg_names": [], "import_names": [], "rhs_call_name": "find", "annotation": ""}, "snippet": " quote_pos = first_line.find('\"', encoding_pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:If_L64_C16", "label": "if", "type": "if", "loc": [64, 65], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:If_L60_C12", "vector": [4, 4, 0.8377, 0.026, 4, 0.41, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if quote_pos == -1: # look for single quote\n quote_pos = first_line.find(\"'\", encoding_pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L65_C20", "label": "quote_pos = find()", "type": "assigned_variable", "loc": [65, 65], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:If_L64_C16", "vector": [14, 5, 0.8442, 0.013, 5, 0.81, 0.0, 620, 3, 2, 0, 0, 340, 10, 1], "semantic": {"name": "quote_pos", "arg_names": [], "import_names": [], "rhs_call_name": "find", "annotation": ""}, "snippet": " quote_pos = first_line.find(\"'\", encoding_pos)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:If_L67_C16", "label": "if", "type": "if", "loc": [67, 70], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:If_L60_C12", "vector": [4, 4, 0.8896, 0.0519, 4, 0.41, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if quote_pos > -1:\n quote_char, rest = (first_line[quote_pos],\n first_line[quote_pos + 1:])\n encoding = rest[:rest.find(quote_char)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L68_C20", "label": "quote_char, rest =", "type": "assigned_variable", "loc": [68, 69], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:If_L67_C16", "vector": [14, 5, 0.8896, 0.026, 5, 0.45, 0.0, 954, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "quote_char, rest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " quote_char, rest = (first_line[quote_pos],\n first_line[quote_pos + 1:])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L70_C20", "label": "encoding =", "type": "assigned_variable", "loc": [70, 70], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:If_L67_C16", "vector": [14, 5, 0.9091, 0.013, 5, 0.45, 1.0, 325, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " encoding = rest[:rest.find(quote_char)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:Return_L72_C4", "label": "return", "type": "return", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:FunctionDef_L25_C0", "vector": [13, 1, 0.9351, 0.013, 1, 0.01, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:FunctionDef_L75_C0", "label": "decoder", "type": "function", "loc": [75, 77], "level": 0, "parent": null, "vector": [2, 0, 0.987, 0.039, 0, 0.66, 1.0, 404, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "decoder", "arg_names": ["buffer"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def decoder(buffer):\n encoding = autoDetectXMLEncoding(buffer)\n return buffer.decode(encoding).encode('utf8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L76_C4", "label": "encoding = autoDetectXMLEncoding()", "type": "assigned_variable", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:FunctionDef_L75_C0", "vector": [14, 1, 0.987, 0.013, 1, 0.3, 0.0, 325, 3, 1, 0, 0, 556, 10, 1], "semantic": {"name": "encoding", "arg_names": [], "import_names": [], "rhs_call_name": "autoDetectXMLEncoding", "annotation": ""}, "snippet": " encoding = autoDetectXMLEncoding(buffer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_463:Return_L77_C4", "label": "return", "type": "return", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_463:FunctionDef_L75_C0", "vector": [13, 1, 1.0, 0.013, 1, 0.3, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return buffer.decode(encoding).encode('utf8')"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_463:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_463:Expr_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_463:If_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:If_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:If_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:If_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_463:If_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:If_L43_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:If_L43_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:If_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_463:If_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:If_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:If_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:If_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:If_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:If_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_463:If_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_463:If_L60_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:If_L60_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L62_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:If_L60_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_463:If_L64_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:If_L64_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L65_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:If_L60_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_463:If_L67_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:If_L67_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L68_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:If_L67_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L70_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:FunctionDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_463:Return_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:FunctionDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_463:Assign_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_463:FunctionDef_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_463:Return_L77_C4"}] |
import logging
import os
try:
import Tkinter
except:
Tkinter = None
class MessageBoxHandler(logging.Handler):
def __init__(self):
logging.Handler.__init__(self)
def emit(self, record):
if Tkinter:
msg = self.format(record)
root = Tkinter.Tk()
root.wm_title("web2py logger message")
text = Tkinter.Text()
text["height"] = 12
text.insert(0.1, msg)
text.pack()
button = Tkinter.Button(root, text="OK", command=root.destroy)
button.pack()
root.mainloop()
class NotifySendHandler(logging.Handler):
def __init__(self):
logging.Handler.__init__(self)
def emit(self, record):
if Tkinter:
msg = self.format(record)
os.system("notify-send '%s'" % msg)
| ajibawa-2023/Python-Code-Large/train/row_464 | 27 | 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_464:Import_L1_C0", "label": "logging import logging", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0286, 0.0286, 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_464:Import_L2_C0", "label": "os import os", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0571, 0.0286, 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_464:Try_L4_C0", "label": "try", "type": "try", "loc": [4, 7], "level": 0, "parent": null, "vector": [7, 0, 0.1571, 0.1143, 0, 0.66, 0.5, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n import Tkinter\nexcept:\n Tkinter = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:Import_L5_C4", "label": "Tkinter import Tkinter", "type": "import", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_464:Try_L4_C0", "vector": [1, 1, 0.1429, 0.0286, 1, 0.76, 0.0, 368, 0, 1, 0, 0, 368, 0, 0], "semantic": {"name": "Tkinter", "arg_names": [], "import_names": ["Tkinter"], "rhs_call_name": "", "annotation": ""}, "snippet": " import Tkinter"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:Assign_L7_C4", "label": "Tkinter =", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_464:Try_L4_C0", "vector": [14, 1, 0.2, 0.0286, 1, 0.76, 0.0, 368, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "Tkinter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " Tkinter = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:ClassDef_L10_C0", "label": "MessageBoxHandler", "type": "class", "loc": [10, 25], "level": 0, "parent": null, "vector": [3, 0, 0.5, 0.4571, 0, 0.66, 0.75, 927, 0, 2, 0, 0, 981, 0, 10], "semantic": {"name": "MessageBoxHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MessageBoxHandler(logging.Handler):\n def __init__(self):\n logging.Handler.__init__(self)\n\n def emit(self, record):\n if Tkinter:\n msg = self.format(record)\n root = Tkinter.Tk()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:FunctionDef_L11_C4", "label": "__init__", "type": "function", "loc": [11, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_464:ClassDef_L10_C0", "vector": [2, 1, 0.3286, 0.0571, 1, 0.21, 0.0, 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 logging.Handler.__init__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:Expr_L12_C8", "label": "__init__()", "type": "expression", "loc": [12, 12], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_464:FunctionDef_L11_C4", "vector": [8, 2, 0.3429, 0.0286, 2, 0.83, 0.0, 555, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " logging.Handler.__init__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:FunctionDef_L14_C4", "label": "emit", "type": "function", "loc": [14, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_464:ClassDef_L10_C0", "vector": [2, 1, 0.5571, 0.3429, 1, 0.21, 1.0, 627, 0, 2, 0, 0, 0, 0, 9], "semantic": {"name": "emit", "arg_names": ["self", "record"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def emit(self, record):\n if Tkinter:\n msg = self.format(record)\n root = Tkinter.Tk()\n root.wm_title(\"web2py logger message\")\n text = Tkinter.Text()\n text[\"height\"] = 12\n text.insert(0.1, msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:If_L15_C8", "label": "if", "type": "if", "loc": [15, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_464:FunctionDef_L14_C4", "vector": [4, 2, 0.5714, 0.3143, 2, 0.38, 0.0, 0, 2, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if Tkinter:\n msg = self.format(record)\n root = Tkinter.Tk()\n root.wm_title(\"web2py logger message\")\n text = Tkinter.Text()\n text[\"height\"] = 12\n text.insert(0.1, msg)\n text.pack()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:Assign_L16_C12", "label": "msg = format()", "type": "assigned_variable", "loc": [16, 16], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_464:If_L15_C8", "vector": [14, 3, 0.4571, 0.0286, 3, 0.62, 0.0, 712, 3, 1, 0, 0, 293, 10, 1], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "format", "annotation": ""}, "snippet": " msg = self.format(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:Assign_L17_C12", "label": "root = Tk()", "type": "assigned_variable", "loc": [17, 17], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_464:If_L15_C8", "vector": [14, 3, 0.4857, 0.0286, 3, 0.62, 0.1111, 696, 3, 0, 0, 0, 309, 10, 1], "semantic": {"name": "root", "arg_names": [], "import_names": [], "rhs_call_name": "Tk", "annotation": ""}, "snippet": " root = Tkinter.Tk()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:Expr_L18_C12", "label": "wm_title()", "type": "expression", "loc": [18, 18], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_464:If_L15_C8", "vector": [8, 3, 0.5143, 0.0286, 3, 0.62, 0.2222, 543, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "wm_title", "arg_names": [], "import_names": [], "rhs_call_name": "wm_title", "annotation": ""}, "snippet": " root.wm_title(\"web2py logger message\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:Assign_L19_C12", "label": "text = Text()", "type": "assigned_variable", "loc": [19, 19], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_464:If_L15_C8", "vector": [14, 3, 0.5429, 0.0286, 3, 0.62, 0.3333, 439, 3, 0, 0, 0, 833, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "Text", "annotation": ""}, "snippet": " text = Tkinter.Text()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:Assign_L20_C12", "label": "assign", "type": "assigned_variable", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_464:If_L15_C8", "vector": [14, 3, 0.5714, 0.0286, 3, 0.62, 0.4444, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text[\"height\"] = 12"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:Expr_L21_C12", "label": "insert()", "type": "expression", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_464:If_L15_C8", "vector": [8, 3, 0.6, 0.0286, 3, 0.62, 0.5556, 368, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " text.insert(0.1, msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:Expr_L22_C12", "label": "pack()", "type": "expression", "loc": [22, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_464:If_L15_C8", "vector": [8, 3, 0.6286, 0.0286, 3, 0.62, 0.6667, 742, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " text.pack()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:Assign_L23_C12", "label": "button = Button()", "type": "assigned_variable", "loc": [23, 23], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_464:If_L15_C8", "vector": [14, 3, 0.6571, 0.0286, 3, 0.62, 0.7778, 95, 3, 3, 0, 0, 608, 10, 1], "semantic": {"name": "button", "arg_names": [], "import_names": [], "rhs_call_name": "Button", "annotation": ""}, "snippet": " button = Tkinter.Button(root, text=\"OK\", command=root.destroy)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:Expr_L24_C12", "label": "pack()", "type": "expression", "loc": [24, 24], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_464:If_L15_C8", "vector": [8, 3, 0.6857, 0.0286, 3, 0.62, 0.8889, 742, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "pack", "arg_names": [], "import_names": [], "rhs_call_name": "pack", "annotation": ""}, "snippet": " button.pack()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:Expr_L25_C12", "label": "mainloop()", "type": "expression", "loc": [25, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_464:If_L15_C8", "vector": [8, 3, 0.7143, 0.0286, 3, 0.62, 1.0, 192, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "mainloop", "arg_names": [], "import_names": [], "rhs_call_name": "mainloop", "annotation": ""}, "snippet": " root.mainloop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:ClassDef_L28_C0", "label": "NotifySendHandler", "type": "class", "loc": [28, 35], "level": 0, "parent": null, "vector": [3, 0, 0.9, 0.2286, 0, 0.66, 1.0, 839, 0, 2, 0, 0, 981, 0, 3], "semantic": {"name": "NotifySendHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class NotifySendHandler(logging.Handler):\n def __init__(self):\n logging.Handler.__init__(self)\n\n def emit(self, record):\n if Tkinter:\n msg = self.format(record)\n os.system(\"notify-send '%s'\" % msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:FunctionDef_L29_C4", "label": "__init__", "type": "function", "loc": [29, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_464:ClassDef_L28_C0", "vector": [2, 1, 0.8429, 0.0571, 1, 0.53, 0.0, 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 logging.Handler.__init__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:Expr_L30_C8", "label": "__init__()", "type": "expression", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_464:FunctionDef_L29_C4", "vector": [8, 2, 0.8571, 0.0286, 2, 0.12, 0.0, 555, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " logging.Handler.__init__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:FunctionDef_L32_C4", "label": "emit", "type": "function", "loc": [32, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_464:ClassDef_L28_C0", "vector": [2, 1, 0.9571, 0.1143, 1, 0.53, 1.0, 627, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "emit", "arg_names": ["self", "record"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def emit(self, record):\n if Tkinter:\n msg = self.format(record)\n os.system(\"notify-send '%s'\" % msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:If_L33_C8", "label": "if", "type": "if", "loc": [33, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_464:FunctionDef_L32_C4", "vector": [4, 2, 0.9714, 0.0857, 2, 0.8, 0.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if Tkinter:\n msg = self.format(record)\n os.system(\"notify-send '%s'\" % msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:Assign_L34_C12", "label": "msg = format()", "type": "assigned_variable", "loc": [34, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_464:If_L33_C8", "vector": [14, 3, 0.9714, 0.0286, 3, 0.23, 0.0, 712, 3, 1, 0, 0, 293, 10, 1], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "format", "annotation": ""}, "snippet": " msg = self.format(record)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_464:Expr_L35_C12", "label": "system()", "type": "expression", "loc": [35, 35], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_464:If_L33_C8", "vector": [8, 3, 1.0, 0.0286, 3, 0.23, 1.0, 856, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "system", "arg_names": [], "import_names": [], "rhs_call_name": "system", "annotation": ""}, "snippet": " os.system(\"notify-send '%s'\" % msg)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_464:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_464:Import_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_464:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_464:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_464:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_464:FunctionDef_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_464:FunctionDef_L11_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_464:Expr_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_464:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_464:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_464:FunctionDef_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_464:If_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_464:If_L15_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_464:Assign_L16_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_464:If_L15_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_464:Assign_L17_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_464:If_L15_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_464:Expr_L18_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_464:If_L15_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_464:Assign_L19_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_464:If_L15_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_464:Assign_L20_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_464:If_L15_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_464:Expr_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_464:If_L15_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_464:Expr_L22_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_464:If_L15_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_464:Assign_L23_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_464:If_L15_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_464:Expr_L24_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_464:If_L15_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_464:Expr_L25_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_464:ClassDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_464:FunctionDef_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_464:FunctionDef_L29_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_464:Expr_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_464:ClassDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_464:FunctionDef_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_464:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_464:If_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_464:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_464:Assign_L34_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_464:If_L33_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_464:Expr_L35_C12"}] |
# encoding utf-8
__author__ = "Thadeus Burgess <thadeusb@thadeusb.com>"
# we classify as "non-reserved" those key words that are explicitly known
# to the parser but are allowed as column or table names. Some key words
# that are otherwise non-reserved cannot be used as function or data type n
# ames and are in the nonreserved list. (Most of these words represent
# built-in functions or data types with special syntax. The function
# or type is still available but it cannot be redefined by the user.)
# Labeled "reserved" are those tokens that are not allowed as column or
# table names. Some reserved key words are allowable as names for
# functions or data typesself.
# Note at the bottom of the list is a dict containing references to the
# tuples, and also if you add a list don't forget to remove its default
# set of COMMON.
# Keywords that are adapter specific. Such as a list of "postgresql"
# or "mysql" keywords
# These are keywords that are common to all SQL dialects, and should
# never be used as a table or column. Even if you use one of these
# the cursor will throw an OperationalError for the SQL syntax.
COMMON = set((
'SELECT',
'INSERT',
'DELETE',
'UPDATE',
'DROP',
'CREATE',
'ALTER',
'WHERE',
'FROM',
'INNER',
'JOIN',
'AND',
'OR',
'LIKE',
'ON',
'IN',
'SET',
'BY',
'GROUP',
'ORDER',
'LEFT',
'OUTER',
'IF',
'END',
'THEN',
'LOOP',
'AS',
'ELSE',
'FOR',
'CASE',
'WHEN',
'MIN',
'MAX',
'DISTINCT',
))
POSTGRESQL = set((
'FALSE',
'TRUE',
'ALL',
'ANALYSE',
'ANALYZE',
'AND',
'ANY',
'ARRAY',
'AS',
'ASC',
'ASYMMETRIC',
'AUTHORIZATION',
'BETWEEN',
'BIGINT',
'BINARY',
'BIT',
'BOOLEAN',
'BOTH',
'CASE',
'CAST',
'CHAR',
'CHARACTER',
'CHECK',
'COALESCE',
'COLLATE',
'COLUMN',
'CONSTRAINT',
'CREATE',
'CROSS',
'CURRENT_CATALOG',
'CURRENT_DATE',
'CURRENT_ROLE',
'CURRENT_SCHEMA',
'CURRENT_TIME',
'CURRENT_TIMESTAMP',
'CURRENT_USER',
'DEC',
'DECIMAL',
'DEFAULT',
'DEFERRABLE',
'DESC',
'DISTINCT',
'DO',
'ELSE',
'END',
'EXCEPT',
'EXISTS',
'EXTRACT',
'FETCH',
'FLOAT',
'FOR',
'FOREIGN',
'FREEZE',
'FROM',
'FULL',
'GRANT',
'GREATEST',
'GROUP',
'HAVING',
'ILIKE',
'IN',
'INITIALLY',
'INNER',
'INOUT',
'INT',
'INTEGER',
'INTERSECT',
'INTERVAL',
'INTO',
'IS',
'ISNULL',
'JOIN',
'LEADING',
'LEAST',
'LEFT',
'LIKE',
'LIMIT',
'LOCALTIME',
'LOCALTIMESTAMP',
'NATIONAL',
'NATURAL',
'NCHAR',
'NEW',
'NONE',
'NOT',
'NOTNULL',
'NULL',
'NULLIF',
'NUMERIC',
'OFF',
'OFFSET',
'OLD',
'ON',
'ONLY',
'OR',
'ORDER',
'OUT',
'OUTER',
'OVERLAPS',
'OVERLAY',
'PLACING',
'POSITION',
'PRECISION',
'PRIMARY',
'REAL',
'REFERENCES',
'RETURNING',
'RIGHT',
'ROW',
'SELECT',
'SESSION_USER',
'SETOF',
'SIMILAR',
'SMALLINT',
'SOME',
'SUBSTRING',
'SYMMETRIC',
'TABLE',
'THEN',
'TIME',
'TIMESTAMP',
'TO',
'TRAILING',
'TREAT',
'TRIM',
'UNION',
'UNIQUE',
'USER',
'USING',
'VALUES',
'VARCHAR',
'VARIADIC',
'VERBOSE',
'WHEN',
'WHERE',
'WITH',
'XMLATTRIBUTES',
'XMLCONCAT',
'XMLELEMENT',
'XMLFOREST',
'XMLPARSE',
'XMLPI',
'XMLROOT',
'XMLSERIALIZE',
))
POSTGRESQL_NONRESERVED = set((
'A',
'ABORT',
'ABS',
'ABSENT',
'ABSOLUTE',
'ACCESS',
'ACCORDING',
'ACTION',
'ADA',
'ADD',
'ADMIN',
'AFTER',
'AGGREGATE',
'ALIAS',
'ALLOCATE',
'ALSO',
'ALTER',
'ALWAYS',
'ARE',
'ARRAY_AGG',
'ASENSITIVE',
'ASSERTION',
'ASSIGNMENT',
'AT',
'ATOMIC',
'ATTRIBUTE',
'ATTRIBUTES',
'AVG',
'BACKWARD',
'BASE64',
'BEFORE',
'BEGIN',
'BERNOULLI',
'BIT_LENGTH',
'BITVAR',
'BLOB',
'BOM',
'BREADTH',
'BY',
'C',
'CACHE',
'CALL',
'CALLED',
'CARDINALITY',
'CASCADE',
'CASCADED',
'CATALOG',
'CATALOG_NAME',
'CEIL',
'CEILING',
'CHAIN',
'CHAR_LENGTH',
'CHARACTER_LENGTH',
'CHARACTER_SET_CATALOG',
'CHARACTER_SET_NAME',
'CHARACTER_SET_SCHEMA',
'CHARACTERISTICS',
'CHARACTERS',
'CHECKED',
'CHECKPOINT',
'CLASS',
'CLASS_ORIGIN',
'CLOB',
'CLOSE',
'CLUSTER',
'COBOL',
'COLLATION',
'COLLATION_CATALOG',
'COLLATION_NAME',
'COLLATION_SCHEMA',
'COLLECT',
'COLUMN_NAME',
'COLUMNS',
'COMMAND_FUNCTION',
'COMMAND_FUNCTION_CODE',
'COMMENT',
'COMMIT',
'COMMITTED',
'COMPLETION',
'CONCURRENTLY',
'CONDITION',
'CONDITION_NUMBER',
'CONFIGURATION',
'CONNECT',
'CONNECTION',
'CONNECTION_NAME',
'CONSTRAINT_CATALOG',
'CONSTRAINT_NAME',
'CONSTRAINT_SCHEMA',
'CONSTRAINTS',
'CONSTRUCTOR',
'CONTAINS',
'CONTENT',
'CONTINUE',
'CONVERSION',
'CONVERT',
'COPY',
'CORR',
'CORRESPONDING',
'COST',
'COUNT',
'COVAR_POP',
'COVAR_SAMP',
'CREATEDB',
'CREATEROLE',
'CREATEUSER',
'CSV',
'CUBE',
'CUME_DIST',
'CURRENT',
'CURRENT_DEFAULT_TRANSFORM_GROUP',
'CURRENT_PATH',
'CURRENT_TRANSFORM_GROUP_FOR_TYPE',
'CURSOR',
'CURSOR_NAME',
'CYCLE',
'DATA',
'DATABASE',
'DATE',
'DATETIME_INTERVAL_CODE',
'DATETIME_INTERVAL_PRECISION',
'DAY',
'DEALLOCATE',
'DECLARE',
'DEFAULTS',
'DEFERRED',
'DEFINED',
'DEFINER',
'DEGREE',
'DELETE',
'DELIMITER',
'DELIMITERS',
'DENSE_RANK',
'DEPTH',
'DEREF',
'DERIVED',
'DESCRIBE',
'DESCRIPTOR',
'DESTROY',
'DESTRUCTOR',
'DETERMINISTIC',
'DIAGNOSTICS',
'DICTIONARY',
'DISABLE',
'DISCARD',
'DISCONNECT',
'DISPATCH',
'DOCUMENT',
'DOMAIN',
'DOUBLE',
'DROP',
'DYNAMIC',
'DYNAMIC_FUNCTION',
'DYNAMIC_FUNCTION_CODE',
'EACH',
'ELEMENT',
'EMPTY',
'ENABLE',
'ENCODING',
'ENCRYPTED',
'END-EXEC',
'ENUM',
'EQUALS',
'ESCAPE',
'EVERY',
'EXCEPTION',
'EXCLUDE',
'EXCLUDING',
'EXCLUSIVE',
'EXEC',
'EXECUTE',
'EXISTING',
'EXP',
'EXPLAIN',
'EXTERNAL',
'FAMILY',
'FILTER',
'FINAL',
'FIRST',
'FIRST_VALUE',
'FLAG',
'FLOOR',
'FOLLOWING',
'FORCE',
'FORTRAN',
'FORWARD',
'FOUND',
'FREE',
'FUNCTION',
'FUSION',
'G',
'GENERAL',
'GENERATED',
'GET',
'GLOBAL',
'GO',
'GOTO',
'GRANTED',
'GROUPING',
'HANDLER',
'HEADER',
'HEX',
'HIERARCHY',
'HOLD',
'HOST',
'HOUR',
# 'ID',
'IDENTITY',
'IF',
'IGNORE',
'IMMEDIATE',
'IMMUTABLE',
'IMPLEMENTATION',
'IMPLICIT',
'INCLUDING',
'INCREMENT',
'INDENT',
'INDEX',
'INDEXES',
'INDICATOR',
'INFIX',
'INHERIT',
'INHERITS',
'INITIALIZE',
'INPUT',
'INSENSITIVE',
'INSERT',
'INSTANCE',
'INSTANTIABLE',
'INSTEAD',
'INTERSECTION',
'INVOKER',
'ISOLATION',
'ITERATE',
'K',
'KEY',
'KEY_MEMBER',
'KEY_TYPE',
'LAG',
'LANCOMPILER',
'LANGUAGE',
'LARGE',
'LAST',
'LAST_VALUE',
'LATERAL',
'LC_COLLATE',
'LC_CTYPE',
'LEAD',
'LENGTH',
'LESS',
'LEVEL',
'LIKE_REGEX',
'LISTEN',
'LN',
'LOAD',
'LOCAL',
'LOCATION',
'LOCATOR',
'LOCK',
'LOGIN',
'LOWER',
'M',
'MAP',
'MAPPING',
'MATCH',
'MATCHED',
'MAX',
'MAX_CARDINALITY',
'MAXVALUE',
'MEMBER',
'MERGE',
'MESSAGE_LENGTH',
'MESSAGE_OCTET_LENGTH',
'MESSAGE_TEXT',
'METHOD',
'MIN',
'MINUTE',
'MINVALUE',
'MOD',
'MODE',
'MODIFIES',
'MODIFY',
'MODULE',
'MONTH',
'MORE',
'MOVE',
'MULTISET',
'MUMPS',
# 'NAME',
'NAMES',
'NAMESPACE',
'NCLOB',
'NESTING',
'NEXT',
'NFC',
'NFD',
'NFKC',
'NFKD',
'NIL',
'NO',
'NOCREATEDB',
'NOCREATEROLE',
'NOCREATEUSER',
'NOINHERIT',
'NOLOGIN',
'NORMALIZE',
'NORMALIZED',
'NOSUPERUSER',
'NOTHING',
'NOTIFY',
'NOWAIT',
'NTH_VALUE',
'NTILE',
'NULLABLE',
'NULLS',
'NUMBER',
'OBJECT',
'OCCURRENCES_REGEX',
'OCTET_LENGTH',
'OCTETS',
'OF',
'OIDS',
'OPEN',
'OPERATION',
'OPERATOR',
'OPTION',
'OPTIONS',
'ORDERING',
'ORDINALITY',
'OTHERS',
'OUTPUT',
'OVER',
'OVERRIDING',
'OWNED',
'OWNER',
'P',
'PAD',
'PARAMETER',
'PARAMETER_MODE',
'PARAMETER_NAME',
'PARAMETER_ORDINAL_POSITION',
'PARAMETER_SPECIFIC_CATALOG',
'PARAMETER_SPECIFIC_NAME',
'PARAMETER_SPECIFIC_SCHEMA',
'PARAMETERS',
'PARSER',
'PARTIAL',
'PARTITION',
'PASCAL',
'PASSING',
# 'PASSWORD',
'PATH',
'PERCENT_RANK',
'PERCENTILE_CONT',
'PERCENTILE_DISC',
'PLANS',
'PLI',
'POSITION_REGEX',
'POSTFIX',
'POWER',
'PRECEDING',
'PREFIX',
'PREORDER',
'PREPARE',
'PREPARED',
'PRESERVE',
'PRIOR',
'PRIVILEGES',
'PROCEDURAL',
'PROCEDURE',
'PUBLIC',
'QUOTE',
'RANGE',
'RANK',
'READ',
'READS',
'REASSIGN',
'RECHECK',
'RECURSIVE',
'REF',
'REFERENCING',
'REGR_AVGX',
'REGR_AVGY',
'REGR_COUNT',
'REGR_INTERCEPT',
'REGR_R2',
'REGR_SLOPE',
'REGR_SXX',
'REGR_SXY',
'REGR_SYY',
'REINDEX',
'RELATIVE',
'RELEASE',
'RENAME',
'REPEATABLE',
'REPLACE',
'REPLICA',
'RESET',
'RESPECT',
'RESTART',
'RESTRICT',
'RESULT',
'RETURN',
'RETURNED_CARDINALITY',
'RETURNED_LENGTH',
'RETURNED_OCTET_LENGTH',
'RETURNED_SQLSTATE',
'RETURNS',
'REVOKE',
# 'ROLE',
'ROLLBACK',
'ROLLUP',
'ROUTINE',
'ROUTINE_CATALOG',
'ROUTINE_NAME',
'ROUTINE_SCHEMA',
'ROW_COUNT',
'ROW_NUMBER',
'ROWS',
'RULE',
'SAVEPOINT',
'SCALE',
'SCHEMA',
'SCHEMA_NAME',
'SCOPE',
'SCOPE_CATALOG',
'SCOPE_NAME',
'SCOPE_SCHEMA',
'SCROLL',
'SEARCH',
'SECOND',
'SECTION',
'SECURITY',
'SELF',
'SENSITIVE',
'SEQUENCE',
'SERIALIZABLE',
'SERVER',
'SERVER_NAME',
'SESSION',
'SET',
'SETS',
'SHARE',
'SHOW',
'SIMPLE',
'SIZE',
'SOURCE',
'SPACE',
'SPECIFIC',
'SPECIFIC_NAME',
'SPECIFICTYPE',
'SQL',
'SQLCODE',
'SQLERROR',
'SQLEXCEPTION',
'SQLSTATE',
'SQLWARNING',
'SQRT',
'STABLE',
'STANDALONE',
'START',
'STATE',
'STATEMENT',
'STATIC',
'STATISTICS',
'STDDEV_POP',
'STDDEV_SAMP',
'STDIN',
'STDOUT',
'STORAGE',
'STRICT',
'STRIP',
'STRUCTURE',
'STYLE',
'SUBCLASS_ORIGIN',
'SUBLIST',
'SUBMULTISET',
'SUBSTRING_REGEX',
'SUM',
'SUPERUSER',
'SYSID',
'SYSTEM',
'SYSTEM_USER',
'T',
# 'TABLE_NAME',
'TABLESAMPLE',
'TABLESPACE',
'TEMP',
'TEMPLATE',
'TEMPORARY',
'TERMINATE',
'TEXT',
'THAN',
'TIES',
'TIMEZONE_HOUR',
'TIMEZONE_MINUTE',
'TOP_LEVEL_COUNT',
'TRANSACTION',
'TRANSACTION_ACTIVE',
'TRANSACTIONS_COMMITTED',
'TRANSACTIONS_ROLLED_BACK',
'TRANSFORM',
'TRANSFORMS',
'TRANSLATE',
'TRANSLATE_REGEX',
'TRANSLATION',
'TRIGGER',
'TRIGGER_CATALOG',
'TRIGGER_NAME',
'TRIGGER_SCHEMA',
'TRIM_ARRAY',
'TRUNCATE',
'TRUSTED',
'TYPE',
'UESCAPE',
'UNBOUNDED',
'UNCOMMITTED',
'UNDER',
'UNENCRYPTED',
'UNKNOWN',
'UNLISTEN',
'UNNAMED',
'UNNEST',
'UNTIL',
'UNTYPED',
'UPDATE',
'UPPER',
'URI',
'USAGE',
'USER_DEFINED_TYPE_CATALOG',
'USER_DEFINED_TYPE_CODE',
'USER_DEFINED_TYPE_NAME',
'USER_DEFINED_TYPE_SCHEMA',
'VACUUM',
'VALID',
'VALIDATOR',
'VALUE',
'VAR_POP',
'VAR_SAMP',
'VARBINARY',
'VARIABLE',
'VARYING',
'VERSION',
'VIEW',
'VOLATILE',
'WHENEVER',
'WHITESPACE',
'WIDTH_BUCKET',
'WINDOW',
'WITHIN',
'WITHOUT',
'WORK',
'WRAPPER',
'WRITE',
'XML',
'XMLAGG',
'XMLBINARY',
'XMLCAST',
'XMLCOMMENT',
'XMLDECLARATION',
'XMLDOCUMENT',
'XMLEXISTS',
'XMLITERATE',
'XMLNAMESPACES',
'XMLQUERY',
'XMLSCHEMA',
'XMLTABLE',
'XMLTEXT',
'XMLVALIDATE',
'YEAR',
'YES',
'ZONE',
))
#Thanks villas
FIREBIRD = set((
'ABS',
'ACTIVE',
'ADMIN',
'AFTER',
'ASCENDING',
'AUTO',
'AUTODDL',
'BASED',
'BASENAME',
'BASE_NAME',
'BEFORE',
'BIT_LENGTH',
'BLOB',
'BLOBEDIT',
'BOOLEAN',
'BOTH',
'BUFFER',
'CACHE',
'CHAR_LENGTH',
'CHARACTER_LENGTH',
'CHECK_POINT_LEN',
'CHECK_POINT_LENGTH',
'CLOSE',
'COMMITTED',
'COMPILETIME',
'COMPUTED',
'CONDITIONAL',
'CONNECT',
'CONTAINING',
'CROSS',
'CSTRING',
'CURRENT_CONNECTION',
'CURRENT_ROLE',
'CURRENT_TRANSACTION',
'CURRENT_USER',
'DATABASE',
'DB_KEY',
'DEBUG',
'DESCENDING',
'DISCONNECT',
'DISPLAY',
'DO',
'ECHO',
'EDIT',
'ENTRY_POINT',
'EVENT',
'EXIT',
'EXTERN',
'FALSE',
'FETCH',
'FILE',
'FILTER',
'FREE_IT',
'FUNCTION',
'GDSCODE',
'GENERATOR',
'GEN_ID',
'GLOBAL',
'GROUP_COMMIT_WAIT',
'GROUP_COMMIT_WAIT_TIME',
'HELP',
'IF',
'INACTIVE',
'INDEX',
'INIT',
'INPUT_TYPE',
'INSENSITIVE',
'ISQL',
'LC_MESSAGES',
'LC_TYPE',
'LEADING',
'LENGTH',
'LEV',
'LOGFILE',
'LOG_BUFFER_SIZE',
'LOG_BUF_SIZE',
'LONG',
'LOWER',
'MANUAL',
'MAXIMUM',
'MAXIMUM_SEGMENT',
'MAX_SEGMENT',
'MERGE',
'MESSAGE',
'MINIMUM',
'MODULE_NAME',
'NOAUTO',
'NUM_LOG_BUFS',
'NUM_LOG_BUFFERS',
'OCTET_LENGTH',
'OPEN',
'OUTPUT_TYPE',
'OVERFLOW',
'PAGE',
'PAGELENGTH',
'PAGES',
'PAGE_SIZE',
'PARAMETER',
# 'PASSWORD',
'PLAN',
'POST_EVENT',
'QUIT',
'RAW_PARTITIONS',
'RDB$DB_KEY',
'RECORD_VERSION',
'RECREATE',
'RECURSIVE',
'RELEASE',
'RESERV',
'RESERVING',
'RETAIN',
'RETURN',
'RETURNING_VALUES',
'RETURNS',
# 'ROLE',
'ROW_COUNT',
'ROWS',
'RUNTIME',
'SAVEPOINT',
'SECOND',
'SENSITIVE',
'SHADOW',
'SHARED',
'SHELL',
'SHOW',
'SINGULAR',
'SNAPSHOT',
'SORT',
'STABILITY',
'START',
'STARTING',
'STARTS',
'STATEMENT',
'STATIC',
'STATISTICS',
'SUB_TYPE',
'SUSPEND',
'TERMINATOR',
'TRAILING',
'TRIGGER',
'TRIM',
'TRUE',
'TYPE',
'UNCOMMITTED',
'UNKNOWN',
'USING',
'VARIABLE',
'VERSION',
'WAIT',
'WEEKDAY',
'WHILE',
'YEARDAY',
))
FIREBIRD_NONRESERVED = set((
'BACKUP',
'BLOCK',
'COALESCE',
'COLLATION',
'COMMENT',
'DELETING',
'DIFFERENCE',
'IIF',
'INSERTING',
'LAST',
'LEAVE',
'LOCK',
'NEXT',
'NULLIF',
'NULLS',
'RESTART',
'RETURNING',
'SCALAR_ARRAY',
'SEQUENCE',
'STATEMENT',
'UPDATING',
'ABS',
'ACCENT',
'ACOS',
'ALWAYS',
'ASCII_CHAR',
'ASCII_VAL',
'ASIN',
'ATAN',
'ATAN2',
'BACKUP',
'BIN_AND',
'BIN_OR',
'BIN_SHL',
'BIN_SHR',
'BIN_XOR',
'BLOCK',
'CEIL',
'CEILING',
'COLLATION',
'COMMENT',
'COS',
'COSH',
'COT',
'DATEADD',
'DATEDIFF',
'DECODE',
'DIFFERENCE',
'EXP',
'FLOOR',
'GEN_UUID',
'GENERATED',
'HASH',
'IIF',
'LIST',
'LN',
'LOG',
'LOG10',
'LPAD',
'MATCHED',
'MATCHING',
'MAXVALUE',
'MILLISECOND',
'MINVALUE',
'MOD',
'NEXT',
'OVERLAY',
'PAD',
'PI',
'PLACING',
'POWER',
'PRESERVE',
'RAND',
'REPLACE',
'RESTART',
'RETURNING',
'REVERSE',
'ROUND',
'RPAD',
'SCALAR_ARRAY',
'SEQUENCE',
'SIGN',
'SIN',
'SINH',
'SPACE',
'SQRT',
'TAN',
'TANH',
'TEMPORARY',
'TRUNC',
'WEEK',
))
# Thanks Jonathan Lundell
MYSQL = set((
'ACCESSIBLE',
'ADD',
'ALL',
'ALTER',
'ANALYZE',
'AND',
'AS',
'ASC',
'ASENSITIVE',
'BEFORE',
'BETWEEN',
'BIGINT',
'BINARY',
'BLOB',
'BOTH',
'BY',
'CALL',
'CASCADE',
'CASE',
'CHANGE',
'CHAR',
'CHARACTER',
'CHECK',
'COLLATE',
'COLUMN',
'CONDITION',
'CONSTRAINT',
'CONTINUE',
'CONVERT',
'CREATE',
'CROSS',
'CURRENT_DATE',
'CURRENT_TIME',
'CURRENT_TIMESTAMP',
'CURRENT_USER',
'CURSOR',
'DATABASE',
'DATABASES',
'DAY_HOUR',
'DAY_MICROSECOND',
'DAY_MINUTE',
'DAY_SECOND',
'DEC',
'DECIMAL',
'DECLARE',
'DEFAULT',
'DELAYED',
'DELETE',
'DESC',
'DESCRIBE',
'DETERMINISTIC',
'DISTINCT',
'DISTINCTROW',
'DIV',
'DOUBLE',
'DROP',
'DUAL',
'EACH',
'ELSE',
'ELSEIF',
'ENCLOSED',
'ESCAPED',
'EXISTS',
'EXIT',
'EXPLAIN',
'FALSE',
'FETCH',
'FLOAT',
'FLOAT4',
'FLOAT8',
'FOR',
'FORCE',
'FOREIGN',
'FROM',
'FULLTEXT',
'GRANT',
'GROUP',
'HAVING',
'HIGH_PRIORITY',
'HOUR_MICROSECOND',
'HOUR_MINUTE',
'HOUR_SECOND',
'IF',
'IGNORE',
'IGNORE_SERVER_IDS',
'IGNORE_SERVER_IDS',
'IN',
'INDEX',
'INFILE',
'INNER',
'INOUT',
'INSENSITIVE',
'INSERT',
'INT',
'INT1',
'INT2',
'INT3',
'INT4',
'INT8',
'INTEGER',
'INTERVAL',
'INTO',
'IS',
'ITERATE',
'JOIN',
'KEY',
'KEYS',
'KILL',
'LEADING',
'LEAVE',
'LEFT',
'LIKE',
'LIMIT',
'LINEAR',
'LINES',
'LOAD',
'LOCALTIME',
'LOCALTIMESTAMP',
'LOCK',
'LONG',
'LONGBLOB',
'LONGTEXT',
'LOOP',
'LOW_PRIORITY',
'MASTER_HEARTBEAT_PERIOD',
'MASTER_HEARTBEAT_PERIOD',
'MASTER_SSL_VERIFY_SERVER_CERT',
'MATCH',
'MAXVALUE',
'MAXVALUE',
'MEDIUMBLOB',
'MEDIUMINT',
'MEDIUMTEXT',
'MIDDLEINT',
'MINUTE_MICROSECOND',
'MINUTE_SECOND',
'MOD',
'MODIFIES',
'NATURAL',
'NO_WRITE_TO_BINLOG',
'NOT',
'NULL',
'NUMERIC',
'ON',
'OPTIMIZE',
'OPTION',
'OPTIONALLY',
'OR',
'ORDER',
'OUT',
'OUTER',
'OUTFILE',
'PRECISION',
'PRIMARY',
'PROCEDURE',
'PURGE',
'RANGE',
'READ',
'READ_WRITE',
'READS',
'REAL',
'REFERENCES',
'REGEXP',
'RELEASE',
'RENAME',
'REPEAT',
'REPLACE',
'REQUIRE',
'RESIGNAL',
'RESIGNAL',
'RESTRICT',
'RETURN',
'REVOKE',
'RIGHT',
'RLIKE',
'SCHEMA',
'SCHEMAS',
'SECOND_MICROSECOND',
'SELECT',
'SENSITIVE',
'SEPARATOR',
'SET',
'SHOW',
'SIGNAL',
'SIGNAL',
'SMALLINT',
'SPATIAL',
'SPECIFIC',
'SQL',
'SQL_BIG_RESULT',
'SQL_CALC_FOUND_ROWS',
'SQL_SMALL_RESULT',
'SQLEXCEPTION',
'SQLSTATE',
'SQLWARNING',
'SSL',
'STARTING',
'STRAIGHT_JOIN',
'TABLE',
'TERMINATED',
'THEN',
'TINYBLOB',
'TINYINT',
'TINYTEXT',
'TO',
'TRAILING',
'TRIGGER',
'TRUE',
'UNDO',
'UNION',
'UNIQUE',
'UNLOCK',
'UNSIGNED',
'UPDATE',
'USAGE',
'USE',
'USING',
'UTC_DATE',
'UTC_TIME',
'UTC_TIMESTAMP',
'VALUES',
'VARBINARY',
'VARCHAR',
'VARCHARACTER',
'VARYING',
'WHEN',
'WHERE',
'WHILE',
'WITH',
'WRITE',
'XOR',
'YEAR_MONTH',
'ZEROFILL',
))
MSSQL = set((
'ADD',
'ALL',
'ALTER',
'AND',
'ANY',
'AS',
'ASC',
'AUTHORIZATION',
'BACKUP',
'BEGIN',
'BETWEEN',
'BREAK',
'BROWSE',
'BULK',
'BY',
'CASCADE',
'CASE',
'CHECK',
'CHECKPOINT',
'CLOSE',
'CLUSTERED',
'COALESCE',
'COLLATE',
'COLUMN',
'COMMIT',
'COMPUTE',
'CONSTRAINT',
'CONTAINS',
'CONTAINSTABLE',
'CONTINUE',
'CONVERT',
'CREATE',
'CROSS',
'CURRENT',
'CURRENT_DATE',
'CURRENT_TIME',
'CURRENT_TIMESTAMP',
'CURRENT_USER',
'CURSOR',
'DATABASE',
'DBCC',
'DEALLOCATE',
'DECLARE',
'DEFAULT',
'DELETE',
'DENY',
'DESC',
'DISK',
'DISTINCT',
'DISTRIBUTED',
'DOUBLE',
'DROP',
'DUMMY',
'DUMP',
'ELSE',
'END',
'ERRLVL',
'ESCAPE',
'EXCEPT',
'EXEC',
'EXECUTE',
'EXISTS',
'EXIT',
'FETCH',
'FILE',
'FILLFACTOR',
'FOR',
'FOREIGN',
'FREETEXT',
'FREETEXTTABLE',
'FROM',
'FULL',
'FUNCTION',
'GOTO',
'GRANT',
'GROUP',
'HAVING',
'HOLDLOCK',
'IDENTITY',
'IDENTITY_INSERT',
'IDENTITYCOL',
'IF',
'IN',
'INDEX',
'INNER',
'INSERT',
'INTERSECT',
'INTO',
'IS',
'JOIN',
'KEY',
'KILL',
'LEFT',
'LIKE',
'LINENO',
'LOAD',
'NATIONAL ',
'NOCHECK',
'NONCLUSTERED',
'NOT',
'NULL',
'NULLIF',
'OF',
'OFF',
'OFFSETS',
'ON',
'OPEN',
'OPENDATASOURCE',
'OPENQUERY',
'OPENROWSET',
'OPENXML',
'OPTION',
'OR',
'ORDER',
'OUTER',
'OVER',
'PERCENT',
'PLAN',
'PRECISION',
'PRIMARY',
'PRINT',
'PROC',
'PROCEDURE',
'PUBLIC',
'RAISERROR',
'READ',
'READTEXT',
'RECONFIGURE',
'REFERENCES',
'REPLICATION',
'RESTORE',
'RESTRICT',
'RETURN',
'REVOKE',
'RIGHT',
'ROLLBACK',
'ROWCOUNT',
'ROWGUIDCOL',
'RULE',
'SAVE',
'SCHEMA',
'SELECT',
'SESSION_USER',
'SET',
'SETUSER',
'SHUTDOWN',
'SOME',
'STATISTICS',
'SYSTEM_USER',
'TABLE',
'TEXTSIZE',
'THEN',
'TO',
'TOP',
'TRAN',
'TRANSACTION',
'TRIGGER',
'TRUNCATE',
'TSEQUAL',
'UNION',
'UNIQUE',
'UPDATE',
'UPDATETEXT',
'USE',
'USER',
'VALUES',
'VARYING',
'VIEW',
'WAITFOR',
'WHEN',
'WHERE',
'WHILE',
'WITH',
'WRITETEXT',
))
ORACLE = set((
'ACCESS',
'ADD',
'ALL',
'ALTER',
'AND',
'ANY',
'AS',
'ASC',
'AUDIT',
'BETWEEN',
'BY',
'CHAR',
'CHECK',
'CLUSTER',
'COLUMN',
'COMMENT',
'COMPRESS',
'CONNECT',
'CREATE',
'CURRENT',
'DATE',
'DECIMAL',
'DEFAULT',
'DELETE',
'DESC',
'DISTINCT',
'DROP',
'ELSE',
'EXCLUSIVE',
'EXISTS',
'FILE',
'FLOAT',
'FOR',
'FROM',
'GRANT',
'GROUP',
'HAVING',
'IDENTIFIED',
'IMMEDIATE',
'IN',
'INCREMENT',
'INDEX',
'INITIAL',
'INSERT',
'INTEGER',
'INTERSECT',
'INTO',
'IS',
'LEVEL',
'LIKE',
'LOCK',
'LONG',
'MAXEXTENTS',
'MINUS',
'MLSLABEL',
'MODE',
'MODIFY',
'NOAUDIT',
'NOCOMPRESS',
'NOT',
'NOWAIT',
'NULL',
'NUMBER',
'OF',
'OFFLINE',
'ON',
'ONLINE',
'OPTION',
'OR',
'ORDER',
'PCTFREE',
'PRIOR',
'PRIVILEGES',
'PUBLIC',
'RAW',
'RENAME',
'RESOURCE',
'REVOKE',
'ROW',
'ROWID',
'ROWNUM',
'ROWS',
'SELECT',
'SESSION',
'SET',
'SHARE',
'SIZE',
'SMALLINT',
'START',
'SUCCESSFUL',
'SYNONYM',
'SYSDATE',
'TABLE',
'THEN',
'TO',
'TRIGGER',
'UID',
'UNION',
'UNIQUE',
'UPDATE',
'USER',
'VALIDATE',
'VALUES',
'VARCHAR',
'VARCHAR2',
'VIEW',
'WHENEVER',
'WHERE',
'WITH',
))
SQLITE = set((
'ABORT',
'ACTION',
'ADD',
'AFTER',
'ALL',
'ALTER',
'ANALYZE',
'AND',
'AS',
'ASC',
'ATTACH',
'AUTOINCREMENT',
'BEFORE',
'BEGIN',
'BETWEEN',
'BY',
'CASCADE',
'CASE',
'CAST',
'CHECK',
'COLLATE',
'COLUMN',
'COMMIT',
'CONFLICT',
'CONSTRAINT',
'CREATE',
'CROSS',
'CURRENT_DATE',
'CURRENT_TIME',
'CURRENT_TIMESTAMP',
'DATABASE',
'DEFAULT',
'DEFERRABLE',
'DEFERRED',
'DELETE',
'DESC',
'DETACH',
'DISTINCT',
'DROP',
'EACH',
'ELSE',
'END',
'ESCAPE',
'EXCEPT',
'EXCLUSIVE',
'EXISTS',
'EXPLAIN',
'FAIL',
'FOR',
'FOREIGN',
'FROM',
'FULL',
'GLOB',
'GROUP',
'HAVING',
'IF',
'IGNORE',
'IMMEDIATE',
'IN',
'INDEX',
'INDEXED',
'INITIALLY',
'INNER',
'INSERT',
'INSTEAD',
'INTERSECT',
'INTO',
'IS',
'ISNULL',
'JOIN',
'KEY',
'LEFT',
'LIKE',
'LIMIT',
'MATCH',
'NATURAL',
'NO',
'NOT',
'NOTNULL',
'NULL',
'OF',
'OFFSET',
'ON',
'OR',
'ORDER',
'OUTER',
'PLAN',
'PRAGMA',
'PRIMARY',
'QUERY',
'RAISE',
'REFERENCES',
'REGEXP',
'REINDEX',
'RELEASE',
'RENAME',
'REPLACE',
'RESTRICT',
'RIGHT',
'ROLLBACK',
'ROW',
'SAVEPOINT',
'SELECT',
'SET',
'TABLE',
'TEMP',
'TEMPORARY',
'THEN',
'TO',
'TRANSACTION',
'TRIGGER',
'UNION',
'UNIQUE',
'UPDATE',
'USING',
'VACUUM',
'VALUES',
'VIEW',
'VIRTUAL',
'WHEN',
'WHERE',
))
MONGODB_NONRESERVED = set(('SAFE',))
# remove from here when you add a list.
JDBCSQLITE = SQLITE
DB2 = INFORMIX = INGRES = JDBCPOSTGRESQL = COMMON
ADAPTERS = {
'sqlite': SQLITE,
'mysql': MYSQL,
'postgres': POSTGRESQL,
'postgres_nonreserved': POSTGRESQL_NONRESERVED,
'oracle': ORACLE,
'mssql': MSSQL,
'mssql2': MSSQL,
'db2': DB2,
'informix': INFORMIX,
'firebird': FIREBIRD,
'firebird_embedded': FIREBIRD,
'firebird_nonreserved': FIREBIRD_NONRESERVED,
'ingres': INGRES,
'ingresu': INGRES,
'jdbc:sqlite': JDBCSQLITE,
'jdbc:postgres': JDBCPOSTGRESQL,
'common': COMMON,
'mongodb_nonreserved': MONGODB_NONRESERVED
}
ADAPTERS['all'] = reduce(lambda a, b: a.union(b), (
x for x in ADAPTERS.values()))
| ajibawa-2023/Python-Code-Large/train/row_465 | 15 | 1,718 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_465:Assign_L3_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.0017, 0.0006, 0, 0.66, 0.0, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = \"Thadeus Burgess <thadeusb@thadeusb.com>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_465:Assign_L25_C0", "label": "COMMON = set()", "type": "assigned_variable", "loc": [25, 64], "level": 0, "parent": null, "vector": [14, 0, 0.0259, 0.0233, 0, 0.66, 0.0714, 63, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "COMMON", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": "COMMON = set((\n 'SELECT',\n 'INSERT',\n 'DELETE',\n 'UPDATE',\n 'DROP',\n 'CREATE',\n 'ALTER',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_465:Assign_L67_C0", "label": "POSTGRESQL = set()", "type": "assigned_variable", "loc": [67, 212], "level": 0, "parent": null, "vector": [14, 0, 0.0812, 0.085, 0, 0.66, 0.1429, 565, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "POSTGRESQL", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": "POSTGRESQL = set((\n 'FALSE',\n 'TRUE',\n 'ALL',\n 'ANALYSE',\n 'ANALYZE',\n 'AND',\n 'ANY',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_465:Assign_L215_C0", "label": "POSTGRESQL_NONRESERVED = set()", "type": "assigned_variable", "loc": [215, 788], "level": 0, "parent": null, "vector": [14, 0, 0.2919, 0.3341, 0, 0.66, 0.2143, 637, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "POSTGRESQL_NONRESERVED", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": "POSTGRESQL_NONRESERVED = set((\n 'A',\n 'ABORT',\n 'ABS',\n 'ABSENT',\n 'ABSOLUTE',\n 'ACCESS',\n 'ACCORDING',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_465:Assign_L791_C0", "label": "FIREBIRD = set()", "type": "assigned_variable", "loc": [791, 944], "level": 0, "parent": null, "vector": [14, 0, 0.5049, 0.0896, 0, 0.66, 0.2857, 811, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "FIREBIRD", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": "FIREBIRD = set((\n 'ABS',\n 'ACTIVE',\n 'ADMIN',\n 'AFTER',\n 'ASCENDING',\n 'AUTO',\n 'AUTODDL',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_465:Assign_L945_C0", "label": "FIREBIRD_NONRESERVED = set()", "type": "assigned_variable", "loc": [945, 1037], "level": 0, "parent": null, "vector": [14, 0, 0.5768, 0.0541, 0, 0.66, 0.3571, 396, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "FIREBIRD_NONRESERVED", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": "FIREBIRD_NONRESERVED = set((\n 'BACKUP',\n 'BLOCK',\n 'COALESCE',\n 'COLLATION',\n 'COMMENT',\n 'DELETING',\n 'DIFFERENCE',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_465:Assign_L1040_C0", "label": "MYSQL = set()", "type": "assigned_variable", "loc": [1040, 1274], "level": 0, "parent": null, "vector": [14, 0, 0.6735, 0.1368, 0, 0.66, 0.4286, 528, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "MYSQL", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": "MYSQL = set((\n 'ACCESSIBLE',\n 'ADD',\n 'ALL',\n 'ALTER',\n 'ANALYZE',\n 'AND',\n 'AS',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_465:Assign_L1276_C0", "label": "MSSQL = set()", "type": "assigned_variable", "loc": [1276, 1451], "level": 0, "parent": null, "vector": [14, 0, 0.7937, 0.1024, 0, 0.66, 0.5, 24, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "MSSQL", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": "MSSQL = set((\n 'ADD',\n 'ALL',\n 'ALTER',\n 'AND',\n 'ANY',\n 'AS',\n 'ASC',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_465:Assign_L1453_C0", "label": "ORACLE = set()", "type": "assigned_variable", "loc": [1453, 1563], "level": 0, "parent": null, "vector": [14, 0, 0.8778, 0.0646, 0, 0.66, 0.5714, 201, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "ORACLE", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": "ORACLE = set((\n 'ACCESS',\n 'ADD',\n 'ALL',\n 'ALTER',\n 'AND',\n 'ANY',\n 'AS',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_465:Assign_L1565_C0", "label": "SQLITE = set()", "type": "assigned_variable", "loc": [1565, 1687], "level": 0, "parent": null, "vector": [14, 0, 0.9464, 0.0716, 0, 0.66, 0.6429, 81, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "SQLITE", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": "SQLITE = set((\n 'ABORT',\n 'ACTION',\n 'ADD',\n 'AFTER',\n 'ALL',\n 'ALTER',\n 'ANALYZE',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_465:Assign_L1690_C0", "label": "MONGODB_NONRESERVED = set()", "type": "assigned_variable", "loc": [1690, 1690], "level": 0, "parent": null, "vector": [14, 0, 0.9837, 0.0006, 0, 0.66, 0.7143, 631, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "MONGODB_NONRESERVED", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": "MONGODB_NONRESERVED = set(('SAFE',))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_465:Assign_L1693_C0", "label": "JDBCSQLITE =", "type": "assigned_variable", "loc": [1693, 1693], "level": 0, "parent": null, "vector": [14, 0, 0.9854, 0.0006, 0, 0.66, 0.7857, 740, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "JDBCSQLITE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "JDBCSQLITE = SQLITE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_465:Assign_L1694_C0", "label": "DB2 =", "type": "assigned_variable", "loc": [1694, 1694], "level": 0, "parent": null, "vector": [14, 0, 0.986, 0.0006, 0, 0.66, 0.8571, 50, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "DB2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DB2 = INFORMIX = INGRES = JDBCPOSTGRESQL = COMMON"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_465:Assign_L1696_C0", "label": "ADAPTERS =", "type": "assigned_variable", "loc": [1696, 1715], "level": 0, "parent": null, "vector": [14, 0, 0.9927, 0.0116, 0, 0.66, 0.9286, 682, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "ADAPTERS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ADAPTERS = {\n 'sqlite': SQLITE,\n 'mysql': MYSQL,\n 'postgres': POSTGRESQL,\n 'postgres_nonreserved': POSTGRESQL_NONRESERVED,\n 'oracle': ORACLE,\n 'mssql': MSSQL,\n 'mssql2': MSSQL,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_465:Assign_L1717_C0", "label": " = reduce()", "type": "assigned_variable", "loc": [1717, 1718], "level": 0, "parent": null, "vector": [14, 0, 0.9997, 0.0012, 0, 0.66, 1.0, 0, 3, 2, 0, 0, 622, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "reduce", "annotation": ""}, "snippet": "ADAPTERS['all'] = reduce(lambda a, b: a.union(b), (\n x for x in ADAPTERS.values()))"}] | [] |
# -*- coding: utf-8 -*-
# This file is part of the Rocket Web Server
# Copyright (c) 2011 Timothy Farrell
# Modified by Massimo Di Pierro
# Import System Modules
import sys
import errno
import socket
import logging
import platform
# Define Constants
VERSION = '1.2.6'
SERVER_NAME = socket.gethostname()
SERVER_SOFTWARE = 'Rocket %s' % VERSION
HTTP_SERVER_SOFTWARE = '%s Python/%s' % (
SERVER_SOFTWARE, sys.version.split(' ')[0])
BUF_SIZE = 16384
SOCKET_TIMEOUT = 10 # in secs
THREAD_STOP_CHECK_INTERVAL = 1 # in secs, How often should threads check for a server stop message?
IS_JYTHON = platform.system() == 'Java' # Handle special cases for Jython
IGNORE_ERRORS_ON_CLOSE = set([errno.ECONNABORTED, errno.ECONNRESET])
DEFAULT_LISTEN_QUEUE_SIZE = 5
DEFAULT_MIN_THREADS = 10
DEFAULT_MAX_THREADS = 0
DEFAULTS = dict(LISTEN_QUEUE_SIZE=DEFAULT_LISTEN_QUEUE_SIZE,
MIN_THREADS=DEFAULT_MIN_THREADS,
MAX_THREADS=DEFAULT_MAX_THREADS)
PY3K = sys.version_info[0] > 2
class NullHandler(logging.Handler):
"A Logging handler to prevent library errors."
def emit(self, record):
pass
if PY3K:
def b(val):
""" Convert string/unicode/bytes literals into bytes. This allows for
the same code to run on Python 2.x and 3.x. """
if isinstance(val, str):
return val.encode()
else:
return val
def u(val, encoding="us-ascii"):
""" Convert bytes into string/unicode. This allows for the
same code to run on Python 2.x and 3.x. """
if isinstance(val, bytes):
return val.decode(encoding)
else:
return val
else:
def b(val):
""" Convert string/unicode/bytes literals into bytes. This allows for
the same code to run on Python 2.x and 3.x. """
if isinstance(val, unicode):
return val.encode()
else:
return val
def u(val, encoding="us-ascii"):
""" Convert bytes into string/unicode. This allows for the
same code to run on Python 2.x and 3.x. """
if isinstance(val, str):
return val.decode(encoding)
else:
return val
# Import Package Modules
# package imports removed in monolithic build
__all__ = ['VERSION', 'SERVER_SOFTWARE', 'HTTP_SERVER_SOFTWARE', 'BUF_SIZE',
'IS_JYTHON', 'IGNORE_ERRORS_ON_CLOSE', 'DEFAULTS', 'PY3K', 'b', 'u',
'Rocket', 'CherryPyWSGIServer', 'SERVER_NAME', 'NullHandler']
# Monolithic build...end of module: rocket/__init__.py
# Monolithic build...start of module: rocket/connection.py
# Import System Modules
import sys
import time
import socket
try:
import ssl
has_ssl = True
except ImportError:
has_ssl = False
# Import Package Modules
# package imports removed in monolithic build
# TODO - This part is still very experimental.
#from .filelike import FileLikeSocket
class Connection(object):
__slots__ = [
'setblocking',
'sendall',
'shutdown',
'makefile',
'fileno',
'client_addr',
'client_port',
'server_port',
'socket',
'start_time',
'ssl',
'secure',
'recv',
'send',
'read',
'write'
]
def __init__(self, sock_tuple, port, secure=False):
self.client_addr, self.client_port = sock_tuple[1][:2]
self.server_port = port
self.socket = sock_tuple[0]
self.start_time = time.time()
self.ssl = has_ssl and isinstance(self.socket, ssl.SSLSocket)
self.secure = secure
if IS_JYTHON:
# In Jython we must set TCP_NODELAY here since it does not
# inherit from the listening socket.
# See: http://bugs.jython.org/issue1309
self.socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
self.socket.settimeout(SOCKET_TIMEOUT)
self.shutdown = self.socket.shutdown
self.fileno = self.socket.fileno
self.setblocking = self.socket.setblocking
self.recv = self.socket.recv
self.send = self.socket.send
self.makefile = self.socket.makefile
if sys.platform == 'darwin':
self.sendall = self._sendall_darwin
else:
self.sendall = self.socket.sendall
def _sendall_darwin(self, buf):
pending = len(buf)
offset = 0
while pending:
try:
sent = self.socket.send(buf[offset:])
pending -= sent
offset += sent
except socket.error:
import errno
info = sys.exc_info()
if info[1].args[0] != errno.EAGAIN:
raise
return offset
# FIXME - this is not ready for prime-time yet.
# def makefile(self, buf_size=BUF_SIZE):
# return FileLikeSocket(self, buf_size)
def close(self):
if hasattr(self.socket, '_sock'):
try:
self.socket._sock.close()
except socket.error:
info = sys.exc_info()
if info[1].args[0] != socket.EBADF:
raise info[1]
else:
pass
self.socket.close()
# Monolithic build...end of module: rocket/connection.py
# Monolithic build...start of module: rocket/filelike.py
# Import System Modules
import socket
try:
from io import StringIO
except ImportError:
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
# Import Package Modules
# package imports removed in monolithic build
class FileLikeSocket(object):
def __init__(self, conn, buf_size=BUF_SIZE):
self.conn = conn
self.buf_size = buf_size
self.buffer = StringIO()
self.content_length = None
if self.conn.socket.gettimeout() == 0.0:
self.read = self.non_blocking_read
else:
self.read = self.blocking_read
def __iter__(self):
return self
def recv(self, size):
while True:
try:
return self.conn.recv(size)
except socket.error:
exc = sys.exc_info()
e = exc[1]
# FIXME - Don't raise socket_errors_nonblocking or socket_error_eintr
if (e.args[0] not in set()):
raise
def next(self):
data = self.readline()
if data == '':
raise StopIteration
return data
def non_blocking_read(self, size=None):
# Shamelessly adapted from Cherrypy!
bufr = self.buffer
bufr.seek(0, 2)
if size is None:
while True:
data = self.recv(self.buf_size)
if not data:
break
bufr.write(data)
self.buffer = StringIO()
return bufr.getvalue()
else:
buf_len = self.buffer.tell()
if buf_len >= size:
bufr.seek(0)
data = bufr.read(size)
self.buffer = StringIO(bufr.read())
return data
self.buffer = StringIO()
while True:
remaining = size - buf_len
data = self.recv(remaining)
if not data:
break
n = len(data)
if n == size and not buf_len:
return data
if n == remaining:
bufr.write(data)
del data
break
bufr.write(data)
buf_len += n
del data
return bufr.getvalue()
def blocking_read(self, length=None):
if length is None:
if self.content_length is not None:
length = self.content_length
else:
length = 1
try:
data = self.conn.recv(length)
except:
data = b('')
return data
def readline(self):
data = b("")
char = self.read(1)
while char != b('\n') and char is not b(''):
line = repr(char)
data += char
char = self.read(1)
data += char
return data
def readlines(self, hint="ignored"):
return list(self)
def close(self):
self.conn = None
self.content_length = None
# Monolithic build...end of module: rocket/filelike.py
# Monolithic build...start of module: rocket/futures.py
# Import System Modules
import time
try:
from concurrent.futures import Future, ThreadPoolExecutor
from concurrent.futures.thread import _WorkItem
has_futures = True
except ImportError:
has_futures = False
class Future:
pass
class ThreadPoolExecutor:
pass
class _WorkItem:
pass
class WSGIFuture(Future):
def __init__(self, f_dict, *args, **kwargs):
Future.__init__(self, *args, **kwargs)
self.timeout = None
self._mem_dict = f_dict
self._lifespan = 30
self._name = None
self._start_time = time.time()
def set_running_or_notify_cancel(self):
if time.time() - self._start_time >= self._lifespan:
self.cancel()
else:
return super(WSGIFuture, self).set_running_or_notify_cancel()
def remember(self, name, lifespan=None):
self._lifespan = lifespan or self._lifespan
if name in self._mem_dict:
raise NameError('Cannot remember future by name "%s". ' % name +
'A future already exists with that name.')
self._name = name
self._mem_dict[name] = self
return self
def forget(self):
if self._name in self._mem_dict and self._mem_dict[self._name] is self:
del self._mem_dict[self._name]
self._name = None
class _WorkItem(object):
def __init__(self, future, fn, args, kwargs):
self.future = future
self.fn = fn
self.args = args
self.kwargs = kwargs
def run(self):
if not self.future.set_running_or_notify_cancel():
return
try:
result = self.fn(*self.args, **self.kwargs)
except BaseException:
e = sys.exc_info()[1]
self.future.set_exception(e)
else:
self.future.set_result(result)
class WSGIExecutor(ThreadPoolExecutor):
multithread = True
multiprocess = False
def __init__(self, *args, **kwargs):
ThreadPoolExecutor.__init__(self, *args, **kwargs)
self.futures = dict()
def submit(self, fn, *args, **kwargs):
if self._shutdown_lock.acquire():
if self._shutdown:
self._shutdown_lock.release()
raise RuntimeError(
'Cannot schedule new futures after shutdown')
f = WSGIFuture(self.futures)
w = _WorkItem(f, fn, args, kwargs)
self._work_queue.put(w)
self._adjust_thread_count()
self._shutdown_lock.release()
return f
else:
return False
class FuturesMiddleware(object):
"Futures middleware that adds a Futures Executor to the environment"
def __init__(self, app, threads=5):
self.app = app
self.executor = WSGIExecutor(threads)
def __call__(self, environ, start_response):
environ["wsgiorg.executor"] = self.executor
environ["wsgiorg.futures"] = self.executor.futures
return self.app(environ, start_response)
# Monolithic build...end of module: rocket/futures.py
# Monolithic build...start of module: rocket/listener.py
# Import System Modules
import os
import socket
import logging
import traceback
from threading import Thread
try:
import ssl
from ssl import SSLError
has_ssl = True
except ImportError:
has_ssl = False
class SSLError(socket.error):
pass
# Import Package Modules
# package imports removed in monolithic build
class Listener(Thread):
"""The Listener class is a class responsible for accepting connections
and queuing them to be processed by a worker thread."""
def __init__(self, interface, queue_size, active_queue, *args, **kwargs):
Thread.__init__(self, *args, **kwargs)
# Instance variables
self.active_queue = active_queue
self.interface = interface
self.addr = interface[0]
self.port = interface[1]
self.secure = len(interface) >= 4
self.clientcert_req = (len(interface) == 5 and interface[4])
self.thread = None
self.ready = False
# Error Log
self.err_log = logging.getLogger('Rocket.Errors.Port%i' % self.port)
self.err_log.addHandler(NullHandler())
# Build the socket
if ':' in self.addr:
listener = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
else:
listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if not listener:
self.err_log.error("Failed to get socket.")
return
if self.secure:
if not has_ssl:
self.err_log.error("ssl module required to serve HTTPS.")
return
elif not os.path.exists(interface[2]):
data = (interface[2], interface[0], interface[1])
self.err_log.error("Cannot find key file "
"'%s'. Cannot bind to %s:%s" % data)
return
elif not os.path.exists(interface[3]):
data = (interface[3], interface[0], interface[1])
self.err_log.error("Cannot find certificate file "
"'%s'. Cannot bind to %s:%s" % data)
return
if self.clientcert_req and not os.path.exists(interface[4]):
data = (interface[4], interface[0], interface[1])
self.err_log.error("Cannot find root ca certificate file "
"'%s'. Cannot bind to %s:%s" % data)
return
# Set socket options
try:
listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
except:
msg = "Cannot share socket. Using %s:%i exclusively."
self.err_log.warning(msg % (self.addr, self.port))
try:
if not IS_JYTHON:
listener.setsockopt(socket.IPPROTO_TCP,
socket.TCP_NODELAY,
1)
except:
msg = "Cannot set TCP_NODELAY, things might run a little slower"
self.err_log.warning(msg)
try:
listener.bind((self.addr, self.port))
except:
msg = "Socket %s:%i in use by other process and it won't share."
self.err_log.error(msg % (self.addr, self.port))
else:
# We want socket operations to timeout periodically so we can
# check if the server is shutting down
listener.settimeout(THREAD_STOP_CHECK_INTERVAL)
# Listen for new connections allowing queue_size number of
# connections to wait before rejecting a connection.
listener.listen(queue_size)
self.listener = listener
self.ready = True
def wrap_socket(self, sock):
try:
if self.clientcert_req:
ca_certs = self.interface[4]
cert_reqs = ssl.CERT_OPTIONAL
sock = ssl.wrap_socket(sock,
keyfile=self.interface[2],
certfile=self.interface[3],
server_side=True,
cert_reqs=cert_reqs,
ca_certs=ca_certs,
ssl_version=ssl.PROTOCOL_SSLv23)
else:
sock = ssl.wrap_socket(sock,
keyfile=self.interface[2],
certfile=self.interface[3],
server_side=True,
ssl_version=ssl.PROTOCOL_SSLv23)
except SSLError:
# Generally this happens when an HTTP request is received on a
# secure socket. We don't do anything because it will be detected
# by Worker and dealt with appropriately.
pass
return sock
def start(self):
if not self.ready:
self.err_log.warning('Listener started when not ready.')
return
if self.thread is not None and self.thread.isAlive():
self.err_log.warning('Listener already running.')
return
self.thread = Thread(target=self.listen, name="Port" + str(self.port))
self.thread.start()
def isAlive(self):
if self.thread is None:
return False
return self.thread.isAlive()
def join(self):
if self.thread is None:
return
self.ready = False
self.thread.join()
del self.thread
self.thread = None
self.ready = True
def listen(self):
if __debug__:
self.err_log.debug('Entering main loop.')
while True:
try:
sock, addr = self.listener.accept()
if self.secure:
sock = self.wrap_socket(sock)
self.active_queue.put(((sock, addr),
self.interface[1],
self.secure))
except socket.timeout:
# socket.timeout will be raised every
# THREAD_STOP_CHECK_INTERVAL seconds. When that happens,
# we check if it's time to die.
if not self.ready:
if __debug__:
self.err_log.debug('Listener exiting.')
return
else:
continue
except:
self.err_log.error(traceback.format_exc())
# Monolithic build...end of module: rocket/listener.py
# Monolithic build...start of module: rocket/main.py
# Import System Modules
import sys
import time
import socket
import logging
import traceback
from threading import Lock
try:
from queue import Queue
except ImportError:
from Queue import Queue
# Import Package Modules
# package imports removed in monolithic build
# Setup Logging
log = logging.getLogger('Rocket')
log.addHandler(NullHandler())
class Rocket(object):
"""The Rocket class is responsible for handling threads and accepting and
dispatching connections."""
def __init__(self,
interfaces=('127.0.0.1', 8000),
method='wsgi',
app_info=None,
min_threads=None,
max_threads=None,
queue_size=None,
timeout=600,
handle_signals=True):
self.handle_signals = handle_signals
self.startstop_lock = Lock()
self.timeout = timeout
if not isinstance(interfaces, list):
self.interfaces = [interfaces]
else:
self.interfaces = interfaces
if min_threads is None:
min_threads = DEFAULTS['MIN_THREADS']
if max_threads is None:
max_threads = DEFAULTS['MAX_THREADS']
if not queue_size:
if hasattr(socket, 'SOMAXCONN'):
queue_size = socket.SOMAXCONN
else:
queue_size = DEFAULTS['LISTEN_QUEUE_SIZE']
if max_threads and queue_size > max_threads:
queue_size = max_threads
if isinstance(app_info, dict):
app_info['server_software'] = SERVER_SOFTWARE
self.monitor_queue = Queue()
self.active_queue = Queue()
self._threadpool = ThreadPool(get_method(method),
app_info=app_info,
active_queue=self.active_queue,
monitor_queue=self.monitor_queue,
min_threads=min_threads,
max_threads=max_threads)
# Build our socket listeners
self.listeners = [Listener(
i, queue_size, self.active_queue) for i in self.interfaces]
for ndx in range(len(self.listeners) - 1, 0, -1):
if not self.listeners[ndx].ready:
del self.listeners[ndx]
if not self.listeners:
log.critical("No interfaces to listen on...closing.")
sys.exit(1)
def _sigterm(self, signum, frame):
log.info('Received SIGTERM')
self.stop()
def _sighup(self, signum, frame):
log.info('Received SIGHUP')
self.restart()
def start(self, background=False):
log.info('Starting %s' % SERVER_SOFTWARE)
self.startstop_lock.acquire()
try:
# Set up our shutdown signals
if self.handle_signals:
try:
import signal
signal.signal(signal.SIGTERM, self._sigterm)
signal.signal(signal.SIGUSR1, self._sighup)
except:
log.debug('This platform does not support signals.')
# Start our worker threads
self._threadpool.start()
# Start our monitor thread
self._monitor = Monitor(self.monitor_queue,
self.active_queue,
self.timeout,
self._threadpool)
self._monitor.setDaemon(True)
self._monitor.start()
# I know that EXPR and A or B is bad but I'm keeping it for Py2.4
# compatibility.
str_extract = lambda l: (l.addr, l.port, l.secure and '*' or '')
msg = 'Listening on sockets: '
msg += ', '.join(
['%s:%i%s' % str_extract(l) for l in self.listeners])
log.info(msg)
for l in self.listeners:
l.start()
finally:
self.startstop_lock.release()
if background:
return
while self._monitor.isAlive():
try:
time.sleep(THREAD_STOP_CHECK_INTERVAL)
except KeyboardInterrupt:
# Capture a keyboard interrupt when running from a console
break
except:
if self._monitor.isAlive():
log.error(traceback.format_exc())
continue
return self.stop()
def stop(self, stoplogging=False):
log.info('Stopping %s' % SERVER_SOFTWARE)
self.startstop_lock.acquire()
try:
# Stop listeners
for l in self.listeners:
l.ready = False
# Encourage a context switch
time.sleep(0.01)
for l in self.listeners:
if l.isAlive():
l.join()
# Stop Monitor
self._monitor.stop()
if self._monitor.isAlive():
self._monitor.join()
# Stop Worker threads
self._threadpool.stop()
if stoplogging:
logging.shutdown()
msg = "Calling logging.shutdown() is now the responsibility of \
the application developer. Please update your \
applications to no longer call rocket.stop(True)"
try:
import warnings
raise warnings.DeprecationWarning(msg)
except ImportError:
raise RuntimeError(msg)
finally:
self.startstop_lock.release()
def restart(self):
self.stop()
self.start()
def CherryPyWSGIServer(bind_addr,
wsgi_app,
numthreads=10,
server_name=None,
max=-1,
request_queue_size=5,
timeout=10,
shutdown_timeout=5):
""" A Cherrypy wsgiserver-compatible wrapper. """
max_threads = max
if max_threads < 0:
max_threads = 0
return Rocket(bind_addr, 'wsgi', {'wsgi_app': wsgi_app},
min_threads=numthreads,
max_threads=max_threads,
queue_size=request_queue_size,
timeout=timeout)
# Monolithic build...end of module: rocket/main.py
# Monolithic build...start of module: rocket/monitor.py
# Import System Modules
import time
import logging
import select
from threading import Thread
# Import Package Modules
# package imports removed in monolithic build
class Monitor(Thread):
# Monitor worker class.
def __init__(self,
monitor_queue,
active_queue,
timeout,
threadpool,
*args,
**kwargs):
Thread.__init__(self, *args, **kwargs)
self._threadpool = threadpool
# Instance Variables
self.monitor_queue = monitor_queue
self.active_queue = active_queue
self.timeout = timeout
self.log = logging.getLogger('Rocket.Monitor')
self.log.addHandler(NullHandler())
self.connections = set()
self.active = False
def run(self):
self.active = True
conn_list = list()
list_changed = False
# We need to make sure the queue is empty before we start
while not self.monitor_queue.empty():
self.monitor_queue.get()
if __debug__:
self.log.debug('Entering monitor loop.')
# Enter thread main loop
while self.active:
# Move the queued connections to the selection pool
while not self.monitor_queue.empty():
if __debug__:
self.log.debug('In "receive timed-out connections" loop.')
c = self.monitor_queue.get()
if c is None:
# A non-client is a signal to die
if __debug__:
self.log.debug('Received a death threat.')
self.stop()
break
self.log.debug('Received a timed out connection.')
if __debug__:
assert(c not in self.connections)
if IS_JYTHON:
# Jython requires a socket to be in Non-blocking mode in
# order to select on it.
c.setblocking(False)
if __debug__:
self.log.debug('Adding connection to monitor list.')
self.connections.add(c)
list_changed = True
# Wait on those connections
if list_changed:
conn_list = list(self.connections)
list_changed = False
try:
if len(conn_list):
readable = select.select(conn_list,
[],
[],
THREAD_STOP_CHECK_INTERVAL)[0]
else:
time.sleep(THREAD_STOP_CHECK_INTERVAL)
readable = []
if not self.active:
break
# If we have any readable connections, put them back
for r in readable:
if __debug__:
self.log.debug('Restoring readable connection')
if IS_JYTHON:
# Jython requires a socket to be in Non-blocking mode in
# order to select on it, but the rest of the code requires
# that it be in blocking mode.
r.setblocking(True)
r.start_time = time.time()
self.active_queue.put(r)
self.connections.remove(r)
list_changed = True
except:
if self.active:
raise
else:
break
# If we have any stale connections, kill them off.
if self.timeout:
now = time.time()
stale = set()
for c in self.connections:
if (now - c.start_time) >= self.timeout:
stale.add(c)
for c in stale:
if __debug__:
# "EXPR and A or B" kept for Py2.4 compatibility
data = (
c.client_addr, c.server_port, c.ssl and '*' or '')
self.log.debug(
'Flushing stale connection: %s:%i%s' % data)
self.connections.remove(c)
list_changed = True
try:
c.close()
finally:
del c
# Dynamically resize the threadpool to adapt to our changing needs.
self._threadpool.dynamic_resize()
def stop(self):
self.active = False
if __debug__:
self.log.debug('Flushing waiting connections')
while self.connections:
c = self.connections.pop()
try:
c.close()
finally:
del c
if __debug__:
self.log.debug('Flushing queued connections')
while not self.monitor_queue.empty():
c = self.monitor_queue.get()
if c is None:
continue
try:
c.close()
finally:
del c
# Place a None sentry value to cause the monitor to die.
self.monitor_queue.put(None)
# Monolithic build...end of module: rocket/monitor.py
# Monolithic build...start of module: rocket/threadpool.py
# Import System Modules
import logging
# Import Package Modules
# package imports removed in monolithic build
# Setup Logging
log = logging.getLogger('Rocket.Errors.ThreadPool')
log.addHandler(NullHandler())
class ThreadPool:
"""The ThreadPool class is a container class for all the worker threads. It
manages the number of actively running threads."""
def __init__(self,
method,
app_info,
active_queue,
monitor_queue,
min_threads=DEFAULTS['MIN_THREADS'],
max_threads=DEFAULTS['MAX_THREADS'],
):
if __debug__:
log.debug("Initializing ThreadPool.")
self.check_for_dead_threads = 0
self.active_queue = active_queue
self.worker_class = method
self.min_threads = min_threads
self.max_threads = max_threads
self.monitor_queue = monitor_queue
self.stop_server = False
self.alive = False
# TODO - Optimize this based on some real-world usage data
self.grow_threshold = int(max_threads / 10) + 2
if not isinstance(app_info, dict):
app_info = dict()
if has_futures and app_info.get('futures'):
app_info['executor'] = WSGIExecutor(max([DEFAULTS['MIN_THREADS'],
2]))
app_info.update(max_threads=max_threads,
min_threads=min_threads)
self.min_threads = min_threads
self.app_info = app_info
self.threads = set()
def start(self):
self.stop_server = False
if __debug__:
log.debug("Starting threads.")
self.grow(self.min_threads)
self.alive = True
def stop(self):
self.alive = False
if __debug__:
log.debug("Stopping threads.")
self.stop_server = True
# Prompt the threads to die
self.shrink(len(self.threads))
# Stop futures initially
if has_futures and self.app_info.get('futures'):
if __debug__:
log.debug("Future executor is present. Python will not "
"exit until all jobs have finished.")
self.app_info['executor'].shutdown(wait=False)
# Give them the gun
#active_threads = [t for t in self.threads if t.isAlive()]
#while active_threads:
# t = active_threads.pop()
# t.kill()
# Wait until they pull the trigger
for t in self.threads:
if t.isAlive():
t.join()
# Clean up the mess
self.bring_out_your_dead()
def bring_out_your_dead(self):
# Remove dead threads from the pool
dead_threads = [t for t in self.threads if not t.isAlive()]
for t in dead_threads:
if __debug__:
log.debug("Removing dead thread: %s." % t.getName())
try:
# Py2.4 complains here so we put it in a try block
self.threads.remove(t)
except:
pass
self.check_for_dead_threads -= len(dead_threads)
def grow(self, amount=None):
if self.stop_server:
return
if not amount:
amount = self.max_threads
if self.alive:
amount = min([amount, self.max_threads - len(self.threads)])
if __debug__:
log.debug("Growing by %i." % amount)
for x in range(amount):
worker = self.worker_class(self.app_info,
self.active_queue,
self.monitor_queue)
worker.setDaemon(True)
self.threads.add(worker)
worker.start()
def shrink(self, amount=1):
if __debug__:
log.debug("Shrinking by %i." % amount)
self.check_for_dead_threads += amount
for x in range(amount):
self.active_queue.put(None)
def dynamic_resize(self):
if (self.max_threads > self.min_threads or self.max_threads == 0):
if self.check_for_dead_threads > 0:
self.bring_out_your_dead()
queueSize = self.active_queue.qsize()
threadCount = len(self.threads)
if __debug__:
log.debug("Examining ThreadPool. %i threads and %i Q'd conxions"
% (threadCount, queueSize))
if queueSize == 0 and threadCount > self.min_threads:
self.shrink()
elif queueSize > self.grow_threshold:
self.grow(queueSize)
# Monolithic build...end of module: rocket/threadpool.py
# Monolithic build...start of module: rocket/worker.py
# Import System Modules
import re
import sys
import socket
import logging
import traceback
from wsgiref.headers import Headers
from threading import Thread
from datetime import datetime
try:
from urllib import unquote
except ImportError:
from urllib.parse import unquote
try:
from io import StringIO
except ImportError:
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
try:
from ssl import SSLError
except ImportError:
class SSLError(socket.error):
pass
# Import Package Modules
# package imports removed in monolithic build
# Define Constants
re_SLASH = re.compile('%2F', re.IGNORECASE)
re_REQUEST_LINE = re.compile(r"""^
(?P<method>OPTIONS|GET|HEAD|POST|PUT|DELETE|TRACE|CONNECT) # Request Method
\ # (single space)
(
(?P<scheme>[^:/]+) # Scheme
(://) #
(?P<host>[^/]+) # Host
)? #
(?P<path>(\*|/[^ \?]*)) # Path
(\? (?P<query_string>[^ ]*))? # Query String
\ # (single space)
(?P<protocol>HTTPS?/1\.[01]) # Protocol
$
""", re.X)
LOG_LINE = '%(client_ip)s - "%(request_line)s" - %(status)s %(size)s'
RESPONSE = '''\
%s %s
Content-Length: %i
Content-Type: %s
%s
'''
if IS_JYTHON:
HTTP_METHODS = set(['OPTIONS', 'GET', 'HEAD', 'POST', 'PUT',
'DELETE', 'TRACE', 'CONNECT'])
class Worker(Thread):
"""The Worker class is a base class responsible for receiving connections
and (a subclass) will run an application to process the the connection """
def __init__(self,
app_info,
active_queue,
monitor_queue,
*args,
**kwargs):
Thread.__init__(self, *args, **kwargs)
# Instance Variables
self.app_info = app_info
self.active_queue = active_queue
self.monitor_queue = monitor_queue
self.size = 0
self.status = "200 OK"
self.closeConnection = True
self.request_line = ""
self.protocol = 'HTTP/1.1'
# Request Log
self.req_log = logging.getLogger('Rocket.Requests')
self.req_log.addHandler(NullHandler())
# Error Log
self.err_log = logging.getLogger('Rocket.Errors.' + self.getName())
self.err_log.addHandler(NullHandler())
def _handleError(self, typ, val, tb):
if typ == SSLError:
if 'timed out' in str(val.args[0]):
typ = SocketTimeout
if typ == SocketTimeout:
if __debug__:
self.err_log.debug('Socket timed out')
self.monitor_queue.put(self.conn)
return True
if typ == SocketClosed:
self.closeConnection = True
if __debug__:
self.err_log.debug('Client closed socket')
return False
if typ == BadRequest:
self.closeConnection = True
if __debug__:
self.err_log.debug('Client sent a bad request')
return True
if typ == socket.error:
self.closeConnection = True
if val.args[0] in IGNORE_ERRORS_ON_CLOSE:
if __debug__:
self.err_log.debug('Ignorable socket Error received...'
'closing connection.')
return False
else:
self.status = "999 Utter Server Failure"
tb_fmt = traceback.format_exception(typ, val, tb)
self.err_log.error('Unhandled Error when serving '
'connection:\n' + '\n'.join(tb_fmt))
return False
self.closeConnection = True
tb_fmt = traceback.format_exception(typ, val, tb)
self.err_log.error('\n'.join(tb_fmt))
self.send_response('500 Server Error')
return False
def run(self):
if __debug__:
self.err_log.debug('Entering main loop.')
# Enter thread main loop
while True:
conn = self.active_queue.get()
if not conn:
# A non-client is a signal to die
if __debug__:
self.err_log.debug('Received a death threat.')
return conn
if isinstance(conn, tuple):
conn = Connection(*conn)
self.conn = conn
if conn.ssl != conn.secure:
self.err_log.info('Received HTTP connection on HTTPS port.')
self.send_response('400 Bad Request')
self.closeConnection = True
conn.close()
continue
else:
if __debug__:
self.err_log.debug('Received a connection.')
self.closeConnection = False
# Enter connection serve loop
while True:
if __debug__:
self.err_log.debug('Serving a request')
try:
self.run_app(conn)
except:
exc = sys.exc_info()
handled = self._handleError(*exc)
if handled:
break
finally:
if self.request_line:
log_info = dict(client_ip=conn.client_addr,
time=datetime.now().strftime('%c'),
status=self.status.split(' ')[0],
size=self.size,
request_line=self.request_line)
self.req_log.info(LOG_LINE % log_info)
if self.closeConnection:
try:
conn.close()
except:
self.err_log.error(str(traceback.format_exc()))
break
def run_app(self, conn):
# Must be overridden with a method reads the request from the socket
# and sends a response.
self.closeConnection = True
raise NotImplementedError('Overload this method!')
def send_response(self, status):
stat_msg = status.split(' ', 1)[1]
msg = RESPONSE % (self.protocol,
status,
len(stat_msg),
'text/plain',
stat_msg)
try:
self.conn.sendall(b(msg))
except socket.timeout:
self.closeConnection = True
msg = 'Tried to send "%s" to client but received timeout error'
self.err_log.error(msg % status)
except socket.error:
self.closeConnection = True
msg = 'Tried to send "%s" to client but received socket error'
self.err_log.error(msg % status)
def read_request_line(self, sock_file):
self.request_line = ''
try:
# Grab the request line
d = sock_file.readline()
if PY3K:
d = d.decode('ISO-8859-1')
if d == '\r\n':
# Allow an extra NEWLINE at the beginning per HTTP 1.1 spec
if __debug__:
self.err_log.debug('Client sent newline')
d = sock_file.readline()
if PY3K:
d = d.decode('ISO-8859-1')
except socket.timeout:
raise SocketTimeout('Socket timed out before request.')
except TypeError:
raise SocketClosed(
'SSL bug caused closure of socket. See '
'"https://groups.google.com/d/topic/web2py/P_Gw0JxWzCs".')
d = d.strip()
if not d:
if __debug__:
self.err_log.debug(
'Client did not send a recognizable request.')
raise SocketClosed('Client closed socket.')
self.request_line = d
# NOTE: I've replaced the traditional method of procedurally breaking
# apart the request line with a (rather unsightly) regular expression.
# However, Java's regexp support sucks so bad that it actually takes
# longer in Jython to process the regexp than procedurally. So I've
# left the old code here for Jython's sake...for now.
if IS_JYTHON:
return self._read_request_line_jython(d)
match = re_REQUEST_LINE.match(d)
if not match:
self.send_response('400 Bad Request')
raise BadRequest
req = match.groupdict()
for k, v in req.iteritems():
if not v:
req[k] = ""
if k == 'path':
req['path'] = r'%2F'.join(
[unquote(x) for x in re_SLASH.split(v)])
self.protocol = req['protocol']
return req
def _read_request_line_jython(self, d):
d = d.strip()
try:
method, uri, proto = d.split(' ')
if not proto.startswith('HTTP') or \
proto[-3:] not in ('1.0', '1.1') or \
method not in HTTP_METHODS:
self.send_response('400 Bad Request')
raise BadRequest
except ValueError:
self.send_response('400 Bad Request')
raise BadRequest
req = dict(method=method, protocol=proto)
scheme = ''
host = ''
if uri == '*' or uri.startswith('/'):
path = uri
elif '://' in uri:
scheme, rest = uri.split('://')
host, path = rest.split('/', 1)
path = '/' + path
else:
self.send_response('400 Bad Request')
raise BadRequest
query_string = ''
if '?' in path:
path, query_string = path.split('?', 1)
path = r'%2F'.join([unquote(x) for x in re_SLASH.split(path)])
req.update(path=path,
query_string=query_string,
scheme=scheme.lower(),
host=host)
return req
def read_headers(self, sock_file):
try:
headers = dict()
lname = None
lval = None
while True:
l = sock_file.readline()
if PY3K:
try:
l = str(l, 'ISO-8859-1')
except UnicodeDecodeError:
self.err_log.warning(
'Client sent invalid header: ' + repr(l))
if l.strip().replace('\0', '') == '':
break
if l[0] in ' \t' and lname:
# Some headers take more than one line
lval += ' ' + l.strip()
else:
# HTTP header values are latin-1 encoded
l = l.split(':', 1)
# HTTP header names are us-ascii encoded
lname = l[0].strip().upper().replace('-', '_')
lval = l[-1].strip()
headers[str(lname)] = str(lval)
except socket.timeout:
raise SocketTimeout("Socket timed out before request.")
return headers
class SocketTimeout(Exception):
"Exception for when a socket times out between requests."
pass
class BadRequest(Exception):
"Exception for when a client sends an incomprehensible request."
pass
class SocketClosed(Exception):
"Exception for when a socket is closed by the client."
pass
class ChunkedReader(object):
def __init__(self, sock_file):
self.stream = sock_file
self.chunk_size = 0
def _read_header(self):
chunk_len = ""
try:
while "" == chunk_len:
chunk_len = self.stream.readline().strip()
return int(chunk_len, 16)
except ValueError:
return 0
def read(self, size):
data = b('')
chunk_size = self.chunk_size
while size:
if not chunk_size:
chunk_size = self._read_header()
if size < chunk_size:
data += self.stream.read(size)
chunk_size -= size
break
else:
if not chunk_size:
break
data += self.stream.read(chunk_size)
size -= chunk_size
chunk_size = 0
self.chunk_size = chunk_size
return data
def readline(self):
data = b('')
c = self.read(1)
while c and c != b('\n'):
data += c
c = self.read(1)
data += c
return data
def readlines(self):
yield self.readline()
def get_method(method):
methods = dict(wsgi=WSGIWorker)
return methods[method.lower()]
# Monolithic build...end of module: rocket/worker.py
# Monolithic build...start of module: rocket/methods/__init__.py
# Monolithic build...end of module: rocket/methods/__init__.py
# Monolithic build...start of module: rocket/methods/wsgi.py
# Import System Modules
import sys
import socket
from wsgiref.headers import Headers
from wsgiref.util import FileWrapper
# Import Package Modules
# package imports removed in monolithic build
if PY3K:
from email.utils import formatdate
else:
# Caps Utils for Py2.4 compatibility
from email.Utils import formatdate
# Define Constants
NEWLINE = b('\r\n')
HEADER_RESPONSE = '''HTTP/1.1 %s\r\n%s'''
BASE_ENV = {'SERVER_NAME': SERVER_NAME,
'SCRIPT_NAME': '', # Direct call WSGI does not need a name
'wsgi.errors': sys.stderr,
'wsgi.version': (1, 0),
'wsgi.multiprocess': False,
'wsgi.run_once': False,
'wsgi.file_wrapper': FileWrapper
}
class WSGIWorker(Worker):
def __init__(self, *args, **kwargs):
"""Builds some instance variables that will last the life of the
thread."""
Worker.__init__(self, *args, **kwargs)
if isinstance(self.app_info, dict):
multithreaded = self.app_info.get('max_threads') != 1
else:
multithreaded = False
self.base_environ = dict(
{'SERVER_SOFTWARE': self.app_info['server_software'],
'wsgi.multithread': multithreaded,
})
self.base_environ.update(BASE_ENV)
# Grab our application
self.app = self.app_info.get('wsgi_app')
if not hasattr(self.app, "__call__"):
raise TypeError("The wsgi_app specified (%s) is not a valid WSGI application." % repr(self.app))
# Enable futures
if has_futures and self.app_info.get('futures'):
executor = self.app_info['executor']
self.base_environ.update({"wsgiorg.executor": executor,
"wsgiorg.futures": executor.futures})
def build_environ(self, sock_file, conn):
""" Build the execution environment. """
# Grab the request line
request = self.read_request_line(sock_file)
# Copy the Base Environment
environ = self.base_environ.copy()
# Grab the headers
for k, v in self.read_headers(sock_file).iteritems():
environ[str('HTTP_' + k)] = v
# Add CGI Variables
environ['REQUEST_METHOD'] = request['method']
environ['PATH_INFO'] = request['path']
environ['SERVER_PROTOCOL'] = request['protocol']
environ['SERVER_PORT'] = str(conn.server_port)
environ['REMOTE_PORT'] = str(conn.client_port)
environ['REMOTE_ADDR'] = str(conn.client_addr)
environ['QUERY_STRING'] = request['query_string']
if 'HTTP_CONTENT_LENGTH' in environ:
environ['CONTENT_LENGTH'] = environ['HTTP_CONTENT_LENGTH']
if 'HTTP_CONTENT_TYPE' in environ:
environ['CONTENT_TYPE'] = environ['HTTP_CONTENT_TYPE']
# Save the request method for later
self.request_method = environ['REQUEST_METHOD']
# Add Dynamic WSGI Variables
if conn.ssl:
environ['wsgi.url_scheme'] = 'https'
environ['HTTPS'] = 'on'
try:
peercert = conn.socket.getpeercert(binary_form=True)
environ['SSL_CLIENT_RAW_CERT'] = \
peercert and ssl.DER_cert_to_PEM_cert(peercert)
except Exception:
print sys.exc_info()[1]
else:
environ['wsgi.url_scheme'] = 'http'
if environ.get('HTTP_TRANSFER_ENCODING', '') == 'chunked':
environ['wsgi.input'] = ChunkedReader(sock_file)
else:
environ['wsgi.input'] = sock_file
return environ
def send_headers(self, data, sections):
h_set = self.header_set
# Does the app want us to send output chunked?
self.chunked = h_set.get('Transfer-Encoding', '').lower() == 'chunked'
# Add a Date header if it's not there already
if not 'Date' in h_set:
h_set['Date'] = formatdate(usegmt=True)
# Add a Server header if it's not there already
if not 'Server' in h_set:
h_set['Server'] = HTTP_SERVER_SOFTWARE
if 'Content-Length' in h_set:
self.size = int(h_set['Content-Length'])
else:
s = int(self.status.split(' ')[0])
if (s < 200 or s not in (204, 205, 304)) and not self.chunked:
if sections == 1 or self.protocol != 'HTTP/1.1':
# Add a Content-Length header because it's not there
self.size = len(data)
h_set['Content-Length'] = str(self.size)
else:
# If they sent us more than one section, we blow chunks
h_set['Transfer-Encoding'] = 'Chunked'
self.chunked = True
if __debug__:
self.err_log.debug('Adding header...'
'Transfer-Encoding: Chunked')
if 'Connection' not in h_set:
# If the application did not provide a connection header,
# fill it in
client_conn = self.environ.get('HTTP_CONNECTION', '').lower()
if self.environ['SERVER_PROTOCOL'] == 'HTTP/1.1':
# HTTP = 1.1 defaults to keep-alive connections
if client_conn:
h_set['Connection'] = client_conn
else:
h_set['Connection'] = 'keep-alive'
else:
# HTTP < 1.1 supports keep-alive but it's quirky
# so we don't support it
h_set['Connection'] = 'close'
# Close our connection if we need to.
self.closeConnection = h_set.get('Connection', '').lower() == 'close'
# Build our output headers
header_data = HEADER_RESPONSE % (self.status, str(h_set))
# Send the headers
if __debug__:
self.err_log.debug('Sending Headers: %s' % repr(header_data))
self.conn.sendall(b(header_data))
self.headers_sent = True
def write_warning(self, data, sections=None):
self.err_log.warning('WSGI app called write method directly. This is '
'deprecated behavior. Please update your app.')
return self.write(data, sections)
def write(self, data, sections=None):
""" Write the data to the output socket. """
if self.error[0]:
self.status = self.error[0]
data = b(self.error[1])
if not self.headers_sent:
self.send_headers(data, sections)
if self.request_method != 'HEAD':
try:
if self.chunked:
self.conn.sendall(b('%x\r\n%s\r\n' % (len(data), data)))
else:
self.conn.sendall(data)
except socket.timeout:
self.closeConnection = True
except socket.error:
# But some clients will close the connection before that
# resulting in a socket error.
self.closeConnection = True
def start_response(self, status, response_headers, exc_info=None):
""" Store the HTTP status and headers to be sent when self.write is
called. """
if exc_info:
try:
if self.headers_sent:
# Re-raise original exception if headers sent
# because this violates WSGI specification.
raise
finally:
exc_info = None
elif self.header_set:
raise AssertionError("Headers already set!")
if PY3K and not isinstance(status, str):
self.status = str(status, 'ISO-8859-1')
else:
self.status = status
# Make sure headers are bytes objects
try:
self.header_set = Headers(response_headers)
except UnicodeDecodeError:
self.error = ('500 Internal Server Error',
'HTTP Headers should be bytes')
self.err_log.error('Received HTTP Headers from client that contain'
' invalid characters for Latin-1 encoding.')
return self.write_warning
def run_app(self, conn):
self.size = 0
self.header_set = Headers([])
self.headers_sent = False
self.error = (None, None)
self.chunked = False
sections = None
output = None
if __debug__:
self.err_log.debug('Getting sock_file')
# Build our file-like object
if PY3K:
sock_file = conn.makefile(mode='rb', buffering=BUF_SIZE)
else:
sock_file = conn.makefile(BUF_SIZE)
try:
# Read the headers and build our WSGI environment
self.environ = environ = self.build_environ(sock_file, conn)
# Handle 100 Continue
if environ.get('HTTP_EXPECT', '') == '100-continue':
res = environ['SERVER_PROTOCOL'] + ' 100 Continue\r\n\r\n'
conn.sendall(b(res))
# Send it to our WSGI application
output = self.app(environ, self.start_response)
if not hasattr(output, '__len__') and not hasattr(output, '__iter__'):
self.error = ('500 Internal Server Error',
'WSGI applications must return a list or '
'generator type.')
if hasattr(output, '__len__'):
sections = len(output)
for data in output:
# Don't send headers until body appears
if data:
self.write(data, sections)
if self.chunked:
# If chunked, send our final chunk length
self.conn.sendall(b('0\r\n\r\n'))
elif not self.headers_sent:
# Send headers if the body was empty
self.send_headers('', sections)
# Don't capture exceptions here. The Worker class handles
# them appropriately.
finally:
if __debug__:
self.err_log.debug('Finally closing output and sock_file')
if hasattr(output, 'close'):
output.close()
sock_file.close()
# Monolithic build...end of module: rocket/methods/wsgi.py
| ajibawa-2023/Python-Code-Large/train/row_467 | 1,004 | 1,871 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_467:Import_L8_C0", "label": "sys import sys", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0043, 0.0005, 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_467:Import_L9_C0", "label": "errno import errno", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0048, 0.0005, 0, 0.66, 0.0108, 546, 0, 1, 0, 0, 546, 0, 0], "semantic": {"name": "errno", "arg_names": [], "import_names": ["errno"], "rhs_call_name": "", "annotation": ""}, "snippet": "import errno"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Import_L10_C0", "label": "socket import socket", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0053, 0.0005, 0, 0.66, 0.0215, 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_467:Import_L11_C0", "label": "logging import logging", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0059, 0.0005, 0, 0.66, 0.0323, 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_467:Import_L12_C0", "label": "platform import platform", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0064, 0.0005, 0, 0.66, 0.043, 590, 0, 1, 0, 0, 590, 0, 0], "semantic": {"name": "platform", "arg_names": [], "import_names": ["platform"], "rhs_call_name": "", "annotation": ""}, "snippet": "import platform"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L15_C0", "label": "VERSION =", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.008, 0.0005, 0, 0.66, 0.0538, 557, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "VERSION = '1.2.6'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L16_C0", "label": "SERVER_NAME = gethostname()", "type": "assigned_variable", "loc": [16, 16], "level": 0, "parent": null, "vector": [14, 0, 0.0086, 0.0005, 0, 0.66, 0.0645, 707, 3, 0, 0, 0, 682, 10, 1], "semantic": {"name": "SERVER_NAME", "arg_names": [], "import_names": [], "rhs_call_name": "gethostname", "annotation": ""}, "snippet": "SERVER_NAME = socket.gethostname()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L17_C0", "label": "SERVER_SOFTWARE =", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.0091, 0.0005, 0, 0.66, 0.0753, 528, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "SERVER_SOFTWARE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SERVER_SOFTWARE = 'Rocket %s' % VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L18_C0", "label": "HTTP_SERVER_SOFTWARE =", "type": "assigned_variable", "loc": [18, 19], "level": 0, "parent": null, "vector": [14, 0, 0.0099, 0.0011, 0, 0.66, 0.086, 81, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "HTTP_SERVER_SOFTWARE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "HTTP_SERVER_SOFTWARE = '%s Python/%s' % (\n SERVER_SOFTWARE, sys.version.split(' ')[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L20_C0", "label": "BUF_SIZE =", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.0107, 0.0005, 0, 0.66, 0.0968, 273, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "BUF_SIZE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "BUF_SIZE = 16384"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L21_C0", "label": "SOCKET_TIMEOUT =", "type": "assigned_variable", "loc": [21, 21], "level": 0, "parent": null, "vector": [14, 0, 0.0112, 0.0005, 0, 0.66, 0.1075, 704, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "SOCKET_TIMEOUT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SOCKET_TIMEOUT = 10 # in secs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L22_C0", "label": "THREAD_STOP_CHECK_INTERVAL =", "type": "assigned_variable", "loc": [22, 22], "level": 0, "parent": null, "vector": [14, 0, 0.0118, 0.0005, 0, 0.66, 0.1183, 902, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "THREAD_STOP_CHECK_INTERVAL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "THREAD_STOP_CHECK_INTERVAL = 1 # in secs, How often should threads check for a server stop message?"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L23_C0", "label": "IS_JYTHON =", "type": "assigned_variable", "loc": [23, 23], "level": 0, "parent": null, "vector": [14, 0, 0.0123, 0.0005, 0, 0.66, 0.129, 853, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "IS_JYTHON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "IS_JYTHON = platform.system() == 'Java' # Handle special cases for Jython"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L24_C0", "label": "IGNORE_ERRORS_ON_CLOSE = set()", "type": "assigned_variable", "loc": [24, 24], "level": 0, "parent": null, "vector": [14, 0, 0.0128, 0.0005, 0, 0.66, 0.1398, 199, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "IGNORE_ERRORS_ON_CLOSE", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": "IGNORE_ERRORS_ON_CLOSE = set([errno.ECONNABORTED, errno.ECONNRESET])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L25_C0", "label": "DEFAULT_LISTEN_QUEUE_SIZE =", "type": "assigned_variable", "loc": [25, 25], "level": 0, "parent": null, "vector": [14, 0, 0.0134, 0.0005, 0, 0.66, 0.1505, 28, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "DEFAULT_LISTEN_QUEUE_SIZE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DEFAULT_LISTEN_QUEUE_SIZE = 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L26_C0", "label": "DEFAULT_MIN_THREADS =", "type": "assigned_variable", "loc": [26, 26], "level": 0, "parent": null, "vector": [14, 0, 0.0139, 0.0005, 0, 0.66, 0.1613, 389, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "DEFAULT_MIN_THREADS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DEFAULT_MIN_THREADS = 10"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L27_C0", "label": "DEFAULT_MAX_THREADS =", "type": "assigned_variable", "loc": [27, 27], "level": 0, "parent": null, "vector": [14, 0, 0.0144, 0.0005, 0, 0.66, 0.172, 88, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "DEFAULT_MAX_THREADS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DEFAULT_MAX_THREADS = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L28_C0", "label": "DEFAULTS = dict()", "type": "assigned_variable", "loc": [28, 30], "level": 0, "parent": null, "vector": [14, 0, 0.0155, 0.0016, 0, 0.66, 0.1828, 854, 3, 3, 0, 0, 827, 10, 1], "semantic": {"name": "DEFAULTS", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": "DEFAULTS = dict(LISTEN_QUEUE_SIZE=DEFAULT_LISTEN_QUEUE_SIZE,\n MIN_THREADS=DEFAULT_MIN_THREADS,\n MAX_THREADS=DEFAULT_MAX_THREADS)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L32_C0", "label": "PY3K =", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.0171, 0.0005, 0, 0.66, 0.1935, 679, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "PY3K", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "PY3K = sys.version_info[0] > 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L35_C0", "label": "NullHandler", "type": "class", "loc": [35, 38], "level": 0, "parent": null, "vector": [3, 0, 0.0195, 0.0021, 0, 0.66, 0.2043, 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 \"A Logging handler to prevent library errors.\"\n def emit(self, record):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L36_C4", "label": "expression", "type": "expression", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L35_C0", "vector": [8, 1, 0.0192, 0.0005, 1, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"A Logging handler to prevent library errors.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L37_C4", "label": "emit", "type": "function", "loc": [37, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L35_C0", "vector": [2, 1, 0.02, 0.0011, 1, 0.49, 1.0, 627, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "emit", "arg_names": ["self", "record"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def emit(self, record):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L40_C0", "label": "if", "type": "if", "loc": [40, 72], "level": 0, "parent": null, "vector": [4, 0, 0.0299, 0.0176, 0, 0.66, 0.2151, 0, 2, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if PY3K:\n def b(val):\n \"\"\" Convert string/unicode/bytes literals into bytes. This allows for\n the same code to run on Python 2.x and 3.x. \"\"\"\n if isinstance(val, str):\n return val.encode()\n else:\n return val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L41_C4", "label": "b", "type": "function", "loc": [41, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L40_C0", "vector": [2, 1, 0.0235, 0.0037, 1, 0.44, 0.0, 756, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "b", "arg_names": ["val"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def b(val):\n \"\"\" Convert string/unicode/bytes literals into bytes. This allows for\n the same code to run on Python 2.x and 3.x. \"\"\"\n if isinstance(val, str):\n return val.encode()\n else:\n return val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L42_C8", "label": "expression", "type": "expression", "loc": [42, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L41_C4", "vector": [8, 2, 0.0227, 0.0011, 2, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Convert string/unicode/bytes literals into bytes. This allows for\n the same code to run on Python 2.x and 3.x. \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L44_C8", "label": "if", "type": "if", "loc": [44, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L41_C4", "vector": [4, 2, 0.0243, 0.0021, 2, 0.76, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(val, str):\n return val.encode()\n else:\n return val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L45_C12", "label": "return", "type": "return", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L44_C8", "vector": [13, 3, 0.0241, 0.0005, 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 val.encode()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L47_C12", "label": "return", "type": "return", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L44_C8", "vector": [13, 3, 0.0251, 0.0005, 3, 0.01, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L49_C4", "label": "u", "type": "function", "loc": [49, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L40_C0", "vector": [2, 1, 0.0278, 0.0037, 1, 0.44, 0.3333, 609, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "u", "arg_names": ["val", "encoding"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def u(val, encoding=\"us-ascii\"):\n \"\"\" Convert bytes into string/unicode. This allows for the\n same code to run on Python 2.x and 3.x. \"\"\"\n if isinstance(val, bytes):\n return val.decode(encoding)\n else:\n return val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L50_C8", "label": "expression", "type": "expression", "loc": [50, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L49_C4", "vector": [8, 2, 0.027, 0.0011, 2, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Convert bytes into string/unicode. This allows for the\n same code to run on Python 2.x and 3.x. \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L52_C8", "label": "if", "type": "if", "loc": [52, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L49_C4", "vector": [4, 2, 0.0286, 0.0021, 2, 0.28, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(val, bytes):\n return val.decode(encoding)\n else:\n return val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L53_C12", "label": "return", "type": "return", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L52_C8", "vector": [13, 3, 0.0283, 0.0005, 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 val.decode(encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L55_C12", "label": "return", "type": "return", "loc": [55, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L52_C8", "vector": [13, 3, 0.0294, 0.0005, 3, 0.79, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L58_C4", "label": "b", "type": "function", "loc": [58, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L40_C0", "vector": [2, 1, 0.0326, 0.0037, 1, 0.44, 0.6667, 756, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "b", "arg_names": ["val"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def b(val):\n \"\"\" Convert string/unicode/bytes literals into bytes. This allows for\n the same code to run on Python 2.x and 3.x. \"\"\"\n if isinstance(val, unicode):\n return val.encode()\n else:\n return val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L59_C8", "label": "expression", "type": "expression", "loc": [59, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L58_C4", "vector": [8, 2, 0.0318, 0.0011, 2, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Convert string/unicode/bytes literals into bytes. This allows for\n the same code to run on Python 2.x and 3.x. \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L61_C8", "label": "if", "type": "if", "loc": [61, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L58_C4", "vector": [4, 2, 0.0334, 0.0021, 2, 0.65, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(val, unicode):\n return val.encode()\n else:\n return val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L62_C12", "label": "return", "type": "return", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L61_C8", "vector": [13, 3, 0.0331, 0.0005, 3, 0.5, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return val.encode()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L64_C12", "label": "return", "type": "return", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L61_C8", "vector": [13, 3, 0.0342, 0.0005, 3, 0.5, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L66_C4", "label": "u", "type": "function", "loc": [66, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L40_C0", "vector": [2, 1, 0.0369, 0.0037, 1, 0.44, 1.0, 609, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "u", "arg_names": ["val", "encoding"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def u(val, encoding=\"us-ascii\"):\n \"\"\" Convert bytes into string/unicode. This allows for the\n same code to run on Python 2.x and 3.x. \"\"\"\n if isinstance(val, str):\n return val.decode(encoding)\n else:\n return val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L67_C8", "label": "expression", "type": "expression", "loc": [67, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L66_C4", "vector": [8, 2, 0.0361, 0.0011, 2, 0.42, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Convert bytes into string/unicode. This allows for the\n same code to run on Python 2.x and 3.x. \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L69_C8", "label": "if", "type": "if", "loc": [69, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L66_C4", "vector": [4, 2, 0.0377, 0.0021, 2, 0.42, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(val, str):\n return val.decode(encoding)\n else:\n return val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L70_C12", "label": "return", "type": "return", "loc": [70, 70], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L69_C8", "vector": [13, 3, 0.0374, 0.0005, 3, 0.24, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return val.decode(encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L72_C12", "label": "return", "type": "return", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L69_C8", "vector": [13, 3, 0.0385, 0.0005, 3, 0.24, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return val"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L77_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [77, 79], "level": 0, "parent": null, "vector": [14, 0, 0.0417, 0.0016, 0, 0.66, 0.2258, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = ['VERSION', 'SERVER_SOFTWARE', 'HTTP_SERVER_SOFTWARE', 'BUF_SIZE',\n 'IS_JYTHON', 'IGNORE_ERRORS_ON_CLOSE', 'DEFAULTS', 'PY3K', 'b', 'u',\n 'Rocket', 'CherryPyWSGIServer', 'SERVER_NAME', 'NullHandler']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Import_L85_C0", "label": "sys import sys", "type": "import", "loc": [85, 85], "level": 0, "parent": null, "vector": [1, 0, 0.0454, 0.0005, 0, 0.66, 0.2366, 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_467:Import_L86_C0", "label": "time import time", "type": "import", "loc": [86, 86], "level": 0, "parent": null, "vector": [1, 0, 0.046, 0.0005, 0, 0.66, 0.2473, 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_467:Import_L87_C0", "label": "socket import socket", "type": "import", "loc": [87, 87], "level": 0, "parent": null, "vector": [1, 0, 0.0465, 0.0005, 0, 0.66, 0.2581, 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_467:Try_L88_C0", "label": "try", "type": "try", "loc": [88, 92], "level": 0, "parent": null, "vector": [7, 0, 0.0481, 0.0027, 0, 0.66, 0.2688, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n import ssl\n has_ssl = True\nexcept ImportError:\n has_ssl = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Import_L89_C4", "label": "ssl import ssl", "type": "import", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L88_C0", "vector": [1, 1, 0.0476, 0.0005, 1, 0.04, 0.0, 591, 0, 1, 0, 0, 591, 0, 0], "semantic": {"name": "ssl", "arg_names": [], "import_names": ["ssl"], "rhs_call_name": "", "annotation": ""}, "snippet": " import ssl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L90_C4", "label": "has_ssl =", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L88_C0", "vector": [14, 1, 0.0481, 0.0005, 1, 0.04, 1.0, 940, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "has_ssl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " has_ssl = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L92_C4", "label": "has_ssl =", "type": "assigned_variable", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L88_C0", "vector": [14, 1, 0.0492, 0.0005, 1, 0.04, 0.0, 940, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "has_ssl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " has_ssl = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L99_C0", "label": "Connection", "type": "class", "loc": [99, 176], "level": 0, "parent": null, "vector": [3, 0, 0.0735, 0.0417, 0, 0.66, 0.2796, 823, 0, 3, 0, 0, 186, 0, 11], "semantic": {"name": "Connection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Connection(object):\n __slots__ = [\n 'setblocking',\n 'sendall',\n 'shutdown',\n 'makefile',\n 'fileno',\n 'client_addr',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L100_C4", "label": "__slots__ =", "type": "assigned_variable", "loc": [100, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L99_C0", "vector": [14, 1, 0.058, 0.0096, 1, 0.71, 0.0, 596, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__slots__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " __slots__ = [\n 'setblocking',\n 'sendall',\n 'shutdown',\n 'makefile',\n 'fileno',\n 'client_addr',\n 'client_port',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "label": "__init__", "type": "function", "loc": [119, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L99_C0", "vector": [2, 1, 0.0706, 0.0144, 1, 0.71, 0.3333, 555, 0, 4, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "sock_tuple", "port", "secure"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, sock_tuple, port, secure=False):\n self.client_addr, self.client_port = sock_tuple[1][:2]\n self.server_port = port\n self.socket = sock_tuple[0]\n self.start_time = time.time()\n self.ssl = has_ssl and isinstance(self.socket, ssl.SSLSocket)\n self.secure = secure\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L120_C8", "label": "assign", "type": "assigned_variable", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "vector": [14, 2, 0.0641, 0.0005, 2, 0.32, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.client_addr, self.client_port = sock_tuple[1][:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L121_C8", "label": "self.server_port =", "type": "assigned_variable", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "vector": [14, 2, 0.0647, 0.0005, 2, 0.32, 0.0714, 367, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.server_port", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.server_port = port"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L122_C8", "label": "self.socket =", "type": "assigned_variable", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "vector": [14, 2, 0.0652, 0.0005, 2, 0.32, 0.1429, 172, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.socket", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.socket = sock_tuple[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L123_C8", "label": "self.start_time = time()", "type": "assigned_variable", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "vector": [14, 2, 0.0657, 0.0005, 2, 0.32, 0.2143, 387, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "self.start_time", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " self.start_time = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L124_C8", "label": "self.ssl =", "type": "assigned_variable", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "vector": [14, 2, 0.0663, 0.0005, 2, 0.32, 0.2857, 689, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.ssl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ssl = has_ssl and isinstance(self.socket, ssl.SSLSocket)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L125_C8", "label": "self.secure =", "type": "assigned_variable", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "vector": [14, 2, 0.0668, 0.0005, 2, 0.32, 0.3571, 9, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.secure", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.secure = secure"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L127_C8", "label": "if", "type": "if", "loc": [127, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "vector": [4, 2, 0.0689, 0.0027, 2, 0.32, 0.4286, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if IS_JYTHON:\n # In Jython we must set TCP_NODELAY here since it does not\n # inherit from the listening socket.\n # See: http://bugs.jython.org/issue1309\n self.socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L131_C12", "label": "setsockopt()", "type": "expression", "loc": [131, 131], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L127_C8", "vector": [8, 3, 0.07, 0.0005, 3, 0.4, 0.0, 461, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setsockopt", "arg_names": [], "import_names": [], "rhs_call_name": "setsockopt", "annotation": ""}, "snippet": " self.socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L133_C8", "label": "settimeout()", "type": "expression", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "vector": [8, 2, 0.0711, 0.0005, 2, 0.32, 0.5, 27, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "settimeout", "arg_names": [], "import_names": [], "rhs_call_name": "settimeout", "annotation": ""}, "snippet": " self.socket.settimeout(SOCKET_TIMEOUT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L135_C8", "label": "self.shutdown =", "type": "assigned_variable", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "vector": [14, 2, 0.0722, 0.0005, 2, 0.32, 0.5714, 876, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.shutdown", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.shutdown = self.socket.shutdown"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L136_C8", "label": "self.fileno =", "type": "assigned_variable", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "vector": [14, 2, 0.0727, 0.0005, 2, 0.32, 0.6429, 263, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.fileno", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.fileno = self.socket.fileno"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L137_C8", "label": "self.setblocking =", "type": "assigned_variable", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "vector": [14, 2, 0.0732, 0.0005, 2, 0.32, 0.7143, 147, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.setblocking", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.setblocking = self.socket.setblocking"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L138_C8", "label": "self.recv =", "type": "assigned_variable", "loc": [138, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "vector": [14, 2, 0.0738, 0.0005, 2, 0.32, 0.7857, 839, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.recv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.recv = self.socket.recv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L139_C8", "label": "self.send =", "type": "assigned_variable", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "vector": [14, 2, 0.0743, 0.0005, 2, 0.32, 0.8571, 206, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.send", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.send = self.socket.send"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L140_C8", "label": "self.makefile =", "type": "assigned_variable", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "vector": [14, 2, 0.0748, 0.0005, 2, 0.32, 0.9286, 924, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.makefile", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.makefile = self.socket.makefile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L142_C8", "label": "if", "type": "if", "loc": [142, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "vector": [4, 2, 0.0767, 0.0021, 2, 0.32, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if sys.platform == 'darwin':\n self.sendall = self._sendall_darwin\n else:\n self.sendall = self.socket.sendall"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L143_C12", "label": "self.sendall =", "type": "assigned_variable", "loc": [143, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L142_C8", "vector": [14, 3, 0.0764, 0.0005, 3, 0.17, 0.0, 646, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.sendall", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.sendall = self._sendall_darwin"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L145_C12", "label": "self.sendall =", "type": "assigned_variable", "loc": [145, 145], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L142_C8", "vector": [14, 3, 0.0775, 0.0005, 3, 0.17, 1.0, 646, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.sendall", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.sendall = self.socket.sendall"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L147_C4", "label": "_sendall_darwin", "type": "function", "loc": [147, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L99_C0", "vector": [2, 1, 0.082, 0.0075, 1, 0.71, 0.6667, 487, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "_sendall_darwin", "arg_names": ["self", "buf"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _sendall_darwin(self, buf):\n pending = len(buf)\n offset = 0\n while pending:\n try:\n sent = self.socket.send(buf[offset:])\n pending -= sent\n offset += sent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L148_C8", "label": "pending = len()", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L147_C4", "vector": [14, 2, 0.0791, 0.0005, 2, 0.3, 0.0, 258, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "pending", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " pending = len(buf)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L149_C8", "label": "offset =", "type": "assigned_variable", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L147_C4", "vector": [14, 2, 0.0796, 0.0005, 2, 0.3, 0.3333, 132, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "offset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " offset = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:While_L150_C8", "label": "while", "type": "while", "loc": [150, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L147_C4", "vector": [5, 2, 0.0826, 0.0053, 2, 0.3, 0.6667, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while pending:\n try:\n sent = self.socket.send(buf[offset:])\n pending -= sent\n offset += sent\n except socket.error:\n import errno\n info = sys.exc_info()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L151_C12", "label": "try", "type": "try", "loc": [151, 159], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L150_C8", "vector": [7, 3, 0.0828, 0.0048, 3, 0.18, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n sent = self.socket.send(buf[offset:])\n pending -= sent\n offset += sent\n except socket.error:\n import errno\n info = sys.exc_info()\n if info[1].args[0] != errno.EAGAIN:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L152_C16", "label": "sent = send()", "type": "assigned_variable", "loc": [152, 152], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L151_C12", "vector": [14, 4, 0.0812, 0.0005, 4, 0.56, 0.0, 928, 3, 1, 0, 0, 826, 10, 1], "semantic": {"name": "sent", "arg_names": [], "import_names": [], "rhs_call_name": "send", "annotation": ""}, "snippet": " sent = self.socket.send(buf[offset:])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Import_L156_C16", "label": "errno import errno", "type": "import", "loc": [156, 156], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L151_C12", "vector": [1, 4, 0.0834, 0.0005, 4, 0.56, 0.0, 546, 0, 1, 0, 0, 546, 0, 0], "semantic": {"name": "errno", "arg_names": [], "import_names": ["errno"], "rhs_call_name": "", "annotation": ""}, "snippet": " import errno"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L157_C16", "label": "info = exc_info()", "type": "assigned_variable", "loc": [157, 157], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L151_C12", "vector": [14, 4, 0.0839, 0.0005, 4, 0.56, 0.5, 730, 3, 0, 0, 0, 289, 10, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "exc_info", "annotation": ""}, "snippet": " info = sys.exc_info()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L158_C16", "label": "if", "type": "if", "loc": [158, 159], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L151_C12", "vector": [4, 4, 0.0847, 0.0011, 4, 0.56, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if info[1].args[0] != errno.EAGAIN:\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L160_C8", "label": "return", "type": "return", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L147_C4", "vector": [13, 2, 0.0855, 0.0005, 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 offset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L166_C4", "label": "close", "type": "function", "loc": [166, 176], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L99_C0", "vector": [2, 1, 0.0914, 0.0059, 1, 0.71, 1.0, 77, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "close", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def close(self):\n if hasattr(self.socket, '_sock'):\n try:\n self.socket._sock.close()\n except socket.error:\n info = sys.exc_info()\n if info[1].args[0] != socket.EBADF:\n raise info[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L167_C8", "label": "if", "type": "if", "loc": [167, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L166_C4", "vector": [4, 2, 0.0914, 0.0048, 2, 0.25, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(self.socket, '_sock'):\n try:\n self.socket._sock.close()\n except socket.error:\n info = sys.exc_info()\n if info[1].args[0] != socket.EBADF:\n raise info[1]\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L168_C12", "label": "try", "type": "try", "loc": [168, 175], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L167_C8", "vector": [7, 3, 0.0917, 0.0043, 3, 0.77, 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._sock.close()\n except socket.error:\n info = sys.exc_info()\n if info[1].args[0] != socket.EBADF:\n raise info[1]\n else:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L169_C16", "label": "close()", "type": "expression", "loc": [169, 169], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L168_C12", "vector": [8, 4, 0.0903, 0.0005, 4, 0.67, 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._sock.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L171_C16", "label": "info = exc_info()", "type": "assigned_variable", "loc": [171, 171], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L168_C12", "vector": [14, 4, 0.0914, 0.0005, 4, 0.67, 0.0, 730, 3, 0, 0, 0, 289, 10, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "exc_info", "annotation": ""}, "snippet": " info = sys.exc_info()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L172_C16", "label": "if", "type": "if", "loc": [172, 175], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L168_C12", "vector": [4, 4, 0.0927, 0.0021, 4, 0.67, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if info[1].args[0] != socket.EBADF:\n raise info[1]\n else:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L176_C8", "label": "close()", "type": "expression", "loc": [176, 176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L166_C4", "vector": [8, 2, 0.0941, 0.0005, 2, 0.25, 1.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_467:Import_L182_C0", "label": "socket import socket", "type": "import", "loc": [182, 182], "level": 0, "parent": null, "vector": [1, 0, 0.0973, 0.0005, 0, 0.66, 0.2903, 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_467:Try_L183_C0", "label": "try", "type": "try", "loc": [183, 189], "level": 0, "parent": null, "vector": [7, 0, 0.0994, 0.0037, 0, 0.66, 0.3011, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from io import StringIO\nexcept ImportError:\n try:\n from cStringIO import StringIO\n except ImportError:\n from StringIO import StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L184_C4", "label": "from io import StringIO", "type": "import", "loc": [184, 184], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L183_C0", "vector": [1, 1, 0.0983, 0.0005, 1, 0.04, 0.0, 518, 0, 1, 0, 0, 518, 0, 0], "semantic": {"name": "io", "arg_names": [], "import_names": ["StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": " from io import StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L186_C4", "label": "try", "type": "try", "loc": [186, 189], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L183_C0", "vector": [7, 1, 0.1002, 0.0021, 1, 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 from cStringIO import StringIO\n except ImportError:\n from StringIO import StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L187_C8", "label": "from cStringIO import StringIO", "type": "import", "loc": [187, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L186_C4", "vector": [1, 2, 0.0999, 0.0005, 2, 0.53, 0.0, 764, 0, 1, 0, 0, 764, 0, 0], "semantic": {"name": "cStringIO", "arg_names": [], "import_names": ["StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": " from cStringIO import StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L189_C8", "label": "from StringIO import StringIO", "type": "import", "loc": [189, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L186_C4", "vector": [1, 2, 0.101, 0.0005, 2, 0.53, 0.0, 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_467:ClassDef_L194_C0", "label": "FileLikeSocket", "type": "class", "loc": [194, 300], "level": 0, "parent": null, "vector": [3, 0, 0.132, 0.0572, 0, 0.66, 0.3118, 963, 0, 9, 0, 0, 186, 0, 31], "semantic": {"name": "FileLikeSocket", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FileLikeSocket(object):\n def __init__(self, conn, buf_size=BUF_SIZE):\n self.conn = conn\n self.buf_size = buf_size\n self.buffer = StringIO()\n self.content_length = None\n\n if self.conn.socket.gettimeout() == 0.0:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L195_C4", "label": "__init__", "type": "function", "loc": [195, 204], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L194_C0", "vector": [2, 1, 0.1066, 0.0053, 1, 0.75, 0.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "conn", "buf_size"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, conn, buf_size=BUF_SIZE):\n self.conn = conn\n self.buf_size = buf_size\n self.buffer = StringIO()\n self.content_length = None\n\n if self.conn.socket.gettimeout() == 0.0:\n self.read = self.non_blocking_read"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L196_C8", "label": "self.conn =", "type": "assigned_variable", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L195_C4", "vector": [14, 2, 0.1048, 0.0005, 2, 0.8, 0.0, 6, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.conn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.conn = conn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L197_C8", "label": "self.buf_size =", "type": "assigned_variable", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L195_C4", "vector": [14, 2, 0.1053, 0.0005, 2, 0.8, 0.25, 900, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.buf_size", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.buf_size = buf_size"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L198_C8", "label": "self.buffer = StringIO()", "type": "assigned_variable", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L195_C4", "vector": [14, 2, 0.1058, 0.0005, 2, 0.8, 0.5, 827, 3, 0, 0, 0, 609, 10, 1], "semantic": {"name": "self.buffer", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": " self.buffer = StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L199_C8", "label": "self.content_length =", "type": "assigned_variable", "loc": [199, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L195_C4", "vector": [14, 2, 0.1064, 0.0005, 2, 0.8, 0.75, 601, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.content_length", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.content_length = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L201_C8", "label": "if", "type": "if", "loc": [201, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L195_C4", "vector": [4, 2, 0.1082, 0.0021, 2, 0.8, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.conn.socket.gettimeout() == 0.0:\n self.read = self.non_blocking_read\n else:\n self.read = self.blocking_read"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L202_C12", "label": "self.read =", "type": "assigned_variable", "loc": [202, 202], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L201_C8", "vector": [14, 3, 0.108, 0.0005, 3, 0.63, 0.0, 53, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.read", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.read = self.non_blocking_read"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L204_C12", "label": "self.read =", "type": "assigned_variable", "loc": [204, 204], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L201_C8", "vector": [14, 3, 0.109, 0.0005, 3, 0.63, 1.0, 53, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.read", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.read = self.blocking_read"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L206_C4", "label": "__iter__", "type": "function", "loc": [206, 207], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L194_C0", "vector": [2, 1, 0.1104, 0.0011, 1, 0.75, 0.125, 891, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L207_C8", "label": "return", "type": "return", "loc": [207, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L206_C4", "vector": [13, 2, 0.1106, 0.0005, 2, 0.49, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L209_C4", "label": "recv", "type": "function", "loc": [209, 218], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L194_C0", "vector": [2, 1, 0.1141, 0.0053, 1, 0.75, 0.25, 178, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "recv", "arg_names": ["self", "size"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def recv(self, size):\n while True:\n try:\n return self.conn.recv(size)\n except socket.error:\n exc = sys.exc_info()\n e = exc[1]\n # FIXME - Don't raise socket_errors_nonblocking or socket_error_eintr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:While_L210_C8", "label": "while", "type": "while", "loc": [210, 218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L209_C4", "vector": [5, 2, 0.1144, 0.0048, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n try:\n return self.conn.recv(size)\n except socket.error:\n exc = sys.exc_info()\n e = exc[1]\n # FIXME - Don't raise socket_errors_nonblocking or socket_error_eintr\n if (e.args[0] not in set()):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L211_C12", "label": "try", "type": "try", "loc": [211, 218], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L210_C8", "vector": [7, 3, 0.1146, 0.0043, 3, 0.86, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return self.conn.recv(size)\n except socket.error:\n exc = sys.exc_info()\n e = exc[1]\n # FIXME - Don't raise socket_errors_nonblocking or socket_error_eintr\n if (e.args[0] not in set()):\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L212_C16", "label": "return", "type": "return", "loc": [212, 212], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L211_C12", "vector": [13, 4, 0.1133, 0.0005, 4, 0.49, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.conn.recv(size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L214_C16", "label": "exc = exc_info()", "type": "assigned_variable", "loc": [214, 214], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L211_C12", "vector": [14, 4, 0.1144, 0.0005, 4, 0.49, 0.0, 201, 3, 0, 0, 0, 289, 10, 1], "semantic": {"name": "exc", "arg_names": [], "import_names": [], "rhs_call_name": "exc_info", "annotation": ""}, "snippet": " exc = sys.exc_info()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L215_C16", "label": "e =", "type": "assigned_variable", "loc": [215, 215], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L211_C12", "vector": [14, 4, 0.1149, 0.0005, 4, 0.49, 0.5, 175, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "e", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " e = exc[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L217_C16", "label": "if", "type": "if", "loc": [217, 218], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L211_C12", "vector": [4, 4, 0.1162, 0.0011, 4, 0.49, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (e.args[0] not in set()):\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L220_C4", "label": "next", "type": "function", "loc": [220, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L194_C0", "vector": [2, 1, 0.1187, 0.0027, 1, 0.75, 0.375, 11, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "next", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def next(self):\n data = self.readline()\n if data == '':\n raise StopIteration\n return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L221_C8", "label": "data = readline()", "type": "assigned_variable", "loc": [221, 221], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L220_C4", "vector": [14, 2, 0.1181, 0.0005, 2, 0.14, 0.0, 929, 3, 0, 0, 0, 303, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "readline", "annotation": ""}, "snippet": " data = self.readline()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L222_C8", "label": "if", "type": "if", "loc": [222, 223], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L220_C4", "vector": [4, 2, 0.1189, 0.0011, 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 data == '':\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L224_C8", "label": "return", "type": "return", "loc": [224, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L220_C4", "vector": [13, 2, 0.1197, 0.0005, 2, 0.14, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L226_C4", "label": "non_blocking_read", "type": "function", "loc": [226, 269], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L194_C0", "vector": [2, 1, 0.1323, 0.0235, 1, 0.75, 0.5, 872, 0, 2, 1, 0, 0, 0, 16], "semantic": {"name": "non_blocking_read", "arg_names": ["self", "size"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def non_blocking_read(self, size=None):\n # Shamelessly adapted from Cherrypy!\n bufr = self.buffer\n bufr.seek(0, 2)\n if size is None:\n while True:\n data = self.recv(self.buf_size)\n if not data:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L228_C8", "label": "bufr =", "type": "assigned_variable", "loc": [228, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L226_C4", "vector": [14, 2, 0.1219, 0.0005, 2, 0.69, 0.0, 923, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "bufr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bufr = self.buffer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L229_C8", "label": "seek()", "type": "expression", "loc": [229, 229], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L226_C4", "vector": [8, 2, 0.1224, 0.0005, 2, 0.69, 0.5, 66, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "seek", "arg_names": [], "import_names": [], "rhs_call_name": "seek", "annotation": ""}, "snippet": " bufr.seek(0, 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L230_C8", "label": "if", "type": "if", "loc": [230, 269], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L226_C4", "vector": [4, 2, 0.1334, 0.0214, 2, 0.69, 1.0, 0, 0, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if size is None:\n while True:\n data = self.recv(self.buf_size)\n if not data:\n break\n bufr.write(data)\n\n self.buffer = StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:While_L231_C12", "label": "while", "type": "while", "loc": [231, 235], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L230_C8", "vector": [5, 3, 0.1245, 0.0027, 3, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n data = self.recv(self.buf_size)\n if not data:\n break\n bufr.write(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L232_C16", "label": "data = recv()", "type": "assigned_variable", "loc": [232, 232], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L231_C12", "vector": [14, 4, 0.124, 0.0005, 4, 0.5, 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.buf_size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L233_C16", "label": "if", "type": "if", "loc": [233, 234], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L231_C12", "vector": [4, 4, 0.1248, 0.0011, 4, 0.5, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not data:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L235_C16", "label": "write()", "type": "expression", "loc": [235, 235], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L231_C12", "vector": [8, 4, 0.1256, 0.0005, 4, 0.5, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " bufr.write(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L237_C12", "label": "self.buffer = StringIO()", "type": "assigned_variable", "loc": [237, 237], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L230_C8", "vector": [14, 3, 0.1267, 0.0005, 3, 0.15, 0.1429, 827, 3, 0, 0, 0, 609, 10, 1], "semantic": {"name": "self.buffer", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": " self.buffer = StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L239_C12", "label": "return", "type": "return", "loc": [239, 239], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L230_C8", "vector": [13, 3, 0.1277, 0.0005, 3, 0.15, 0.2857, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bufr.getvalue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L241_C12", "label": "buf_len = tell()", "type": "assigned_variable", "loc": [241, 241], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L230_C8", "vector": [14, 3, 0.1288, 0.0005, 3, 0.15, 0.4286, 429, 3, 0, 0, 0, 759, 10, 1], "semantic": {"name": "buf_len", "arg_names": [], "import_names": [], "rhs_call_name": "tell", "annotation": ""}, "snippet": " buf_len = self.buffer.tell()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L242_C12", "label": "if", "type": "if", "loc": [242, 246], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L230_C8", "vector": [4, 3, 0.1304, 0.0027, 3, 0.15, 0.5714, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if buf_len >= size:\n bufr.seek(0)\n data = bufr.read(size)\n self.buffer = StringIO(bufr.read())\n return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L243_C16", "label": "seek()", "type": "expression", "loc": [243, 243], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L242_C12", "vector": [8, 4, 0.1299, 0.0005, 4, 0.75, 0.0, 66, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "seek", "arg_names": [], "import_names": [], "rhs_call_name": "seek", "annotation": ""}, "snippet": " bufr.seek(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L244_C16", "label": "data = read()", "type": "assigned_variable", "loc": [244, 244], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L242_C12", "vector": [14, 4, 0.1304, 0.0005, 4, 0.75, 0.3333, 929, 3, 1, 0, 0, 453, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " data = bufr.read(size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L245_C16", "label": "self.buffer = StringIO()", "type": "assigned_variable", "loc": [245, 245], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L242_C12", "vector": [14, 4, 0.1309, 0.0005, 4, 0.75, 0.6667, 827, 3, 1, 0, 0, 609, 10, 2], "semantic": {"name": "self.buffer", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": " self.buffer = StringIO(bufr.read())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L246_C16", "label": "return", "type": "return", "loc": [246, 246], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L242_C12", "vector": [13, 4, 0.1315, 0.0005, 4, 0.75, 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_467:Assign_L248_C12", "label": "self.buffer = StringIO()", "type": "assigned_variable", "loc": [248, 248], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L230_C8", "vector": [14, 3, 0.1325, 0.0005, 3, 0.15, 0.7143, 827, 3, 0, 0, 0, 609, 10, 1], "semantic": {"name": "self.buffer", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": " self.buffer = StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:While_L249_C12", "label": "while", "type": "while", "loc": [249, 267], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L230_C8", "vector": [5, 3, 0.1379, 0.0102, 3, 0.15, 0.8571, 0, 1, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n remaining = size - buf_len\n data = self.recv(remaining)\n\n if not data:\n break\n\n n = len(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L250_C16", "label": "remaining =", "type": "assigned_variable", "loc": [250, 250], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L249_C12", "vector": [14, 4, 0.1336, 0.0005, 4, 0.85, 0.0, 789, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "remaining", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " remaining = size - buf_len"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L251_C16", "label": "data = recv()", "type": "assigned_variable", "loc": [251, 251], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L249_C12", "vector": [14, 4, 0.1342, 0.0005, 4, 0.85, 0.1667, 929, 3, 1, 0, 0, 178, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "recv", "annotation": ""}, "snippet": " data = self.recv(remaining)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L253_C16", "label": "if", "type": "if", "loc": [253, 254], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L249_C12", "vector": [4, 4, 0.1355, 0.0011, 4, 0.85, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not data:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L256_C16", "label": "n = len()", "type": "assigned_variable", "loc": [256, 256], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L249_C12", "vector": [14, 4, 0.1368, 0.0005, 4, 0.85, 0.5, 773, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "n", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " n = len(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L257_C16", "label": "if", "type": "if", "loc": [257, 258], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L249_C12", "vector": [4, 4, 0.1376, 0.0011, 4, 0.85, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if n == size and not buf_len:\n return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L258_C20", "label": "return", "type": "return", "loc": [258, 258], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L257_C16", "vector": [13, 5, 0.1379, 0.0005, 5, 0.31, 0.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_467:If_L260_C16", "label": "if", "type": "if", "loc": [260, 263], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L249_C12", "vector": [4, 4, 0.1398, 0.0021, 4, 0.85, 0.8333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if n == remaining:\n bufr.write(data)\n del data\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L261_C20", "label": "write()", "type": "expression", "loc": [261, 261], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L260_C16", "vector": [8, 5, 0.1395, 0.0005, 5, 0.11, 0.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " bufr.write(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L265_C16", "label": "write()", "type": "expression", "loc": [265, 265], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L249_C12", "vector": [8, 4, 0.1416, 0.0005, 4, 0.85, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " bufr.write(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L269_C12", "label": "return", "type": "return", "loc": [269, 269], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L230_C8", "vector": [13, 3, 0.1438, 0.0005, 3, 0.15, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bufr.getvalue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L271_C4", "label": "blocking_read", "type": "function", "loc": [271, 283], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L194_C0", "vector": [2, 1, 0.148, 0.0069, 1, 0.75, 0.625, 778, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "blocking_read", "arg_names": ["self", "length"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def blocking_read(self, length=None):\n if length is None:\n if self.content_length is not None:\n length = self.content_length\n else:\n length = 1\n\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L272_C8", "label": "if", "type": "if", "loc": [272, 276], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L271_C4", "vector": [4, 2, 0.1464, 0.0027, 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 length is None:\n if self.content_length is not None:\n length = self.content_length\n else:\n length = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L273_C12", "label": "if", "type": "if", "loc": [273, 276], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L272_C8", "vector": [4, 3, 0.1467, 0.0021, 3, 0.43, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.content_length is not None:\n length = self.content_length\n else:\n length = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L274_C16", "label": "length =", "type": "assigned_variable", "loc": [274, 274], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L273_C12", "vector": [14, 4, 0.1464, 0.0005, 4, 0.63, 0.0, 221, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "length", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " length = self.content_length"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L276_C16", "label": "length =", "type": "assigned_variable", "loc": [276, 276], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L273_C12", "vector": [14, 4, 0.1475, 0.0005, 4, 0.63, 1.0, 221, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "length", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " length = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L278_C8", "label": "try", "type": "try", "loc": [278, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L271_C4", "vector": [7, 2, 0.1494, 0.0021, 2, 0.63, 0.5, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n data = self.conn.recv(length)\n except:\n data = b('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L279_C12", "label": "data = recv()", "type": "assigned_variable", "loc": [279, 279], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L278_C8", "vector": [14, 3, 0.1491, 0.0005, 3, 0.92, 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.conn.recv(length)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L281_C12", "label": "data = b()", "type": "assigned_variable", "loc": [281, 281], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L278_C8", "vector": [14, 3, 0.1502, 0.0005, 3, 0.92, 0.0, 929, 3, 1, 0, 0, 756, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "b", "annotation": ""}, "snippet": " data = b('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L283_C8", "label": "return", "type": "return", "loc": [283, 283], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L271_C4", "vector": [13, 2, 0.1513, 0.0005, 2, 0.63, 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_467:FunctionDef_L285_C4", "label": "readline", "type": "function", "loc": [285, 293], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L194_C0", "vector": [2, 1, 0.1545, 0.0048, 1, 0.75, 0.75, 303, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "readline", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def readline(self):\n data = b(\"\")\n char = self.read(1)\n while char != b('\\n') and char is not b(''):\n line = repr(char)\n data += char\n char = self.read(1)\n data += char"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L286_C8", "label": "data = b()", "type": "assigned_variable", "loc": [286, 286], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L285_C4", "vector": [14, 2, 0.1529, 0.0005, 2, 0.84, 0.0, 929, 3, 1, 0, 0, 756, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "b", "annotation": ""}, "snippet": " data = b(\"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L287_C8", "label": "char = read()", "type": "assigned_variable", "loc": [287, 287], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L285_C4", "vector": [14, 2, 0.1534, 0.0005, 2, 0.84, 0.3333, 272, 3, 1, 0, 0, 453, 10, 1], "semantic": {"name": "char", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " char = self.read(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:While_L288_C8", "label": "while", "type": "while", "loc": [288, 291], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L285_C4", "vector": [5, 2, 0.1547, 0.0021, 2, 0.84, 0.6667, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while char != b('\\n') and char is not b(''):\n line = repr(char)\n data += char\n char = self.read(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L289_C12", "label": "line = repr()", "type": "assigned_variable", "loc": [289, 289], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L288_C8", "vector": [14, 3, 0.1545, 0.0005, 3, 0.28, 0.0, 373, 3, 1, 0, 0, 881, 10, 1], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "repr", "annotation": ""}, "snippet": " line = repr(char)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L291_C12", "label": "char = read()", "type": "assigned_variable", "loc": [291, 291], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L288_C8", "vector": [14, 3, 0.1555, 0.0005, 3, 0.28, 1.0, 272, 3, 1, 0, 0, 453, 10, 1], "semantic": {"name": "char", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " char = self.read(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L293_C8", "label": "return", "type": "return", "loc": [293, 293], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L285_C4", "vector": [13, 2, 0.1566, 0.0005, 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 data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L295_C4", "label": "readlines", "type": "function", "loc": [295, 296], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L194_C0", "vector": [2, 1, 0.1579, 0.0011, 1, 0.75, 0.875, 841, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "readlines", "arg_names": ["self", "hint"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def readlines(self, hint=\"ignored\"):\n return list(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L296_C8", "label": "return", "type": "return", "loc": [296, 296], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L295_C4", "vector": [13, 2, 0.1582, 0.0005, 2, 0.26, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return list(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L298_C4", "label": "close", "type": "function", "loc": [298, 300], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L194_C0", "vector": [2, 1, 0.1598, 0.0016, 1, 0.75, 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 self.conn = None\n self.content_length = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L299_C8", "label": "self.conn =", "type": "assigned_variable", "loc": [299, 299], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L298_C4", "vector": [14, 2, 0.1598, 0.0005, 2, 0.89, 0.0, 6, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.conn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.conn = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L300_C8", "label": "self.content_length =", "type": "assigned_variable", "loc": [300, 300], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L298_C4", "vector": [14, 2, 0.1603, 0.0005, 2, 0.89, 1.0, 601, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.content_length", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.content_length = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Import_L306_C0", "label": "time import time", "type": "import", "loc": [306, 306], "level": 0, "parent": null, "vector": [1, 0, 0.1635, 0.0005, 0, 0.66, 0.3226, 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_467:Try_L307_C0", "label": "try", "type": "try", "loc": [307, 321], "level": 0, "parent": null, "vector": [7, 0, 0.1678, 0.008, 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 concurrent.futures import Future, ThreadPoolExecutor\n from concurrent.futures.thread import _WorkItem\n has_futures = True\nexcept ImportError:\n has_futures = False\n\n class Future:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L308_C4", "label": "from concurrent.futures import Future, ThreadPoolExecutor", "type": "import", "loc": [308, 308], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L307_C0", "vector": [1, 1, 0.1646, 0.0005, 1, 0.55, 0.0, 682, 0, 2, 0, 0, 682, 0, 0], "semantic": {"name": "concurrent.futures", "arg_names": [], "import_names": ["Future", "ThreadPoolExecutor"], "rhs_call_name": "", "annotation": ""}, "snippet": " from concurrent.futures import Future, ThreadPoolExecutor"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L309_C4", "label": "from concurrent.futures.thread import _WorkItem", "type": "import", "loc": [309, 309], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L307_C0", "vector": [1, 1, 0.1652, 0.0005, 1, 0.55, 0.5, 21, 0, 1, 0, 0, 21, 0, 0], "semantic": {"name": "concurrent.futures.thread", "arg_names": [], "import_names": ["_WorkItem"], "rhs_call_name": "", "annotation": ""}, "snippet": " from concurrent.futures.thread import _WorkItem"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L310_C4", "label": "has_futures =", "type": "assigned_variable", "loc": [310, 310], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L307_C0", "vector": [14, 1, 0.1657, 0.0005, 1, 0.55, 1.0, 352, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "has_futures", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " has_futures = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L312_C4", "label": "has_futures =", "type": "assigned_variable", "loc": [312, 312], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L307_C0", "vector": [14, 1, 0.1668, 0.0005, 1, 0.55, 0.0, 352, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "has_futures", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " has_futures = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L314_C4", "label": "Future", "type": "class", "loc": [314, 315], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L307_C0", "vector": [3, 1, 0.1681, 0.0011, 1, 0.55, 0.3333, 427, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Future", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Future:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L317_C4", "label": "ThreadPoolExecutor", "type": "class", "loc": [317, 318], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L307_C0", "vector": [3, 1, 0.1697, 0.0011, 1, 0.55, 0.6667, 510, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ThreadPoolExecutor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class ThreadPoolExecutor:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L320_C4", "label": "_WorkItem", "type": "class", "loc": [320, 321], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L307_C0", "vector": [3, 1, 0.1713, 0.0011, 1, 0.55, 1.0, 264, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_WorkItem", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class _WorkItem:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L324_C0", "label": "WSGIFuture", "type": "class", "loc": [324, 355], "level": 0, "parent": null, "vector": [3, 0, 0.1815, 0.0171, 0, 0.66, 0.3441, 184, 0, 4, 0, 0, 427, 0, 7], "semantic": {"name": "WSGIFuture", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WSGIFuture(Future):\n def __init__(self, f_dict, *args, **kwargs):\n Future.__init__(self, *args, **kwargs)\n\n self.timeout = None\n\n self._mem_dict = f_dict\n self._lifespan = 30"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L325_C4", "label": "__init__", "type": "function", "loc": [325, 333], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L324_C0", "vector": [2, 1, 0.1758, 0.0048, 1, 0.18, 0.0, 555, 0, 4, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "f_dict", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, f_dict, *args, **kwargs):\n Future.__init__(self, *args, **kwargs)\n\n self.timeout = None\n\n self._mem_dict = f_dict\n self._lifespan = 30\n self._name = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L326_C8", "label": "__init__()", "type": "expression", "loc": [326, 326], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L325_C4", "vector": [8, 2, 0.1742, 0.0005, 2, 0.97, 0.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " Future.__init__(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L328_C8", "label": "self.timeout =", "type": "assigned_variable", "loc": [328, 328], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L325_C4", "vector": [14, 2, 0.1753, 0.0005, 2, 0.97, 0.2, 621, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.timeout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.timeout = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L330_C8", "label": "self._mem_dict =", "type": "assigned_variable", "loc": [330, 330], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L325_C4", "vector": [14, 2, 0.1764, 0.0005, 2, 0.97, 0.4, 376, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._mem_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._mem_dict = f_dict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L331_C8", "label": "self._lifespan =", "type": "assigned_variable", "loc": [331, 331], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L325_C4", "vector": [14, 2, 0.1769, 0.0005, 2, 0.97, 0.6, 838, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self._lifespan", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._lifespan = 30"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L332_C8", "label": "self._name =", "type": "assigned_variable", "loc": [332, 332], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L325_C4", "vector": [14, 2, 0.1774, 0.0005, 2, 0.97, 0.8, 257, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._name = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L333_C8", "label": "self._start_time = time()", "type": "assigned_variable", "loc": [333, 333], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L325_C4", "vector": [14, 2, 0.178, 0.0005, 2, 0.97, 1.0, 910, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "self._start_time", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " self._start_time = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L335_C4", "label": "set_running_or_notify_cancel", "type": "function", "loc": [335, 339], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L324_C0", "vector": [2, 1, 0.1801, 0.0027, 1, 0.18, 0.3333, 621, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "set_running_or_notify_cancel", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_running_or_notify_cancel(self):\n if time.time() - self._start_time >= self._lifespan:\n self.cancel()\n else:\n return super(WSGIFuture, self).set_running_or_notify_cancel()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L336_C8", "label": "if", "type": "if", "loc": [336, 339], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L335_C4", "vector": [4, 2, 0.1804, 0.0021, 2, 0.5, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if time.time() - self._start_time >= self._lifespan:\n self.cancel()\n else:\n return super(WSGIFuture, self).set_running_or_notify_cancel()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L337_C12", "label": "cancel()", "type": "expression", "loc": [337, 337], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L336_C8", "vector": [8, 3, 0.1801, 0.0005, 3, 0.07, 0.0, 732, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "cancel", "arg_names": [], "import_names": [], "rhs_call_name": "cancel", "annotation": ""}, "snippet": " self.cancel()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L339_C12", "label": "return", "type": "return", "loc": [339, 339], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L336_C8", "vector": [13, 3, 0.1812, 0.0005, 3, 0.07, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return super(WSGIFuture, self).set_running_or_notify_cancel()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L341_C4", "label": "remember", "type": "function", "loc": [341, 350], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L324_C0", "vector": [2, 1, 0.1847, 0.0053, 1, 0.18, 0.6667, 160, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "remember", "arg_names": ["self", "name", "lifespan"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remember(self, name, lifespan=None):\n self._lifespan = lifespan or self._lifespan\n\n if name in self._mem_dict:\n raise NameError('Cannot remember future by name \"%s\". ' % name +\n 'A future already exists with that name.')\n self._name = name\n self._mem_dict[name] = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L342_C8", "label": "self._lifespan =", "type": "assigned_variable", "loc": [342, 342], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L341_C4", "vector": [14, 2, 0.1828, 0.0005, 2, 0.14, 0.0, 838, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._lifespan", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._lifespan = lifespan or self._lifespan"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L344_C8", "label": "if", "type": "if", "loc": [344, 346], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L341_C4", "vector": [4, 2, 0.1844, 0.0016, 2, 0.14, 0.25, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name in self._mem_dict:\n raise NameError('Cannot remember future by name \"%s\". ' % name +\n 'A future already exists with that name.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L347_C8", "label": "self._name =", "type": "assigned_variable", "loc": [347, 347], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L341_C4", "vector": [14, 2, 0.1855, 0.0005, 2, 0.14, 0.5, 257, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._name = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L348_C8", "label": "assign", "type": "assigned_variable", "loc": [348, 348], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L341_C4", "vector": [14, 2, 0.186, 0.0005, 2, 0.14, 0.75, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._mem_dict[name] = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L350_C8", "label": "return", "type": "return", "loc": [350, 350], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L341_C4", "vector": [13, 2, 0.1871, 0.0005, 2, 0.14, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L352_C4", "label": "forget", "type": "function", "loc": [352, 355], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L324_C0", "vector": [2, 1, 0.1889, 0.0021, 1, 0.18, 1.0, 757, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "forget", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def forget(self):\n if self._name in self._mem_dict and self._mem_dict[self._name] is self:\n del self._mem_dict[self._name]\n self._name = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L353_C8", "label": "if", "type": "if", "loc": [353, 355], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L352_C4", "vector": [4, 2, 0.1892, 0.0016, 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 self._name in self._mem_dict and self._mem_dict[self._name] is self:\n del self._mem_dict[self._name]\n self._name = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L355_C12", "label": "self._name =", "type": "assigned_variable", "loc": [355, 355], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L353_C8", "vector": [14, 3, 0.1897, 0.0005, 3, 0.79, 0.0, 257, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._name = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L358_C0", "label": "_WorkItem", "type": "class", "loc": [358, 375], "level": 0, "parent": null, "vector": [3, 0, 0.1959, 0.0096, 0, 0.66, 0.3548, 264, 0, 2, 0, 0, 186, 0, 5], "semantic": {"name": "_WorkItem", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class _WorkItem(object):\n def __init__(self, future, fn, args, kwargs):\n self.future = future\n self.fn = fn\n self.args = args\n self.kwargs = kwargs\n\n def run(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L359_C4", "label": "__init__", "type": "function", "loc": [359, 363], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L358_C0", "vector": [2, 1, 0.1929, 0.0027, 1, 0.5, 0.0, 555, 0, 5, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "future", "fn", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, future, fn, args, kwargs):\n self.future = future\n self.fn = fn\n self.args = args\n self.kwargs = kwargs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L360_C8", "label": "self.future =", "type": "assigned_variable", "loc": [360, 360], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L359_C4", "vector": [14, 2, 0.1924, 0.0005, 2, 0.01, 0.0, 455, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.future", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.future = future"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L361_C8", "label": "self.fn =", "type": "assigned_variable", "loc": [361, 361], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L359_C4", "vector": [14, 2, 0.1929, 0.0005, 2, 0.01, 0.3333, 187, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.fn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.fn = fn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L362_C8", "label": "self.args =", "type": "assigned_variable", "loc": [362, 362], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L359_C4", "vector": [14, 2, 0.1935, 0.0005, 2, 0.01, 0.6667, 640, 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_467:Assign_L363_C8", "label": "self.kwargs =", "type": "assigned_variable", "loc": [363, 363], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L359_C4", "vector": [14, 2, 0.194, 0.0005, 2, 0.01, 1.0, 790, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.kwargs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.kwargs = kwargs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L365_C4", "label": "run", "type": "function", "loc": [365, 375], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L358_C0", "vector": [2, 1, 0.1978, 0.0059, 1, 0.5, 1.0, 679, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "run", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def run(self):\n if not self.future.set_running_or_notify_cancel():\n return\n\n try:\n result = self.fn(*self.args, **self.kwargs)\n except BaseException:\n e = sys.exc_info()[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L366_C8", "label": "if", "type": "if", "loc": [366, 367], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L365_C4", "vector": [4, 2, 0.1959, 0.0011, 2, 0.54, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.future.set_running_or_notify_cancel():\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L367_C12", "label": "return", "type": "return", "loc": [367, 367], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L366_C8", "vector": [13, 3, 0.1962, 0.0005, 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_467:Try_L369_C8", "label": "try", "type": "try", "loc": [369, 375], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L365_C4", "vector": [7, 2, 0.1988, 0.0037, 2, 0.54, 1.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n result = self.fn(*self.args, **self.kwargs)\n except BaseException:\n e = sys.exc_info()[1]\n self.future.set_exception(e)\n else:\n self.future.set_result(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L370_C12", "label": "result = fn()", "type": "assigned_variable", "loc": [370, 370], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L369_C8", "vector": [14, 3, 0.1978, 0.0005, 3, 0.88, 0.0, 51, 3, 2, 0, 0, 59, 10, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "fn", "annotation": ""}, "snippet": " result = self.fn(*self.args, **self.kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L372_C12", "label": "e =", "type": "assigned_variable", "loc": [372, 372], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L369_C8", "vector": [14, 3, 0.1988, 0.0005, 3, 0.88, 0.0, 175, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "e", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " e = sys.exc_info()[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L373_C12", "label": "set_exception()", "type": "expression", "loc": [373, 373], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L369_C8", "vector": [8, 3, 0.1994, 0.0005, 3, 0.88, 1.0, 152, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_exception", "arg_names": [], "import_names": [], "rhs_call_name": "set_exception", "annotation": ""}, "snippet": " self.future.set_exception(e)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L375_C12", "label": "set_result()", "type": "expression", "loc": [375, 375], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L369_C8", "vector": [8, 3, 0.2004, 0.0005, 3, 0.88, 1.0, 992, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_result", "arg_names": [], "import_names": [], "rhs_call_name": "set_result", "annotation": ""}, "snippet": " self.future.set_result(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L378_C0", "label": "WSGIExecutor", "type": "class", "loc": [378, 402], "level": 0, "parent": null, "vector": [3, 0, 0.2084, 0.0134, 0, 0.66, 0.3656, 50, 0, 2, 0, 0, 510, 0, 10], "semantic": {"name": "WSGIExecutor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WSGIExecutor(ThreadPoolExecutor):\n multithread = True\n multiprocess = False\n\n def __init__(self, *args, **kwargs):\n ThreadPoolExecutor.__init__(self, *args, **kwargs)\n\n self.futures = dict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L379_C4", "label": "multithread =", "type": "assigned_variable", "loc": [379, 379], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L378_C0", "vector": [14, 1, 0.2026, 0.0005, 1, 0.27, 0.0, 700, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "multithread", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " multithread = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L380_C4", "label": "multiprocess =", "type": "assigned_variable", "loc": [380, 380], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L378_C0", "vector": [14, 1, 0.2031, 0.0005, 1, 0.27, 0.3333, 595, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "multiprocess", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " multiprocess = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L382_C4", "label": "__init__", "type": "function", "loc": [382, 385], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L378_C0", "vector": [2, 1, 0.205, 0.0021, 1, 0.27, 0.6667, 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 ThreadPoolExecutor.__init__(self, *args, **kwargs)\n\n self.futures = dict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L383_C8", "label": "__init__()", "type": "expression", "loc": [383, 383], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L382_C4", "vector": [8, 2, 0.2047, 0.0005, 2, 0.59, 0.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " ThreadPoolExecutor.__init__(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L385_C8", "label": "self.futures = dict()", "type": "assigned_variable", "loc": [385, 385], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L382_C4", "vector": [14, 2, 0.2058, 0.0005, 2, 0.59, 1.0, 331, 3, 0, 0, 0, 827, 10, 1], "semantic": {"name": "self.futures", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " self.futures = dict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L387_C4", "label": "submit", "type": "function", "loc": [387, 402], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L378_C0", "vector": [2, 1, 0.2108, 0.0086, 1, 0.27, 1.0, 487, 0, 4, 1, 0, 0, 0, 8], "semantic": {"name": "submit", "arg_names": ["self", "fn", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def submit(self, fn, *args, **kwargs):\n if self._shutdown_lock.acquire():\n if self._shutdown:\n self._shutdown_lock.release()\n raise RuntimeError(\n 'Cannot schedule new futures after shutdown')\n\n f = WSGIFuture(self.futures)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L388_C8", "label": "if", "type": "if", "loc": [388, 402], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L387_C4", "vector": [4, 2, 0.2111, 0.008, 2, 0.2, 0.0, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._shutdown_lock.acquire():\n if self._shutdown:\n self._shutdown_lock.release()\n raise RuntimeError(\n 'Cannot schedule new futures after shutdown')\n\n f = WSGIFuture(self.futures)\n w = _WorkItem(f, fn, args, kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L389_C12", "label": "if", "type": "if", "loc": [389, 392], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L388_C8", "vector": [4, 3, 0.2087, 0.0021, 3, 0.66, 0.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._shutdown:\n self._shutdown_lock.release()\n raise RuntimeError(\n 'Cannot schedule new futures after shutdown')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L390_C16", "label": "release()", "type": "expression", "loc": [390, 390], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L389_C12", "vector": [8, 4, 0.2084, 0.0005, 4, 0.39, 0.0, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " self._shutdown_lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L394_C12", "label": "f = WSGIFuture()", "type": "assigned_variable", "loc": [394, 394], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L388_C8", "vector": [14, 3, 0.2106, 0.0005, 3, 0.66, 0.1429, 899, 3, 1, 0, 0, 184, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "WSGIFuture", "annotation": ""}, "snippet": " f = WSGIFuture(self.futures)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L395_C12", "label": "w = _WorkItem()", "type": "assigned_variable", "loc": [395, 395], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L388_C8", "vector": [14, 3, 0.2111, 0.0005, 3, 0.66, 0.2857, 549, 3, 4, 0, 0, 264, 10, 1], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "_WorkItem", "annotation": ""}, "snippet": " w = _WorkItem(f, fn, args, kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L397_C12", "label": "put()", "type": "expression", "loc": [397, 397], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L388_C8", "vector": [8, 3, 0.2122, 0.0005, 3, 0.66, 0.4286, 636, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " self._work_queue.put(w)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L398_C12", "label": "_adjust_thread_count()", "type": "expression", "loc": [398, 398], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L388_C8", "vector": [8, 3, 0.2127, 0.0005, 3, 0.66, 0.5714, 316, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_adjust_thread_count", "arg_names": [], "import_names": [], "rhs_call_name": "_adjust_thread_count", "annotation": ""}, "snippet": " self._adjust_thread_count()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L399_C12", "label": "release()", "type": "expression", "loc": [399, 399], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L388_C8", "vector": [8, 3, 0.2133, 0.0005, 3, 0.66, 0.7143, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " self._shutdown_lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L400_C12", "label": "return", "type": "return", "loc": [400, 400], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L388_C8", "vector": [13, 3, 0.2138, 0.0005, 3, 0.66, 0.8571, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return f"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L402_C12", "label": "return", "type": "return", "loc": [402, 402], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L388_C8", "vector": [13, 3, 0.2149, 0.0005, 3, 0.66, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L405_C0", "label": "FuturesMiddleware", "type": "class", "loc": [405, 414], "level": 0, "parent": null, "vector": [3, 0, 0.2189, 0.0053, 0, 0.66, 0.3763, 107, 0, 2, 0, 0, 186, 0, 2], "semantic": {"name": "FuturesMiddleware", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FuturesMiddleware(object):\n \"Futures middleware that adds a Futures Executor to the environment\"\n def __init__(self, app, threads=5):\n self.app = app\n self.executor = WSGIExecutor(threads)\n\n def __call__(self, environ, start_response):\n environ[\"wsgiorg.executor\"] = self.executor"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L406_C4", "label": "expression", "type": "expression", "loc": [406, 406], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L405_C0", "vector": [8, 1, 0.217, 0.0005, 1, 0.69, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Futures middleware that adds a Futures Executor to the environment\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L407_C4", "label": "__init__", "type": "function", "loc": [407, 409], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L405_C0", "vector": [2, 1, 0.2181, 0.0016, 1, 0.69, 0.5, 555, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "app", "threads"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, app, threads=5):\n self.app = app\n self.executor = WSGIExecutor(threads)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L408_C8", "label": "self.app =", "type": "assigned_variable", "loc": [408, 408], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L407_C4", "vector": [14, 2, 0.2181, 0.0005, 2, 0.05, 0.0, 809, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.app", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.app = app"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L409_C8", "label": "self.executor = WSGIExecutor()", "type": "assigned_variable", "loc": [409, 409], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L407_C4", "vector": [14, 2, 0.2186, 0.0005, 2, 0.05, 1.0, 759, 3, 1, 0, 0, 50, 10, 1], "semantic": {"name": "self.executor", "arg_names": [], "import_names": [], "rhs_call_name": "WSGIExecutor", "annotation": ""}, "snippet": " self.executor = WSGIExecutor(threads)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L411_C4", "label": "__call__", "type": "function", "loc": [411, 414], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L405_C0", "vector": [2, 1, 0.2205, 0.0021, 1, 0.69, 1.0, 319, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "__call__", "arg_names": ["self", "environ", "start_response"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __call__(self, environ, start_response):\n environ[\"wsgiorg.executor\"] = self.executor\n environ[\"wsgiorg.futures\"] = self.executor.futures\n return self.app(environ, start_response)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L412_C8", "label": "assign", "type": "assigned_variable", "loc": [412, 412], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L411_C4", "vector": [14, 2, 0.2202, 0.0005, 2, 0.89, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ[\"wsgiorg.executor\"] = self.executor"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L413_C8", "label": "assign", "type": "assigned_variable", "loc": [413, 413], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L411_C4", "vector": [14, 2, 0.2207, 0.0005, 2, 0.89, 0.5, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ[\"wsgiorg.futures\"] = self.executor.futures"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L414_C8", "label": "return", "type": "return", "loc": [414, 414], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L411_C4", "vector": [13, 2, 0.2213, 0.0005, 2, 0.89, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.app(environ, start_response)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Import_L420_C0", "label": "os import os", "type": "import", "loc": [420, 420], "level": 0, "parent": null, "vector": [1, 0, 0.2245, 0.0005, 0, 0.66, 0.3871, 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_467:Import_L421_C0", "label": "socket import socket", "type": "import", "loc": [421, 421], "level": 0, "parent": null, "vector": [1, 0, 0.225, 0.0005, 0, 0.66, 0.3978, 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_467:Import_L422_C0", "label": "logging import logging", "type": "import", "loc": [422, 422], "level": 0, "parent": null, "vector": [1, 0, 0.2255, 0.0005, 0, 0.66, 0.4086, 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_467:Import_L423_C0", "label": "traceback import traceback", "type": "import", "loc": [423, 423], "level": 0, "parent": null, "vector": [1, 0, 0.2261, 0.0005, 0, 0.66, 0.4194, 423, 0, 1, 0, 0, 423, 0, 0], "semantic": {"name": "traceback", "arg_names": [], "import_names": ["traceback"], "rhs_call_name": "", "annotation": ""}, "snippet": "import traceback"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L424_C0", "label": "from threading import Thread", "type": "import", "loc": [424, 424], "level": 0, "parent": null, "vector": [1, 0, 0.2266, 0.0005, 0, 0.66, 0.4301, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["Thread"], "rhs_call_name": "", "annotation": ""}, "snippet": "from threading import Thread"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L426_C0", "label": "try", "type": "try", "loc": [426, 434], "level": 0, "parent": null, "vector": [7, 0, 0.2298, 0.0048, 0, 0.66, 0.4409, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n import ssl\n from ssl import SSLError\n has_ssl = True\nexcept ImportError:\n has_ssl = False\n\n class SSLError(socket.error):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Import_L427_C4", "label": "ssl import ssl", "type": "import", "loc": [427, 427], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L426_C0", "vector": [1, 1, 0.2282, 0.0005, 1, 0.31, 0.0, 591, 0, 1, 0, 0, 591, 0, 0], "semantic": {"name": "ssl", "arg_names": [], "import_names": ["ssl"], "rhs_call_name": "", "annotation": ""}, "snippet": " import ssl"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L428_C4", "label": "from ssl import SSLError", "type": "import", "loc": [428, 428], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L426_C0", "vector": [1, 1, 0.2288, 0.0005, 1, 0.31, 0.5, 591, 0, 1, 0, 0, 591, 0, 0], "semantic": {"name": "ssl", "arg_names": [], "import_names": ["SSLError"], "rhs_call_name": "", "annotation": ""}, "snippet": " from ssl import SSLError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L429_C4", "label": "has_ssl =", "type": "assigned_variable", "loc": [429, 429], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L426_C0", "vector": [14, 1, 0.2293, 0.0005, 1, 0.31, 1.0, 940, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "has_ssl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " has_ssl = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L431_C4", "label": "has_ssl =", "type": "assigned_variable", "loc": [431, 431], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L426_C0", "vector": [14, 1, 0.2304, 0.0005, 1, 0.31, 0.0, 940, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "has_ssl", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " has_ssl = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L433_C4", "label": "SSLError", "type": "class", "loc": [433, 434], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L426_C0", "vector": [3, 1, 0.2317, 0.0011, 1, 0.31, 1.0, 226, 0, 0, 0, 0, 611, 0, 0], "semantic": {"name": "SSLError", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class SSLError(socket.error):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L439_C0", "label": "Listener", "type": "class", "loc": [439, 608], "level": 0, "parent": null, "vector": [3, 0, 0.2798, 0.0909, 0, 0.66, 0.4516, 32, 0, 6, 0, 0, 134, 0, 41], "semantic": {"name": "Listener", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Listener(Thread):\n \"\"\"The Listener class is a class responsible for accepting connections\n and queuing them to be processed by a worker thread.\"\"\"\n\n def __init__(self, interface, queue_size, active_queue, *args, **kwargs):\n Thread.__init__(self, *args, **kwargs)\n\n # Instance variables"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L440_C4", "label": "expression", "type": "expression", "loc": [440, 441], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L439_C0", "vector": [8, 1, 0.2354, 0.0011, 1, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The Listener class is a class responsible for accepting connections\n and queuing them to be processed by a worker thread.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "label": "__init__", "type": "function", "loc": [443, 523], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L439_C0", "vector": [2, 1, 0.2582, 0.0433, 1, 0.98, 0.1667, 555, 0, 6, 0, 0, 0, 0, 24], "semantic": {"name": "__init__", "arg_names": ["self", "interface", "queue_size", "active_queue", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, interface, queue_size, active_queue, *args, **kwargs):\n Thread.__init__(self, *args, **kwargs)\n\n # Instance variables\n self.active_queue = active_queue\n self.interface = interface\n self.addr = interface[0]\n self.port = interface[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L444_C8", "label": "__init__()", "type": "expression", "loc": [444, 444], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "vector": [8, 2, 0.2373, 0.0005, 2, 0.57, 0.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " Thread.__init__(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L447_C8", "label": "self.active_queue =", "type": "assigned_variable", "loc": [447, 447], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "vector": [14, 2, 0.2389, 0.0005, 2, 0.57, 0.0625, 711, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.active_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.active_queue = active_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L448_C8", "label": "self.interface =", "type": "assigned_variable", "loc": [448, 448], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "vector": [14, 2, 0.2394, 0.0005, 2, 0.57, 0.125, 140, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.interface", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.interface = interface"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L449_C8", "label": "self.addr =", "type": "assigned_variable", "loc": [449, 449], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "vector": [14, 2, 0.24, 0.0005, 2, 0.57, 0.1875, 895, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.addr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.addr = interface[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L450_C8", "label": "self.port =", "type": "assigned_variable", "loc": [450, 450], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "vector": [14, 2, 0.2405, 0.0005, 2, 0.57, 0.25, 435, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.port", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.port = interface[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L451_C8", "label": "self.secure =", "type": "assigned_variable", "loc": [451, 451], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "vector": [14, 2, 0.241, 0.0005, 2, 0.57, 0.3125, 9, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.secure", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.secure = len(interface) >= 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L452_C8", "label": "self.clientcert_req =", "type": "assigned_variable", "loc": [452, 452], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "vector": [14, 2, 0.2416, 0.0005, 2, 0.57, 0.375, 507, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.clientcert_req", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.clientcert_req = (len(interface) == 5 and interface[4])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L454_C8", "label": "self.thread =", "type": "assigned_variable", "loc": [454, 454], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "vector": [14, 2, 0.2427, 0.0005, 2, 0.57, 0.4375, 2, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.thread", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.thread = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L455_C8", "label": "self.ready =", "type": "assigned_variable", "loc": [455, 455], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "vector": [14, 2, 0.2432, 0.0005, 2, 0.57, 0.5, 827, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.ready", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ready = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L458_C8", "label": "self.err_log = getLogger()", "type": "assigned_variable", "loc": [458, 458], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "vector": [14, 2, 0.2448, 0.0005, 2, 0.57, 0.5625, 286, 3, 1, 0, 0, 71, 10, 1], "semantic": {"name": "self.err_log", "arg_names": [], "import_names": [], "rhs_call_name": "getLogger", "annotation": ""}, "snippet": " self.err_log = logging.getLogger('Rocket.Errors.Port%i' % self.port)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L459_C8", "label": "addHandler()", "type": "expression", "loc": [459, 459], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "vector": [8, 2, 0.2453, 0.0005, 2, 0.57, 0.625, 255, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "addHandler", "arg_names": [], "import_names": [], "rhs_call_name": "addHandler", "annotation": ""}, "snippet": " self.err_log.addHandler(NullHandler())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L462_C8", "label": "if", "type": "if", "loc": [462, 465], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "vector": [4, 2, 0.2477, 0.0021, 2, 0.57, 0.6875, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ':' in self.addr:\n listener = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)\n else:\n listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L463_C12", "label": "listener = socket()", "type": "assigned_variable", "loc": [463, 463], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L462_C8", "vector": [14, 3, 0.2475, 0.0005, 3, 0.25, 0.0, 870, 3, 2, 0, 0, 687, 10, 1], "semantic": {"name": "listener", "arg_names": [], "import_names": [], "rhs_call_name": "socket", "annotation": ""}, "snippet": " listener = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L465_C12", "label": "listener = socket()", "type": "assigned_variable", "loc": [465, 465], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L462_C8", "vector": [14, 3, 0.2485, 0.0005, 3, 0.25, 1.0, 870, 3, 2, 0, 0, 687, 10, 1], "semantic": {"name": "listener", "arg_names": [], "import_names": [], "rhs_call_name": "socket", "annotation": ""}, "snippet": " listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L467_C8", "label": "if", "type": "if", "loc": [467, 469], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "vector": [4, 2, 0.2501, 0.0016, 2, 0.57, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not listener:\n self.err_log.error(\"Failed to get socket.\")\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L468_C12", "label": "error()", "type": "expression", "loc": [468, 468], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L467_C8", "vector": [8, 3, 0.2501, 0.0005, 3, 0.37, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " self.err_log.error(\"Failed to get socket.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L469_C12", "label": "return", "type": "return", "loc": [469, 469], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L467_C8", "vector": [13, 3, 0.2507, 0.0005, 3, 0.37, 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_467:If_L471_C8", "label": "if", "type": "if", "loc": [471, 490], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "vector": [4, 2, 0.2568, 0.0107, 2, 0.57, 0.8125, 0, 7, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.secure:\n if not has_ssl:\n self.err_log.error(\"ssl module required to serve HTTPS.\")\n return\n elif not os.path.exists(interface[2]):\n data = (interface[2], interface[0], interface[1])\n self.err_log.error(\"Cannot find key file \"\n \"'%s'. Cannot bind to %s:%s\" % data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L472_C12", "label": "if", "type": "if", "loc": [472, 484], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L471_C8", "vector": [4, 3, 0.2555, 0.0069, 3, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not has_ssl:\n self.err_log.error(\"ssl module required to serve HTTPS.\")\n return\n elif not os.path.exists(interface[2]):\n data = (interface[2], interface[0], interface[1])\n self.err_log.error(\"Cannot find key file \"\n \"'%s'. Cannot bind to %s:%s\" % data)\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L473_C16", "label": "error()", "type": "expression", "loc": [473, 473], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L472_C12", "vector": [8, 4, 0.2528, 0.0005, 4, 0.3, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " self.err_log.error(\"ssl module required to serve HTTPS.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L474_C16", "label": "return", "type": "return", "loc": [474, 474], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L472_C12", "vector": [13, 4, 0.2533, 0.0005, 4, 0.3, 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_467:If_L475_C12", "label": "if", "type": "if", "loc": [475, 484], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L472_C12", "vector": [4, 4, 0.2563, 0.0053, 4, 0.3, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not os.path.exists(interface[2]):\n data = (interface[2], interface[0], interface[1])\n self.err_log.error(\"Cannot find key file \"\n \"'%s'. Cannot bind to %s:%s\" % data)\n return\n elif not os.path.exists(interface[3]):\n data = (interface[3], interface[0], interface[1])\n self.err_log.error(\"Cannot find certificate file \""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L476_C16", "label": "data =", "type": "assigned_variable", "loc": [476, 476], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L475_C12", "vector": [14, 5, 0.2544, 0.0005, 5, 0.27, 0.0, 929, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = (interface[2], interface[0], interface[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L477_C16", "label": "error()", "type": "expression", "loc": [477, 478], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L475_C12", "vector": [8, 5, 0.2552, 0.0011, 5, 0.27, 0.3333, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " self.err_log.error(\"Cannot find key file \"\n \"'%s'. Cannot bind to %s:%s\" % data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L479_C16", "label": "return", "type": "return", "loc": [479, 479], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L475_C12", "vector": [13, 5, 0.256, 0.0005, 5, 0.27, 0.6667, 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_467:If_L480_C12", "label": "if", "type": "if", "loc": [480, 484], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L475_C12", "vector": [4, 5, 0.2576, 0.0027, 5, 0.27, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not os.path.exists(interface[3]):\n data = (interface[3], interface[0], interface[1])\n self.err_log.error(\"Cannot find certificate file \"\n \"'%s'. Cannot bind to %s:%s\" % data)\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L481_C16", "label": "data =", "type": "assigned_variable", "loc": [481, 481], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L480_C12", "vector": [14, 6, 0.2571, 0.0005, 6, 0.7, 0.0, 929, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = (interface[3], interface[0], interface[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L482_C16", "label": "error()", "type": "expression", "loc": [482, 483], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L480_C12", "vector": [8, 6, 0.2579, 0.0011, 6, 0.7, 0.5, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " self.err_log.error(\"Cannot find certificate file \"\n \"'%s'. Cannot bind to %s:%s\" % data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L484_C16", "label": "return", "type": "return", "loc": [484, 484], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L480_C12", "vector": [13, 6, 0.2587, 0.0005, 6, 0.7, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L486_C12", "label": "if", "type": "if", "loc": [486, 490], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L471_C8", "vector": [4, 3, 0.2608, 0.0027, 3, 0.56, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.clientcert_req and not os.path.exists(interface[4]):\n data = (interface[4], interface[0], interface[1])\n self.err_log.error(\"Cannot find root ca certificate file \"\n \"'%s'. Cannot bind to %s:%s\" % data)\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L487_C16", "label": "data =", "type": "assigned_variable", "loc": [487, 487], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L486_C12", "vector": [14, 4, 0.2603, 0.0005, 4, 0.59, 0.0, 929, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = (interface[4], interface[0], interface[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L488_C16", "label": "error()", "type": "expression", "loc": [488, 489], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L486_C12", "vector": [8, 4, 0.2611, 0.0011, 4, 0.59, 0.5, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " self.err_log.error(\"Cannot find root ca certificate file \"\n \"'%s'. Cannot bind to %s:%s\" % data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L490_C16", "label": "return", "type": "return", "loc": [490, 490], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L486_C12", "vector": [13, 4, 0.2619, 0.0005, 4, 0.59, 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_467:Try_L493_C8", "label": "try", "type": "try", "loc": [493, 497], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "vector": [7, 2, 0.2646, 0.0027, 2, 0.57, 0.875, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n except:\n msg = \"Cannot share socket. Using %s:%i exclusively.\"\n self.err_log.warning(msg % (self.addr, self.port))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L494_C12", "label": "setsockopt()", "type": "expression", "loc": [494, 494], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L493_C8", "vector": [8, 3, 0.264, 0.0005, 3, 0.48, 0.0, 461, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setsockopt", "arg_names": [], "import_names": [], "rhs_call_name": "setsockopt", "annotation": ""}, "snippet": " listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L496_C12", "label": "msg =", "type": "assigned_variable", "loc": [496, 496], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L493_C8", "vector": [14, 3, 0.2651, 0.0005, 3, 0.48, 0.0, 712, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg = \"Cannot share socket. Using %s:%i exclusively.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L497_C12", "label": "warning()", "type": "expression", "loc": [497, 497], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L493_C8", "vector": [8, 3, 0.2656, 0.0005, 3, 0.48, 1.0, 320, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warning", "arg_names": [], "import_names": [], "rhs_call_name": "warning", "annotation": ""}, "snippet": " self.err_log.warning(msg % (self.addr, self.port))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L499_C8", "label": "try", "type": "try", "loc": [499, 506], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "vector": [7, 2, 0.2686, 0.0043, 2, 0.57, 0.9375, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if not IS_JYTHON:\n listener.setsockopt(socket.IPPROTO_TCP,\n socket.TCP_NODELAY,\n 1)\n except:\n msg = \"Cannot set TCP_NODELAY, things might run a little slower\"\n self.err_log.warning(msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L500_C12", "label": "if", "type": "if", "loc": [500, 503], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L499_C8", "vector": [4, 3, 0.268, 0.0021, 3, 0.13, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not IS_JYTHON:\n listener.setsockopt(socket.IPPROTO_TCP,\n socket.TCP_NODELAY,\n 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L501_C16", "label": "setsockopt()", "type": "expression", "loc": [501, 503], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L500_C12", "vector": [8, 4, 0.2683, 0.0016, 4, 0.18, 0.0, 461, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setsockopt", "arg_names": [], "import_names": [], "rhs_call_name": "setsockopt", "annotation": ""}, "snippet": " listener.setsockopt(socket.IPPROTO_TCP,\n socket.TCP_NODELAY,\n 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L505_C12", "label": "msg =", "type": "assigned_variable", "loc": [505, 505], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L499_C8", "vector": [14, 3, 0.2699, 0.0005, 3, 0.13, 0.0, 712, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg = \"Cannot set TCP_NODELAY, things might run a little slower\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L506_C12", "label": "warning()", "type": "expression", "loc": [506, 506], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L499_C8", "vector": [8, 3, 0.2704, 0.0005, 3, 0.13, 1.0, 320, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warning", "arg_names": [], "import_names": [], "rhs_call_name": "warning", "annotation": ""}, "snippet": " self.err_log.warning(msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L508_C8", "label": "try", "type": "try", "loc": [508, 523], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "vector": [7, 2, 0.2755, 0.0086, 2, 0.57, 1.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n listener.bind((self.addr, self.port))\n except:\n msg = \"Socket %s:%i in use by other process and it won't share.\"\n self.err_log.error(msg % (self.addr, self.port))\n else:\n # We want socket operations to timeout periodically so we can\n # check if the server is shutting down"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L509_C12", "label": "bind()", "type": "expression", "loc": [509, 509], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L508_C8", "vector": [8, 3, 0.272, 0.0005, 3, 0.34, 0.0, 640, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "bind", "arg_names": [], "import_names": [], "rhs_call_name": "bind", "annotation": ""}, "snippet": " listener.bind((self.addr, self.port))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L511_C12", "label": "msg =", "type": "assigned_variable", "loc": [511, 511], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L508_C8", "vector": [14, 3, 0.2731, 0.0005, 3, 0.34, 0.0, 712, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg = \"Socket %s:%i in use by other process and it won't share.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L512_C12", "label": "error()", "type": "expression", "loc": [512, 512], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L508_C8", "vector": [8, 3, 0.2737, 0.0005, 3, 0.34, 1.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " self.err_log.error(msg % (self.addr, self.port))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L516_C12", "label": "settimeout()", "type": "expression", "loc": [516, 516], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L508_C8", "vector": [8, 3, 0.2758, 0.0005, 3, 0.34, 0.25, 27, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "settimeout", "arg_names": [], "import_names": [], "rhs_call_name": "settimeout", "annotation": ""}, "snippet": " listener.settimeout(THREAD_STOP_CHECK_INTERVAL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L519_C12", "label": "listen()", "type": "expression", "loc": [519, 519], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L508_C8", "vector": [8, 3, 0.2774, 0.0005, 3, 0.34, 0.5, 265, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "listen", "arg_names": [], "import_names": [], "rhs_call_name": "listen", "annotation": ""}, "snippet": " listener.listen(queue_size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L521_C12", "label": "self.listener =", "type": "assigned_variable", "loc": [521, 521], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L508_C8", "vector": [14, 3, 0.2785, 0.0005, 3, 0.34, 0.75, 686, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.listener", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.listener = listener"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L523_C12", "label": "self.ready =", "type": "assigned_variable", "loc": [523, 523], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L508_C8", "vector": [14, 3, 0.2795, 0.0005, 3, 0.34, 1.0, 827, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.ready", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ready = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L525_C4", "label": "wrap_socket", "type": "function", "loc": [525, 549], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L439_C0", "vector": [2, 1, 0.287, 0.0134, 1, 0.98, 0.3333, 85, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "wrap_socket", "arg_names": ["self", "sock"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wrap_socket(self, sock):\n try:\n if self.clientcert_req:\n ca_certs = self.interface[4]\n cert_reqs = ssl.CERT_OPTIONAL\n sock = ssl.wrap_socket(sock,\n keyfile=self.interface[2],\n certfile=self.interface[3],"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L526_C8", "label": "try", "type": "try", "loc": [526, 547], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L525_C4", "vector": [7, 2, 0.2867, 0.0118, 2, 0.56, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if self.clientcert_req:\n ca_certs = self.interface[4]\n cert_reqs = ssl.CERT_OPTIONAL\n sock = ssl.wrap_socket(sock,\n keyfile=self.interface[2],\n certfile=self.interface[3],\n server_side=True,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L527_C12", "label": "if", "type": "if", "loc": [527, 542], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L526_C8", "vector": [4, 3, 0.2857, 0.0086, 3, 0.48, 0.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.clientcert_req:\n ca_certs = self.interface[4]\n cert_reqs = ssl.CERT_OPTIONAL\n sock = ssl.wrap_socket(sock,\n keyfile=self.interface[2],\n certfile=self.interface[3],\n server_side=True,\n cert_reqs=cert_reqs,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L528_C16", "label": "ca_certs =", "type": "assigned_variable", "loc": [528, 528], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L527_C12", "vector": [14, 4, 0.2822, 0.0005, 4, 0.59, 0.0, 965, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ca_certs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ca_certs = self.interface[4]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L529_C16", "label": "cert_reqs =", "type": "assigned_variable", "loc": [529, 529], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L527_C12", "vector": [14, 4, 0.2827, 0.0005, 4, 0.59, 0.3333, 983, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cert_reqs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cert_reqs = ssl.CERT_OPTIONAL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L530_C16", "label": "sock = wrap_socket()", "type": "assigned_variable", "loc": [530, 536], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L527_C12", "vector": [14, 4, 0.2849, 0.0037, 4, 0.59, 0.6667, 263, 3, 7, 0, 0, 85, 10, 1], "semantic": {"name": "sock", "arg_names": [], "import_names": [], "rhs_call_name": "wrap_socket", "annotation": ""}, "snippet": " sock = ssl.wrap_socket(sock,\n keyfile=self.interface[2],\n certfile=self.interface[3],\n server_side=True,\n cert_reqs=cert_reqs,\n ca_certs=ca_certs,\n ssl_version=ssl.PROTOCOL_SSLv23)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L538_C16", "label": "sock = wrap_socket()", "type": "assigned_variable", "loc": [538, 542], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L527_C12", "vector": [14, 4, 0.2886, 0.0027, 4, 0.59, 1.0, 263, 3, 5, 0, 0, 85, 10, 1], "semantic": {"name": "sock", "arg_names": [], "import_names": [], "rhs_call_name": "wrap_socket", "annotation": ""}, "snippet": " sock = ssl.wrap_socket(sock,\n keyfile=self.interface[2],\n certfile=self.interface[3],\n server_side=True,\n ssl_version=ssl.PROTOCOL_SSLv23)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L549_C8", "label": "return", "type": "return", "loc": [549, 549], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L525_C4", "vector": [13, 2, 0.2934, 0.0005, 2, 0.56, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sock"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L551_C4", "label": "start", "type": "function", "loc": [551, 562], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L439_C0", "vector": [2, 1, 0.2974, 0.0064, 1, 0.98, 0.5, 511, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "start", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def start(self):\n if not self.ready:\n self.err_log.warning('Listener started when not ready.')\n return\n\n if self.thread is not None and self.thread.isAlive():\n self.err_log.warning('Listener already running.')\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L552_C8", "label": "if", "type": "if", "loc": [552, 554], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L551_C4", "vector": [4, 2, 0.2956, 0.0016, 2, 0.31, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.ready:\n self.err_log.warning('Listener started when not ready.')\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L553_C12", "label": "warning()", "type": "expression", "loc": [553, 553], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L552_C8", "vector": [8, 3, 0.2956, 0.0005, 3, 0.89, 0.0, 320, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warning", "arg_names": [], "import_names": [], "rhs_call_name": "warning", "annotation": ""}, "snippet": " self.err_log.warning('Listener started when not ready.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L554_C12", "label": "return", "type": "return", "loc": [554, 554], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L552_C8", "vector": [13, 3, 0.2961, 0.0005, 3, 0.89, 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_467:If_L556_C8", "label": "if", "type": "if", "loc": [556, 558], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L551_C4", "vector": [4, 2, 0.2977, 0.0016, 2, 0.31, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.thread is not None and self.thread.isAlive():\n self.err_log.warning('Listener already running.')\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L557_C12", "label": "warning()", "type": "expression", "loc": [557, 557], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L556_C8", "vector": [8, 3, 0.2977, 0.0005, 3, 0.05, 0.0, 320, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warning", "arg_names": [], "import_names": [], "rhs_call_name": "warning", "annotation": ""}, "snippet": " self.err_log.warning('Listener already running.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L558_C12", "label": "return", "type": "return", "loc": [558, 558], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L556_C8", "vector": [13, 3, 0.2982, 0.0005, 3, 0.05, 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_467:Assign_L560_C8", "label": "self.thread = Thread()", "type": "assigned_variable", "loc": [560, 560], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L551_C4", "vector": [14, 2, 0.2993, 0.0005, 2, 0.31, 0.6667, 2, 3, 2, 0, 0, 134, 10, 2], "semantic": {"name": "self.thread", "arg_names": [], "import_names": [], "rhs_call_name": "Thread", "annotation": ""}, "snippet": " self.thread = Thread(target=self.listen, name=\"Port\" + str(self.port))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L562_C8", "label": "start()", "type": "expression", "loc": [562, 562], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L551_C4", "vector": [8, 2, 0.3004, 0.0005, 2, 0.31, 1.0, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " self.thread.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L564_C4", "label": "isAlive", "type": "function", "loc": [564, 568], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L439_C0", "vector": [2, 1, 0.3025, 0.0027, 1, 0.98, 0.6667, 844, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "isAlive", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def isAlive(self):\n if self.thread is None:\n return False\n\n return self.thread.isAlive()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L565_C8", "label": "if", "type": "if", "loc": [565, 566], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L564_C4", "vector": [4, 2, 0.3022, 0.0011, 2, 0.75, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.thread is None:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L566_C12", "label": "return", "type": "return", "loc": [566, 566], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L565_C8", "vector": [13, 3, 0.3025, 0.0005, 3, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L568_C8", "label": "return", "type": "return", "loc": [568, 568], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L564_C4", "vector": [13, 2, 0.3036, 0.0005, 2, 0.75, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.thread.isAlive()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L570_C4", "label": "join", "type": "function", "loc": [570, 580], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L439_C0", "vector": [2, 1, 0.3073, 0.0059, 1, 0.98, 0.8333, 933, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "join", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def join(self):\n if self.thread is None:\n return\n\n self.ready = False\n\n self.thread.join()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L571_C8", "label": "if", "type": "if", "loc": [571, 572], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L570_C4", "vector": [4, 2, 0.3055, 0.0011, 2, 0.39, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.thread is None:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L572_C12", "label": "return", "type": "return", "loc": [572, 572], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L571_C8", "vector": [13, 3, 0.3057, 0.0005, 3, 0.54, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L574_C8", "label": "self.ready =", "type": "assigned_variable", "loc": [574, 574], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L570_C4", "vector": [14, 2, 0.3068, 0.0005, 2, 0.39, 0.25, 827, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.ready", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ready = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L576_C8", "label": "join()", "type": "expression", "loc": [576, 576], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L570_C4", "vector": [8, 2, 0.3079, 0.0005, 2, 0.39, 0.5, 933, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "join", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " self.thread.join()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L579_C8", "label": "self.thread =", "type": "assigned_variable", "loc": [579, 579], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L570_C4", "vector": [14, 2, 0.3095, 0.0005, 2, 0.39, 0.75, 2, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.thread", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.thread = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L580_C8", "label": "self.ready =", "type": "assigned_variable", "loc": [580, 580], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L570_C4", "vector": [14, 2, 0.31, 0.0005, 2, 0.39, 1.0, 827, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.ready", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ready = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L582_C4", "label": "listen", "type": "function", "loc": [582, 608], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L439_C0", "vector": [2, 1, 0.318, 0.0144, 1, 0.98, 1.0, 265, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "listen", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def listen(self):\n if __debug__:\n self.err_log.debug('Entering main loop.')\n while True:\n try:\n sock, addr = self.listener.accept()\n\n if self.secure:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L583_C8", "label": "if", "type": "if", "loc": [583, 584], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L582_C4", "vector": [4, 2, 0.3119, 0.0011, 2, 0.88, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.err_log.debug('Entering main loop.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L584_C12", "label": "debug()", "type": "expression", "loc": [584, 584], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L583_C8", "vector": [8, 3, 0.3121, 0.0005, 3, 0.9, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.err_log.debug('Entering main loop.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:While_L585_C8", "label": "while", "type": "while", "loc": [585, 608], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L582_C4", "vector": [5, 2, 0.3188, 0.0128, 2, 0.88, 1.0, 0, 1, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n try:\n sock, addr = self.listener.accept()\n\n if self.secure:\n sock = self.wrap_socket(sock)\n\n self.active_queue.put(((sock, addr),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L586_C12", "label": "try", "type": "try", "loc": [586, 608], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L585_C8", "vector": [7, 3, 0.3191, 0.0123, 3, 0.81, 0.0, 0, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n sock, addr = self.listener.accept()\n\n if self.secure:\n sock = self.wrap_socket(sock)\n\n self.active_queue.put(((sock, addr),\n self.interface[1],"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L587_C16", "label": "sock, addr = accept()", "type": "assigned_variable", "loc": [587, 587], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L586_C12", "vector": [14, 4, 0.3137, 0.0005, 4, 0.48, 0.0, 775, 3, 0, 0, 0, 829, 10, 1], "semantic": {"name": "sock, addr", "arg_names": [], "import_names": [], "rhs_call_name": "accept", "annotation": ""}, "snippet": " sock, addr = self.listener.accept()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L589_C16", "label": "if", "type": "if", "loc": [589, 590], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L586_C12", "vector": [4, 4, 0.3151, 0.0011, 4, 0.48, 0.5, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.secure:\n sock = self.wrap_socket(sock)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L590_C20", "label": "sock = wrap_socket()", "type": "assigned_variable", "loc": [590, 590], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L589_C16", "vector": [14, 5, 0.3153, 0.0005, 5, 0.22, 0.0, 263, 3, 1, 0, 0, 85, 10, 1], "semantic": {"name": "sock", "arg_names": [], "import_names": [], "rhs_call_name": "wrap_socket", "annotation": ""}, "snippet": " sock = self.wrap_socket(sock)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L592_C16", "label": "put()", "type": "expression", "loc": [592, 594], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L586_C12", "vector": [8, 4, 0.3169, 0.0016, 4, 0.48, 1.0, 636, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " self.active_queue.put(((sock, addr),\n self.interface[1],\n self.secure))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L601_C16", "label": "if", "type": "if", "loc": [601, 606], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L586_C12", "vector": [4, 4, 0.3226, 0.0032, 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 not self.ready:\n if __debug__:\n self.err_log.debug('Listener exiting.')\n return\n else:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L602_C20", "label": "if", "type": "if", "loc": [602, 603], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L601_C16", "vector": [4, 5, 0.322, 0.0011, 5, 0.12, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.err_log.debug('Listener exiting.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L603_C24", "label": "debug()", "type": "expression", "loc": [603, 603], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L602_C20", "vector": [8, 6, 0.3223, 0.0005, 6, 0.45, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.err_log.debug('Listener exiting.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L604_C20", "label": "return", "type": "return", "loc": [604, 604], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L601_C16", "vector": [13, 5, 0.3228, 0.0005, 5, 0.12, 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_467:Expr_L608_C16", "label": "error()", "type": "expression", "loc": [608, 608], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L586_C12", "vector": [8, 4, 0.325, 0.0005, 4, 0.48, 0.0, 771, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " self.err_log.error(traceback.format_exc())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Import_L614_C0", "label": "sys import sys", "type": "import", "loc": [614, 614], "level": 0, "parent": null, "vector": [1, 0, 0.3282, 0.0005, 0, 0.66, 0.4624, 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_467:Import_L615_C0", "label": "time import time", "type": "import", "loc": [615, 615], "level": 0, "parent": null, "vector": [1, 0, 0.3287, 0.0005, 0, 0.66, 0.4731, 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_467:Import_L616_C0", "label": "socket import socket", "type": "import", "loc": [616, 616], "level": 0, "parent": null, "vector": [1, 0, 0.3292, 0.0005, 0, 0.66, 0.4839, 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_467:Import_L617_C0", "label": "logging import logging", "type": "import", "loc": [617, 617], "level": 0, "parent": null, "vector": [1, 0, 0.3298, 0.0005, 0, 0.66, 0.4946, 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_467:Import_L618_C0", "label": "traceback import traceback", "type": "import", "loc": [618, 618], "level": 0, "parent": null, "vector": [1, 0, 0.3303, 0.0005, 0, 0.66, 0.5054, 423, 0, 1, 0, 0, 423, 0, 0], "semantic": {"name": "traceback", "arg_names": [], "import_names": ["traceback"], "rhs_call_name": "", "annotation": ""}, "snippet": "import traceback"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L619_C0", "label": "from threading import Lock", "type": "import", "loc": [619, 619], "level": 0, "parent": null, "vector": [1, 0, 0.3308, 0.0005, 0, 0.66, 0.5161, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["Lock"], "rhs_call_name": "", "annotation": ""}, "snippet": "from threading import Lock"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L620_C0", "label": "try", "type": "try", "loc": [620, 623], "level": 0, "parent": null, "vector": [7, 0, 0.3322, 0.0021, 0, 0.66, 0.5269, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from queue import Queue\nexcept ImportError:\n from Queue import Queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L621_C4", "label": "from queue import Queue", "type": "import", "loc": [621, 621], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L620_C0", "vector": [1, 1, 0.3319, 0.0005, 1, 0.88, 0.0, 325, 0, 1, 0, 0, 325, 0, 0], "semantic": {"name": "queue", "arg_names": [], "import_names": ["Queue"], "rhs_call_name": "", "annotation": ""}, "snippet": " from queue import Queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L623_C4", "label": "from Queue import Queue", "type": "import", "loc": [623, 623], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L620_C0", "vector": [1, 1, 0.333, 0.0005, 1, 0.88, 0.0, 952, 0, 1, 0, 0, 952, 0, 0], "semantic": {"name": "Queue", "arg_names": [], "import_names": ["Queue"], "rhs_call_name": "", "annotation": ""}, "snippet": " from Queue import Queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L629_C0", "label": "log = getLogger()", "type": "assigned_variable", "loc": [629, 629], "level": 0, "parent": null, "vector": [14, 0, 0.3362, 0.0005, 0, 0.66, 0.5376, 432, 3, 1, 0, 0, 71, 10, 1], "semantic": {"name": "log", "arg_names": [], "import_names": [], "rhs_call_name": "getLogger", "annotation": ""}, "snippet": "log = logging.getLogger('Rocket')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L630_C0", "label": "addHandler()", "type": "expression", "loc": [630, 630], "level": 0, "parent": null, "vector": [8, 0, 0.3367, 0.0005, 0, 0.66, 0.5484, 255, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "addHandler", "arg_names": [], "import_names": [], "rhs_call_name": "addHandler", "annotation": ""}, "snippet": "log.addHandler(NullHandler())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L633_C0", "label": "Rocket", "type": "class", "loc": [633, 801], "level": 0, "parent": null, "vector": [3, 0, 0.3832, 0.0903, 0, 0.66, 0.5591, 560, 0, 6, 0, 0, 186, 0, 52], "semantic": {"name": "Rocket", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Rocket(object):\n \"\"\"The Rocket class is responsible for handling threads and accepting and\n dispatching connections.\"\"\"\n\n def __init__(self,\n interfaces=('127.0.0.1', 8000),\n method='wsgi',\n app_info=None,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L634_C4", "label": "expression", "type": "expression", "loc": [634, 635], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L633_C0", "vector": [8, 1, 0.3391, 0.0011, 1, 0.47, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The Rocket class is responsible for handling threads and accepting and\n dispatching connections.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "label": "__init__", "type": "function", "loc": [637, 693], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L633_C0", "vector": [2, 1, 0.3554, 0.0305, 1, 0.47, 0.1667, 555, 0, 9, 0, 0, 0, 0, 13], "semantic": {"name": "__init__", "arg_names": ["self", "interfaces", "method", "app_info", "min_threads", "max_threads", "queue_size", "timeout", "handle_signals"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self,\n interfaces=('127.0.0.1', 8000),\n method='wsgi',\n app_info=None,\n min_threads=None,\n max_threads=None,\n queue_size=None,\n timeout=600,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L647_C8", "label": "self.handle_signals =", "type": "assigned_variable", "loc": [647, 647], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "vector": [14, 2, 0.3458, 0.0005, 2, 0.83, 0.0, 107, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.handle_signals", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.handle_signals = handle_signals"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L648_C8", "label": "self.startstop_lock = Lock()", "type": "assigned_variable", "loc": [648, 648], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "vector": [14, 2, 0.3463, 0.0005, 2, 0.83, 0.0714, 32, 3, 0, 0, 0, 843, 10, 1], "semantic": {"name": "self.startstop_lock", "arg_names": [], "import_names": [], "rhs_call_name": "Lock", "annotation": ""}, "snippet": " self.startstop_lock = Lock()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L649_C8", "label": "self.timeout =", "type": "assigned_variable", "loc": [649, 649], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "vector": [14, 2, 0.3469, 0.0005, 2, 0.83, 0.1429, 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_467:If_L651_C8", "label": "if", "type": "if", "loc": [651, 654], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "vector": [4, 2, 0.3487, 0.0021, 2, 0.83, 0.2143, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(interfaces, list):\n self.interfaces = [interfaces]\n else:\n self.interfaces = interfaces"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L652_C12", "label": "self.interfaces =", "type": "assigned_variable", "loc": [652, 652], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L651_C8", "vector": [14, 3, 0.3485, 0.0005, 3, 0.16, 0.0, 981, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.interfaces", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.interfaces = [interfaces]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L654_C12", "label": "self.interfaces =", "type": "assigned_variable", "loc": [654, 654], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L651_C8", "vector": [14, 3, 0.3495, 0.0005, 3, 0.16, 1.0, 981, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.interfaces", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.interfaces = interfaces"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L656_C8", "label": "if", "type": "if", "loc": [656, 657], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "vector": [4, 2, 0.3509, 0.0011, 2, 0.83, 0.2857, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if min_threads is None:\n min_threads = DEFAULTS['MIN_THREADS']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L657_C12", "label": "min_threads =", "type": "assigned_variable", "loc": [657, 657], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L656_C8", "vector": [14, 3, 0.3511, 0.0005, 3, 0.18, 0.0, 976, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "min_threads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " min_threads = DEFAULTS['MIN_THREADS']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L659_C8", "label": "if", "type": "if", "loc": [659, 660], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "vector": [4, 2, 0.3525, 0.0011, 2, 0.83, 0.3571, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if max_threads is None:\n max_threads = DEFAULTS['MAX_THREADS']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L660_C12", "label": "max_threads =", "type": "assigned_variable", "loc": [660, 660], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L659_C8", "vector": [14, 3, 0.3528, 0.0005, 3, 0.65, 0.0, 461, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "max_threads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max_threads = DEFAULTS['MAX_THREADS']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L662_C8", "label": "if", "type": "if", "loc": [662, 666], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "vector": [4, 2, 0.3549, 0.0027, 2, 0.83, 0.4286, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not queue_size:\n if hasattr(socket, 'SOMAXCONN'):\n queue_size = socket.SOMAXCONN\n else:\n queue_size = DEFAULTS['LISTEN_QUEUE_SIZE']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L663_C12", "label": "if", "type": "if", "loc": [663, 666], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L662_C8", "vector": [4, 3, 0.3552, 0.0021, 3, 0.37, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(socket, 'SOMAXCONN'):\n queue_size = socket.SOMAXCONN\n else:\n queue_size = DEFAULTS['LISTEN_QUEUE_SIZE']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L664_C16", "label": "queue_size =", "type": "assigned_variable", "loc": [664, 664], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L663_C12", "vector": [14, 4, 0.3549, 0.0005, 4, 0.49, 0.0, 529, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "queue_size", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " queue_size = socket.SOMAXCONN"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L666_C16", "label": "queue_size =", "type": "assigned_variable", "loc": [666, 666], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L663_C12", "vector": [14, 4, 0.356, 0.0005, 4, 0.49, 1.0, 529, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "queue_size", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " queue_size = DEFAULTS['LISTEN_QUEUE_SIZE']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L668_C8", "label": "if", "type": "if", "loc": [668, 669], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "vector": [4, 2, 0.3573, 0.0011, 2, 0.83, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if max_threads and queue_size > max_threads:\n queue_size = max_threads"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L669_C12", "label": "queue_size =", "type": "assigned_variable", "loc": [669, 669], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L668_C8", "vector": [14, 3, 0.3576, 0.0005, 3, 0.82, 0.0, 529, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "queue_size", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " queue_size = max_threads"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L671_C8", "label": "if", "type": "if", "loc": [671, 672], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "vector": [4, 2, 0.3589, 0.0011, 2, 0.83, 0.5714, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(app_info, dict):\n app_info['server_software'] = SERVER_SOFTWARE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L672_C12", "label": "assign", "type": "assigned_variable", "loc": [672, 672], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L671_C8", "vector": [14, 3, 0.3592, 0.0005, 3, 0.89, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " app_info['server_software'] = SERVER_SOFTWARE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L674_C8", "label": "self.monitor_queue = Queue()", "type": "assigned_variable", "loc": [674, 674], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "vector": [14, 2, 0.3602, 0.0005, 2, 0.83, 0.6429, 203, 3, 0, 0, 0, 952, 10, 1], "semantic": {"name": "self.monitor_queue", "arg_names": [], "import_names": [], "rhs_call_name": "Queue", "annotation": ""}, "snippet": " self.monitor_queue = Queue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L675_C8", "label": "self.active_queue = Queue()", "type": "assigned_variable", "loc": [675, 675], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "vector": [14, 2, 0.3608, 0.0005, 2, 0.83, 0.7143, 711, 3, 0, 0, 0, 952, 10, 1], "semantic": {"name": "self.active_queue", "arg_names": [], "import_names": [], "rhs_call_name": "Queue", "annotation": ""}, "snippet": " self.active_queue = Queue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L677_C8", "label": "self._threadpool = ThreadPool()", "type": "assigned_variable", "loc": [677, 682], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "vector": [14, 2, 0.3632, 0.0032, 2, 0.83, 0.7857, 337, 3, 6, 0, 0, 395, 10, 2], "semantic": {"name": "self._threadpool", "arg_names": [], "import_names": [], "rhs_call_name": "ThreadPool", "annotation": ""}, "snippet": " self._threadpool = ThreadPool(get_method(method),\n app_info=app_info,\n active_queue=self.active_queue,\n monitor_queue=self.monitor_queue,\n min_threads=min_threads,\n max_threads=max_threads)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L685_C8", "label": "self.listeners =", "type": "assigned_variable", "loc": [685, 686], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "vector": [14, 2, 0.3664, 0.0011, 2, 0.83, 0.8571, 667, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.listeners", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.listeners = [Listener(\n i, queue_size, self.active_queue) for i in self.interfaces]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:For_L687_C8", "label": "for ndx", "type": "for", "loc": [687, 689], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "vector": [6, 2, 0.3677, 0.0016, 2, 0.83, 0.9286, 757, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "ndx", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for ndx in range(len(self.listeners) - 1, 0, -1):\n if not self.listeners[ndx].ready:\n del self.listeners[ndx]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L688_C12", "label": "if", "type": "if", "loc": [688, 689], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L687_C8", "vector": [4, 3, 0.368, 0.0011, 3, 0.37, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.listeners[ndx].ready:\n del self.listeners[ndx]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L691_C8", "label": "if", "type": "if", "loc": [691, 693], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "vector": [4, 2, 0.3699, 0.0016, 2, 0.83, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.listeners:\n log.critical(\"No interfaces to listen on...closing.\")\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L692_C12", "label": "critical()", "type": "expression", "loc": [692, 692], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L691_C8", "vector": [8, 3, 0.3699, 0.0005, 3, 0.03, 0.0, 432, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "critical", "arg_names": [], "import_names": [], "rhs_call_name": "critical", "annotation": ""}, "snippet": " log.critical(\"No interfaces to listen on...closing.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L693_C12", "label": "exit()", "type": "expression", "loc": [693, 693], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L691_C8", "vector": [8, 3, 0.3704, 0.0005, 3, 0.03, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L695_C4", "label": "_sigterm", "type": "function", "loc": [695, 697], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L633_C0", "vector": [2, 1, 0.372, 0.0016, 1, 0.47, 0.3333, 490, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "_sigterm", "arg_names": ["self", "signum", "frame"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _sigterm(self, signum, frame):\n log.info('Received SIGTERM')\n self.stop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L696_C8", "label": "info()", "type": "expression", "loc": [696, 696], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L695_C4", "vector": [8, 2, 0.372, 0.0005, 2, 0.15, 0.0, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " log.info('Received SIGTERM')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L697_C8", "label": "stop()", "type": "expression", "loc": [697, 697], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L695_C4", "vector": [8, 2, 0.3725, 0.0005, 2, 0.15, 1.0, 343, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "stop", "annotation": ""}, "snippet": " self.stop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L699_C4", "label": "_sighup", "type": "function", "loc": [699, 701], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L633_C0", "vector": [2, 1, 0.3741, 0.0016, 1, 0.47, 0.5, 305, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "_sighup", "arg_names": ["self", "signum", "frame"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _sighup(self, signum, frame):\n log.info('Received SIGHUP')\n self.restart()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L700_C8", "label": "info()", "type": "expression", "loc": [700, 700], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L699_C4", "vector": [8, 2, 0.3741, 0.0005, 2, 0.96, 0.0, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " log.info('Received SIGHUP')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L701_C8", "label": "restart()", "type": "expression", "loc": [701, 701], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L699_C4", "vector": [8, 2, 0.3747, 0.0005, 2, 0.96, 1.0, 442, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "restart", "arg_names": [], "import_names": [], "rhs_call_name": "restart", "annotation": ""}, "snippet": " self.restart()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L703_C4", "label": "start", "type": "function", "loc": [703, 758], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L633_C0", "vector": [2, 1, 0.3904, 0.0299, 1, 0.47, 0.6667, 511, 0, 2, 1, 0, 0, 0, 20], "semantic": {"name": "start", "arg_names": ["self", "background"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def start(self, background=False):\n log.info('Starting %s' % SERVER_SOFTWARE)\n\n self.startstop_lock.acquire()\n\n try:\n # Set up our shutdown signals\n if self.handle_signals:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L704_C8", "label": "info()", "type": "expression", "loc": [704, 704], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L703_C4", "vector": [8, 2, 0.3763, 0.0005, 2, 0.98, 0.0, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " log.info('Starting %s' % SERVER_SOFTWARE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L706_C8", "label": "acquire()", "type": "expression", "loc": [706, 706], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L703_C4", "vector": [8, 2, 0.3773, 0.0005, 2, 0.98, 0.2, 229, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "acquire", "arg_names": [], "import_names": [], "rhs_call_name": "acquire", "annotation": ""}, "snippet": " self.startstop_lock.acquire()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L708_C8", "label": "try", "type": "try", "loc": [708, 742], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L703_C4", "vector": [7, 2, 0.3875, 0.0187, 2, 0.98, 0.4, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # Set up our shutdown signals\n if self.handle_signals:\n try:\n import signal\n signal.signal(signal.SIGTERM, self._sigterm)\n signal.signal(signal.SIGUSR1, self._sighup)\n except:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L710_C12", "label": "if", "type": "if", "loc": [710, 716], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L708_C8", "vector": [4, 3, 0.3811, 0.0037, 3, 0.62, 0.0, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.handle_signals:\n try:\n import signal\n signal.signal(signal.SIGTERM, self._sigterm)\n signal.signal(signal.SIGUSR1, self._sighup)\n except:\n log.debug('This platform does not support signals.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L711_C16", "label": "try", "type": "try", "loc": [711, 716], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L710_C12", "vector": [7, 4, 0.3813, 0.0032, 4, 0.96, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n import signal\n signal.signal(signal.SIGTERM, self._sigterm)\n signal.signal(signal.SIGUSR1, self._sighup)\n except:\n log.debug('This platform does not support signals.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Import_L712_C20", "label": "signal import signal", "type": "import", "loc": [712, 712], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L711_C16", "vector": [1, 5, 0.3805, 0.0005, 5, 0.51, 0.0, 621, 0, 1, 0, 0, 621, 0, 0], "semantic": {"name": "signal", "arg_names": [], "import_names": ["signal"], "rhs_call_name": "", "annotation": ""}, "snippet": " import signal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L713_C20", "label": "signal()", "type": "expression", "loc": [713, 713], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L711_C16", "vector": [8, 5, 0.3811, 0.0005, 5, 0.51, 0.5, 621, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "signal", "arg_names": [], "import_names": [], "rhs_call_name": "signal", "annotation": ""}, "snippet": " signal.signal(signal.SIGTERM, self._sigterm)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L714_C20", "label": "signal()", "type": "expression", "loc": [714, 714], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L711_C16", "vector": [8, 5, 0.3816, 0.0005, 5, 0.51, 1.0, 621, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "signal", "arg_names": [], "import_names": [], "rhs_call_name": "signal", "annotation": ""}, "snippet": " signal.signal(signal.SIGUSR1, self._sighup)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L716_C20", "label": "debug()", "type": "expression", "loc": [716, 716], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L711_C16", "vector": [8, 5, 0.3827, 0.0005, 5, 0.51, 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('This platform does not support signals.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L719_C12", "label": "start()", "type": "expression", "loc": [719, 719], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L708_C8", "vector": [8, 3, 0.3843, 0.0005, 3, 0.62, 0.1111, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " self._threadpool.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L722_C12", "label": "self._monitor = Monitor()", "type": "assigned_variable", "loc": [722, 725], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L708_C8", "vector": [14, 3, 0.3867, 0.0021, 3, 0.62, 0.2222, 416, 3, 4, 0, 0, 958, 10, 1], "semantic": {"name": "self._monitor", "arg_names": [], "import_names": [], "rhs_call_name": "Monitor", "annotation": ""}, "snippet": " self._monitor = Monitor(self.monitor_queue,\n self.active_queue,\n self.timeout,\n self._threadpool)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L726_C12", "label": "setDaemon()", "type": "expression", "loc": [726, 726], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L708_C8", "vector": [8, 3, 0.388, 0.0005, 3, 0.62, 0.3333, 432, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setDaemon", "arg_names": [], "import_names": [], "rhs_call_name": "setDaemon", "annotation": ""}, "snippet": " self._monitor.setDaemon(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L727_C12", "label": "start()", "type": "expression", "loc": [727, 727], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L708_C8", "vector": [8, 3, 0.3886, 0.0005, 3, 0.62, 0.4444, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " self._monitor.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L731_C12", "label": "str_extract =", "type": "assigned_variable", "loc": [731, 731], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L708_C8", "vector": [14, 3, 0.3907, 0.0005, 3, 0.62, 0.5556, 69, 9, 0, 0, 0, 0, 0, 0], "semantic": {"name": "str_extract", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " str_extract = lambda l: (l.addr, l.port, l.secure and '*' or '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L733_C12", "label": "msg =", "type": "assigned_variable", "loc": [733, 733], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L708_C8", "vector": [14, 3, 0.3918, 0.0005, 3, 0.62, 0.6667, 712, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg = 'Listening on sockets: '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L736_C12", "label": "info()", "type": "expression", "loc": [736, 736], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L708_C8", "vector": [8, 3, 0.3934, 0.0005, 3, 0.62, 0.7778, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " log.info(msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:For_L738_C12", "label": "for l", "type": "for", "loc": [738, 739], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L708_C8", "vector": [6, 3, 0.3947, 0.0011, 3, 0.62, 0.8889, 810, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "l", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for l in self.listeners:\n l.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L739_C16", "label": "start()", "type": "expression", "loc": [739, 739], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L738_C12", "vector": [8, 4, 0.395, 0.0005, 4, 0.65, 0.0, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " l.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L742_C12", "label": "release()", "type": "expression", "loc": [742, 742], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L708_C8", "vector": [8, 3, 0.3966, 0.0005, 3, 0.62, 1.0, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " self.startstop_lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L744_C8", "label": "if", "type": "if", "loc": [744, 745], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L703_C4", "vector": [4, 2, 0.3979, 0.0011, 2, 0.98, 0.6, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if background:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L745_C12", "label": "return", "type": "return", "loc": [745, 745], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L744_C8", "vector": [13, 3, 0.3982, 0.0005, 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_467:While_L747_C8", "label": "while", "type": "while", "loc": [747, 756], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L703_C4", "vector": [5, 2, 0.4017, 0.0053, 2, 0.98, 0.8, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while self._monitor.isAlive():\n try:\n time.sleep(THREAD_STOP_CHECK_INTERVAL)\n except KeyboardInterrupt:\n # Capture a keyboard interrupt when running from a console\n break\n except:\n if self._monitor.isAlive():"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L748_C12", "label": "try", "type": "try", "loc": [748, 756], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L747_C8", "vector": [7, 3, 0.4019, 0.0048, 3, 0.5, 0.0, 0, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n time.sleep(THREAD_STOP_CHECK_INTERVAL)\n except KeyboardInterrupt:\n # Capture a keyboard interrupt when running from a console\n break\n except:\n if self._monitor.isAlive():\n log.error(traceback.format_exc())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L749_C16", "label": "sleep()", "type": "expression", "loc": [749, 749], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L748_C12", "vector": [8, 4, 0.4003, 0.0005, 4, 0.16, 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(THREAD_STOP_CHECK_INTERVAL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L754_C16", "label": "if", "type": "if", "loc": [754, 756], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L748_C12", "vector": [4, 4, 0.4035, 0.0016, 4, 0.16, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._monitor.isAlive():\n log.error(traceback.format_exc())\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L755_C20", "label": "error()", "type": "expression", "loc": [755, 755], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L754_C16", "vector": [8, 5, 0.4035, 0.0005, 5, 0.79, 0.0, 771, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " log.error(traceback.format_exc())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L758_C8", "label": "return", "type": "return", "loc": [758, 758], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L703_C4", "vector": [13, 2, 0.4051, 0.0005, 2, 0.98, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.stop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L760_C4", "label": "stop", "type": "function", "loc": [760, 797], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L633_C0", "vector": [2, 1, 0.4161, 0.0203, 1, 0.47, 0.8333, 343, 0, 2, 0, 0, 0, 0, 13], "semantic": {"name": "stop", "arg_names": ["self", "stoplogging"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def stop(self, stoplogging=False):\n log.info('Stopping %s' % SERVER_SOFTWARE)\n\n self.startstop_lock.acquire()\n\n try:\n # Stop listeners\n for l in self.listeners:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L761_C8", "label": "info()", "type": "expression", "loc": [761, 761], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L760_C4", "vector": [8, 2, 0.4067, 0.0005, 2, 0.84, 0.0, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " log.info('Stopping %s' % SERVER_SOFTWARE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L763_C8", "label": "acquire()", "type": "expression", "loc": [763, 763], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L760_C4", "vector": [8, 2, 0.4078, 0.0005, 2, 0.84, 0.5, 229, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "acquire", "arg_names": [], "import_names": [], "rhs_call_name": "acquire", "annotation": ""}, "snippet": " self.startstop_lock.acquire()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L765_C8", "label": "try", "type": "try", "loc": [765, 797], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L760_C4", "vector": [7, 2, 0.4174, 0.0176, 2, 0.84, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # Stop listeners\n for l in self.listeners:\n l.ready = False\n\n # Encourage a context switch\n time.sleep(0.01)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:For_L767_C12", "label": "for l", "type": "for", "loc": [767, 768], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L765_C8", "vector": [6, 3, 0.4102, 0.0011, 3, 0.67, 0.0, 810, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "l", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for l in self.listeners:\n l.ready = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L768_C16", "label": "l.ready =", "type": "assigned_variable", "loc": [768, 768], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L767_C12", "vector": [14, 4, 0.4105, 0.0005, 4, 0.48, 0.0, 294, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "l.ready", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " l.ready = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L771_C12", "label": "sleep()", "type": "expression", "loc": [771, 771], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L765_C8", "vector": [8, 3, 0.4121, 0.0005, 3, 0.67, 0.1429, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep(0.01)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:For_L773_C12", "label": "for l", "type": "for", "loc": [773, 775], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L765_C8", "vector": [6, 3, 0.4137, 0.0016, 3, 0.67, 0.2857, 810, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "l", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for l in self.listeners:\n if l.isAlive():\n l.join()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L774_C16", "label": "if", "type": "if", "loc": [774, 775], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L773_C12", "vector": [4, 4, 0.4139, 0.0011, 4, 0.79, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if l.isAlive():\n l.join()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L775_C20", "label": "join()", "type": "expression", "loc": [775, 775], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L774_C16", "vector": [8, 5, 0.4142, 0.0005, 5, 0.49, 0.0, 933, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "join", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " l.join()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L778_C12", "label": "stop()", "type": "expression", "loc": [778, 778], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L765_C8", "vector": [8, 3, 0.4158, 0.0005, 3, 0.67, 0.4286, 343, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "stop", "annotation": ""}, "snippet": " self._monitor.stop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L779_C12", "label": "if", "type": "if", "loc": [779, 780], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L765_C8", "vector": [4, 3, 0.4166, 0.0011, 3, 0.67, 0.5714, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._monitor.isAlive():\n self._monitor.join()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L780_C16", "label": "join()", "type": "expression", "loc": [780, 780], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L779_C12", "vector": [8, 4, 0.4169, 0.0005, 4, 0.84, 0.0, 933, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "join", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " self._monitor.join()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L783_C12", "label": "stop()", "type": "expression", "loc": [783, 783], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L765_C8", "vector": [8, 3, 0.4185, 0.0005, 3, 0.67, 0.7143, 343, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "stop", "annotation": ""}, "snippet": " self._threadpool.stop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L785_C12", "label": "if", "type": "if", "loc": [785, 794], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L765_C8", "vector": [4, 3, 0.422, 0.0053, 3, 0.67, 0.8571, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if stoplogging:\n logging.shutdown()\n msg = \"Calling logging.shutdown() is now the responsibility of \\\n the application developer. Please update your \\\n applications to no longer call rocket.stop(True)\"\n try:\n import warnings\n raise warnings.DeprecationWarning(msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L786_C16", "label": "shutdown()", "type": "expression", "loc": [786, 786], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L785_C12", "vector": [8, 4, 0.4201, 0.0005, 4, 0.08, 0.0, 322, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "shutdown", "arg_names": [], "import_names": [], "rhs_call_name": "shutdown", "annotation": ""}, "snippet": " logging.shutdown()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L787_C16", "label": "msg =", "type": "assigned_variable", "loc": [787, 789], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L785_C12", "vector": [14, 4, 0.4212, 0.0016, 4, 0.08, 0.5, 712, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg = \"Calling logging.shutdown() is now the responsibility of \\\n the application developer. Please update your \\\n applications to no longer call rocket.stop(True)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L790_C16", "label": "try", "type": "try", "loc": [790, 794], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L785_C12", "vector": [7, 4, 0.4233, 0.0027, 4, 0.08, 1.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n import warnings\n raise warnings.DeprecationWarning(msg)\n except ImportError:\n raise RuntimeError(msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Import_L791_C20", "label": "warnings import warnings", "type": "import", "loc": [791, 791], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L790_C16", "vector": [1, 5, 0.4228, 0.0005, 5, 0.84, 0.0, 358, 0, 1, 0, 0, 358, 0, 0], "semantic": {"name": "warnings", "arg_names": [], "import_names": ["warnings"], "rhs_call_name": "", "annotation": ""}, "snippet": " import warnings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L797_C12", "label": "release()", "type": "expression", "loc": [797, 797], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L765_C8", "vector": [8, 3, 0.426, 0.0005, 3, 0.67, 1.0, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " self.startstop_lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L799_C4", "label": "restart", "type": "function", "loc": [799, 801], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L633_C0", "vector": [2, 1, 0.4276, 0.0016, 1, 0.47, 1.0, 442, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "restart", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def restart(self):\n self.stop()\n self.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L800_C8", "label": "stop()", "type": "expression", "loc": [800, 800], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L799_C4", "vector": [8, 2, 0.4276, 0.0005, 2, 0.16, 0.0, 343, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "stop", "annotation": ""}, "snippet": " self.stop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L801_C8", "label": "start()", "type": "expression", "loc": [801, 801], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L799_C4", "vector": [8, 2, 0.4281, 0.0005, 2, 0.16, 1.0, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " self.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L804_C0", "label": "CherryPyWSGIServer", "type": "function", "loc": [804, 820], "level": 0, "parent": null, "vector": [2, 0, 0.434, 0.0091, 0, 0.66, 0.5699, 886, 0, 8, 1, 0, 0, 0, 1], "semantic": {"name": "CherryPyWSGIServer", "arg_names": ["bind_addr", "wsgi_app", "numthreads", "server_name", "max", "request_queue_size", "timeout", "shutdown_timeout"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def CherryPyWSGIServer(bind_addr,\n wsgi_app,\n numthreads=10,\n server_name=None,\n max=-1,\n request_queue_size=5,\n timeout=10,\n shutdown_timeout=5):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L812_C4", "label": "expression", "type": "expression", "loc": [812, 812], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L804_C0", "vector": [8, 1, 0.434, 0.0005, 1, 0.7, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" A Cherrypy wsgiserver-compatible wrapper. \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L813_C4", "label": "max_threads =", "type": "assigned_variable", "loc": [813, 813], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L804_C0", "vector": [14, 1, 0.4345, 0.0005, 1, 0.7, 0.3333, 461, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "max_threads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max_threads = max"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L814_C4", "label": "if", "type": "if", "loc": [814, 815], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L804_C0", "vector": [4, 1, 0.4353, 0.0011, 1, 0.7, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if max_threads < 0:\n max_threads = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L815_C8", "label": "max_threads =", "type": "assigned_variable", "loc": [815, 815], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L814_C4", "vector": [14, 2, 0.4356, 0.0005, 2, 0.01, 0.0, 461, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "max_threads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " max_threads = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L816_C4", "label": "return", "type": "return", "loc": [816, 820], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L804_C0", "vector": [13, 1, 0.4372, 0.0027, 1, 0.7, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Rocket(bind_addr, 'wsgi', {'wsgi_app': wsgi_app},\n min_threads=numthreads,\n max_threads=max_threads,\n queue_size=request_queue_size,\n timeout=timeout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Import_L826_C0", "label": "time import time", "type": "import", "loc": [826, 826], "level": 0, "parent": null, "vector": [1, 0, 0.4415, 0.0005, 0, 0.66, 0.5806, 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_467:Import_L827_C0", "label": "logging import logging", "type": "import", "loc": [827, 827], "level": 0, "parent": null, "vector": [1, 0, 0.442, 0.0005, 0, 0.66, 0.5914, 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_467:Import_L828_C0", "label": "select import select", "type": "import", "loc": [828, 828], "level": 0, "parent": null, "vector": [1, 0, 0.4425, 0.0005, 0, 0.66, 0.6022, 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_467:ImportFrom_L829_C0", "label": "from threading import Thread", "type": "import", "loc": [829, 829], "level": 0, "parent": null, "vector": [1, 0, 0.4431, 0.0005, 0, 0.66, 0.6129, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["Thread"], "rhs_call_name": "", "annotation": ""}, "snippet": "from threading import Thread"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L835_C0", "label": "Monitor", "type": "class", "loc": [835, 1002], "level": 0, "parent": null, "vector": [3, 0, 0.4909, 0.0898, 0, 0.66, 0.6237, 958, 0, 3, 0, 0, 134, 0, 42], "semantic": {"name": "Monitor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Monitor(Thread):\n # Monitor worker class.\n\n def __init__(self,\n monitor_queue,\n active_queue,\n timeout,\n threadpool,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L838_C4", "label": "__init__", "type": "function", "loc": [838, 859], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L835_C0", "vector": [2, 1, 0.4535, 0.0118, 1, 0.99, 0.0, 555, 0, 7, 0, 0, 0, 0, 5], "semantic": {"name": "__init__", "arg_names": ["self", "monitor_queue", "active_queue", "timeout", "threadpool", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self,\n monitor_queue,\n active_queue,\n timeout,\n threadpool,\n *args,\n **kwargs):\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L846_C8", "label": "__init__()", "type": "expression", "loc": [846, 846], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L838_C4", "vector": [8, 2, 0.4522, 0.0005, 2, 0.76, 0.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " Thread.__init__(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L848_C8", "label": "self._threadpool =", "type": "assigned_variable", "loc": [848, 848], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L838_C4", "vector": [14, 2, 0.4532, 0.0005, 2, 0.76, 0.125, 337, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._threadpool", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._threadpool = threadpool"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L851_C8", "label": "self.monitor_queue =", "type": "assigned_variable", "loc": [851, 851], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L838_C4", "vector": [14, 2, 0.4548, 0.0005, 2, 0.76, 0.25, 203, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.monitor_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.monitor_queue = monitor_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L852_C8", "label": "self.active_queue =", "type": "assigned_variable", "loc": [852, 852], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L838_C4", "vector": [14, 2, 0.4554, 0.0005, 2, 0.76, 0.375, 711, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.active_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.active_queue = active_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L853_C8", "label": "self.timeout =", "type": "assigned_variable", "loc": [853, 853], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L838_C4", "vector": [14, 2, 0.4559, 0.0005, 2, 0.76, 0.5, 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_467:Assign_L855_C8", "label": "self.log = getLogger()", "type": "assigned_variable", "loc": [855, 855], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L838_C4", "vector": [14, 2, 0.457, 0.0005, 2, 0.76, 0.625, 338, 3, 1, 0, 0, 71, 10, 1], "semantic": {"name": "self.log", "arg_names": [], "import_names": [], "rhs_call_name": "getLogger", "annotation": ""}, "snippet": " self.log = logging.getLogger('Rocket.Monitor')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L856_C8", "label": "addHandler()", "type": "expression", "loc": [856, 856], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L838_C4", "vector": [8, 2, 0.4575, 0.0005, 2, 0.76, 0.75, 255, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "addHandler", "arg_names": [], "import_names": [], "rhs_call_name": "addHandler", "annotation": ""}, "snippet": " self.log.addHandler(NullHandler())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L858_C8", "label": "self.connections = set()", "type": "assigned_variable", "loc": [858, 858], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L838_C4", "vector": [14, 2, 0.4586, 0.0005, 2, 0.76, 0.875, 881, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "self.connections", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " self.connections = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L859_C8", "label": "self.active =", "type": "assigned_variable", "loc": [859, 859], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L838_C4", "vector": [14, 2, 0.4591, 0.0005, 2, 0.76, 1.0, 175, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.active", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.active = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L861_C4", "label": "run", "type": "function", "loc": [861, 972], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L835_C0", "vector": [2, 1, 0.4898, 0.0599, 1, 0.99, 0.5, 679, 0, 1, 0, 0, 0, 0, 29], "semantic": {"name": "run", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def run(self):\n self.active = True\n conn_list = list()\n list_changed = False\n\n # We need to make sure the queue is empty before we start\n while not self.monitor_queue.empty():\n self.monitor_queue.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L862_C8", "label": "self.active =", "type": "assigned_variable", "loc": [862, 862], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L861_C4", "vector": [14, 2, 0.4607, 0.0005, 2, 0.87, 0.0, 175, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.active", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.active = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L863_C8", "label": "conn_list = list()", "type": "assigned_variable", "loc": [863, 863], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L861_C4", "vector": [14, 2, 0.4613, 0.0005, 2, 0.87, 0.2, 632, 3, 0, 0, 0, 430, 10, 1], "semantic": {"name": "conn_list", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " conn_list = list()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L864_C8", "label": "list_changed =", "type": "assigned_variable", "loc": [864, 864], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L861_C4", "vector": [14, 2, 0.4618, 0.0005, 2, 0.87, 0.4, 527, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "list_changed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " list_changed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:While_L867_C8", "label": "while", "type": "while", "loc": [867, 868], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L861_C4", "vector": [5, 2, 0.4637, 0.0011, 2, 0.87, 0.6, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while not self.monitor_queue.empty():\n self.monitor_queue.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L868_C12", "label": "get()", "type": "expression", "loc": [868, 868], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L867_C8", "vector": [8, 3, 0.4639, 0.0005, 3, 0.97, 0.0, 607, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "get", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.monitor_queue.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L870_C8", "label": "if", "type": "if", "loc": [870, 871], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L861_C4", "vector": [4, 2, 0.4653, 0.0011, 2, 0.87, 0.8, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.log.debug('Entering monitor loop.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L871_C12", "label": "debug()", "type": "expression", "loc": [871, 871], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L870_C8", "vector": [8, 3, 0.4655, 0.0005, 3, 0.49, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.log.debug('Entering monitor loop.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:While_L874_C8", "label": "while", "type": "while", "loc": [874, 972], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L861_C4", "vector": [5, 2, 0.4933, 0.0529, 2, 0.87, 1.0, 0, 7, 0, 0, 0, 0, 0, 25], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while self.active:\n\n # Move the queued connections to the selection pool\n while not self.monitor_queue.empty():\n if __debug__:\n self.log.debug('In \"receive timed-out connections\" loop.')\n\n c = self.monitor_queue.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:While_L877_C12", "label": "while", "type": "while", "loc": [877, 904], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L874_C8", "vector": [5, 3, 0.4759, 0.015, 3, 0.05, 0.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while not self.monitor_queue.empty():\n if __debug__:\n self.log.debug('In \"receive timed-out connections\" loop.')\n\n c = self.monitor_queue.get()\n\n if c is None:\n # A non-client is a signal to die"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L878_C16", "label": "if", "type": "if", "loc": [878, 879], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L877_C12", "vector": [4, 4, 0.4695, 0.0011, 4, 0.17, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.log.debug('In \"receive timed-out connections\" loop.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L879_C20", "label": "debug()", "type": "expression", "loc": [879, 879], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L878_C16", "vector": [8, 5, 0.4698, 0.0005, 5, 0.1, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.log.debug('In \"receive timed-out connections\" loop.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L881_C16", "label": "c = get()", "type": "assigned_variable", "loc": [881, 881], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L877_C12", "vector": [14, 4, 0.4709, 0.0005, 4, 0.17, 0.125, 411, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " c = self.monitor_queue.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L883_C16", "label": "if", "type": "if", "loc": [883, 888], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L877_C12", "vector": [4, 4, 0.4733, 0.0032, 4, 0.17, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if c is None:\n # A non-client is a signal to die\n if __debug__:\n self.log.debug('Received a death threat.')\n self.stop()\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L885_C20", "label": "if", "type": "if", "loc": [885, 886], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L883_C16", "vector": [4, 5, 0.4733, 0.0011, 5, 0.38, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.log.debug('Received a death threat.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L886_C24", "label": "debug()", "type": "expression", "loc": [886, 886], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L885_C20", "vector": [8, 6, 0.4735, 0.0005, 6, 0.23, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.log.debug('Received a death threat.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L887_C20", "label": "stop()", "type": "expression", "loc": [887, 887], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L883_C16", "vector": [8, 5, 0.4741, 0.0005, 5, 0.38, 1.0, 343, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "stop", "annotation": ""}, "snippet": " self.stop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L890_C16", "label": "debug()", "type": "expression", "loc": [890, 890], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L877_C12", "vector": [8, 4, 0.4757, 0.0005, 4, 0.17, 0.375, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.log.debug('Received a timed out connection.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L892_C16", "label": "if", "type": "if", "loc": [892, 893], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L877_C12", "vector": [4, 4, 0.477, 0.0011, 4, 0.17, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n assert(c not in self.connections)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L895_C16", "label": "if", "type": "if", "loc": [895, 898], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L877_C12", "vector": [4, 4, 0.4792, 0.0021, 4, 0.17, 0.625, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if IS_JYTHON:\n # Jython requires a socket to be in Non-blocking mode in\n # order to select on it.\n c.setblocking(False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L898_C20", "label": "setblocking()", "type": "expression", "loc": [898, 898], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L895_C16", "vector": [8, 5, 0.48, 0.0005, 5, 0.23, 0.0, 473, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setblocking", "arg_names": [], "import_names": [], "rhs_call_name": "setblocking", "annotation": ""}, "snippet": " c.setblocking(False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L900_C16", "label": "if", "type": "if", "loc": [900, 901], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L877_C12", "vector": [4, 4, 0.4813, 0.0011, 4, 0.17, 0.75, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.log.debug('Adding connection to monitor list.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L901_C20", "label": "debug()", "type": "expression", "loc": [901, 901], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L900_C16", "vector": [8, 5, 0.4816, 0.0005, 5, 0.74, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.log.debug('Adding connection to monitor list.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L903_C16", "label": "add()", "type": "expression", "loc": [903, 903], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L877_C12", "vector": [8, 4, 0.4826, 0.0005, 4, 0.17, 0.875, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " self.connections.add(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L904_C16", "label": "list_changed =", "type": "assigned_variable", "loc": [904, 904], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L877_C12", "vector": [14, 4, 0.4832, 0.0005, 4, 0.17, 1.0, 527, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "list_changed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " list_changed = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L907_C12", "label": "if", "type": "if", "loc": [907, 909], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L874_C8", "vector": [4, 3, 0.4853, 0.0016, 3, 0.05, 0.25, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if list_changed:\n conn_list = list(self.connections)\n list_changed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L908_C16", "label": "conn_list = list()", "type": "assigned_variable", "loc": [908, 908], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L907_C12", "vector": [14, 4, 0.4853, 0.0005, 4, 0.25, 0.0, 632, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "conn_list", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " conn_list = list(self.connections)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L909_C16", "label": "list_changed =", "type": "assigned_variable", "loc": [909, 909], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L907_C12", "vector": [14, 4, 0.4858, 0.0005, 4, 0.25, 1.0, 527, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "list_changed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " list_changed = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L911_C12", "label": "try", "type": "try", "loc": [911, 945], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L874_C8", "vector": [7, 3, 0.496, 0.0187, 3, 0.05, 0.5, 0, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if len(conn_list):\n readable = select.select(conn_list,\n [],\n [],\n THREAD_STOP_CHECK_INTERVAL)[0]\n else:\n time.sleep(THREAD_STOP_CHECK_INTERVAL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L912_C16", "label": "if", "type": "if", "loc": [912, 919], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L911_C12", "vector": [4, 4, 0.4893, 0.0043, 4, 0.46, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(conn_list):\n readable = select.select(conn_list,\n [],\n [],\n THREAD_STOP_CHECK_INTERVAL)[0]\n else:\n time.sleep(THREAD_STOP_CHECK_INTERVAL)\n readable = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L913_C20", "label": "readable =", "type": "assigned_variable", "loc": [913, 916], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L912_C16", "vector": [14, 5, 0.4888, 0.0021, 5, 0.75, 0.0, 808, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "readable", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " readable = select.select(conn_list,\n [],\n [],\n THREAD_STOP_CHECK_INTERVAL)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L918_C20", "label": "sleep()", "type": "expression", "loc": [918, 918], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L912_C16", "vector": [8, 5, 0.4906, 0.0005, 5, 0.75, 0.5, 476, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sleep", "arg_names": [], "import_names": [], "rhs_call_name": "sleep", "annotation": ""}, "snippet": " time.sleep(THREAD_STOP_CHECK_INTERVAL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L919_C20", "label": "readable =", "type": "assigned_variable", "loc": [919, 919], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L912_C16", "vector": [14, 5, 0.4912, 0.0005, 5, 0.75, 1.0, 808, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "readable", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " readable = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L921_C16", "label": "if", "type": "if", "loc": [921, 922], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L911_C12", "vector": [4, 4, 0.4925, 0.0011, 4, 0.46, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.active:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:For_L925_C16", "label": "for r", "type": "for", "loc": [925, 939], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L911_C12", "vector": [6, 4, 0.4981, 0.008, 4, 0.46, 1.0, 436, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for r in readable:\n if __debug__:\n self.log.debug('Restoring readable connection')\n\n if IS_JYTHON:\n # Jython requires a socket to be in Non-blocking mode in\n # order to select on it, but the rest of the code requires\n # that it be in blocking mode."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L926_C20", "label": "if", "type": "if", "loc": [926, 927], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L925_C16", "vector": [4, 5, 0.4952, 0.0011, 5, 0.45, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.log.debug('Restoring readable connection')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L927_C24", "label": "debug()", "type": "expression", "loc": [927, 927], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L926_C20", "vector": [8, 6, 0.4955, 0.0005, 6, 0.99, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.log.debug('Restoring readable connection')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L929_C20", "label": "if", "type": "if", "loc": [929, 933], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L925_C16", "vector": [4, 5, 0.4976, 0.0027, 5, 0.45, 0.2, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if IS_JYTHON:\n # Jython requires a socket to be in Non-blocking mode in\n # order to select on it, but the rest of the code requires\n # that it be in blocking mode.\n r.setblocking(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L933_C24", "label": "setblocking()", "type": "expression", "loc": [933, 933], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L929_C20", "vector": [8, 6, 0.4987, 0.0005, 6, 0.23, 0.0, 473, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setblocking", "arg_names": [], "import_names": [], "rhs_call_name": "setblocking", "annotation": ""}, "snippet": " r.setblocking(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L935_C20", "label": "r.start_time = time()", "type": "assigned_variable", "loc": [935, 935], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L925_C16", "vector": [14, 5, 0.4997, 0.0005, 5, 0.45, 0.4, 345, 3, 0, 0, 0, 654, 10, 1], "semantic": {"name": "r.start_time", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " r.start_time = time.time()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L936_C20", "label": "put()", "type": "expression", "loc": [936, 936], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L925_C16", "vector": [8, 5, 0.5003, 0.0005, 5, 0.45, 0.6, 636, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " self.active_queue.put(r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L938_C20", "label": "remove()", "type": "expression", "loc": [938, 938], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L925_C16", "vector": [8, 5, 0.5013, 0.0005, 5, 0.45, 0.8, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " self.connections.remove(r)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L939_C20", "label": "list_changed =", "type": "assigned_variable", "loc": [939, 939], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L925_C16", "vector": [14, 5, 0.5019, 0.0005, 5, 0.45, 1.0, 527, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "list_changed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " list_changed = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L942_C16", "label": "if", "type": "if", "loc": [942, 945], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L911_C12", "vector": [4, 4, 0.5043, 0.0021, 4, 0.46, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.active:\n raise\n else:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L948_C12", "label": "if", "type": "if", "loc": [948, 969], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L874_C8", "vector": [4, 3, 0.5123, 0.0118, 3, 0.05, 0.75, 0, 7, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.timeout:\n now = time.time()\n stale = set()\n for c in self.connections:\n if (now - c.start_time) >= self.timeout:\n stale.add(c)\n\n for c in stale:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L949_C16", "label": "now = time()", "type": "assigned_variable", "loc": [949, 949], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L948_C12", "vector": [14, 4, 0.5072, 0.0005, 4, 0.03, 0.0, 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_467:Assign_L950_C16", "label": "stale = set()", "type": "assigned_variable", "loc": [950, 950], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L948_C12", "vector": [14, 4, 0.5077, 0.0005, 4, 0.03, 0.3333, 888, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "stale", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " stale = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:For_L951_C16", "label": "for c", "type": "for", "loc": [951, 953], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L948_C12", "vector": [6, 4, 0.5088, 0.0016, 4, 0.03, 0.6667, 411, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in self.connections:\n if (now - c.start_time) >= self.timeout:\n stale.add(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L952_C20", "label": "if", "type": "if", "loc": [952, 953], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L951_C16", "vector": [4, 5, 0.5091, 0.0011, 5, 0.76, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (now - c.start_time) >= self.timeout:\n stale.add(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L953_C24", "label": "add()", "type": "expression", "loc": [953, 953], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L952_C20", "vector": [8, 6, 0.5094, 0.0005, 6, 0.68, 0.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " stale.add(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:For_L955_C16", "label": "for c", "type": "for", "loc": [955, 969], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L948_C12", "vector": [6, 4, 0.5142, 0.008, 4, 0.03, 1.0, 411, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in stale:\n if __debug__:\n # \"EXPR and A or B\" kept for Py2.4 compatibility\n data = (\n c.client_addr, c.server_port, c.ssl and '*' or '')\n self.log.debug(\n 'Flushing stale connection: %s:%i%s' % data)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L956_C20", "label": "if", "type": "if", "loc": [956, 961], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L955_C16", "vector": [4, 5, 0.5123, 0.0032, 5, 0.35, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n # \"EXPR and A or B\" kept for Py2.4 compatibility\n data = (\n c.client_addr, c.server_port, c.ssl and '*' or '')\n self.log.debug(\n 'Flushing stale connection: %s:%i%s' % data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L958_C24", "label": "data =", "type": "assigned_variable", "loc": [958, 959], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L956_C20", "vector": [14, 6, 0.5123, 0.0011, 6, 0.57, 0.0, 929, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = (\n c.client_addr, c.server_port, c.ssl and '*' or '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L960_C24", "label": "debug()", "type": "expression", "loc": [960, 961], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L956_C20", "vector": [8, 6, 0.5134, 0.0011, 6, 0.57, 1.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.log.debug(\n 'Flushing stale connection: %s:%i%s' % data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L963_C20", "label": "remove()", "type": "expression", "loc": [963, 963], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L955_C16", "vector": [8, 5, 0.5147, 0.0005, 5, 0.35, 0.3333, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " self.connections.remove(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L964_C20", "label": "list_changed =", "type": "assigned_variable", "loc": [964, 964], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L955_C16", "vector": [14, 5, 0.5152, 0.0005, 5, 0.35, 0.6667, 527, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "list_changed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " list_changed = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L966_C20", "label": "try", "type": "try", "loc": [966, 969], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L955_C16", "vector": [7, 5, 0.5171, 0.0021, 5, 0.35, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n c.close()\n finally:\n del c"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L967_C24", "label": "close()", "type": "expression", "loc": [967, 967], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L966_C20", "vector": [8, 6, 0.5168, 0.0005, 6, 0.15, 0.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " c.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L972_C12", "label": "dynamic_resize()", "type": "expression", "loc": [972, 972], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L874_C8", "vector": [8, 3, 0.5195, 0.0005, 3, 0.05, 1.0, 983, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "dynamic_resize", "arg_names": [], "import_names": [], "rhs_call_name": "dynamic_resize", "annotation": ""}, "snippet": " self._threadpool.dynamic_resize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L974_C4", "label": "stop", "type": "function", "loc": [974, 1002], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L835_C0", "vector": [2, 1, 0.5281, 0.0155, 1, 0.99, 1.0, 343, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "stop", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def stop(self):\n self.active = False\n\n if __debug__:\n self.log.debug('Flushing waiting connections')\n\n while self.connections:\n c = self.connections.pop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L975_C8", "label": "self.active =", "type": "assigned_variable", "loc": [975, 975], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L974_C4", "vector": [14, 2, 0.5211, 0.0005, 2, 0.83, 0.0, 175, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.active", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.active = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L977_C8", "label": "if", "type": "if", "loc": [977, 978], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L974_C4", "vector": [4, 2, 0.5224, 0.0011, 2, 0.83, 0.2, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.log.debug('Flushing waiting connections')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L978_C12", "label": "debug()", "type": "expression", "loc": [978, 978], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L977_C8", "vector": [8, 3, 0.5227, 0.0005, 3, 0.45, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.log.debug('Flushing waiting connections')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:While_L980_C8", "label": "while", "type": "while", "loc": [980, 985], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L974_C4", "vector": [5, 2, 0.5251, 0.0032, 2, 0.83, 0.4, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while self.connections:\n c = self.connections.pop()\n try:\n c.close()\n finally:\n del c"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L981_C12", "label": "c = pop()", "type": "assigned_variable", "loc": [981, 981], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L980_C8", "vector": [14, 3, 0.5243, 0.0005, 3, 0.07, 0.0, 411, 3, 0, 0, 0, 969, 10, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " c = self.connections.pop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L982_C12", "label": "try", "type": "try", "loc": [982, 985], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L980_C8", "vector": [7, 3, 0.5257, 0.0021, 3, 0.07, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n c.close()\n finally:\n del c"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L983_C16", "label": "close()", "type": "expression", "loc": [983, 983], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L982_C12", "vector": [8, 4, 0.5254, 0.0005, 4, 0.1, 0.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " c.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L987_C8", "label": "if", "type": "if", "loc": [987, 988], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L974_C4", "vector": [4, 2, 0.5278, 0.0011, 2, 0.83, 0.6, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.log.debug('Flushing queued connections')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L988_C12", "label": "debug()", "type": "expression", "loc": [988, 988], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L987_C8", "vector": [8, 3, 0.5281, 0.0005, 3, 0.09, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.log.debug('Flushing queued connections')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:While_L990_C8", "label": "while", "type": "while", "loc": [990, 999], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L974_C4", "vector": [5, 2, 0.5315, 0.0053, 2, 0.83, 0.8, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while not self.monitor_queue.empty():\n c = self.monitor_queue.get()\n\n if c is None:\n continue\n\n try:\n c.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L991_C12", "label": "c = get()", "type": "assigned_variable", "loc": [991, 991], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L990_C8", "vector": [14, 3, 0.5297, 0.0005, 3, 0.25, 0.0, 411, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " c = self.monitor_queue.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L993_C12", "label": "if", "type": "if", "loc": [993, 994], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L990_C8", "vector": [4, 3, 0.531, 0.0011, 3, 0.25, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if c is None:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L996_C12", "label": "try", "type": "try", "loc": [996, 999], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L990_C8", "vector": [7, 3, 0.5331, 0.0021, 3, 0.25, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n c.close()\n finally:\n del c"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L997_C16", "label": "close()", "type": "expression", "loc": [997, 997], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L996_C12", "vector": [8, 4, 0.5329, 0.0005, 4, 0.28, 0.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " c.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1002_C8", "label": "put()", "type": "expression", "loc": [1002, 1002], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L974_C4", "vector": [8, 2, 0.5355, 0.0005, 2, 0.83, 1.0, 636, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " self.monitor_queue.put(None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Import_L1008_C0", "label": "logging import logging", "type": "import", "loc": [1008, 1008], "level": 0, "parent": null, "vector": [1, 0, 0.5387, 0.0005, 0, 0.66, 0.6344, 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_467:Assign_L1014_C0", "label": "log = getLogger()", "type": "assigned_variable", "loc": [1014, 1014], "level": 0, "parent": null, "vector": [14, 0, 0.542, 0.0005, 0, 0.66, 0.6452, 432, 3, 1, 0, 0, 71, 10, 1], "semantic": {"name": "log", "arg_names": [], "import_names": [], "rhs_call_name": "getLogger", "annotation": ""}, "snippet": "log = logging.getLogger('Rocket.Errors.ThreadPool')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1015_C0", "label": "addHandler()", "type": "expression", "loc": [1015, 1015], "level": 0, "parent": null, "vector": [8, 0, 0.5425, 0.0005, 0, 0.66, 0.6559, 255, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "addHandler", "arg_names": [], "import_names": [], "rhs_call_name": "addHandler", "annotation": ""}, "snippet": "log.addHandler(NullHandler())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1018_C0", "label": "ThreadPool", "type": "class", "loc": [1018, 1165], "level": 0, "parent": null, "vector": [3, 0, 0.5834, 0.0791, 0, 0.66, 0.6667, 395, 0, 7, 0, 0, 0, 0, 42], "semantic": {"name": "ThreadPool", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ThreadPool:\n \"\"\"The ThreadPool class is a container class for all the worker threads. It\n manages the number of actively running threads.\"\"\"\n\n def __init__(self,\n method,\n app_info,\n active_queue,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1019_C4", "label": "expression", "type": "expression", "loc": [1019, 1020], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1018_C0", "vector": [8, 1, 0.5449, 0.0011, 1, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The ThreadPool class is a container class for all the worker threads. It\n manages the number of actively running threads.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "label": "__init__", "type": "function", "loc": [1022, 1060], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1018_C0", "vector": [2, 1, 0.5564, 0.0208, 1, 0.37, 0.1429, 555, 0, 7, 0, 0, 0, 0, 9], "semantic": {"name": "__init__", "arg_names": ["self", "method", "app_info", "active_queue", "monitor_queue", "min_threads", "max_threads"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self,\n method,\n app_info,\n active_queue,\n monitor_queue,\n min_threads=DEFAULTS['MIN_THREADS'],\n max_threads=DEFAULTS['MAX_THREADS'],\n ):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1031_C8", "label": "if", "type": "if", "loc": [1031, 1032], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "vector": [4, 2, 0.5513, 0.0011, 2, 0.57, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n log.debug(\"Initializing ThreadPool.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1032_C12", "label": "debug()", "type": "expression", "loc": [1032, 1032], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1031_C8", "vector": [8, 3, 0.5516, 0.0005, 3, 0.35, 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(\"Initializing ThreadPool.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1034_C8", "label": "self.check_for_dead_threads =", "type": "assigned_variable", "loc": [1034, 1034], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "vector": [14, 2, 0.5526, 0.0005, 2, 0.57, 0.0667, 541, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.check_for_dead_threads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.check_for_dead_threads = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1035_C8", "label": "self.active_queue =", "type": "assigned_variable", "loc": [1035, 1035], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "vector": [14, 2, 0.5532, 0.0005, 2, 0.57, 0.1333, 711, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.active_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.active_queue = active_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1037_C8", "label": "self.worker_class =", "type": "assigned_variable", "loc": [1037, 1037], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "vector": [14, 2, 0.5542, 0.0005, 2, 0.57, 0.2, 229, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.worker_class", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.worker_class = method"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1038_C8", "label": "self.min_threads =", "type": "assigned_variable", "loc": [1038, 1038], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "vector": [14, 2, 0.5548, 0.0005, 2, 0.57, 0.2667, 153, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.min_threads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.min_threads = min_threads"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1039_C8", "label": "self.max_threads =", "type": "assigned_variable", "loc": [1039, 1039], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "vector": [14, 2, 0.5553, 0.0005, 2, 0.57, 0.3333, 86, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.max_threads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.max_threads = max_threads"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1040_C8", "label": "self.monitor_queue =", "type": "assigned_variable", "loc": [1040, 1040], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "vector": [14, 2, 0.5559, 0.0005, 2, 0.57, 0.4, 203, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.monitor_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.monitor_queue = monitor_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1041_C8", "label": "self.stop_server =", "type": "assigned_variable", "loc": [1041, 1041], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "vector": [14, 2, 0.5564, 0.0005, 2, 0.57, 0.4667, 207, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.stop_server", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.stop_server = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1042_C8", "label": "self.alive =", "type": "assigned_variable", "loc": [1042, 1042], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "vector": [14, 2, 0.5569, 0.0005, 2, 0.57, 0.5333, 177, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.alive", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.alive = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1045_C8", "label": "self.grow_threshold =", "type": "assigned_variable", "loc": [1045, 1045], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "vector": [14, 2, 0.5585, 0.0005, 2, 0.57, 0.6, 793, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "self.grow_threshold", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.grow_threshold = int(max_threads / 10) + 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1047_C8", "label": "if", "type": "if", "loc": [1047, 1048], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "vector": [4, 2, 0.5599, 0.0011, 2, 0.57, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(app_info, dict):\n app_info = dict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1048_C12", "label": "app_info = dict()", "type": "assigned_variable", "loc": [1048, 1048], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1047_C8", "vector": [14, 3, 0.5601, 0.0005, 3, 0.65, 0.0, 924, 3, 0, 0, 0, 827, 10, 1], "semantic": {"name": "app_info", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " app_info = dict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1050_C8", "label": "if", "type": "if", "loc": [1050, 1052], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "vector": [4, 2, 0.5617, 0.0016, 2, 0.57, 0.7333, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if has_futures and app_info.get('futures'):\n app_info['executor'] = WSGIExecutor(max([DEFAULTS['MIN_THREADS'],\n 2]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1051_C12", "label": " = WSGIExecutor()", "type": "assigned_variable", "loc": [1051, 1052], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1050_C8", "vector": [14, 3, 0.562, 0.0011, 3, 0.28, 0.0, 0, 3, 1, 0, 0, 50, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "WSGIExecutor", "annotation": ""}, "snippet": " app_info['executor'] = WSGIExecutor(max([DEFAULTS['MIN_THREADS'],\n 2]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1054_C8", "label": "update()", "type": "expression", "loc": [1054, 1055], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "vector": [8, 2, 0.5636, 0.0011, 2, 0.57, 0.8, 637, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " app_info.update(max_threads=max_threads,\n min_threads=min_threads)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1057_C8", "label": "self.min_threads =", "type": "assigned_variable", "loc": [1057, 1057], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "vector": [14, 2, 0.5649, 0.0005, 2, 0.57, 0.8667, 153, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.min_threads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.min_threads = min_threads"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1058_C8", "label": "self.app_info =", "type": "assigned_variable", "loc": [1058, 1058], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "vector": [14, 2, 0.5655, 0.0005, 2, 0.57, 0.9333, 724, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.app_info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.app_info = app_info"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1060_C8", "label": "self.threads = set()", "type": "assigned_variable", "loc": [1060, 1060], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "vector": [14, 2, 0.5665, 0.0005, 2, 0.57, 1.0, 638, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "self.threads", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " self.threads = set()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1062_C4", "label": "start", "type": "function", "loc": [1062, 1069], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1018_C0", "vector": [2, 1, 0.5695, 0.0043, 1, 0.37, 0.2857, 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.stop_server = False\n if __debug__:\n log.debug(\"Starting threads.\")\n\n self.grow(self.min_threads)\n\n self.alive = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1063_C8", "label": "self.stop_server =", "type": "assigned_variable", "loc": [1063, 1063], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1062_C4", "vector": [14, 2, 0.5681, 0.0005, 2, 0.88, 0.0, 207, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.stop_server", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.stop_server = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1064_C8", "label": "if", "type": "if", "loc": [1064, 1065], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1062_C4", "vector": [4, 2, 0.5689, 0.0011, 2, 0.88, 0.3333, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n log.debug(\"Starting threads.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1065_C12", "label": "debug()", "type": "expression", "loc": [1065, 1065], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1064_C8", "vector": [8, 3, 0.5692, 0.0005, 3, 0.54, 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(\"Starting threads.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1067_C8", "label": "grow()", "type": "expression", "loc": [1067, 1067], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1062_C4", "vector": [8, 2, 0.5703, 0.0005, 2, 0.88, 0.6667, 151, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "grow", "arg_names": [], "import_names": [], "rhs_call_name": "grow", "annotation": ""}, "snippet": " self.grow(self.min_threads)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1069_C8", "label": "self.alive =", "type": "assigned_variable", "loc": [1069, 1069], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1062_C4", "vector": [14, 2, 0.5714, 0.0005, 2, 0.88, 1.0, 177, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.alive", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.alive = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1071_C4", "label": "stop", "type": "function", "loc": [1071, 1101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1018_C0", "vector": [2, 1, 0.5804, 0.0166, 1, 0.37, 0.4286, 343, 0, 1, 0, 0, 0, 0, 9], "semantic": {"name": "stop", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def stop(self):\n self.alive = False\n\n if __debug__:\n log.debug(\"Stopping threads.\")\n\n self.stop_server = True\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1072_C8", "label": "self.alive =", "type": "assigned_variable", "loc": [1072, 1072], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1071_C4", "vector": [14, 2, 0.573, 0.0005, 2, 0.34, 0.0, 177, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.alive", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.alive = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1074_C8", "label": "if", "type": "if", "loc": [1074, 1075], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1071_C4", "vector": [4, 2, 0.5743, 0.0011, 2, 0.34, 0.1667, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n log.debug(\"Stopping threads.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1075_C12", "label": "debug()", "type": "expression", "loc": [1075, 1075], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1074_C8", "vector": [8, 3, 0.5746, 0.0005, 3, 0.08, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " log.debug(\"Stopping threads.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1077_C8", "label": "self.stop_server =", "type": "assigned_variable", "loc": [1077, 1077], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1071_C4", "vector": [14, 2, 0.5756, 0.0005, 2, 0.34, 0.3333, 207, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.stop_server", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.stop_server = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1080_C8", "label": "shrink()", "type": "expression", "loc": [1080, 1080], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1071_C4", "vector": [8, 2, 0.5772, 0.0005, 2, 0.34, 0.5, 239, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "shrink", "arg_names": [], "import_names": [], "rhs_call_name": "shrink", "annotation": ""}, "snippet": " self.shrink(len(self.threads))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1083_C8", "label": "if", "type": "if", "loc": [1083, 1087], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1071_C4", "vector": [4, 2, 0.5799, 0.0027, 2, 0.34, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if has_futures and self.app_info.get('futures'):\n if __debug__:\n log.debug(\"Future executor is present. Python will not \"\n \"exit until all jobs have finished.\")\n self.app_info['executor'].shutdown(wait=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1084_C12", "label": "if", "type": "if", "loc": [1084, 1086], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1083_C8", "vector": [4, 3, 0.5799, 0.0016, 3, 0.64, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n log.debug(\"Future executor is present. Python will not \"\n \"exit until all jobs have finished.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1085_C16", "label": "debug()", "type": "expression", "loc": [1085, 1086], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1084_C12", "vector": [8, 4, 0.5802, 0.0011, 4, 0.4, 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(\"Future executor is present. Python will not \"\n \"exit until all jobs have finished.\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1087_C12", "label": "shutdown()", "type": "expression", "loc": [1087, 1087], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1083_C8", "vector": [8, 3, 0.581, 0.0005, 3, 0.64, 1.0, 322, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "shutdown", "arg_names": [], "import_names": [], "rhs_call_name": "shutdown", "annotation": ""}, "snippet": " self.app_info['executor'].shutdown(wait=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1096_C8", "label": "for t", "type": "for", "loc": [1096, 1098], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1071_C4", "vector": [6, 2, 0.5863, 0.0016, 2, 0.34, 0.8333, 15, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for t in self.threads:\n if t.isAlive():\n t.join()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1097_C12", "label": "if", "type": "if", "loc": [1097, 1098], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1096_C8", "vector": [4, 3, 0.5866, 0.0011, 3, 0.15, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if t.isAlive():\n t.join()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1098_C16", "label": "join()", "type": "expression", "loc": [1098, 1098], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1097_C12", "vector": [8, 4, 0.5869, 0.0005, 4, 0.59, 0.0, 933, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "join", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " t.join()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1101_C8", "label": "bring_out_your_dead()", "type": "expression", "loc": [1101, 1101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1071_C4", "vector": [8, 2, 0.5885, 0.0005, 2, 0.34, 1.0, 444, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "bring_out_your_dead", "arg_names": [], "import_names": [], "rhs_call_name": "bring_out_your_dead", "annotation": ""}, "snippet": " self.bring_out_your_dead()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1103_C4", "label": "bring_out_your_dead", "type": "function", "loc": [1103, 1115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1018_C0", "vector": [2, 1, 0.5927, 0.0069, 1, 0.37, 0.5714, 444, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "bring_out_your_dead", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def bring_out_your_dead(self):\n # Remove dead threads from the pool\n\n dead_threads = [t for t in self.threads if not t.isAlive()]\n for t in dead_threads:\n if __debug__:\n log.debug(\"Removing dead thread: %s.\" % t.getName())\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1106_C8", "label": "dead_threads =", "type": "assigned_variable", "loc": [1106, 1106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1103_C4", "vector": [14, 2, 0.5911, 0.0005, 2, 0.97, 0.0, 766, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "dead_threads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dead_threads = [t for t in self.threads if not t.isAlive()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1107_C8", "label": "for t", "type": "for", "loc": [1107, 1114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1103_C4", "vector": [6, 2, 0.5935, 0.0043, 2, 0.97, 1.0, 15, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for t in dead_threads:\n if __debug__:\n log.debug(\"Removing dead thread: %s.\" % t.getName())\n try:\n # Py2.4 complains here so we put it in a try block\n self.threads.remove(t)\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1108_C12", "label": "if", "type": "if", "loc": [1108, 1109], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1107_C8", "vector": [4, 3, 0.5925, 0.0011, 3, 0.87, 0.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n log.debug(\"Removing dead thread: %s.\" % t.getName())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1109_C16", "label": "debug()", "type": "expression", "loc": [1109, 1109], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1108_C12", "vector": [8, 4, 0.5927, 0.0005, 4, 0.68, 0.0, 924, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " log.debug(\"Removing dead thread: %s.\" % t.getName())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1110_C12", "label": "try", "type": "try", "loc": [1110, 1114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1107_C8", "vector": [7, 3, 0.5943, 0.0027, 3, 0.87, 1.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # Py2.4 complains here so we put it in a try block\n self.threads.remove(t)\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1112_C16", "label": "remove()", "type": "expression", "loc": [1112, 1112], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1110_C12", "vector": [8, 4, 0.5943, 0.0005, 4, 0.5, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " self.threads.remove(t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1117_C4", "label": "grow", "type": "function", "loc": [1117, 1137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1018_C0", "vector": [2, 1, 0.6024, 0.0112, 1, 0.37, 0.7143, 151, 0, 2, 0, 0, 0, 0, 8], "semantic": {"name": "grow", "arg_names": ["self", "amount"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def grow(self, amount=None):\n if self.stop_server:\n return\n\n if not amount:\n amount = self.max_threads\n\n if self.alive:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1118_C8", "label": "if", "type": "if", "loc": [1118, 1119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1117_C4", "vector": [4, 2, 0.5978, 0.0011, 2, 0.8, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.stop_server:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1119_C12", "label": "return", "type": "return", "loc": [1119, 1119], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1118_C8", "vector": [13, 3, 0.5981, 0.0005, 3, 0.3, 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_467:If_L1121_C8", "label": "if", "type": "if", "loc": [1121, 1122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1117_C4", "vector": [4, 2, 0.5994, 0.0011, 2, 0.8, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not amount:\n amount = self.max_threads"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1122_C12", "label": "amount =", "type": "assigned_variable", "loc": [1122, 1122], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1121_C8", "vector": [14, 3, 0.5997, 0.0005, 3, 0.0, 0.0, 369, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "amount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " amount = self.max_threads"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1124_C8", "label": "if", "type": "if", "loc": [1124, 1125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1117_C4", "vector": [4, 2, 0.601, 0.0011, 2, 0.8, 0.5, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.alive:\n amount = min([amount, self.max_threads - len(self.threads)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1125_C12", "label": "amount = min()", "type": "assigned_variable", "loc": [1125, 1125], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1124_C8", "vector": [14, 3, 0.6013, 0.0005, 3, 0.47, 0.0, 369, 3, 1, 0, 0, 867, 10, 2], "semantic": {"name": "amount", "arg_names": [], "import_names": [], "rhs_call_name": "min", "annotation": ""}, "snippet": " amount = min([amount, self.max_threads - len(self.threads)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1127_C8", "label": "if", "type": "if", "loc": [1127, 1128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1117_C4", "vector": [4, 2, 0.6026, 0.0011, 2, 0.8, 0.75, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n log.debug(\"Growing by %i.\" % amount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1128_C12", "label": "debug()", "type": "expression", "loc": [1128, 1128], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1127_C8", "vector": [8, 3, 0.6029, 0.0005, 3, 0.94, 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(\"Growing by %i.\" % amount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1130_C8", "label": "for x", "type": "for", "loc": [1130, 1137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1117_C4", "vector": [6, 2, 0.6058, 0.0043, 2, 0.8, 1.0, 190, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for x in range(amount):\n worker = self.worker_class(self.app_info,\n self.active_queue,\n self.monitor_queue)\n\n worker.setDaemon(True)\n self.threads.add(worker)\n worker.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1131_C12", "label": "worker = worker_class()", "type": "assigned_variable", "loc": [1131, 1133], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1130_C8", "vector": [14, 3, 0.605, 0.0016, 3, 0.12, 0.0, 814, 3, 3, 0, 0, 468, 10, 1], "semantic": {"name": "worker", "arg_names": [], "import_names": [], "rhs_call_name": "worker_class", "annotation": ""}, "snippet": " worker = self.worker_class(self.app_info,\n self.active_queue,\n self.monitor_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1135_C12", "label": "setDaemon()", "type": "expression", "loc": [1135, 1135], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1130_C8", "vector": [8, 3, 0.6066, 0.0005, 3, 0.12, 0.3333, 432, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "setDaemon", "arg_names": [], "import_names": [], "rhs_call_name": "setDaemon", "annotation": ""}, "snippet": " worker.setDaemon(True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1136_C12", "label": "add()", "type": "expression", "loc": [1136, 1136], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1130_C8", "vector": [8, 3, 0.6072, 0.0005, 3, 0.12, 0.6667, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " self.threads.add(worker)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1137_C12", "label": "start()", "type": "expression", "loc": [1137, 1137], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1130_C8", "vector": [8, 3, 0.6077, 0.0005, 3, 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": " worker.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1139_C4", "label": "shrink", "type": "function", "loc": [1139, 1146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1018_C0", "vector": [2, 1, 0.6106, 0.0043, 1, 0.37, 0.8571, 239, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "shrink", "arg_names": ["self", "amount"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def shrink(self, amount=1):\n if __debug__:\n log.debug(\"Shrinking by %i.\" % amount)\n\n self.check_for_dead_threads += amount\n\n for x in range(amount):\n self.active_queue.put(None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1140_C8", "label": "if", "type": "if", "loc": [1140, 1141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1139_C4", "vector": [4, 2, 0.6096, 0.0011, 2, 0.11, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n log.debug(\"Shrinking by %i.\" % amount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1141_C12", "label": "debug()", "type": "expression", "loc": [1141, 1141], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1140_C8", "vector": [8, 3, 0.6098, 0.0005, 3, 0.03, 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(\"Shrinking by %i.\" % amount)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1145_C8", "label": "for x", "type": "for", "loc": [1145, 1146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1139_C4", "vector": [6, 2, 0.6122, 0.0011, 2, 0.11, 1.0, 190, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for x in range(amount):\n self.active_queue.put(None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1146_C12", "label": "put()", "type": "expression", "loc": [1146, 1146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1145_C8", "vector": [8, 3, 0.6125, 0.0005, 3, 0.04, 0.0, 636, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " self.active_queue.put(None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1148_C4", "label": "dynamic_resize", "type": "function", "loc": [1148, 1165], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1018_C0", "vector": [2, 1, 0.6181, 0.0096, 1, 0.37, 1.0, 983, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "dynamic_resize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def dynamic_resize(self):\n if (self.max_threads > self.min_threads or self.max_threads == 0):\n if self.check_for_dead_threads > 0:\n self.bring_out_your_dead()\n\n queueSize = self.active_queue.qsize()\n threadCount = len(self.threads)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1149_C8", "label": "if", "type": "if", "loc": [1149, 1165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1148_C4", "vector": [4, 2, 0.6184, 0.0091, 2, 0.35, 0.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (self.max_threads > self.min_threads or self.max_threads == 0):\n if self.check_for_dead_threads > 0:\n self.bring_out_your_dead()\n\n queueSize = self.active_queue.qsize()\n threadCount = len(self.threads)\n\n if __debug__:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1150_C12", "label": "if", "type": "if", "loc": [1150, 1151], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1149_C8", "vector": [4, 3, 0.6149, 0.0011, 3, 0.02, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.check_for_dead_threads > 0:\n self.bring_out_your_dead()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1151_C16", "label": "bring_out_your_dead()", "type": "expression", "loc": [1151, 1151], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1150_C12", "vector": [8, 4, 0.6152, 0.0005, 4, 0.84, 0.0, 444, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "bring_out_your_dead", "arg_names": [], "import_names": [], "rhs_call_name": "bring_out_your_dead", "annotation": ""}, "snippet": " self.bring_out_your_dead()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1153_C12", "label": "queueSize = qsize()", "type": "assigned_variable", "loc": [1153, 1153], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1149_C8", "vector": [14, 3, 0.6162, 0.0005, 3, 0.02, 0.25, 994, 3, 0, 0, 0, 256, 10, 1], "semantic": {"name": "queueSize", "arg_names": [], "import_names": [], "rhs_call_name": "qsize", "annotation": ""}, "snippet": " queueSize = self.active_queue.qsize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1154_C12", "label": "threadCount = len()", "type": "assigned_variable", "loc": [1154, 1154], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1149_C8", "vector": [14, 3, 0.6168, 0.0005, 3, 0.02, 0.5, 295, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "threadCount", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " threadCount = len(self.threads)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1156_C12", "label": "if", "type": "if", "loc": [1156, 1158], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1149_C8", "vector": [4, 3, 0.6184, 0.0016, 3, 0.02, 0.75, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n log.debug(\"Examining ThreadPool. %i threads and %i Q'd conxions\"\n % (threadCount, queueSize))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1157_C16", "label": "debug()", "type": "expression", "loc": [1157, 1158], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1156_C12", "vector": [8, 4, 0.6187, 0.0011, 4, 0.36, 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(\"Examining ThreadPool. %i threads and %i Q'd conxions\"\n % (threadCount, queueSize))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1160_C12", "label": "if", "type": "if", "loc": [1160, 1165], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1149_C8", "vector": [4, 3, 0.6213, 0.0032, 3, 0.02, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if queueSize == 0 and threadCount > self.min_threads:\n self.shrink()\n\n elif queueSize > self.grow_threshold:\n\n self.grow(queueSize)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1161_C16", "label": "shrink()", "type": "expression", "loc": [1161, 1161], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1160_C12", "vector": [8, 4, 0.6205, 0.0005, 4, 0.08, 0.0, 239, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "shrink", "arg_names": [], "import_names": [], "rhs_call_name": "shrink", "annotation": ""}, "snippet": " self.shrink()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1163_C12", "label": "if", "type": "if", "loc": [1163, 1165], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1160_C12", "vector": [4, 4, 0.6221, 0.0016, 4, 0.08, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif queueSize > self.grow_threshold:\n\n self.grow(queueSize)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1165_C16", "label": "grow()", "type": "expression", "loc": [1165, 1165], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1163_C12", "vector": [8, 5, 0.6227, 0.0005, 5, 0.8, 0.0, 151, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "grow", "arg_names": [], "import_names": [], "rhs_call_name": "grow", "annotation": ""}, "snippet": " self.grow(queueSize)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Import_L1171_C0", "label": "re import re", "type": "import", "loc": [1171, 1171], "level": 0, "parent": null, "vector": [1, 0, 0.6259, 0.0005, 0, 0.66, 0.6774, 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_467:Import_L1172_C0", "label": "sys import sys", "type": "import", "loc": [1172, 1172], "level": 0, "parent": null, "vector": [1, 0, 0.6264, 0.0005, 0, 0.66, 0.6882, 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_467:Import_L1173_C0", "label": "socket import socket", "type": "import", "loc": [1173, 1173], "level": 0, "parent": null, "vector": [1, 0, 0.6269, 0.0005, 0, 0.66, 0.6989, 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_467:Import_L1174_C0", "label": "logging import logging", "type": "import", "loc": [1174, 1174], "level": 0, "parent": null, "vector": [1, 0, 0.6275, 0.0005, 0, 0.66, 0.7097, 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_467:Import_L1175_C0", "label": "traceback import traceback", "type": "import", "loc": [1175, 1175], "level": 0, "parent": null, "vector": [1, 0, 0.628, 0.0005, 0, 0.66, 0.7204, 423, 0, 1, 0, 0, 423, 0, 0], "semantic": {"name": "traceback", "arg_names": [], "import_names": ["traceback"], "rhs_call_name": "", "annotation": ""}, "snippet": "import traceback"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L1176_C0", "label": "from wsgiref.headers import Headers", "type": "import", "loc": [1176, 1176], "level": 0, "parent": null, "vector": [1, 0, 0.6285, 0.0005, 0, 0.66, 0.7312, 955, 0, 1, 0, 0, 955, 0, 0], "semantic": {"name": "wsgiref.headers", "arg_names": [], "import_names": ["Headers"], "rhs_call_name": "", "annotation": ""}, "snippet": "from wsgiref.headers import Headers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L1177_C0", "label": "from threading import Thread", "type": "import", "loc": [1177, 1177], "level": 0, "parent": null, "vector": [1, 0, 0.6291, 0.0005, 0, 0.66, 0.7419, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["Thread"], "rhs_call_name": "", "annotation": ""}, "snippet": "from threading import Thread"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L1178_C0", "label": "from datetime import datetime", "type": "import", "loc": [1178, 1178], "level": 0, "parent": null, "vector": [1, 0, 0.6296, 0.0005, 0, 0.66, 0.7527, 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_467:Try_L1180_C0", "label": "try", "type": "try", "loc": [1180, 1183], "level": 0, "parent": null, "vector": [7, 0, 0.6315, 0.0021, 0, 0.66, 0.7634, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from urllib import unquote\nexcept ImportError:\n from urllib.parse import unquote"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L1181_C4", "label": "from urllib import unquote", "type": "import", "loc": [1181, 1181], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1180_C0", "vector": [1, 1, 0.6312, 0.0005, 1, 0.15, 0.0, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "urllib", "arg_names": [], "import_names": ["unquote"], "rhs_call_name": "", "annotation": ""}, "snippet": " from urllib import unquote"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L1183_C4", "label": "from urllib.parse import unquote", "type": "import", "loc": [1183, 1183], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1180_C0", "vector": [1, 1, 0.6323, 0.0005, 1, 0.15, 0.0, 630, 0, 1, 0, 0, 630, 0, 0], "semantic": {"name": "urllib.parse", "arg_names": [], "import_names": ["unquote"], "rhs_call_name": "", "annotation": ""}, "snippet": " from urllib.parse import unquote"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1185_C0", "label": "try", "type": "try", "loc": [1185, 1191], "level": 0, "parent": null, "vector": [7, 0, 0.635, 0.0037, 0, 0.66, 0.7742, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from io import StringIO\nexcept ImportError:\n try:\n from cStringIO import StringIO\n except ImportError:\n from StringIO import StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L1186_C4", "label": "from io import StringIO", "type": "import", "loc": [1186, 1186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1185_C0", "vector": [1, 1, 0.6339, 0.0005, 1, 0.39, 0.0, 518, 0, 1, 0, 0, 518, 0, 0], "semantic": {"name": "io", "arg_names": [], "import_names": ["StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": " from io import StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1188_C4", "label": "try", "type": "try", "loc": [1188, 1191], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1185_C0", "vector": [7, 1, 0.6358, 0.0021, 1, 0.39, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n from cStringIO import StringIO\n except ImportError:\n from StringIO import StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L1189_C8", "label": "from cStringIO import StringIO", "type": "import", "loc": [1189, 1189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1188_C4", "vector": [1, 2, 0.6355, 0.0005, 2, 0.73, 0.0, 764, 0, 1, 0, 0, 764, 0, 0], "semantic": {"name": "cStringIO", "arg_names": [], "import_names": ["StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": " from cStringIO import StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L1191_C8", "label": "from StringIO import StringIO", "type": "import", "loc": [1191, 1191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1188_C4", "vector": [1, 2, 0.6366, 0.0005, 2, 0.73, 0.0, 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_467:Try_L1193_C0", "label": "try", "type": "try", "loc": [1193, 1197], "level": 0, "parent": null, "vector": [7, 0, 0.6387, 0.0027, 0, 0.66, 0.7849, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from ssl import SSLError\nexcept ImportError:\n class SSLError(socket.error):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L1194_C4", "label": "from ssl import SSLError", "type": "import", "loc": [1194, 1194], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1193_C0", "vector": [1, 1, 0.6382, 0.0005, 1, 0.79, 0.0, 591, 0, 1, 0, 0, 591, 0, 0], "semantic": {"name": "ssl", "arg_names": [], "import_names": ["SSLError"], "rhs_call_name": "", "annotation": ""}, "snippet": " from ssl import SSLError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1196_C4", "label": "SSLError", "type": "class", "loc": [1196, 1197], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1193_C0", "vector": [3, 1, 0.6395, 0.0011, 1, 0.79, 0.0, 226, 0, 0, 0, 0, 611, 0, 0], "semantic": {"name": "SSLError", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class SSLError(socket.error):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1203_C0", "label": "re_SLASH = compile()", "type": "assigned_variable", "loc": [1203, 1203], "level": 0, "parent": null, "vector": [14, 0, 0.643, 0.0005, 0, 0.66, 0.7957, 718, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "re_SLASH", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "re_SLASH = re.compile('%2F', re.IGNORECASE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1204_C0", "label": "re_REQUEST_LINE = compile()", "type": "assigned_variable", "loc": [1204, 1217], "level": 0, "parent": null, "vector": [14, 0, 0.647, 0.0075, 0, 0.66, 0.8065, 518, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "re_REQUEST_LINE", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "re_REQUEST_LINE = re.compile(r\"\"\"^\n(?P<method>OPTIONS|GET|HEAD|POST|PUT|DELETE|TRACE|CONNECT) # Request Method\n\\ # (single space)\n(\n (?P<scheme>[^:/]+) # Scheme\n (://) #\n (?P<host>[^/]+) # Host\n)? #"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1218_C0", "label": "LOG_LINE =", "type": "assigned_variable", "loc": [1218, 1218], "level": 0, "parent": null, "vector": [14, 0, 0.651, 0.0005, 0, 0.66, 0.8172, 925, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "LOG_LINE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "LOG_LINE = '%(client_ip)s - \"%(request_line)s\" - %(status)s %(size)s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1219_C0", "label": "RESPONSE =", "type": "assigned_variable", "loc": [1219, 1225], "level": 0, "parent": null, "vector": [14, 0, 0.6531, 0.0037, 0, 0.66, 0.828, 698, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "RESPONSE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "RESPONSE = '''\\\n%s %s\nContent-Length: %i\nContent-Type: %s\n\n%s\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1226_C0", "label": "if", "type": "if", "loc": [1226, 1228], "level": 0, "parent": null, "vector": [4, 0, 0.6558, 0.0016, 0, 0.66, 0.8387, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if IS_JYTHON:\n HTTP_METHODS = set(['OPTIONS', 'GET', 'HEAD', 'POST', 'PUT',\n 'DELETE', 'TRACE', 'CONNECT'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1227_C4", "label": "HTTP_METHODS = set()", "type": "assigned_variable", "loc": [1227, 1228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1226_C0", "vector": [14, 1, 0.6561, 0.0011, 1, 0.52, 0.0, 401, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "HTTP_METHODS", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " HTTP_METHODS = set(['OPTIONS', 'GET', 'HEAD', 'POST', 'PUT',\n 'DELETE', 'TRACE', 'CONNECT'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1231_C0", "label": "Worker", "type": "class", "loc": [1231, 1514], "level": 0, "parent": null, "vector": [3, 0, 0.7336, 0.1518, 0, 0.66, 0.8495, 570, 0, 8, 0, 0, 134, 0, 99], "semantic": {"name": "Worker", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Worker(Thread):\n \"\"\"The Worker class is a base class responsible for receiving connections\n and (a subclass) will run an application to process the the connection \"\"\"\n\n def __init__(self,\n app_info,\n active_queue,\n monitor_queue,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1232_C4", "label": "expression", "type": "expression", "loc": [1232, 1233], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1231_C0", "vector": [8, 1, 0.6587, 0.0011, 1, 0.61, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The Worker class is a base class responsible for receiving connections\n and (a subclass) will run an application to process the the connection \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "label": "__init__", "type": "function", "loc": [1235, 1261], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1231_C0", "vector": [2, 1, 0.667, 0.0144, 1, 0.61, 0.125, 555, 0, 6, 0, 0, 0, 0, 8], "semantic": {"name": "__init__", "arg_names": ["self", "app_info", "active_queue", "monitor_queue", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self,\n app_info,\n active_queue,\n monitor_queue,\n *args,\n **kwargs):\n\n Thread.__init__(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1242_C8", "label": "__init__()", "type": "expression", "loc": [1242, 1242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "vector": [8, 2, 0.6638, 0.0005, 2, 0.76, 0.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " Thread.__init__(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1245_C8", "label": "self.app_info =", "type": "assigned_variable", "loc": [1245, 1245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "vector": [14, 2, 0.6654, 0.0005, 2, 0.76, 0.0833, 724, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.app_info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.app_info = app_info"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1246_C8", "label": "self.active_queue =", "type": "assigned_variable", "loc": [1246, 1246], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "vector": [14, 2, 0.666, 0.0005, 2, 0.76, 0.1667, 711, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.active_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.active_queue = active_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1247_C8", "label": "self.monitor_queue =", "type": "assigned_variable", "loc": [1247, 1247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "vector": [14, 2, 0.6665, 0.0005, 2, 0.76, 0.25, 203, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.monitor_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.monitor_queue = monitor_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1249_C8", "label": "self.size =", "type": "assigned_variable", "loc": [1249, 1249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "vector": [14, 2, 0.6676, 0.0005, 2, 0.76, 0.3333, 183, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.size", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.size = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1250_C8", "label": "self.status =", "type": "assigned_variable", "loc": [1250, 1250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "vector": [14, 2, 0.6681, 0.0005, 2, 0.76, 0.4167, 651, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.status = \"200 OK\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1251_C8", "label": "self.closeConnection =", "type": "assigned_variable", "loc": [1251, 1251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "vector": [14, 2, 0.6686, 0.0005, 2, 0.76, 0.5, 565, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.closeConnection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.closeConnection = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1252_C8", "label": "self.request_line =", "type": "assigned_variable", "loc": [1252, 1252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "vector": [14, 2, 0.6692, 0.0005, 2, 0.76, 0.5833, 609, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.request_line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.request_line = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1253_C8", "label": "self.protocol =", "type": "assigned_variable", "loc": [1253, 1253], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "vector": [14, 2, 0.6697, 0.0005, 2, 0.76, 0.6667, 581, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.protocol", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.protocol = 'HTTP/1.1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1256_C8", "label": "self.req_log = getLogger()", "type": "assigned_variable", "loc": [1256, 1256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "vector": [14, 2, 0.6713, 0.0005, 2, 0.76, 0.75, 454, 3, 1, 0, 0, 71, 10, 1], "semantic": {"name": "self.req_log", "arg_names": [], "import_names": [], "rhs_call_name": "getLogger", "annotation": ""}, "snippet": " self.req_log = logging.getLogger('Rocket.Requests')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1257_C8", "label": "addHandler()", "type": "expression", "loc": [1257, 1257], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "vector": [8, 2, 0.6718, 0.0005, 2, 0.76, 0.8333, 255, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "addHandler", "arg_names": [], "import_names": [], "rhs_call_name": "addHandler", "annotation": ""}, "snippet": " self.req_log.addHandler(NullHandler())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1260_C8", "label": "self.err_log = getLogger()", "type": "assigned_variable", "loc": [1260, 1260], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "vector": [14, 2, 0.6734, 0.0005, 2, 0.76, 0.9167, 286, 3, 1, 0, 0, 71, 10, 2], "semantic": {"name": "self.err_log", "arg_names": [], "import_names": [], "rhs_call_name": "getLogger", "annotation": ""}, "snippet": " self.err_log = logging.getLogger('Rocket.Errors.' + self.getName())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1261_C8", "label": "addHandler()", "type": "expression", "loc": [1261, 1261], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "vector": [8, 2, 0.674, 0.0005, 2, 0.76, 1.0, 255, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "addHandler", "arg_names": [], "import_names": [], "rhs_call_name": "addHandler", "annotation": ""}, "snippet": " self.err_log.addHandler(NullHandler())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1263_C4", "label": "_handleError", "type": "function", "loc": [1263, 1300], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1231_C0", "vector": [2, 1, 0.6849, 0.0203, 1, 0.61, 0.25, 942, 0, 4, 1, 0, 0, 0, 13], "semantic": {"name": "_handleError", "arg_names": ["self", "typ", "val", "tb"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _handleError(self, typ, val, tb):\n if typ == SSLError:\n if 'timed out' in str(val.args[0]):\n typ = SocketTimeout\n if typ == SocketTimeout:\n if __debug__:\n self.err_log.debug('Socket timed out')\n self.monitor_queue.put(self.conn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1264_C8", "label": "if", "type": "if", "loc": [1264, 1266], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1263_C4", "vector": [4, 2, 0.6761, 0.0016, 2, 0.08, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if typ == SSLError:\n if 'timed out' in str(val.args[0]):\n typ = SocketTimeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1265_C12", "label": "if", "type": "if", "loc": [1265, 1266], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1264_C8", "vector": [4, 3, 0.6764, 0.0011, 3, 0.77, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'timed out' in str(val.args[0]):\n typ = SocketTimeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1266_C16", "label": "typ =", "type": "assigned_variable", "loc": [1266, 1266], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1265_C12", "vector": [14, 4, 0.6766, 0.0005, 4, 0.44, 0.0, 722, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "typ", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " typ = SocketTimeout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1267_C8", "label": "if", "type": "if", "loc": [1267, 1271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1263_C4", "vector": [4, 2, 0.6782, 0.0027, 2, 0.08, 0.1111, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if typ == SocketTimeout:\n if __debug__:\n self.err_log.debug('Socket timed out')\n self.monitor_queue.put(self.conn)\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1268_C12", "label": "if", "type": "if", "loc": [1268, 1269], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1267_C8", "vector": [4, 3, 0.678, 0.0011, 3, 0.26, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.err_log.debug('Socket timed out')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1269_C16", "label": "debug()", "type": "expression", "loc": [1269, 1269], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1268_C12", "vector": [8, 4, 0.6782, 0.0005, 4, 0.47, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.err_log.debug('Socket timed out')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1270_C12", "label": "put()", "type": "expression", "loc": [1270, 1270], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1267_C8", "vector": [8, 3, 0.6788, 0.0005, 3, 0.26, 0.5, 636, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " self.monitor_queue.put(self.conn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1271_C12", "label": "return", "type": "return", "loc": [1271, 1271], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1267_C8", "vector": [13, 3, 0.6793, 0.0005, 3, 0.26, 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_467:If_L1272_C8", "label": "if", "type": "if", "loc": [1272, 1276], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1263_C4", "vector": [4, 2, 0.6809, 0.0027, 2, 0.08, 0.2222, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if typ == SocketClosed:\n self.closeConnection = True\n if __debug__:\n self.err_log.debug('Client closed socket')\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1273_C12", "label": "self.closeConnection =", "type": "assigned_variable", "loc": [1273, 1273], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1272_C8", "vector": [14, 3, 0.6804, 0.0005, 3, 0.19, 0.0, 565, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.closeConnection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.closeConnection = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1274_C12", "label": "if", "type": "if", "loc": [1274, 1275], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1272_C8", "vector": [4, 3, 0.6812, 0.0011, 3, 0.19, 0.5, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.err_log.debug('Client closed socket')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1275_C16", "label": "debug()", "type": "expression", "loc": [1275, 1275], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1274_C12", "vector": [8, 4, 0.6815, 0.0005, 4, 0.6, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.err_log.debug('Client closed socket')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1276_C12", "label": "return", "type": "return", "loc": [1276, 1276], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1272_C8", "vector": [13, 3, 0.682, 0.0005, 3, 0.19, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1277_C8", "label": "if", "type": "if", "loc": [1277, 1281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1263_C4", "vector": [4, 2, 0.6836, 0.0027, 2, 0.08, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if typ == BadRequest:\n self.closeConnection = True\n if __debug__:\n self.err_log.debug('Client sent a bad request')\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1278_C12", "label": "self.closeConnection =", "type": "assigned_variable", "loc": [1278, 1278], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1277_C8", "vector": [14, 3, 0.6831, 0.0005, 3, 0.9, 0.0, 565, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.closeConnection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.closeConnection = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1279_C12", "label": "if", "type": "if", "loc": [1279, 1280], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1277_C8", "vector": [4, 3, 0.6839, 0.0011, 3, 0.9, 0.5, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.err_log.debug('Client sent a bad request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1280_C16", "label": "debug()", "type": "expression", "loc": [1280, 1280], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1279_C12", "vector": [8, 4, 0.6841, 0.0005, 4, 0.78, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.err_log.debug('Client sent a bad request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1281_C12", "label": "return", "type": "return", "loc": [1281, 1281], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1277_C8", "vector": [13, 3, 0.6847, 0.0005, 3, 0.9, 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_467:If_L1282_C8", "label": "if", "type": "if", "loc": [1282, 1294], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1263_C4", "vector": [4, 2, 0.6884, 0.0069, 2, 0.08, 0.4444, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if typ == socket.error:\n self.closeConnection = True\n if val.args[0] in IGNORE_ERRORS_ON_CLOSE:\n if __debug__:\n self.err_log.debug('Ignorable socket Error received...'\n 'closing connection.')\n return False\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1283_C12", "label": "self.closeConnection =", "type": "assigned_variable", "loc": [1283, 1283], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1282_C8", "vector": [14, 3, 0.6857, 0.0005, 3, 0.39, 0.0, 565, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.closeConnection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.closeConnection = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1284_C12", "label": "if", "type": "if", "loc": [1284, 1294], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1282_C8", "vector": [4, 3, 0.6889, 0.0059, 3, 0.39, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if val.args[0] in IGNORE_ERRORS_ON_CLOSE:\n if __debug__:\n self.err_log.debug('Ignorable socket Error received...'\n 'closing connection.')\n return False\n else:\n self.status = \"999 Utter Server Failure\"\n tb_fmt = traceback.format_exception(typ, val, tb)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1285_C16", "label": "if", "type": "if", "loc": [1285, 1287], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1284_C12", "vector": [4, 4, 0.6873, 0.0016, 4, 0.23, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.err_log.debug('Ignorable socket Error received...'\n 'closing connection.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1286_C20", "label": "debug()", "type": "expression", "loc": [1286, 1287], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1285_C16", "vector": [8, 5, 0.6876, 0.0011, 5, 0.98, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.err_log.debug('Ignorable socket Error received...'\n 'closing connection.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1288_C16", "label": "return", "type": "return", "loc": [1288, 1288], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1284_C12", "vector": [13, 4, 0.6884, 0.0005, 4, 0.23, 0.2, 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_467:Assign_L1290_C16", "label": "self.status =", "type": "assigned_variable", "loc": [1290, 1290], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1284_C12", "vector": [14, 4, 0.6895, 0.0005, 4, 0.23, 0.4, 651, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.status = \"999 Utter Server Failure\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1291_C16", "label": "tb_fmt = format_exception()", "type": "assigned_variable", "loc": [1291, 1291], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1284_C12", "vector": [14, 4, 0.69, 0.0005, 4, 0.23, 0.6, 535, 3, 3, 0, 0, 346, 10, 1], "semantic": {"name": "tb_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "format_exception", "annotation": ""}, "snippet": " tb_fmt = traceback.format_exception(typ, val, tb)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1292_C16", "label": "error()", "type": "expression", "loc": [1292, 1293], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1284_C12", "vector": [8, 4, 0.6908, 0.0011, 4, 0.23, 0.8, 771, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " self.err_log.error('Unhandled Error when serving '\n 'connection:\\n' + '\\n'.join(tb_fmt))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1294_C16", "label": "return", "type": "return", "loc": [1294, 1294], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1284_C12", "vector": [13, 4, 0.6916, 0.0005, 4, 0.23, 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_467:Assign_L1296_C8", "label": "self.closeConnection =", "type": "assigned_variable", "loc": [1296, 1296], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1263_C4", "vector": [14, 2, 0.6927, 0.0005, 2, 0.08, 0.5556, 565, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.closeConnection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.closeConnection = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1297_C8", "label": "tb_fmt = format_exception()", "type": "assigned_variable", "loc": [1297, 1297], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1263_C4", "vector": [14, 2, 0.6932, 0.0005, 2, 0.08, 0.6667, 535, 3, 3, 0, 0, 346, 10, 1], "semantic": {"name": "tb_fmt", "arg_names": [], "import_names": [], "rhs_call_name": "format_exception", "annotation": ""}, "snippet": " tb_fmt = traceback.format_exception(typ, val, tb)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1298_C8", "label": "error()", "type": "expression", "loc": [1298, 1298], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1263_C4", "vector": [8, 2, 0.6937, 0.0005, 2, 0.08, 0.7778, 771, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " self.err_log.error('\\n'.join(tb_fmt))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1299_C8", "label": "send_response()", "type": "expression", "loc": [1299, 1299], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1263_C4", "vector": [8, 2, 0.6943, 0.0005, 2, 0.08, 0.8889, 844, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "send_response", "arg_names": [], "import_names": [], "rhs_call_name": "send_response", "annotation": ""}, "snippet": " self.send_response('500 Server Error')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1300_C8", "label": "return", "type": "return", "loc": [1300, 1300], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1263_C4", "vector": [13, 2, 0.6948, 0.0005, 2, 0.08, 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_467:FunctionDef_L1302_C4", "label": "run", "type": "function", "loc": [1302, 1358], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1231_C0", "vector": [2, 1, 0.7108, 0.0305, 1, 0.61, 0.375, 679, 0, 1, 1, 0, 0, 0, 22], "semantic": {"name": "run", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def run(self):\n if __debug__:\n self.err_log.debug('Entering main loop.')\n\n # Enter thread main loop\n while True:\n conn = self.active_queue.get()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1303_C8", "label": "if", "type": "if", "loc": [1303, 1304], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1302_C4", "vector": [4, 2, 0.6967, 0.0011, 2, 0.36, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.err_log.debug('Entering main loop.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1304_C12", "label": "debug()", "type": "expression", "loc": [1304, 1304], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1303_C8", "vector": [8, 3, 0.697, 0.0005, 3, 0.24, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.err_log.debug('Entering main loop.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1307_C8", "label": "while", "type": "while", "loc": [1307, 1358], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1302_C4", "vector": [5, 2, 0.7122, 0.0278, 2, 0.36, 1.0, 0, 1, 0, 0, 0, 0, 0, 21], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n conn = self.active_queue.get()\n\n if not conn:\n # A non-client is a signal to die\n if __debug__:\n self.err_log.debug('Received a death threat.')\n return conn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1308_C12", "label": "conn = get()", "type": "assigned_variable", "loc": [1308, 1308], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1307_C8", "vector": [14, 3, 0.6991, 0.0005, 3, 0.34, 0.0, 345, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "conn", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " conn = self.active_queue.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1310_C12", "label": "if", "type": "if", "loc": [1310, 1314], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1307_C8", "vector": [4, 3, 0.7012, 0.0027, 3, 0.34, 0.2, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not conn:\n # A non-client is a signal to die\n if __debug__:\n self.err_log.debug('Received a death threat.')\n return conn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1312_C16", "label": "if", "type": "if", "loc": [1312, 1313], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1310_C12", "vector": [4, 4, 0.7015, 0.0011, 4, 0.45, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.err_log.debug('Received a death threat.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1313_C20", "label": "debug()", "type": "expression", "loc": [1313, 1313], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1312_C16", "vector": [8, 5, 0.7018, 0.0005, 5, 0.33, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.err_log.debug('Received a death threat.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1314_C16", "label": "return", "type": "return", "loc": [1314, 1314], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1310_C12", "vector": [13, 4, 0.7023, 0.0005, 4, 0.45, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return conn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1316_C12", "label": "if", "type": "if", "loc": [1316, 1317], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1307_C8", "vector": [4, 3, 0.7036, 0.0011, 3, 0.34, 0.4, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(conn, tuple):\n conn = Connection(*conn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1317_C16", "label": "conn = Connection()", "type": "assigned_variable", "loc": [1317, 1317], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1316_C12", "vector": [14, 4, 0.7039, 0.0005, 4, 0.53, 0.0, 345, 3, 1, 0, 0, 823, 10, 1], "semantic": {"name": "conn", "arg_names": [], "import_names": [], "rhs_call_name": "Connection", "annotation": ""}, "snippet": " conn = Connection(*conn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1319_C12", "label": "self.conn =", "type": "assigned_variable", "loc": [1319, 1319], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1307_C8", "vector": [14, 3, 0.705, 0.0005, 3, 0.34, 0.6, 6, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.conn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.conn = conn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1321_C12", "label": "if", "type": "if", "loc": [1321, 1330], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1307_C8", "vector": [4, 3, 0.7084, 0.0053, 3, 0.34, 0.8, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if conn.ssl != conn.secure:\n self.err_log.info('Received HTTP connection on HTTPS port.')\n self.send_response('400 Bad Request')\n self.closeConnection = True\n conn.close()\n continue\n else:\n if __debug__:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1322_C16", "label": "info()", "type": "expression", "loc": [1322, 1322], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1321_C12", "vector": [8, 4, 0.7066, 0.0005, 4, 0.15, 0.0, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " self.err_log.info('Received HTTP connection on HTTPS port.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1323_C16", "label": "send_response()", "type": "expression", "loc": [1323, 1323], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1321_C12", "vector": [8, 4, 0.7071, 0.0005, 4, 0.15, 0.2, 844, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "send_response", "arg_names": [], "import_names": [], "rhs_call_name": "send_response", "annotation": ""}, "snippet": " self.send_response('400 Bad Request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1324_C16", "label": "self.closeConnection =", "type": "assigned_variable", "loc": [1324, 1324], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1321_C12", "vector": [14, 4, 0.7076, 0.0005, 4, 0.15, 0.4, 565, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.closeConnection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.closeConnection = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1325_C16", "label": "close()", "type": "expression", "loc": [1325, 1325], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1321_C12", "vector": [8, 4, 0.7082, 0.0005, 4, 0.15, 0.6, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " conn.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1328_C16", "label": "if", "type": "if", "loc": [1328, 1329], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1321_C12", "vector": [4, 4, 0.71, 0.0011, 4, 0.15, 0.8, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.err_log.debug('Received a connection.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1329_C20", "label": "debug()", "type": "expression", "loc": [1329, 1329], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1328_C16", "vector": [8, 5, 0.7103, 0.0005, 5, 0.53, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.err_log.debug('Received a connection.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1330_C16", "label": "self.closeConnection =", "type": "assigned_variable", "loc": [1330, 1330], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1321_C12", "vector": [14, 4, 0.7108, 0.0005, 4, 0.15, 1.0, 565, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.closeConnection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.closeConnection = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1333_C12", "label": "while", "type": "while", "loc": [1333, 1358], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1307_C8", "vector": [5, 3, 0.7191, 0.0139, 3, 0.34, 1.0, 0, 1, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n if __debug__:\n self.err_log.debug('Serving a request')\n try:\n self.run_app(conn)\n except:\n exc = sys.exc_info()\n handled = self._handleError(*exc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1334_C16", "label": "if", "type": "if", "loc": [1334, 1335], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1333_C12", "vector": [4, 4, 0.7133, 0.0011, 4, 0.05, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.err_log.debug('Serving a request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1335_C20", "label": "debug()", "type": "expression", "loc": [1335, 1335], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1334_C16", "vector": [8, 5, 0.7135, 0.0005, 5, 0.92, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.err_log.debug('Serving a request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1336_C16", "label": "try", "type": "try", "loc": [1336, 1350], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1333_C12", "vector": [7, 4, 0.7178, 0.008, 4, 0.05, 0.5, 0, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.run_app(conn)\n except:\n exc = sys.exc_info()\n handled = self._handleError(*exc)\n if handled:\n break\n finally:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1337_C20", "label": "run_app()", "type": "expression", "loc": [1337, 1337], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1336_C16", "vector": [8, 5, 0.7146, 0.0005, 5, 0.43, 0.0, 678, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "run_app", "arg_names": [], "import_names": [], "rhs_call_name": "run_app", "annotation": ""}, "snippet": " self.run_app(conn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1339_C20", "label": "exc = exc_info()", "type": "assigned_variable", "loc": [1339, 1339], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1336_C16", "vector": [14, 5, 0.7157, 0.0005, 5, 0.43, 0.0, 201, 3, 0, 0, 0, 289, 10, 1], "semantic": {"name": "exc", "arg_names": [], "import_names": [], "rhs_call_name": "exc_info", "annotation": ""}, "snippet": " exc = sys.exc_info()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1340_C20", "label": "handled = _handleError()", "type": "assigned_variable", "loc": [1340, 1340], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1336_C16", "vector": [14, 5, 0.7162, 0.0005, 5, 0.43, 0.5, 845, 3, 1, 0, 0, 942, 10, 1], "semantic": {"name": "handled", "arg_names": [], "import_names": [], "rhs_call_name": "_handleError", "annotation": ""}, "snippet": " handled = self._handleError(*exc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1341_C20", "label": "if", "type": "if", "loc": [1341, 1342], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1336_C16", "vector": [4, 5, 0.717, 0.0011, 5, 0.43, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if handled:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1344_C20", "label": "if", "type": "if", "loc": [1344, 1350], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1336_C16", "vector": [4, 5, 0.7199, 0.0037, 5, 0.43, 1.0, 0, 7, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.request_line:\n log_info = dict(client_ip=conn.client_addr,\n time=datetime.now().strftime('%c'),\n status=self.status.split(' ')[0],\n size=self.size,\n request_line=self.request_line)\n self.req_log.info(LOG_LINE % log_info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1345_C24", "label": "log_info = dict()", "type": "assigned_variable", "loc": [1345, 1349], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1344_C20", "vector": [14, 6, 0.7199, 0.0027, 6, 0.39, 0.0, 165, 3, 5, 0, 0, 827, 10, 4], "semantic": {"name": "log_info", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " log_info = dict(client_ip=conn.client_addr,\n time=datetime.now().strftime('%c'),\n status=self.status.split(' ')[0],\n size=self.size,\n request_line=self.request_line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1350_C24", "label": "info()", "type": "expression", "loc": [1350, 1350], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1344_C20", "vector": [8, 6, 0.7215, 0.0005, 6, 0.39, 1.0, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " self.req_log.info(LOG_LINE % log_info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1352_C16", "label": "if", "type": "if", "loc": [1352, 1358], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1333_C12", "vector": [4, 4, 0.7242, 0.0037, 4, 0.05, 1.0, 0, 7, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.closeConnection:\n try:\n conn.close()\n except:\n self.err_log.error(str(traceback.format_exc()))\n\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1353_C20", "label": "try", "type": "try", "loc": [1353, 1356], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1352_C16", "vector": [7, 5, 0.7239, 0.0021, 5, 0.1, 0.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n conn.close()\n except:\n self.err_log.error(str(traceback.format_exc()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1354_C24", "label": "close()", "type": "expression", "loc": [1354, 1354], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1353_C20", "vector": [8, 6, 0.7237, 0.0005, 6, 0.63, 0.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " conn.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1356_C24", "label": "error()", "type": "expression", "loc": [1356, 1356], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1353_C20", "vector": [8, 6, 0.7247, 0.0005, 6, 0.63, 0.0, 771, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " self.err_log.error(str(traceback.format_exc()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1360_C4", "label": "run_app", "type": "function", "loc": [1360, 1364], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1231_C0", "vector": [2, 1, 0.728, 0.0027, 1, 0.61, 0.5, 678, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "run_app", "arg_names": ["self", "conn"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def run_app(self, conn):\n # Must be overridden with a method reads the request from the socket\n # and sends a response.\n self.closeConnection = True\n raise NotImplementedError('Overload this method!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1363_C8", "label": "self.closeConnection =", "type": "assigned_variable", "loc": [1363, 1363], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1360_C4", "vector": [14, 2, 0.7285, 0.0005, 2, 0.89, 0.0, 565, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.closeConnection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.closeConnection = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1366_C4", "label": "send_response", "type": "function", "loc": [1366, 1382], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1231_C0", "vector": [2, 1, 0.7344, 0.0091, 1, 0.61, 0.625, 844, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "send_response", "arg_names": ["self", "status"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def send_response(self, status):\n stat_msg = status.split(' ', 1)[1]\n msg = RESPONSE % (self.protocol,\n status,\n len(stat_msg),\n 'text/plain',\n stat_msg)\n try:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1367_C8", "label": "stat_msg =", "type": "assigned_variable", "loc": [1367, 1367], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1366_C4", "vector": [14, 2, 0.7306, 0.0005, 2, 0.06, 0.0, 664, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stat_msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " stat_msg = status.split(' ', 1)[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1368_C8", "label": "msg =", "type": "assigned_variable", "loc": [1368, 1372], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1366_C4", "vector": [14, 2, 0.7322, 0.0027, 2, 0.06, 0.5, 712, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg = RESPONSE % (self.protocol,\n status,\n len(stat_msg),\n 'text/plain',\n stat_msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1373_C8", "label": "try", "type": "try", "loc": [1373, 1382], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1366_C4", "vector": [7, 2, 0.7362, 0.0053, 2, 0.06, 1.0, 0, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.conn.sendall(b(msg))\n except socket.timeout:\n self.closeConnection = True\n msg = 'Tried to send \"%s\" to client but received timeout error'\n self.err_log.error(msg % status)\n except socket.error:\n self.closeConnection = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1374_C12", "label": "sendall()", "type": "expression", "loc": [1374, 1374], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1373_C8", "vector": [8, 3, 0.7344, 0.0005, 3, 0.75, 0.0, 874, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sendall", "arg_names": [], "import_names": [], "rhs_call_name": "sendall", "annotation": ""}, "snippet": " self.conn.sendall(b(msg))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1376_C12", "label": "self.closeConnection =", "type": "assigned_variable", "loc": [1376, 1376], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1373_C8", "vector": [14, 3, 0.7354, 0.0005, 3, 0.75, 0.0, 565, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.closeConnection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.closeConnection = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1377_C12", "label": "msg =", "type": "assigned_variable", "loc": [1377, 1377], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1373_C8", "vector": [14, 3, 0.736, 0.0005, 3, 0.75, 0.5, 712, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg = 'Tried to send \"%s\" to client but received timeout error'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1378_C12", "label": "error()", "type": "expression", "loc": [1378, 1378], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1373_C8", "vector": [8, 3, 0.7365, 0.0005, 3, 0.75, 1.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " self.err_log.error(msg % status)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1380_C12", "label": "self.closeConnection =", "type": "assigned_variable", "loc": [1380, 1380], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1373_C8", "vector": [14, 3, 0.7376, 0.0005, 3, 0.75, 0.0, 565, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.closeConnection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.closeConnection = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1381_C12", "label": "msg =", "type": "assigned_variable", "loc": [1381, 1381], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1373_C8", "vector": [14, 3, 0.7381, 0.0005, 3, 0.75, 0.5, 712, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg = 'Tried to send \"%s\" to client but received socket error'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1382_C12", "label": "error()", "type": "expression", "loc": [1382, 1382], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1373_C8", "vector": [8, 3, 0.7386, 0.0005, 3, 0.75, 1.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " self.err_log.error(msg % status)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "label": "read_request_line", "type": "function", "loc": [1384, 1440], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1231_C0", "vector": [2, 1, 0.7547, 0.0305, 1, 0.61, 0.75, 124, 0, 2, 1, 0, 0, 0, 18], "semantic": {"name": "read_request_line", "arg_names": ["self", "sock_file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def read_request_line(self, sock_file):\n self.request_line = ''\n try:\n # Grab the request line\n d = sock_file.readline()\n if PY3K:\n d = d.decode('ISO-8859-1')\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1385_C8", "label": "self.request_line =", "type": "assigned_variable", "loc": [1385, 1385], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "vector": [14, 2, 0.7402, 0.0005, 2, 0.62, 0.0, 609, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.request_line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.request_line = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1386_C8", "label": "try", "type": "try", "loc": [1386, 1405], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "vector": [7, 2, 0.7459, 0.0107, 2, 0.62, 0.0909, 0, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # Grab the request line\n d = sock_file.readline()\n if PY3K:\n d = d.decode('ISO-8859-1')\n\n if d == '\\r\\n':\n # Allow an extra NEWLINE at the beginning per HTTP 1.1 spec"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1388_C12", "label": "d = readline()", "type": "assigned_variable", "loc": [1388, 1388], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1386_C8", "vector": [14, 3, 0.7418, 0.0005, 3, 0.96, 0.0, 355, 3, 0, 0, 0, 303, 10, 1], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "readline", "annotation": ""}, "snippet": " d = sock_file.readline()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1389_C12", "label": "if", "type": "if", "loc": [1389, 1390], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1386_C8", "vector": [4, 3, 0.7427, 0.0011, 3, 0.96, 0.5, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if PY3K:\n d = d.decode('ISO-8859-1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1390_C16", "label": "d = decode()", "type": "assigned_variable", "loc": [1390, 1390], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1389_C12", "vector": [14, 4, 0.7429, 0.0005, 4, 0.59, 0.0, 355, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " d = d.decode('ISO-8859-1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1392_C12", "label": "if", "type": "if", "loc": [1392, 1399], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1386_C8", "vector": [4, 3, 0.7459, 0.0043, 3, 0.96, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if d == '\\r\\n':\n # Allow an extra NEWLINE at the beginning per HTTP 1.1 spec\n if __debug__:\n self.err_log.debug('Client sent newline')\n\n d = sock_file.readline()\n if PY3K:\n d = d.decode('ISO-8859-1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1394_C16", "label": "if", "type": "if", "loc": [1394, 1395], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1392_C12", "vector": [4, 4, 0.7453, 0.0011, 4, 0.47, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.err_log.debug('Client sent newline')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1395_C20", "label": "debug()", "type": "expression", "loc": [1395, 1395], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1394_C16", "vector": [8, 5, 0.7456, 0.0005, 5, 0.97, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.err_log.debug('Client sent newline')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1397_C16", "label": "d = readline()", "type": "assigned_variable", "loc": [1397, 1397], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1392_C12", "vector": [14, 4, 0.7467, 0.0005, 4, 0.47, 0.5, 355, 3, 0, 0, 0, 303, 10, 1], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "readline", "annotation": ""}, "snippet": " d = sock_file.readline()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1398_C16", "label": "if", "type": "if", "loc": [1398, 1399], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1392_C12", "vector": [4, 4, 0.7475, 0.0011, 4, 0.47, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if PY3K:\n d = d.decode('ISO-8859-1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1399_C20", "label": "d = decode()", "type": "assigned_variable", "loc": [1399, 1399], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1398_C16", "vector": [14, 5, 0.7477, 0.0005, 5, 0.09, 0.0, 355, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " d = d.decode('ISO-8859-1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1407_C8", "label": "d = strip()", "type": "assigned_variable", "loc": [1407, 1407], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "vector": [14, 2, 0.752, 0.0005, 2, 0.62, 0.1818, 355, 3, 0, 0, 0, 973, 10, 1], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "strip", "annotation": ""}, "snippet": " d = d.strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1409_C8", "label": "if", "type": "if", "loc": [1409, 1413], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "vector": [4, 2, 0.7541, 0.0027, 2, 0.62, 0.2727, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not d:\n if __debug__:\n self.err_log.debug(\n 'Client did not send a recognizable request.')\n raise SocketClosed('Client closed socket.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1410_C12", "label": "if", "type": "if", "loc": [1410, 1412], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1409_C8", "vector": [4, 3, 0.7541, 0.0016, 3, 0.7, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.err_log.debug(\n 'Client did not send a recognizable request.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1411_C16", "label": "debug()", "type": "expression", "loc": [1411, 1412], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1410_C12", "vector": [8, 4, 0.7544, 0.0011, 4, 0.34, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.err_log.debug(\n 'Client did not send a recognizable request.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1415_C8", "label": "self.request_line =", "type": "assigned_variable", "loc": [1415, 1415], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "vector": [14, 2, 0.7563, 0.0005, 2, 0.62, 0.3636, 609, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.request_line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.request_line = d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1422_C8", "label": "if", "type": "if", "loc": [1422, 1423], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "vector": [4, 2, 0.7603, 0.0011, 2, 0.62, 0.4545, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if IS_JYTHON:\n return self._read_request_line_jython(d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1423_C12", "label": "return", "type": "return", "loc": [1423, 1423], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1422_C8", "vector": [13, 3, 0.7606, 0.0005, 3, 0.95, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._read_request_line_jython(d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1425_C8", "label": "match = match()", "type": "assigned_variable", "loc": [1425, 1425], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "vector": [14, 2, 0.7616, 0.0005, 2, 0.62, 0.5455, 36, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "match", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " match = re_REQUEST_LINE.match(d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1427_C8", "label": "if", "type": "if", "loc": [1427, 1429], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "vector": [4, 2, 0.7632, 0.0016, 2, 0.62, 0.6364, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not match:\n self.send_response('400 Bad Request')\n raise BadRequest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1428_C12", "label": "send_response()", "type": "expression", "loc": [1428, 1428], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1427_C8", "vector": [8, 3, 0.7632, 0.0005, 3, 0.16, 0.0, 844, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "send_response", "arg_names": [], "import_names": [], "rhs_call_name": "send_response", "annotation": ""}, "snippet": " self.send_response('400 Bad Request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1431_C8", "label": "req = groupdict()", "type": "assigned_variable", "loc": [1431, 1431], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "vector": [14, 2, 0.7648, 0.0005, 2, 0.62, 0.7273, 233, 3, 0, 0, 0, 572, 10, 1], "semantic": {"name": "req", "arg_names": [], "import_names": [], "rhs_call_name": "groupdict", "annotation": ""}, "snippet": " req = match.groupdict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1432_C8", "label": "for k, v", "type": "for", "loc": [1432, 1437], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "vector": [6, 2, 0.7667, 0.0032, 2, 0.62, 0.8182, 867, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in req.iteritems():\n if not v:\n req[k] = \"\"\n if k == 'path':\n req['path'] = r'%2F'.join(\n [unquote(x) for x in re_SLASH.split(v)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1433_C12", "label": "if", "type": "if", "loc": [1433, 1434], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1432_C8", "vector": [4, 3, 0.7662, 0.0011, 3, 0.51, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not v:\n req[k] = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1434_C16", "label": "assign", "type": "assigned_variable", "loc": [1434, 1434], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1433_C12", "vector": [14, 4, 0.7664, 0.0005, 4, 0.12, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " req[k] = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1435_C12", "label": "if", "type": "if", "loc": [1435, 1437], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1432_C8", "vector": [4, 3, 0.7675, 0.0016, 3, 0.51, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k == 'path':\n req['path'] = r'%2F'.join(\n [unquote(x) for x in re_SLASH.split(v)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1436_C16", "label": " = join()", "type": "assigned_variable", "loc": [1436, 1437], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1435_C12", "vector": [14, 4, 0.7678, 0.0011, 4, 0.71, 0.0, 0, 3, 1, 0, 0, 933, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " req['path'] = r'%2F'.join(\n [unquote(x) for x in re_SLASH.split(v)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1439_C8", "label": "self.protocol =", "type": "assigned_variable", "loc": [1439, 1439], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "vector": [14, 2, 0.7691, 0.0005, 2, 0.62, 0.9091, 581, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.protocol", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.protocol = req['protocol']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1440_C8", "label": "return", "type": "return", "loc": [1440, 1440], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "vector": [13, 2, 0.7696, 0.0005, 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 req"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "label": "_read_request_line_jython", "type": "function", "loc": [1442, 1478], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1231_C0", "vector": [2, 1, 0.7803, 0.0198, 1, 0.61, 0.875, 595, 0, 2, 1, 0, 0, 0, 16], "semantic": {"name": "_read_request_line_jython", "arg_names": ["self", "d"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _read_request_line_jython(self, d):\n d = d.strip()\n try:\n method, uri, proto = d.split(' ')\n if not proto.startswith('HTTP') or \\\n proto[-3:] not in ('1.0', '1.1') or \\\n method not in HTTP_METHODS:\n self.send_response('400 Bad Request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1443_C8", "label": "d = strip()", "type": "assigned_variable", "loc": [1443, 1443], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "vector": [14, 2, 0.7712, 0.0005, 2, 0.66, 0.0, 355, 3, 0, 0, 0, 973, 10, 1], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "strip", "annotation": ""}, "snippet": " d = d.strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1444_C8", "label": "try", "type": "try", "loc": [1444, 1453], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "vector": [7, 2, 0.7742, 0.0053, 2, 0.66, 0.1, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n method, uri, proto = d.split(' ')\n if not proto.startswith('HTTP') or \\\n proto[-3:] not in ('1.0', '1.1') or \\\n method not in HTTP_METHODS:\n self.send_response('400 Bad Request')\n raise BadRequest\n except ValueError:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1445_C12", "label": "method, uri, proto = split()", "type": "assigned_variable", "loc": [1445, 1445], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1444_C8", "vector": [14, 3, 0.7723, 0.0005, 3, 0.71, 0.0, 710, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "method, uri, proto", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " method, uri, proto = d.split(' ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1446_C12", "label": "if", "type": "if", "loc": [1446, 1450], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1444_C8", "vector": [4, 3, 0.7739, 0.0027, 3, 0.71, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not proto.startswith('HTTP') or \\\n proto[-3:] not in ('1.0', '1.1') or \\\n method not in HTTP_METHODS:\n self.send_response('400 Bad Request')\n raise BadRequest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1449_C16", "label": "send_response()", "type": "expression", "loc": [1449, 1449], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1446_C12", "vector": [8, 4, 0.7745, 0.0005, 4, 0.07, 0.0, 844, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "send_response", "arg_names": [], "import_names": [], "rhs_call_name": "send_response", "annotation": ""}, "snippet": " self.send_response('400 Bad Request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1452_C12", "label": "send_response()", "type": "expression", "loc": [1452, 1452], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1444_C8", "vector": [8, 3, 0.7761, 0.0005, 3, 0.71, 0.0, 844, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "send_response", "arg_names": [], "import_names": [], "rhs_call_name": "send_response", "annotation": ""}, "snippet": " self.send_response('400 Bad Request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1455_C8", "label": "req = dict()", "type": "assigned_variable", "loc": [1455, 1455], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "vector": [14, 2, 0.7777, 0.0005, 2, 0.66, 0.2, 233, 3, 2, 0, 0, 827, 10, 1], "semantic": {"name": "req", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " req = dict(method=method, protocol=proto)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1456_C8", "label": "scheme =", "type": "assigned_variable", "loc": [1456, 1456], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "vector": [14, 2, 0.7782, 0.0005, 2, 0.66, 0.3, 207, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "scheme", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scheme = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1457_C8", "label": "host =", "type": "assigned_variable", "loc": [1457, 1457], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "vector": [14, 2, 0.7787, 0.0005, 2, 0.66, 0.4, 867, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "host", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " host = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1458_C8", "label": "if", "type": "if", "loc": [1458, 1466], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "vector": [4, 2, 0.7814, 0.0048, 2, 0.66, 0.5, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if uri == '*' or uri.startswith('/'):\n path = uri\n elif '://' in uri:\n scheme, rest = uri.split('://')\n host, path = rest.split('/', 1)\n path = '/' + path\n else:\n self.send_response('400 Bad Request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1459_C12", "label": "path =", "type": "assigned_variable", "loc": [1459, 1459], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1458_C8", "vector": [14, 3, 0.7798, 0.0005, 3, 0.74, 0.0, 358, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = uri"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1460_C8", "label": "if", "type": "if", "loc": [1460, 1466], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1458_C8", "vector": [4, 3, 0.7819, 0.0037, 3, 0.74, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif '://' in uri:\n scheme, rest = uri.split('://')\n host, path = rest.split('/', 1)\n path = '/' + path\n else:\n self.send_response('400 Bad Request')\n raise BadRequest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1461_C12", "label": "scheme, rest = split()", "type": "assigned_variable", "loc": [1461, 1461], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1460_C8", "vector": [14, 4, 0.7809, 0.0005, 4, 0.44, 0.0, 824, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "scheme, rest", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " scheme, rest = uri.split('://')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1462_C12", "label": "host, path = split()", "type": "assigned_variable", "loc": [1462, 1462], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1460_C8", "vector": [14, 4, 0.7814, 0.0005, 4, 0.44, 0.3333, 141, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "host, path", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " host, path = rest.split('/', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1463_C12", "label": "path =", "type": "assigned_variable", "loc": [1463, 1463], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1460_C8", "vector": [14, 4, 0.7819, 0.0005, 4, 0.44, 0.6667, 358, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = '/' + path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1465_C12", "label": "send_response()", "type": "expression", "loc": [1465, 1465], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1460_C8", "vector": [8, 4, 0.783, 0.0005, 4, 0.44, 1.0, 844, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "send_response", "arg_names": [], "import_names": [], "rhs_call_name": "send_response", "annotation": ""}, "snippet": " self.send_response('400 Bad Request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1468_C8", "label": "query_string =", "type": "assigned_variable", "loc": [1468, 1468], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "vector": [14, 2, 0.7846, 0.0005, 2, 0.66, 0.6, 631, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "query_string", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query_string = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1469_C8", "label": "if", "type": "if", "loc": [1469, 1470], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "vector": [4, 2, 0.7854, 0.0011, 2, 0.66, 0.7, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if '?' in path:\n path, query_string = path.split('?', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1470_C12", "label": "path, query_string = split()", "type": "assigned_variable", "loc": [1470, 1470], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1469_C8", "vector": [14, 3, 0.7857, 0.0005, 3, 0.53, 0.0, 600, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "path, query_string", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " path, query_string = path.split('?', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1472_C8", "label": "path = join()", "type": "assigned_variable", "loc": [1472, 1472], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "vector": [14, 2, 0.7867, 0.0005, 2, 0.66, 0.8, 358, 3, 1, 0, 0, 933, 10, 3], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " path = r'%2F'.join([unquote(x) for x in re_SLASH.split(path)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1474_C8", "label": "update()", "type": "expression", "loc": [1474, 1477], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "vector": [8, 2, 0.7886, 0.0021, 2, 0.66, 0.9, 637, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " req.update(path=path,\n query_string=query_string,\n scheme=scheme.lower(),\n host=host)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1478_C8", "label": "return", "type": "return", "loc": [1478, 1478], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "vector": [13, 2, 0.79, 0.0005, 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 req"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1480_C4", "label": "read_headers", "type": "function", "loc": [1480, 1514], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1231_C0", "vector": [2, 1, 0.8001, 0.0187, 1, 0.61, 1.0, 171, 0, 2, 1, 0, 0, 0, 16], "semantic": {"name": "read_headers", "arg_names": ["self", "sock_file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def read_headers(self, sock_file):\n try:\n headers = dict()\n lname = None\n lval = None\n while True:\n l = sock_file.readline()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1481_C8", "label": "try", "type": "try", "loc": [1481, 1512], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1480_C4", "vector": [7, 2, 0.7998, 0.0171, 2, 0.88, 0.0, 0, 0, 1, 0, 0, 0, 0, 16], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n headers = dict()\n lname = None\n lval = None\n while True:\n l = sock_file.readline()\n\n if PY3K:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1482_C12", "label": "headers = dict()", "type": "assigned_variable", "loc": [1482, 1482], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1481_C8", "vector": [14, 3, 0.7921, 0.0005, 3, 0.46, 0.0, 950, 3, 0, 0, 0, 827, 10, 1], "semantic": {"name": "headers", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " headers = dict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1483_C12", "label": "lname =", "type": "assigned_variable", "loc": [1483, 1483], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1481_C8", "vector": [14, 3, 0.7926, 0.0005, 3, 0.46, 0.3333, 878, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "lname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lname = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1484_C12", "label": "lval =", "type": "assigned_variable", "loc": [1484, 1484], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1481_C8", "vector": [14, 3, 0.7932, 0.0005, 3, 0.46, 0.6667, 114, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "lval", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lval = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1485_C12", "label": "while", "type": "while", "loc": [1485, 1509], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1481_C8", "vector": [5, 3, 0.8001, 0.0134, 3, 0.46, 1.0, 0, 1, 0, 0, 0, 0, 0, 14], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n l = sock_file.readline()\n\n if PY3K:\n try:\n l = str(l, 'ISO-8859-1')\n except UnicodeDecodeError:\n self.err_log.warning("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1486_C16", "label": "l = readline()", "type": "assigned_variable", "loc": [1486, 1486], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1485_C12", "vector": [14, 4, 0.7942, 0.0005, 4, 0.79, 0.0, 810, 3, 0, 0, 0, 303, 10, 1], "semantic": {"name": "l", "arg_names": [], "import_names": [], "rhs_call_name": "readline", "annotation": ""}, "snippet": " l = sock_file.readline()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1488_C16", "label": "if", "type": "if", "loc": [1488, 1493], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1485_C12", "vector": [4, 4, 0.7966, 0.0032, 4, 0.79, 0.25, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if PY3K:\n try:\n l = str(l, 'ISO-8859-1')\n except UnicodeDecodeError:\n self.err_log.warning(\n 'Client sent invalid header: ' + repr(l))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1489_C20", "label": "try", "type": "try", "loc": [1489, 1493], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1488_C16", "vector": [7, 5, 0.7969, 0.0027, 5, 0.39, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n l = str(l, 'ISO-8859-1')\n except UnicodeDecodeError:\n self.err_log.warning(\n 'Client sent invalid header: ' + repr(l))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1490_C24", "label": "l = str()", "type": "assigned_variable", "loc": [1490, 1490], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1489_C20", "vector": [14, 6, 0.7964, 0.0005, 6, 0.3, 0.0, 810, 3, 2, 0, 0, 52, 10, 1], "semantic": {"name": "l", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " l = str(l, 'ISO-8859-1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1492_C24", "label": "warning()", "type": "expression", "loc": [1492, 1493], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1489_C20", "vector": [8, 6, 0.7977, 0.0011, 6, 0.3, 0.0, 320, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "warning", "arg_names": [], "import_names": [], "rhs_call_name": "warning", "annotation": ""}, "snippet": " self.err_log.warning(\n 'Client sent invalid header: ' + repr(l))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1495_C16", "label": "if", "type": "if", "loc": [1495, 1496], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1485_C12", "vector": [4, 4, 0.7993, 0.0011, 4, 0.79, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if l.strip().replace('\\0', '') == '':\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1498_C16", "label": "if", "type": "if", "loc": [1498, 1507], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1485_C12", "vector": [4, 4, 0.803, 0.0053, 4, 0.79, 0.75, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if l[0] in ' \\t' and lname:\n # Some headers take more than one line\n lval += ' ' + l.strip()\n else:\n # HTTP header values are latin-1 encoded\n l = l.split(':', 1)\n # HTTP header names are us-ascii encoded\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1503_C20", "label": "l = split()", "type": "assigned_variable", "loc": [1503, 1503], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1498_C16", "vector": [14, 5, 0.8033, 0.0005, 5, 0.7, 0.0, 810, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "l", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " l = l.split(':', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1506_C20", "label": "lname = replace()", "type": "assigned_variable", "loc": [1506, 1506], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1498_C16", "vector": [14, 5, 0.8049, 0.0005, 5, 0.7, 0.5, 878, 3, 2, 0, 0, 293, 10, 3], "semantic": {"name": "lname", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " lname = l[0].strip().upper().replace('-', '_')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1507_C20", "label": "lval = strip()", "type": "assigned_variable", "loc": [1507, 1507], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1498_C16", "vector": [14, 5, 0.8055, 0.0005, 5, 0.7, 1.0, 114, 3, 0, 0, 0, 973, 10, 1], "semantic": {"name": "lval", "arg_names": [], "import_names": [], "rhs_call_name": "strip", "annotation": ""}, "snippet": " lval = l[-1].strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1509_C16", "label": " = str()", "type": "assigned_variable", "loc": [1509, 1509], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1485_C12", "vector": [14, 4, 0.8065, 0.0005, 4, 0.79, 1.0, 0, 3, 1, 0, 0, 52, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " headers[str(lname)] = str(lval)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1514_C8", "label": "return", "type": "return", "loc": [1514, 1514], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1480_C4", "vector": [13, 2, 0.8092, 0.0005, 2, 0.88, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return headers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1517_C0", "label": "SocketTimeout", "type": "class", "loc": [1517, 1519], "level": 0, "parent": null, "vector": [3, 0, 0.8113, 0.0016, 0, 0.66, 0.8602, 625, 0, 0, 0, 0, 645, 0, 0], "semantic": {"name": "SocketTimeout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SocketTimeout(Exception):\n \"Exception for when a socket times out between requests.\"\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1518_C4", "label": "expression", "type": "expression", "loc": [1518, 1518], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1517_C0", "vector": [8, 1, 0.8113, 0.0005, 1, 0.22, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Exception for when a socket times out between requests.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1522_C0", "label": "BadRequest", "type": "class", "loc": [1522, 1524], "level": 0, "parent": null, "vector": [3, 0, 0.814, 0.0016, 0, 0.66, 0.871, 532, 0, 0, 0, 0, 645, 0, 0], "semantic": {"name": "BadRequest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BadRequest(Exception):\n \"Exception for when a client sends an incomprehensible request.\"\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1523_C4", "label": "expression", "type": "expression", "loc": [1523, 1523], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1522_C0", "vector": [8, 1, 0.814, 0.0005, 1, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Exception for when a client sends an incomprehensible request.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1527_C0", "label": "SocketClosed", "type": "class", "loc": [1527, 1529], "level": 0, "parent": null, "vector": [3, 0, 0.8167, 0.0016, 0, 0.66, 0.8817, 491, 0, 0, 0, 0, 645, 0, 0], "semantic": {"name": "SocketClosed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SocketClosed(Exception):\n \"Exception for when a socket is closed by the client.\"\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1528_C4", "label": "expression", "type": "expression", "loc": [1528, 1528], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1527_C0", "vector": [8, 1, 0.8167, 0.0005, 1, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Exception for when a socket is closed by the client.\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1532_C0", "label": "ChunkedReader", "type": "class", "loc": [1532, 1578], "level": 0, "parent": null, "vector": [3, 0, 0.8311, 0.0251, 0, 0.66, 0.8925, 119, 0, 5, 0, 0, 186, 0, 12], "semantic": {"name": "ChunkedReader", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ChunkedReader(object):\n\n def __init__(self, sock_file):\n self.stream = sock_file\n self.chunk_size = 0\n\n def _read_header(self):\n chunk_len = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1534_C4", "label": "__init__", "type": "function", "loc": [1534, 1536], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1532_C0", "vector": [2, 1, 0.8204, 0.0016, 1, 0.06, 0.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "sock_file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, sock_file):\n self.stream = sock_file\n self.chunk_size = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1535_C8", "label": "self.stream =", "type": "assigned_variable", "loc": [1535, 1535], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1534_C4", "vector": [14, 2, 0.8204, 0.0005, 2, 0.06, 0.0, 207, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.stream", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.stream = sock_file"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1536_C8", "label": "self.chunk_size =", "type": "assigned_variable", "loc": [1536, 1536], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1534_C4", "vector": [14, 2, 0.821, 0.0005, 2, 0.06, 1.0, 732, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.chunk_size", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.chunk_size = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1538_C4", "label": "_read_header", "type": "function", "loc": [1538, 1545], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1532_C0", "vector": [2, 1, 0.8239, 0.0043, 1, 0.06, 0.25, 194, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "_read_header", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _read_header(self):\n chunk_len = \"\"\n try:\n while \"\" == chunk_len:\n chunk_len = self.stream.readline().strip()\n return int(chunk_len, 16)\n except ValueError:\n return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1539_C8", "label": "chunk_len =", "type": "assigned_variable", "loc": [1539, 1539], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1538_C4", "vector": [14, 2, 0.8226, 0.0005, 2, 0.58, 0.0, 730, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "chunk_len", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " chunk_len = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1540_C8", "label": "try", "type": "try", "loc": [1540, 1545], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1538_C4", "vector": [7, 2, 0.8244, 0.0032, 2, 0.58, 1.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n while \"\" == chunk_len:\n chunk_len = self.stream.readline().strip()\n return int(chunk_len, 16)\n except ValueError:\n return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1541_C12", "label": "while", "type": "while", "loc": [1541, 1542], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1540_C8", "vector": [5, 3, 0.8239, 0.0011, 3, 0.81, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while \"\" == chunk_len:\n chunk_len = self.stream.readline().strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1542_C16", "label": "chunk_len = strip()", "type": "assigned_variable", "loc": [1542, 1542], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1541_C12", "vector": [14, 4, 0.8242, 0.0005, 4, 0.74, 0.0, 730, 3, 0, 0, 0, 973, 10, 2], "semantic": {"name": "chunk_len", "arg_names": [], "import_names": [], "rhs_call_name": "strip", "annotation": ""}, "snippet": " chunk_len = self.stream.readline().strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1543_C12", "label": "return", "type": "return", "loc": [1543, 1543], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1540_C8", "vector": [13, 3, 0.8247, 0.0005, 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 int(chunk_len, 16)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1545_C12", "label": "return", "type": "return", "loc": [1545, 1545], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1540_C8", "vector": [13, 3, 0.8258, 0.0005, 3, 0.81, 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_467:FunctionDef_L1547_C4", "label": "read", "type": "function", "loc": [1547, 1566], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1532_C0", "vector": [2, 1, 0.8319, 0.0107, 1, 0.06, 0.5, 453, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "read", "arg_names": ["self", "size"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def read(self, size):\n data = b('')\n chunk_size = self.chunk_size\n while size:\n if not chunk_size:\n chunk_size = self._read_header()\n\n if size < chunk_size:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1548_C8", "label": "data = b()", "type": "assigned_variable", "loc": [1548, 1548], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1547_C4", "vector": [14, 2, 0.8274, 0.0005, 2, 0.45, 0.0, 929, 3, 1, 0, 0, 756, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "b", "annotation": ""}, "snippet": " data = b('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1549_C8", "label": "chunk_size =", "type": "assigned_variable", "loc": [1549, 1549], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1547_C4", "vector": [14, 2, 0.8279, 0.0005, 2, 0.45, 0.25, 135, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "chunk_size", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " chunk_size = self.chunk_size"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1550_C8", "label": "while", "type": "while", "loc": [1550, 1563], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1547_C4", "vector": [5, 2, 0.8319, 0.0075, 2, 0.45, 0.5, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while size:\n if not chunk_size:\n chunk_size = self._read_header()\n\n if size < chunk_size:\n data += self.stream.read(size)\n chunk_size -= size\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1551_C12", "label": "if", "type": "if", "loc": [1551, 1552], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1550_C8", "vector": [4, 3, 0.8292, 0.0011, 3, 0.16, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not chunk_size:\n chunk_size = self._read_header()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1552_C16", "label": "chunk_size = _read_header()", "type": "assigned_variable", "loc": [1552, 1552], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1551_C12", "vector": [14, 4, 0.8295, 0.0005, 4, 0.48, 0.0, 135, 3, 0, 0, 0, 194, 10, 1], "semantic": {"name": "chunk_size", "arg_names": [], "import_names": [], "rhs_call_name": "_read_header", "annotation": ""}, "snippet": " chunk_size = self._read_header()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1554_C12", "label": "if", "type": "if", "loc": [1554, 1563], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1550_C8", "vector": [4, 3, 0.833, 0.0053, 3, 0.16, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if size < chunk_size:\n data += self.stream.read(size)\n chunk_size -= size\n break\n else:\n if not chunk_size:\n break\n data += self.stream.read(chunk_size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1559_C16", "label": "if", "type": "if", "loc": [1559, 1560], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1554_C12", "vector": [4, 4, 0.8335, 0.0011, 4, 0.46, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not chunk_size:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1563_C16", "label": "chunk_size =", "type": "assigned_variable", "loc": [1563, 1563], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1554_C12", "vector": [14, 4, 0.8354, 0.0005, 4, 0.46, 1.0, 135, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "chunk_size", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " chunk_size = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1565_C8", "label": "self.chunk_size =", "type": "assigned_variable", "loc": [1565, 1565], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1547_C4", "vector": [14, 2, 0.8365, 0.0005, 2, 0.45, 0.75, 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_467:Return_L1566_C8", "label": "return", "type": "return", "loc": [1566, 1566], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1547_C4", "vector": [13, 2, 0.837, 0.0005, 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 data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1568_C4", "label": "readline", "type": "function", "loc": [1568, 1575], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1532_C0", "vector": [2, 1, 0.8399, 0.0043, 1, 0.06, 0.75, 303, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "readline", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def readline(self):\n data = b('')\n c = self.read(1)\n while c and c != b('\\n'):\n data += c\n c = self.read(1)\n data += c\n return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1569_C8", "label": "data = b()", "type": "assigned_variable", "loc": [1569, 1569], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1568_C4", "vector": [14, 2, 0.8386, 0.0005, 2, 0.44, 0.0, 929, 3, 1, 0, 0, 756, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "b", "annotation": ""}, "snippet": " data = b('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1570_C8", "label": "c = read()", "type": "assigned_variable", "loc": [1570, 1570], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1568_C4", "vector": [14, 2, 0.8391, 0.0005, 2, 0.44, 0.3333, 411, 3, 1, 0, 0, 453, 10, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " c = self.read(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1571_C8", "label": "while", "type": "while", "loc": [1571, 1573], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1568_C4", "vector": [5, 2, 0.8402, 0.0016, 2, 0.44, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while c and c != b('\\n'):\n data += c\n c = self.read(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1573_C12", "label": "c = read()", "type": "assigned_variable", "loc": [1573, 1573], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1571_C8", "vector": [14, 3, 0.8407, 0.0005, 3, 0.69, 0.0, 411, 3, 1, 0, 0, 453, 10, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " c = self.read(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1575_C8", "label": "return", "type": "return", "loc": [1575, 1575], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1568_C4", "vector": [13, 2, 0.8418, 0.0005, 2, 0.44, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1577_C4", "label": "readlines", "type": "function", "loc": [1577, 1578], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1532_C0", "vector": [2, 1, 0.8431, 0.0011, 1, 0.06, 1.0, 841, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "readlines", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def readlines(self):\n yield self.readline()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1578_C8", "label": "expression", "type": "expression", "loc": [1578, 1578], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1577_C4", "vector": [8, 2, 0.8434, 0.0005, 2, 0.24, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield self.readline()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1581_C0", "label": "get_method", "type": "function", "loc": [1581, 1583], "level": 0, "parent": null, "vector": [2, 0, 0.8455, 0.0016, 0, 0.66, 0.9032, 872, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "get_method", "arg_names": ["method"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_method(method):\n methods = dict(wsgi=WSGIWorker)\n return methods[method.lower()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1582_C4", "label": "methods = dict()", "type": "assigned_variable", "loc": [1582, 1582], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1581_C0", "vector": [14, 1, 0.8455, 0.0005, 1, 0.02, 0.0, 110, 3, 1, 0, 0, 827, 10, 1], "semantic": {"name": "methods", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " methods = dict(wsgi=WSGIWorker)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1583_C4", "label": "return", "type": "return", "loc": [1583, 1583], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1581_C0", "vector": [13, 1, 0.8461, 0.0005, 1, 0.02, 1.0, 0, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return methods[method.lower()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Import_L1592_C0", "label": "sys import sys", "type": "import", "loc": [1592, 1592], "level": 0, "parent": null, "vector": [1, 0, 0.8509, 0.0005, 0, 0.66, 0.914, 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_467:Import_L1593_C0", "label": "socket import socket", "type": "import", "loc": [1593, 1593], "level": 0, "parent": null, "vector": [1, 0, 0.8514, 0.0005, 0, 0.66, 0.9247, 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_467:ImportFrom_L1594_C0", "label": "from wsgiref.headers import Headers", "type": "import", "loc": [1594, 1594], "level": 0, "parent": null, "vector": [1, 0, 0.852, 0.0005, 0, 0.66, 0.9355, 955, 0, 1, 0, 0, 955, 0, 0], "semantic": {"name": "wsgiref.headers", "arg_names": [], "import_names": ["Headers"], "rhs_call_name": "", "annotation": ""}, "snippet": "from wsgiref.headers import Headers"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L1595_C0", "label": "from wsgiref.util import FileWrapper", "type": "import", "loc": [1595, 1595], "level": 0, "parent": null, "vector": [1, 0, 0.8525, 0.0005, 0, 0.66, 0.9462, 913, 0, 1, 0, 0, 913, 0, 0], "semantic": {"name": "wsgiref.util", "arg_names": [], "import_names": ["FileWrapper"], "rhs_call_name": "", "annotation": ""}, "snippet": "from wsgiref.util import FileWrapper"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1600_C0", "label": "if", "type": "if", "loc": [1600, 1604], "level": 0, "parent": null, "vector": [4, 0, 0.8562, 0.0027, 0, 0.66, 0.957, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if PY3K:\n from email.utils import formatdate\nelse:\n # Caps Utils for Py2.4 compatibility\n from email.Utils import formatdate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L1601_C4", "label": "from email.utils import formatdate", "type": "import", "loc": [1601, 1601], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1600_C0", "vector": [1, 1, 0.8557, 0.0005, 1, 0.82, 0.0, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "email.utils", "arg_names": [], "import_names": ["formatdate"], "rhs_call_name": "", "annotation": ""}, "snippet": " from email.utils import formatdate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L1604_C4", "label": "from email.Utils import formatdate", "type": "import", "loc": [1604, 1604], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1600_C0", "vector": [1, 1, 0.8573, 0.0005, 1, 0.82, 1.0, 589, 0, 1, 0, 0, 589, 0, 0], "semantic": {"name": "email.Utils", "arg_names": [], "import_names": ["formatdate"], "rhs_call_name": "", "annotation": ""}, "snippet": " from email.Utils import formatdate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1607_C0", "label": "NEWLINE = b()", "type": "assigned_variable", "loc": [1607, 1607], "level": 0, "parent": null, "vector": [14, 0, 0.8589, 0.0005, 0, 0.66, 0.9677, 766, 3, 1, 0, 0, 756, 10, 1], "semantic": {"name": "NEWLINE", "arg_names": [], "import_names": [], "rhs_call_name": "b", "annotation": ""}, "snippet": "NEWLINE = b('\\r\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1608_C0", "label": "HEADER_RESPONSE =", "type": "assigned_variable", "loc": [1608, 1608], "level": 0, "parent": null, "vector": [14, 0, 0.8594, 0.0005, 0, 0.66, 0.9785, 465, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "HEADER_RESPONSE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "HEADER_RESPONSE = '''HTTP/1.1 %s\\r\\n%s'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1609_C0", "label": "BASE_ENV =", "type": "assigned_variable", "loc": [1609, 1616], "level": 0, "parent": null, "vector": [14, 0, 0.8618, 0.0043, 0, 0.66, 0.9892, 540, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "BASE_ENV", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "BASE_ENV = {'SERVER_NAME': SERVER_NAME,\n 'SCRIPT_NAME': '', # Direct call WSGI does not need a name\n 'wsgi.errors': sys.stderr,\n 'wsgi.version': (1, 0),\n 'wsgi.multiprocess': False,\n 'wsgi.run_once': False,\n 'wsgi.file_wrapper': FileWrapper\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1619_C0", "label": "WSGIWorker", "type": "class", "loc": [1619, 1869], "level": 0, "parent": null, "vector": [3, 0, 0.9321, 0.1342, 0, 0.66, 1.0, 683, 0, 7, 0, 0, 570, 0, 77], "semantic": {"name": "WSGIWorker", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WSGIWorker(Worker):\n def __init__(self, *args, **kwargs):\n \"\"\"Builds some instance variables that will last the life of the\n thread.\"\"\"\n Worker.__init__(self, *args, **kwargs)\n\n if isinstance(self.app_info, dict):\n multithreaded = self.app_info.get('max_threads') != 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1620_C4", "label": "__init__", "type": "function", "loc": [1620, 1645], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1619_C0", "vector": [2, 1, 0.8725, 0.0139, 1, 0.98, 0.0, 555, 0, 3, 0, 0, 0, 0, 11], "semantic": {"name": "__init__", "arg_names": ["self", "args", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *args, **kwargs):\n \"\"\"Builds some instance variables that will last the life of the\n thread.\"\"\"\n Worker.__init__(self, *args, **kwargs)\n\n if isinstance(self.app_info, dict):\n multithreaded = self.app_info.get('max_threads') != 1\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1621_C8", "label": "expression", "type": "expression", "loc": [1621, 1622], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1620_C4", "vector": [8, 2, 0.8666, 0.0011, 2, 0.35, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Builds some instance variables that will last the life of the\n thread.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1623_C8", "label": "__init__()", "type": "expression", "loc": [1623, 1623], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1620_C4", "vector": [8, 2, 0.8675, 0.0005, 2, 0.35, 0.1429, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " Worker.__init__(self, *args, **kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1625_C8", "label": "if", "type": "if", "loc": [1625, 1628], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1620_C4", "vector": [4, 2, 0.8693, 0.0021, 2, 0.35, 0.2857, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(self.app_info, dict):\n multithreaded = self.app_info.get('max_threads') != 1\n else:\n multithreaded = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1626_C12", "label": "multithreaded =", "type": "assigned_variable", "loc": [1626, 1626], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1625_C8", "vector": [14, 3, 0.8691, 0.0005, 3, 0.19, 0.0, 858, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "multithreaded", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " multithreaded = self.app_info.get('max_threads') != 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1628_C12", "label": "multithreaded =", "type": "assigned_variable", "loc": [1628, 1628], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1625_C8", "vector": [14, 3, 0.8701, 0.0005, 3, 0.19, 1.0, 858, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "multithreaded", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " multithreaded = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1629_C8", "label": "self.base_environ = dict()", "type": "assigned_variable", "loc": [1629, 1632], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1620_C4", "vector": [14, 2, 0.8715, 0.0021, 2, 0.35, 0.4286, 627, 3, 1, 0, 0, 827, 10, 1], "semantic": {"name": "self.base_environ", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " self.base_environ = dict(\n {'SERVER_SOFTWARE': self.app_info['server_software'],\n 'wsgi.multithread': multithreaded,\n })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1633_C8", "label": "update()", "type": "expression", "loc": [1633, 1633], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1620_C4", "vector": [8, 2, 0.8728, 0.0005, 2, 0.35, 0.5714, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.base_environ.update(BASE_ENV)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1636_C8", "label": "self.app = get()", "type": "assigned_variable", "loc": [1636, 1636], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1620_C4", "vector": [14, 2, 0.8744, 0.0005, 2, 0.35, 0.7143, 809, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self.app", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.app = self.app_info.get('wsgi_app')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1638_C8", "label": "if", "type": "if", "loc": [1638, 1639], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1620_C4", "vector": [4, 2, 0.8757, 0.0011, 2, 0.35, 0.8571, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hasattr(self.app, \"__call__\"):\n raise TypeError(\"The wsgi_app specified (%s) is not a valid WSGI application.\" % repr(self.app))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1642_C8", "label": "if", "type": "if", "loc": [1642, 1645], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1620_C4", "vector": [4, 2, 0.8784, 0.0021, 2, 0.35, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if has_futures and self.app_info.get('futures'):\n executor = self.app_info['executor']\n self.base_environ.update({\"wsgiorg.executor\": executor,\n \"wsgiorg.futures\": executor.futures})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1643_C12", "label": "executor =", "type": "assigned_variable", "loc": [1643, 1643], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1642_C8", "vector": [14, 3, 0.8781, 0.0005, 3, 0.57, 0.0, 225, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "executor", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " executor = self.app_info['executor']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1644_C12", "label": "update()", "type": "expression", "loc": [1644, 1645], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1642_C8", "vector": [8, 3, 0.8789, 0.0011, 3, 0.57, 1.0, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.base_environ.update({\"wsgiorg.executor\": executor,\n \"wsgiorg.futures\": executor.futures})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "label": "build_environ", "type": "function", "loc": [1647, 1693], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1619_C0", "vector": [2, 1, 0.8926, 0.0251, 1, 0.98, 0.1667, 496, 0, 3, 1, 0, 0, 0, 14], "semantic": {"name": "build_environ", "arg_names": ["self", "sock_file", "conn"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_environ(self, sock_file, conn):\n \"\"\" Build the execution environment. \"\"\"\n # Grab the request line\n request = self.read_request_line(sock_file)\n\n # Copy the Base Environment\n environ = self.base_environ.copy()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1648_C8", "label": "expression", "type": "expression", "loc": [1648, 1648], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "vector": [8, 2, 0.8808, 0.0005, 2, 0.58, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Build the execution environment. \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1650_C8", "label": "request = read_request_line()", "type": "assigned_variable", "loc": [1650, 1650], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "vector": [14, 2, 0.8819, 0.0005, 2, 0.58, 0.0625, 50, 3, 1, 0, 0, 124, 10, 1], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "read_request_line", "annotation": ""}, "snippet": " request = self.read_request_line(sock_file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1653_C8", "label": "environ = copy()", "type": "assigned_variable", "loc": [1653, 1653], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "vector": [14, 2, 0.8835, 0.0005, 2, 0.58, 0.125, 422, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "environ", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " environ = self.base_environ.copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1656_C8", "label": "for k, v", "type": "for", "loc": [1656, 1657], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "vector": [6, 2, 0.8854, 0.0011, 2, 0.58, 0.1875, 867, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in self.read_headers(sock_file).iteritems():\n environ[str('HTTP_' + k)] = v"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1657_C12", "label": "assign", "type": "assigned_variable", "loc": [1657, 1657], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1656_C8", "vector": [14, 3, 0.8856, 0.0005, 3, 0.07, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ[str('HTTP_' + k)] = v"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1660_C8", "label": "assign", "type": "assigned_variable", "loc": [1660, 1660], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "vector": [14, 2, 0.8872, 0.0005, 2, 0.58, 0.25, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['REQUEST_METHOD'] = request['method']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1661_C8", "label": "assign", "type": "assigned_variable", "loc": [1661, 1661], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "vector": [14, 2, 0.8878, 0.0005, 2, 0.58, 0.3125, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['PATH_INFO'] = request['path']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1662_C8", "label": "assign", "type": "assigned_variable", "loc": [1662, 1662], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "vector": [14, 2, 0.8883, 0.0005, 2, 0.58, 0.375, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['SERVER_PROTOCOL'] = request['protocol']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1663_C8", "label": " = str()", "type": "assigned_variable", "loc": [1663, 1663], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "vector": [14, 2, 0.8888, 0.0005, 2, 0.58, 0.4375, 0, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " environ['SERVER_PORT'] = str(conn.server_port)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1664_C8", "label": " = str()", "type": "assigned_variable", "loc": [1664, 1664], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "vector": [14, 2, 0.8894, 0.0005, 2, 0.58, 0.5, 0, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " environ['REMOTE_PORT'] = str(conn.client_port)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1665_C8", "label": " = str()", "type": "assigned_variable", "loc": [1665, 1665], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "vector": [14, 2, 0.8899, 0.0005, 2, 0.58, 0.5625, 0, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " environ['REMOTE_ADDR'] = str(conn.client_addr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1666_C8", "label": "assign", "type": "assigned_variable", "loc": [1666, 1666], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "vector": [14, 2, 0.8904, 0.0005, 2, 0.58, 0.625, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['QUERY_STRING'] = request['query_string']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1667_C8", "label": "if", "type": "if", "loc": [1667, 1668], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "vector": [4, 2, 0.8912, 0.0011, 2, 0.58, 0.6875, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'HTTP_CONTENT_LENGTH' in environ:\n environ['CONTENT_LENGTH'] = environ['HTTP_CONTENT_LENGTH']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1668_C12", "label": "assign", "type": "assigned_variable", "loc": [1668, 1668], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1667_C8", "vector": [14, 3, 0.8915, 0.0005, 3, 0.19, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['CONTENT_LENGTH'] = environ['HTTP_CONTENT_LENGTH']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1669_C8", "label": "if", "type": "if", "loc": [1669, 1670], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "vector": [4, 2, 0.8923, 0.0011, 2, 0.58, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'HTTP_CONTENT_TYPE' in environ:\n environ['CONTENT_TYPE'] = environ['HTTP_CONTENT_TYPE']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1670_C12", "label": "assign", "type": "assigned_variable", "loc": [1670, 1670], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1669_C8", "vector": [14, 3, 0.8926, 0.0005, 3, 0.54, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['CONTENT_TYPE'] = environ['HTTP_CONTENT_TYPE']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1673_C8", "label": "self.request_method =", "type": "assigned_variable", "loc": [1673, 1673], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "vector": [14, 2, 0.8942, 0.0005, 2, 0.58, 0.8125, 137, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.request_method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.request_method = environ['REQUEST_METHOD']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1676_C8", "label": "if", "type": "if", "loc": [1676, 1686], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "vector": [4, 2, 0.8985, 0.0059, 2, 0.58, 0.875, 0, 7, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if conn.ssl:\n environ['wsgi.url_scheme'] = 'https'\n environ['HTTPS'] = 'on'\n try:\n peercert = conn.socket.getpeercert(binary_form=True)\n environ['SSL_CLIENT_RAW_CERT'] = \\\n peercert and ssl.DER_cert_to_PEM_cert(peercert)\n except Exception:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1677_C12", "label": "assign", "type": "assigned_variable", "loc": [1677, 1677], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1676_C8", "vector": [14, 3, 0.8963, 0.0005, 3, 0.17, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['wsgi.url_scheme'] = 'https'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1678_C12", "label": "assign", "type": "assigned_variable", "loc": [1678, 1678], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1676_C8", "vector": [14, 3, 0.8968, 0.0005, 3, 0.17, 0.3333, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['HTTPS'] = 'on'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1679_C12", "label": "try", "type": "try", "loc": [1679, 1684], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1676_C8", "vector": [7, 3, 0.8987, 0.0032, 3, 0.17, 0.6667, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n peercert = conn.socket.getpeercert(binary_form=True)\n environ['SSL_CLIENT_RAW_CERT'] = \\\n peercert and ssl.DER_cert_to_PEM_cert(peercert)\n except Exception:\n print(sys.exc_info()[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1680_C16", "label": "peercert = getpeercert()", "type": "assigned_variable", "loc": [1680, 1680], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1679_C12", "vector": [14, 4, 0.8979, 0.0005, 4, 0.29, 0.0, 84, 3, 1, 0, 0, 516, 10, 1], "semantic": {"name": "peercert", "arg_names": [], "import_names": [], "rhs_call_name": "getpeercert", "annotation": ""}, "snippet": " peercert = conn.socket.getpeercert(binary_form=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1681_C16", "label": "assign", "type": "assigned_variable", "loc": [1681, 1682], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1679_C12", "vector": [14, 4, 0.8987, 0.0011, 4, 0.29, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['SSL_CLIENT_RAW_CERT'] = \\\n peercert and ssl.DER_cert_to_PEM_cert(peercert)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1684_C16", "label": "print()", "type": "expression", "loc": [1684, 1684], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1679_C12", "vector": [8, 4, 0.9001, 0.0005, 4, 0.29, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(sys.exc_info()[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1686_C12", "label": "assign", "type": "assigned_variable", "loc": [1686, 1686], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1676_C8", "vector": [14, 3, 0.9011, 0.0005, 3, 0.17, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['wsgi.url_scheme'] = 'http'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1688_C8", "label": "if", "type": "if", "loc": [1688, 1691], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "vector": [4, 2, 0.903, 0.0021, 2, 0.58, 0.9375, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if environ.get('HTTP_TRANSFER_ENCODING', '') == 'chunked':\n environ['wsgi.input'] = ChunkedReader(sock_file)\n else:\n environ['wsgi.input'] = sock_file"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1689_C12", "label": " = ChunkedReader()", "type": "assigned_variable", "loc": [1689, 1689], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1688_C8", "vector": [14, 3, 0.9027, 0.0005, 3, 0.98, 0.0, 0, 3, 1, 0, 0, 119, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "ChunkedReader", "annotation": ""}, "snippet": " environ['wsgi.input'] = ChunkedReader(sock_file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1691_C12", "label": "assign", "type": "assigned_variable", "loc": [1691, 1691], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1688_C8", "vector": [14, 3, 0.9038, 0.0005, 3, 0.98, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['wsgi.input'] = sock_file"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1693_C8", "label": "return", "type": "return", "loc": [1693, 1693], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "vector": [13, 2, 0.9049, 0.0005, 2, 0.58, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return environ"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "label": "send_headers", "type": "function", "loc": [1695, 1751], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1619_C0", "vector": [2, 1, 0.9209, 0.0305, 1, 0.98, 0.3333, 143, 0, 3, 0, 0, 0, 0, 18], "semantic": {"name": "send_headers", "arg_names": ["self", "data", "sections"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def send_headers(self, data, sections):\n h_set = self.header_set\n\n # Does the app want us to send output chunked?\n self.chunked = h_set.get('Transfer-Encoding', '').lower() == 'chunked'\n\n # Add a Date header if it's not there already\n if not 'Date' in h_set:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1696_C8", "label": "h_set =", "type": "assigned_variable", "loc": [1696, 1696], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "vector": [14, 2, 0.9065, 0.0005, 2, 0.44, 0.0, 5, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "h_set", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " h_set = self.header_set"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1699_C8", "label": "self.chunked =", "type": "assigned_variable", "loc": [1699, 1699], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "vector": [14, 2, 0.9081, 0.0005, 2, 0.44, 0.1, 174, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "self.chunked", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.chunked = h_set.get('Transfer-Encoding', '').lower() == 'chunked'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1702_C8", "label": "if", "type": "if", "loc": [1702, 1703], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "vector": [4, 2, 0.9099, 0.0011, 2, 0.44, 0.2, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not 'Date' in h_set:\n h_set['Date'] = formatdate(usegmt=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1703_C12", "label": " = formatdate()", "type": "assigned_variable", "loc": [1703, 1703], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1702_C8", "vector": [14, 3, 0.9102, 0.0005, 3, 0.29, 0.0, 0, 3, 1, 0, 0, 722, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "formatdate", "annotation": ""}, "snippet": " h_set['Date'] = formatdate(usegmt=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1706_C8", "label": "if", "type": "if", "loc": [1706, 1707], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "vector": [4, 2, 0.9121, 0.0011, 2, 0.44, 0.3, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not 'Server' in h_set:\n h_set['Server'] = HTTP_SERVER_SOFTWARE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1707_C12", "label": "assign", "type": "assigned_variable", "loc": [1707, 1707], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1706_C8", "vector": [14, 3, 0.9123, 0.0005, 3, 0.48, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " h_set['Server'] = HTTP_SERVER_SOFTWARE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1709_C8", "label": "if", "type": "if", "loc": [1709, 1724], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "vector": [4, 2, 0.9174, 0.0086, 2, 0.44, 0.4, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'Content-Length' in h_set:\n self.size = int(h_set['Content-Length'])\n else:\n s = int(self.status.split(' ')[0])\n if (s < 200 or s not in (204, 205, 304)) and not self.chunked:\n if sections == 1 or self.protocol != 'HTTP/1.1':\n # Add a Content-Length header because it's not there\n self.size = len(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1710_C12", "label": "self.size = int()", "type": "assigned_variable", "loc": [1710, 1710], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1709_C8", "vector": [14, 3, 0.9139, 0.0005, 3, 0.33, 0.0, 183, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "self.size", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " self.size = int(h_set['Content-Length'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1712_C12", "label": "s = int()", "type": "assigned_variable", "loc": [1712, 1712], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1709_C8", "vector": [14, 3, 0.915, 0.0005, 3, 0.33, 0.5, 553, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " s = int(self.status.split(' ')[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1713_C12", "label": "if", "type": "if", "loc": [1713, 1724], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1709_C8", "vector": [4, 3, 0.9185, 0.0064, 3, 0.33, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (s < 200 or s not in (204, 205, 304)) and not self.chunked:\n if sections == 1 or self.protocol != 'HTTP/1.1':\n # Add a Content-Length header because it's not there\n self.size = len(data)\n h_set['Content-Length'] = str(self.size)\n else:\n # If they sent us more than one section, we blow chunks\n h_set['Transfer-Encoding'] = 'Chunked'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1714_C16", "label": "if", "type": "if", "loc": [1714, 1724], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1713_C12", "vector": [4, 4, 0.9188, 0.0059, 4, 0.81, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if sections == 1 or self.protocol != 'HTTP/1.1':\n # Add a Content-Length header because it's not there\n self.size = len(data)\n h_set['Content-Length'] = str(self.size)\n else:\n # If they sent us more than one section, we blow chunks\n h_set['Transfer-Encoding'] = 'Chunked'\n self.chunked = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1716_C20", "label": "self.size = len()", "type": "assigned_variable", "loc": [1716, 1716], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1714_C16", "vector": [14, 5, 0.9172, 0.0005, 5, 0.9, 0.0, 183, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "self.size", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " self.size = len(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1717_C20", "label": " = str()", "type": "assigned_variable", "loc": [1717, 1717], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1714_C16", "vector": [14, 5, 0.9177, 0.0005, 5, 0.9, 0.25, 0, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " h_set['Content-Length'] = str(self.size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1720_C20", "label": "assign", "type": "assigned_variable", "loc": [1720, 1720], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1714_C16", "vector": [14, 5, 0.9193, 0.0005, 5, 0.9, 0.5, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " h_set['Transfer-Encoding'] = 'Chunked'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1721_C20", "label": "self.chunked =", "type": "assigned_variable", "loc": [1721, 1721], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1714_C16", "vector": [14, 5, 0.9198, 0.0005, 5, 0.9, 0.75, 174, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.chunked", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.chunked = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1722_C20", "label": "if", "type": "if", "loc": [1722, 1724], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1714_C16", "vector": [4, 5, 0.9209, 0.0016, 5, 0.9, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.err_log.debug('Adding header...'\n 'Transfer-Encoding: Chunked')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1723_C24", "label": "debug()", "type": "expression", "loc": [1723, 1724], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1722_C20", "vector": [8, 6, 0.9212, 0.0011, 6, 0.95, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.err_log.debug('Adding header...'\n 'Transfer-Encoding: Chunked')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1726_C8", "label": "if", "type": "if", "loc": [1726, 1739], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "vector": [4, 2, 0.926, 0.0075, 2, 0.44, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'Connection' not in h_set:\n # If the application did not provide a connection header,\n # fill it in\n client_conn = self.environ.get('HTTP_CONNECTION', '').lower()\n if self.environ['SERVER_PROTOCOL'] == 'HTTP/1.1':\n # HTTP = 1.1 defaults to keep-alive connections\n if client_conn:\n h_set['Connection'] = client_conn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1729_C12", "label": "client_conn = lower()", "type": "assigned_variable", "loc": [1729, 1729], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1726_C8", "vector": [14, 3, 0.9241, 0.0005, 3, 0.24, 0.0, 34, 3, 0, 0, 0, 432, 10, 2], "semantic": {"name": "client_conn", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " client_conn = self.environ.get('HTTP_CONNECTION', '').lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1730_C12", "label": "if", "type": "if", "loc": [1730, 1739], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1726_C8", "vector": [4, 3, 0.927, 0.0053, 3, 0.24, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.environ['SERVER_PROTOCOL'] == 'HTTP/1.1':\n # HTTP = 1.1 defaults to keep-alive connections\n if client_conn:\n h_set['Connection'] = client_conn\n else:\n h_set['Connection'] = 'keep-alive'\n else:\n # HTTP < 1.1 supports keep-alive but it's quirky"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1732_C16", "label": "if", "type": "if", "loc": [1732, 1735], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1730_C12", "vector": [4, 4, 0.9265, 0.0021, 4, 0.52, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if client_conn:\n h_set['Connection'] = client_conn\n else:\n h_set['Connection'] = 'keep-alive'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1733_C20", "label": "assign", "type": "assigned_variable", "loc": [1733, 1733], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1732_C16", "vector": [14, 5, 0.9262, 0.0005, 5, 0.56, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " h_set['Connection'] = client_conn"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1735_C20", "label": "assign", "type": "assigned_variable", "loc": [1735, 1735], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1732_C16", "vector": [14, 5, 0.9273, 0.0005, 5, 0.56, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " h_set['Connection'] = 'keep-alive'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1739_C16", "label": "assign", "type": "assigned_variable", "loc": [1739, 1739], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1730_C12", "vector": [14, 4, 0.9294, 0.0005, 4, 0.52, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " h_set['Connection'] = 'close'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1742_C8", "label": "self.closeConnection =", "type": "assigned_variable", "loc": [1742, 1742], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "vector": [14, 2, 0.9311, 0.0005, 2, 0.44, 0.6, 565, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "self.closeConnection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.closeConnection = h_set.get('Connection', '').lower() == 'close'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1745_C8", "label": "header_data =", "type": "assigned_variable", "loc": [1745, 1745], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "vector": [14, 2, 0.9327, 0.0005, 2, 0.44, 0.7, 476, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "header_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " header_data = HEADER_RESPONSE % (self.status, str(h_set))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1748_C8", "label": "if", "type": "if", "loc": [1748, 1749], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "vector": [4, 2, 0.9345, 0.0011, 2, 0.44, 0.8, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.err_log.debug('Sending Headers: %s' % repr(header_data))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1749_C12", "label": "debug()", "type": "expression", "loc": [1749, 1749], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1748_C8", "vector": [8, 3, 0.9348, 0.0005, 3, 0.78, 0.0, 924, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.err_log.debug('Sending Headers: %s' % repr(header_data))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1750_C8", "label": "sendall()", "type": "expression", "loc": [1750, 1750], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "vector": [8, 2, 0.9353, 0.0005, 2, 0.44, 0.9, 874, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sendall", "arg_names": [], "import_names": [], "rhs_call_name": "sendall", "annotation": ""}, "snippet": " self.conn.sendall(b(header_data))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1751_C8", "label": "self.headers_sent =", "type": "assigned_variable", "loc": [1751, 1751], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "vector": [14, 2, 0.9359, 0.0005, 2, 0.44, 1.0, 131, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.headers_sent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.headers_sent = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1753_C4", "label": "write_warning", "type": "function", "loc": [1753, 1756], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1619_C0", "vector": [2, 1, 0.9377, 0.0021, 1, 0.98, 0.5, 263, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "write_warning", "arg_names": ["self", "data", "sections"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def write_warning(self, data, sections=None):\n self.err_log.warning('WSGI app called write method directly. This is '\n 'deprecated behavior. Please update your app.')\n return self.write(data, sections)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1754_C8", "label": "warning()", "type": "expression", "loc": [1754, 1755], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1753_C4", "vector": [8, 2, 0.9377, 0.0011, 2, 0.89, 0.0, 320, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warning", "arg_names": [], "import_names": [], "rhs_call_name": "warning", "annotation": ""}, "snippet": " self.err_log.warning('WSGI app called write method directly. This is '\n 'deprecated behavior. Please update your app.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1756_C8", "label": "return", "type": "return", "loc": [1756, 1756], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1753_C4", "vector": [13, 2, 0.9385, 0.0005, 2, 0.89, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.write(data, sections)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1758_C4", "label": "write", "type": "function", "loc": [1758, 1779], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1619_C0", "vector": [2, 1, 0.9452, 0.0118, 1, 0.98, 0.6667, 837, 0, 3, 0, 0, 0, 0, 6], "semantic": {"name": "write", "arg_names": ["self", "data", "sections"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def write(self, data, sections=None):\n \"\"\" Write the data to the output socket. \"\"\"\n\n if self.error[0]:\n self.status = self.error[0]\n data = b(self.error[1])\n\n if not self.headers_sent:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1759_C8", "label": "expression", "type": "expression", "loc": [1759, 1759], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1758_C4", "vector": [8, 2, 0.9401, 0.0005, 2, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Write the data to the output socket. \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1761_C8", "label": "if", "type": "if", "loc": [1761, 1763], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1758_C4", "vector": [4, 2, 0.9417, 0.0016, 2, 0.91, 0.3333, 0, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.error[0]:\n self.status = self.error[0]\n data = b(self.error[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1762_C12", "label": "self.status =", "type": "assigned_variable", "loc": [1762, 1762], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1761_C8", "vector": [14, 3, 0.9417, 0.0005, 3, 0.24, 0.0, 651, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.status = self.error[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1763_C12", "label": "data = b()", "type": "assigned_variable", "loc": [1763, 1763], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1761_C8", "vector": [14, 3, 0.9423, 0.0005, 3, 0.24, 1.0, 929, 3, 1, 0, 0, 756, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "b", "annotation": ""}, "snippet": " data = b(self.error[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1765_C8", "label": "if", "type": "if", "loc": [1765, 1766], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1758_C4", "vector": [4, 2, 0.9436, 0.0011, 2, 0.91, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.headers_sent:\n self.send_headers(data, sections)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1766_C12", "label": "send_headers()", "type": "expression", "loc": [1766, 1766], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1765_C8", "vector": [8, 3, 0.9439, 0.0005, 3, 0.58, 0.0, 143, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "send_headers", "arg_names": [], "import_names": [], "rhs_call_name": "send_headers", "annotation": ""}, "snippet": " self.send_headers(data, sections)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1768_C8", "label": "if", "type": "if", "loc": [1768, 1779], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1758_C4", "vector": [4, 2, 0.9479, 0.0064, 2, 0.91, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.request_method != 'HEAD':\n try:\n if self.chunked:\n self.conn.sendall(b('%x\\r\\n%s\\r\\n' % (len(data), data)))\n else:\n self.conn.sendall(data)\n except socket.timeout:\n self.closeConnection = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1769_C12", "label": "try", "type": "try", "loc": [1769, 1779], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1768_C8", "vector": [7, 3, 0.9482, 0.0059, 3, 0.54, 0.0, 0, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if self.chunked:\n self.conn.sendall(b('%x\\r\\n%s\\r\\n' % (len(data), data)))\n else:\n self.conn.sendall(data)\n except socket.timeout:\n self.closeConnection = True\n except socket.error:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1770_C16", "label": "if", "type": "if", "loc": [1770, 1773], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1769_C12", "vector": [4, 4, 0.9468, 0.0021, 4, 0.22, 0.0, 0, 7, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.chunked:\n self.conn.sendall(b('%x\\r\\n%s\\r\\n' % (len(data), data)))\n else:\n self.conn.sendall(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1771_C20", "label": "sendall()", "type": "expression", "loc": [1771, 1771], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1770_C16", "vector": [8, 5, 0.9466, 0.0005, 5, 0.35, 0.0, 874, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "sendall", "arg_names": [], "import_names": [], "rhs_call_name": "sendall", "annotation": ""}, "snippet": " self.conn.sendall(b('%x\\r\\n%s\\r\\n' % (len(data), data)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1773_C20", "label": "sendall()", "type": "expression", "loc": [1773, 1773], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1770_C16", "vector": [8, 5, 0.9476, 0.0005, 5, 0.35, 1.0, 874, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sendall", "arg_names": [], "import_names": [], "rhs_call_name": "sendall", "annotation": ""}, "snippet": " self.conn.sendall(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1775_C16", "label": "self.closeConnection =", "type": "assigned_variable", "loc": [1775, 1775], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1769_C12", "vector": [14, 4, 0.9487, 0.0005, 4, 0.22, 0.0, 565, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.closeConnection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.closeConnection = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1779_C16", "label": "self.closeConnection =", "type": "assigned_variable", "loc": [1779, 1779], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1769_C12", "vector": [14, 4, 0.9508, 0.0005, 4, 0.22, 0.0, 565, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.closeConnection", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.closeConnection = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1781_C4", "label": "start_response", "type": "function", "loc": [1781, 1808], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1619_C0", "vector": [2, 1, 0.9591, 0.015, 1, 0.98, 0.8333, 638, 0, 4, 1, 0, 0, 0, 5], "semantic": {"name": "start_response", "arg_names": ["self", "status", "response_headers", "exc_info"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def start_response(self, status, response_headers, exc_info=None):\n \"\"\" Store the HTTP status and headers to be sent when self.write is\n called. \"\"\"\n if exc_info:\n try:\n if self.headers_sent:\n # Re-raise original exception if headers sent\n # because this violates WSGI specification."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1782_C8", "label": "expression", "type": "expression", "loc": [1782, 1783], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1781_C4", "vector": [8, 2, 0.9527, 0.0011, 2, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Store the HTTP status and headers to be sent when self.write is\n called. \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1784_C8", "label": "if", "type": "if", "loc": [1784, 1793], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1781_C4", "vector": [4, 2, 0.9559, 0.0053, 2, 0.05, 0.25, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if exc_info:\n try:\n if self.headers_sent:\n # Re-raise original exception if headers sent\n # because this violates WSGI specification.\n raise\n finally:\n exc_info = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1785_C12", "label": "try", "type": "try", "loc": [1785, 1791], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1784_C8", "vector": [7, 3, 0.9556, 0.0037, 3, 0.6, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if self.headers_sent:\n # Re-raise original exception if headers sent\n # because this violates WSGI specification.\n raise\n finally:\n exc_info = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1786_C16", "label": "if", "type": "if", "loc": [1786, 1789], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1785_C12", "vector": [4, 4, 0.9554, 0.0021, 4, 0.29, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.headers_sent:\n # Re-raise original exception if headers sent\n # because this violates WSGI specification.\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1791_C16", "label": "exc_info =", "type": "assigned_variable", "loc": [1791, 1791], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1785_C12", "vector": [14, 4, 0.9572, 0.0005, 4, 0.29, 1.0, 289, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "exc_info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " exc_info = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1792_C8", "label": "if", "type": "if", "loc": [1792, 1793], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1784_C8", "vector": [4, 3, 0.958, 0.0011, 3, 0.6, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.header_set:\n raise AssertionError(\"Headers already set!\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1795_C8", "label": "if", "type": "if", "loc": [1795, 1798], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1781_C4", "vector": [4, 2, 0.9602, 0.0021, 2, 0.05, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if PY3K and not isinstance(status, str):\n self.status = str(status, 'ISO-8859-1')\n else:\n self.status = status"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1796_C12", "label": "self.status = str()", "type": "assigned_variable", "loc": [1796, 1796], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1795_C8", "vector": [14, 3, 0.9599, 0.0005, 3, 0.88, 0.0, 651, 3, 2, 0, 0, 52, 10, 1], "semantic": {"name": "self.status", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " self.status = str(status, 'ISO-8859-1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1798_C12", "label": "self.status =", "type": "assigned_variable", "loc": [1798, 1798], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1795_C8", "vector": [14, 3, 0.961, 0.0005, 3, 0.88, 1.0, 651, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.status = status"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1800_C8", "label": "try", "type": "try", "loc": [1800, 1806], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1781_C4", "vector": [7, 2, 0.9637, 0.0037, 2, 0.05, 0.75, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.header_set = Headers(response_headers)\n except UnicodeDecodeError:\n self.error = ('500 Internal Server Error',\n 'HTTP Headers should be bytes')\n self.err_log.error('Received HTTP Headers from client that contain'\n ' invalid characters for Latin-1 encoding.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1801_C12", "label": "self.header_set = Headers()", "type": "assigned_variable", "loc": [1801, 1801], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1800_C8", "vector": [14, 3, 0.9626, 0.0005, 3, 0.9, 0.0, 59, 3, 1, 0, 0, 250, 10, 1], "semantic": {"name": "self.header_set", "arg_names": [], "import_names": [], "rhs_call_name": "Headers", "annotation": ""}, "snippet": " self.header_set = Headers(response_headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1803_C12", "label": "self.error =", "type": "assigned_variable", "loc": [1803, 1804], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1800_C8", "vector": [14, 3, 0.9639, 0.0011, 3, 0.9, 0.0, 784, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "self.error", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.error = ('500 Internal Server Error',\n 'HTTP Headers should be bytes')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1805_C12", "label": "error()", "type": "expression", "loc": [1805, 1806], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1800_C8", "vector": [8, 3, 0.965, 0.0011, 3, 0.9, 1.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " self.err_log.error('Received HTTP Headers from client that contain'\n ' invalid characters for Latin-1 encoding.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1808_C8", "label": "return", "type": "return", "loc": [1808, 1808], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1781_C4", "vector": [13, 2, 0.9663, 0.0005, 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.write_warning"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1810_C4", "label": "run_app", "type": "function", "loc": [1810, 1869], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1619_C0", "vector": [2, 1, 0.9832, 0.0321, 1, 0.98, 1.0, 678, 0, 2, 0, 0, 0, 0, 21], "semantic": {"name": "run_app", "arg_names": ["self", "conn"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def run_app(self, conn):\n self.size = 0\n self.header_set = Headers([])\n self.headers_sent = False\n self.error = (None, None)\n self.chunked = False\n sections = None\n output = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1811_C8", "label": "self.size =", "type": "assigned_variable", "loc": [1811, 1811], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1810_C4", "vector": [14, 2, 0.9679, 0.0005, 2, 0.75, 0.0, 183, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.size", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.size = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1812_C8", "label": "self.header_set = Headers()", "type": "assigned_variable", "loc": [1812, 1812], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1810_C4", "vector": [14, 2, 0.9685, 0.0005, 2, 0.75, 0.1111, 59, 3, 1, 0, 0, 250, 10, 1], "semantic": {"name": "self.header_set", "arg_names": [], "import_names": [], "rhs_call_name": "Headers", "annotation": ""}, "snippet": " self.header_set = Headers([])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1813_C8", "label": "self.headers_sent =", "type": "assigned_variable", "loc": [1813, 1813], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1810_C4", "vector": [14, 2, 0.969, 0.0005, 2, 0.75, 0.2222, 131, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.headers_sent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.headers_sent = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1814_C8", "label": "self.error =", "type": "assigned_variable", "loc": [1814, 1814], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1810_C4", "vector": [14, 2, 0.9695, 0.0005, 2, 0.75, 0.3333, 784, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "self.error", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.error = (None, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1815_C8", "label": "self.chunked =", "type": "assigned_variable", "loc": [1815, 1815], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1810_C4", "vector": [14, 2, 0.9701, 0.0005, 2, 0.75, 0.4444, 174, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.chunked", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.chunked = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1816_C8", "label": "sections =", "type": "assigned_variable", "loc": [1816, 1816], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1810_C4", "vector": [14, 2, 0.9706, 0.0005, 2, 0.75, 0.5556, 190, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "sections", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sections = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1817_C8", "label": "output =", "type": "assigned_variable", "loc": [1817, 1817], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1810_C4", "vector": [14, 2, 0.9711, 0.0005, 2, 0.75, 0.6667, 886, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " output = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1819_C8", "label": "if", "type": "if", "loc": [1819, 1820], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1810_C4", "vector": [4, 2, 0.9725, 0.0011, 2, 0.75, 0.7778, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.err_log.debug('Getting sock_file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1820_C12", "label": "debug()", "type": "expression", "loc": [1820, 1820], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1819_C8", "vector": [8, 3, 0.9727, 0.0005, 3, 0.25, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " self.err_log.debug('Getting sock_file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1823_C8", "label": "if", "type": "if", "loc": [1823, 1826], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1810_C4", "vector": [4, 2, 0.9751, 0.0021, 2, 0.75, 0.8889, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if PY3K:\n sock_file = conn.makefile(mode='rb', buffering=BUF_SIZE)\n else:\n sock_file = conn.makefile(BUF_SIZE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1824_C12", "label": "sock_file = makefile()", "type": "assigned_variable", "loc": [1824, 1824], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1823_C8", "vector": [14, 3, 0.9749, 0.0005, 3, 0.74, 0.0, 967, 3, 2, 0, 0, 831, 10, 1], "semantic": {"name": "sock_file", "arg_names": [], "import_names": [], "rhs_call_name": "makefile", "annotation": ""}, "snippet": " sock_file = conn.makefile(mode='rb', buffering=BUF_SIZE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1826_C12", "label": "sock_file = makefile()", "type": "assigned_variable", "loc": [1826, 1826], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1823_C8", "vector": [14, 3, 0.9759, 0.0005, 3, 0.74, 1.0, 967, 3, 1, 0, 0, 831, 10, 1], "semantic": {"name": "sock_file", "arg_names": [], "import_names": [], "rhs_call_name": "makefile", "annotation": ""}, "snippet": " sock_file = conn.makefile(BUF_SIZE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1828_C8", "label": "try", "type": "try", "loc": [1828, 1869], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1810_C4", "vector": [7, 2, 0.988, 0.0224, 2, 0.75, 1.0, 0, 0, 0, 0, 0, 0, 0, 17], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # Read the headers and build our WSGI environment\n self.environ = environ = self.build_environ(sock_file, conn)\n\n # Handle 100 Continue\n if environ.get('HTTP_EXPECT', '') == '100-continue':\n res = environ['SERVER_PROTOCOL'] + ' 100 Continue\\r\\n\\r\\n'\n conn.sendall(b(res))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1830_C12", "label": "self.environ = build_environ()", "type": "assigned_variable", "loc": [1830, 1830], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1828_C8", "vector": [14, 3, 0.9781, 0.0005, 3, 0.96, 0.0, 50, 3, 2, 0, 0, 496, 10, 1], "semantic": {"name": "self.environ", "arg_names": [], "import_names": [], "rhs_call_name": "build_environ", "annotation": ""}, "snippet": " self.environ = environ = self.build_environ(sock_file, conn)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1833_C12", "label": "if", "type": "if", "loc": [1833, 1835], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1828_C8", "vector": [4, 3, 0.9802, 0.0016, 3, 0.96, 0.1111, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if environ.get('HTTP_EXPECT', '') == '100-continue':\n res = environ['SERVER_PROTOCOL'] + ' 100 Continue\\r\\n\\r\\n'\n conn.sendall(b(res))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1834_C16", "label": "res =", "type": "assigned_variable", "loc": [1834, 1834], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1833_C12", "vector": [14, 4, 0.9802, 0.0005, 4, 0.78, 0.0, 413, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res = environ['SERVER_PROTOCOL'] + ' 100 Continue\\r\\n\\r\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1835_C16", "label": "sendall()", "type": "expression", "loc": [1835, 1835], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1833_C12", "vector": [8, 4, 0.9808, 0.0005, 4, 0.78, 1.0, 874, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sendall", "arg_names": [], "import_names": [], "rhs_call_name": "sendall", "annotation": ""}, "snippet": " conn.sendall(b(res))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1838_C12", "label": "output = app()", "type": "assigned_variable", "loc": [1838, 1838], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1828_C8", "vector": [14, 3, 0.9824, 0.0005, 3, 0.96, 0.2222, 886, 3, 2, 0, 0, 494, 10, 1], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "app", "annotation": ""}, "snippet": " output = self.app(environ, self.start_response)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1840_C12", "label": "if", "type": "if", "loc": [1840, 1843], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1828_C8", "vector": [4, 3, 0.9842, 0.0021, 3, 0.96, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hasattr(output, '__len__') and not hasattr(output, '__iter__'):\n self.error = ('500 Internal Server Error',\n 'WSGI applications must return a list or '\n 'generator type.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1841_C16", "label": "self.error =", "type": "assigned_variable", "loc": [1841, 1843], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1840_C12", "vector": [14, 4, 0.9845, 0.0016, 4, 0.75, 0.0, 784, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "self.error", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.error = ('500 Internal Server Error',\n 'WSGI applications must return a list or '\n 'generator type.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1845_C12", "label": "if", "type": "if", "loc": [1845, 1846], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1828_C8", "vector": [4, 3, 0.9864, 0.0011, 3, 0.96, 0.4444, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(output, '__len__'):\n sections = len(output)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1846_C16", "label": "sections = len()", "type": "assigned_variable", "loc": [1846, 1846], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1845_C12", "vector": [14, 4, 0.9866, 0.0005, 4, 0.82, 0.0, 190, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "sections", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " sections = len(output)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1848_C12", "label": "for data", "type": "for", "loc": [1848, 1851], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1828_C8", "vector": [6, 3, 0.9885, 0.0021, 3, 0.96, 0.5556, 929, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for data in output:\n # Don't send headers until body appears\n if data:\n self.write(data, sections)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1850_C16", "label": "if", "type": "if", "loc": [1850, 1851], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1848_C12", "vector": [4, 4, 0.989, 0.0011, 4, 0.67, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if data:\n self.write(data, sections)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1851_C20", "label": "write()", "type": "expression", "loc": [1851, 1851], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1850_C16", "vector": [8, 5, 0.9893, 0.0005, 5, 0.11, 0.0, 837, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.write(data, sections)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1853_C12", "label": "if", "type": "if", "loc": [1853, 1858], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1828_C8", "vector": [4, 3, 0.9917, 0.0032, 3, 0.96, 0.6667, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.chunked:\n # If chunked, send our final chunk length\n self.conn.sendall(b('0\\r\\n\\r\\n'))\n elif not self.headers_sent:\n # Send headers if the body was empty\n self.send_headers('', sections)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1855_C16", "label": "sendall()", "type": "expression", "loc": [1855, 1855], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1853_C12", "vector": [8, 4, 0.9914, 0.0005, 4, 0.28, 0.0, 874, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "sendall", "arg_names": [], "import_names": [], "rhs_call_name": "sendall", "annotation": ""}, "snippet": " self.conn.sendall(b('0\\r\\n\\r\\n'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1856_C12", "label": "if", "type": "if", "loc": [1856, 1858], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1853_C12", "vector": [4, 4, 0.9925, 0.0016, 4, 0.28, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not self.headers_sent:\n # Send headers if the body was empty\n self.send_headers('', sections)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1858_C16", "label": "send_headers()", "type": "expression", "loc": [1858, 1858], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1856_C12", "vector": [8, 5, 0.9931, 0.0005, 5, 0.1, 0.0, 143, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "send_headers", "arg_names": [], "import_names": [], "rhs_call_name": "send_headers", "annotation": ""}, "snippet": " self.send_headers('', sections)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1863_C12", "label": "if", "type": "if", "loc": [1863, 1864], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1828_C8", "vector": [4, 3, 0.996, 0.0011, 3, 0.96, 0.7778, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if __debug__:\n self.err_log.debug('Finally closing output and sock_file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1864_C16", "label": "debug()", "type": "expression", "loc": [1864, 1864], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1863_C12", "vector": [8, 4, 0.9963, 0.0005, 4, 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": " self.err_log.debug('Finally closing output and sock_file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1866_C12", "label": "if", "type": "if", "loc": [1866, 1867], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1828_C8", "vector": [4, 3, 0.9976, 0.0011, 3, 0.96, 0.8889, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(output, 'close'):\n output.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1867_C16", "label": "close()", "type": "expression", "loc": [1867, 1867], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1866_C12", "vector": [8, 4, 0.9979, 0.0005, 4, 0.98, 0.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " output.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1869_C12", "label": "close()", "type": "expression", "loc": [1869, 1869], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1828_C8", "vector": [8, 3, 0.9989, 0.0005, 3, 0.96, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " sock_file.close()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L44_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L44_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L52_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L52_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L62_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L64_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L69_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L70_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L69_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L72_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Import_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L127_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L131_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L135_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L119_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L143_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L142_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L145_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L147_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L147_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L147_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:While_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L150_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L151_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L151_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L152_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L151_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Import_L156_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L151_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L157_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L151_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L158_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L147_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L167_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L168_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L168_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L169_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L168_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L171_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L168_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L172_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L183_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L183_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L186_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L187_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L186_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L196_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L199_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L201_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L201_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L202_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L201_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L204_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L206_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L207_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L209_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L209_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:While_L210_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L210_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L211_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L211_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L212_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L211_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L214_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L211_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L215_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L211_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L217_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L220_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L221_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L222_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L220_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L224_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L226_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L226_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L226_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L229_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L226_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L230_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L230_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:While_L231_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L231_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L232_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L231_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L233_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L231_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L235_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L230_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L237_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L230_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L239_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L230_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L241_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L230_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L242_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L242_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L243_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L242_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L244_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L242_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L245_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L242_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L246_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L230_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L248_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L230_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:While_L249_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L249_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L250_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L249_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L251_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L249_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L253_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L249_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L256_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L249_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L257_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L257_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L258_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L249_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L260_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L260_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L261_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L249_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L265_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L230_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L269_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L271_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L271_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L272_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L272_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L273_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L273_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L274_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L273_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L276_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L271_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L278_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L278_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L279_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L278_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L281_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L271_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L283_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L285_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L285_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L286_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L285_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L287_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L285_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:While_L288_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L288_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L289_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L288_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L291_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L285_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L293_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L295_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L295_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L296_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L194_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L298_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L298_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L299_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L298_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L300_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L308_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L309_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L310_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L312_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L314_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L317_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L307_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L320_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L324_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L325_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L326_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L328_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L330_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L331_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L332_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L333_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L324_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L335_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L335_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L336_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L337_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L336_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L339_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L324_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L341_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L341_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L342_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L341_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L344_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L341_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L347_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L341_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L348_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L341_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L350_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L324_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L352_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L352_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L353_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L353_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L355_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L358_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L359_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L360_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L361_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L362_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L363_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L358_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L365_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L365_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L366_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L366_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L367_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L365_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L369_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L369_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L370_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L369_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L372_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L369_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L373_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L369_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L375_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L378_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L379_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L378_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L380_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L378_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L382_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L383_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L385_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L378_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L387_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L387_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L388_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L388_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L389_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L389_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L390_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L388_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L394_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L388_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L395_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L388_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L397_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L388_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L398_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L388_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L399_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L388_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L400_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L388_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L402_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L405_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L406_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L405_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L407_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L407_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L408_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L407_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L409_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L405_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L411_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L411_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L412_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L411_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L413_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L411_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L414_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L426_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Import_L427_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L426_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L428_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L426_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L429_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L426_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L431_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L426_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L433_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L439_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L440_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L439_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L444_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L447_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L448_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L449_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L450_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L451_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L452_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L454_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L455_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L458_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L459_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L462_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L462_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L463_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L462_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L465_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L467_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L467_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L468_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L467_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L469_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L471_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L471_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L472_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L472_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L473_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L472_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L474_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L472_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L475_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L475_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L476_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L475_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L477_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L475_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L479_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L475_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L480_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L480_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L481_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L480_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L482_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L480_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L484_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L471_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L486_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L486_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L487_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L486_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L488_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L486_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L490_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L493_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L493_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L494_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L493_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L496_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L493_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L497_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L499_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L499_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L500_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L500_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L501_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L499_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L505_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L499_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L506_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L508_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L508_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L509_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L508_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L511_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L508_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L512_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L508_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L516_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L508_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L519_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L508_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L521_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L508_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L523_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L439_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L525_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L525_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L526_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L526_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L527_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L527_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L528_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L527_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L529_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L527_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L530_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L527_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L538_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L525_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L549_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L439_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L551_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L551_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L552_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L552_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L553_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L552_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L554_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L551_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L556_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L556_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L557_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L556_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L558_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L551_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L560_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L551_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L562_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L439_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L564_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L564_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L565_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L565_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L566_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L564_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L568_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L439_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L570_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L570_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L571_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L571_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L572_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L570_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L574_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L570_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L576_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L570_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L579_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L570_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L580_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L439_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L582_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L582_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L583_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L583_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L584_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L582_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:While_L585_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L585_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L586_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L586_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L587_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L586_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L589_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L589_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L590_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L586_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L592_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L586_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L601_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L601_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L602_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L602_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L603_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L601_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L604_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L586_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L608_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L620_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L621_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L620_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L623_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L633_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L634_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L633_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L647_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L648_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L649_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L651_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L651_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L652_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L651_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L654_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L656_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L656_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L657_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L659_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L659_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L660_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L662_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L662_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L663_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L663_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L664_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L663_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L666_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L668_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L668_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L669_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L671_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L671_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L672_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L674_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L675_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L677_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L685_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:For_L687_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L687_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L688_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L637_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L691_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L691_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L692_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L691_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L693_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L633_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L695_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L695_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L696_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L695_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L697_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L633_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L699_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L699_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L700_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L699_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L701_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L633_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L703_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L703_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L704_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L703_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L706_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L703_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L708_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L708_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L710_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L710_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L711_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L711_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Import_L712_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L711_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L713_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L711_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L714_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L711_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L716_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L708_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L719_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L708_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L722_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L708_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L726_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L708_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L727_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L708_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L731_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L708_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L733_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L708_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L736_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L708_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:For_L738_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L738_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L739_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L708_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L742_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L703_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L744_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L744_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L745_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L703_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:While_L747_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L747_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L748_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L748_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L749_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L748_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L754_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L754_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L755_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L703_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L758_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L633_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L760_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L760_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L761_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L760_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L763_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L760_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L765_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L765_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:For_L767_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L767_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L768_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L765_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L771_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L765_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:For_L773_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L773_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L774_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L774_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L775_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L765_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L778_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L765_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L779_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L779_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L780_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L765_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L783_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L765_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L785_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L785_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L786_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L785_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L787_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L785_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L790_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L790_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Import_L791_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L765_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L797_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L633_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L799_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L799_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L800_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L799_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L801_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L804_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L812_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L804_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L813_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L804_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L814_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L814_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L815_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L804_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L816_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L835_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L838_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L838_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L846_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L838_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L848_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L838_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L851_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L838_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L852_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L838_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L853_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L838_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L855_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L838_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L856_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L838_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L858_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L838_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L859_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L835_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L861_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L861_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L862_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L861_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L863_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L861_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L864_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L861_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:While_L867_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L867_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L868_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L861_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L870_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L870_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L871_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L861_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:While_L874_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L874_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:While_L877_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L877_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L878_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L878_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L879_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L877_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L881_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L877_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L883_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L883_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L885_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L885_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L886_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L883_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L887_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L877_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L890_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L877_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L892_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L877_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L895_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L895_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L898_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L877_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L900_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L900_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L901_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L877_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L903_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L877_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L904_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L874_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L907_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L907_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L908_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L907_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L909_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L874_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L911_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L911_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L912_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L912_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L913_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L912_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L918_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L912_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L919_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L911_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L921_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L911_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:For_L925_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L925_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L926_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L926_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L927_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L925_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L929_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L929_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L933_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L925_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L935_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L925_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L936_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L925_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L938_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L925_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L939_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L911_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L942_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L874_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L948_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L948_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L949_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L948_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L950_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L948_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:For_L951_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L951_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L952_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L952_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L953_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L948_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:For_L955_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L955_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L956_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L956_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L958_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L956_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L960_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L955_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L963_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L955_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L964_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L955_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L966_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L966_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L967_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L874_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L972_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L835_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L974_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L974_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L975_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L974_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L977_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L977_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L978_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L974_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:While_L980_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L980_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L981_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L980_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L982_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L982_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L983_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L974_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L987_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L987_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L988_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L974_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:While_L990_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L990_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L991_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L990_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L993_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L990_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L996_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L996_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L997_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L974_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1002_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1018_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1019_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1018_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1031_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1031_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1032_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1034_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1035_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1037_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1038_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1039_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1040_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1041_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1042_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1045_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1047_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1047_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1048_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1050_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1050_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1051_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1054_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1057_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1058_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1022_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1060_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1018_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1062_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1062_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1063_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1062_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1064_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1064_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1065_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1062_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1067_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1062_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1069_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1018_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1071_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1071_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1072_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1071_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1074_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1074_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1075_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1071_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1077_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1071_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1080_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1071_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1083_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1083_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1084_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1084_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1085_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1083_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1087_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1071_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1096_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1096_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1097_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1097_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1098_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1071_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1018_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1108_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1108_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1109_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1110_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1110_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1112_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1018_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1118_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1119_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1121_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1122_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1124_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1125_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1127_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1128_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1130_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1131_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1130_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1135_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1130_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1136_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1130_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1137_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1018_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1140_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1141_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1145_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1146_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1018_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1148_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1150_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1150_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1151_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1154_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1156_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1156_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1157_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1149_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1160_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1160_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1161_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1160_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1163_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1163_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1165_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1180_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L1181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1180_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L1183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L1186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L1189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L1191_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1193_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L1194_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1193_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1196_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1226_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1231_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1232_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1231_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1242_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1245_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1246_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1247_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1250_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1251_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1252_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1253_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1256_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1257_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1260_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1235_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1261_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1231_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1263_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1264_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1264_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1265_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1265_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1266_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1267_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1267_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1268_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1268_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1269_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1267_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1270_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1267_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1271_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1272_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1272_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1273_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1272_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1274_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1274_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1275_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1272_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1276_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1277_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1278_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1277_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1279_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1279_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1280_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1277_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1281_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1282_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1282_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1283_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1282_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1284_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1284_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1285_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1285_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1286_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1284_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1288_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1284_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1290_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1284_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1291_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1284_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1292_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1284_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1294_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1296_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1297_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1298_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1299_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1263_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1300_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1231_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1303_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1303_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1304_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1302_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1307_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1307_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1308_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1307_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1310_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1310_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1312_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1312_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1313_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1310_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1314_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1307_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1316_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1316_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1317_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1307_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1319_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1307_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1321_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1321_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1322_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1321_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1323_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1321_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1324_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1321_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1325_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1321_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1328_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1328_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1329_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1321_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1330_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1307_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1333_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1333_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1334_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1334_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1335_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1333_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1336_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1336_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1337_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1336_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1339_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1336_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1340_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1336_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1341_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1336_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1344_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1344_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1345_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1344_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1350_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1333_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1352_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1352_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1353_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1353_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1354_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1353_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1356_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1231_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1360_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1360_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1363_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1231_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1366_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1366_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1367_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1366_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1368_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1366_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1373_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1373_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1374_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1373_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1376_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1373_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1377_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1373_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1378_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1373_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1380_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1373_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1381_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1373_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1382_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1231_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1385_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1386_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1386_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1388_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1386_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1389_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1389_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1390_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1386_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1392_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1392_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1394_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1394_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1395_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1392_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1397_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1392_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1398_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1398_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1399_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1407_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1409_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1409_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1410_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1410_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1411_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1415_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1422_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1422_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1423_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1425_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1427_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1427_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1428_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1431_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1432_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1432_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1433_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1433_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1434_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1432_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1435_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1435_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1436_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1439_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1440_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1231_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1443_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1444_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1444_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1445_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1444_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1446_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1446_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1449_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1444_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1452_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1455_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1456_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1457_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1458_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1458_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1459_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1458_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1460_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1460_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1461_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1460_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1462_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1460_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1463_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1460_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1465_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1468_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1469_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1469_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1470_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1472_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1474_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1442_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1478_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1231_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1480_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1480_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1481_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1481_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1482_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1481_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1483_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1481_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1484_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1481_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1485_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1485_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1486_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1485_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1488_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1488_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1489_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1489_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1490_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1489_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1492_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1485_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1495_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1485_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1498_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1498_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1503_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1498_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1506_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1498_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1507_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1485_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1509_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1480_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1514_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1517_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1518_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1522_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1523_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1527_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1528_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1532_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1534_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1534_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1535_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1534_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1536_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1532_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1538_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1538_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1539_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1538_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1540_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1540_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1541_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1541_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1542_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1540_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1543_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1540_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1545_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1532_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1547_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1547_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1548_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1547_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1549_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1547_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1550_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1550_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1551_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1551_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1552_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1550_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1554_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1554_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1559_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1554_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1563_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1547_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1565_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1547_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1566_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1532_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1568_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1568_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1569_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1568_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1570_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1568_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1571_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:While_L1571_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1573_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1568_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1575_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1532_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1577_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1577_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1578_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1582_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1583_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1600_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L1601_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1600_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:ImportFrom_L1604_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1620_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1620_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1621_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1620_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1623_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1620_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1625_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1625_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1626_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1625_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1628_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1620_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1629_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1620_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1633_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1620_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1636_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1620_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1638_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1620_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1642_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1642_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1643_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1642_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1644_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1648_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1650_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1653_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1656_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1656_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1657_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1660_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1661_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1662_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1663_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1664_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1665_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1666_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1667_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1667_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1668_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1669_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1669_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1670_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1673_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1676_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1676_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1677_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1676_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1678_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1676_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1679_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1679_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1680_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1679_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1681_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1679_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1684_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1676_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1686_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1688_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1688_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1689_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1688_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1691_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1693_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1696_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1699_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1702_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1702_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1703_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1706_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1706_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1707_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1709_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1709_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1710_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1709_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1712_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1709_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1713_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1713_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1714_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1714_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1716_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1714_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1717_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1714_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1720_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1714_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1721_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1714_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1722_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1722_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1723_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1726_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1726_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1729_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1726_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1730_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1730_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1732_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1732_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1733_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1732_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1735_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1730_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1739_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1742_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1745_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1748_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1748_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1749_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1750_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1695_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1751_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1753_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1753_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1754_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1753_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1756_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1758_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1758_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1759_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1758_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1761_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1761_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1762_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1761_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1763_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1758_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1765_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1765_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1766_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1758_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1768_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1768_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1769_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1769_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1770_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1770_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1771_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1770_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1773_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1769_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1775_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1769_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1779_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1781_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1781_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1782_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1781_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1784_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1784_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1785_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1785_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1786_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1785_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1791_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1784_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1792_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1781_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1795_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1795_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1796_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1795_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1798_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1781_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1800_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1800_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1801_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1800_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1803_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1800_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1805_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1781_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Return_L1808_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:ClassDef_L1619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1810_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1810_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1811_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1810_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1812_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1810_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1813_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1810_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1814_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1810_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1815_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1810_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1816_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1810_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1817_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1810_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1819_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1819_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1820_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1810_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1823_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1823_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1824_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1823_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1826_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:FunctionDef_L1810_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1828_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1828_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1830_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1828_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1833_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1833_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1834_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1833_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1835_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1828_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1838_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1828_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1840_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1840_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1841_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1828_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1845_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1845_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Assign_L1846_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1828_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1848_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:For_L1848_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1850_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1850_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1851_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1828_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1853_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1853_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1855_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1853_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1856_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1856_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1858_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1828_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1863_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1863_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1864_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1828_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1866_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:If_L1866_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1867_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_467:Try_L1828_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_467:Expr_L1869_C12"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
Functions required to execute app components
============================================
FOR INTERNAL USE ONLY
"""
from os import stat
import thread
import logging
from fileutils import read_file
cfs = {} # for speed-up
cfs_lock = thread.allocate_lock() # and thread safety
def getcfs(key, filename, filter=None):
"""
Caches the *filtered* file `filename` with `key` until the file is
modified.
:param key: the cache key
:param filename: the file to cache
:param filter: is the function used for filtering. Normally `filename` is a
.py file and `filter` is a function that bytecode compiles the file.
In this way the bytecode compiled file is cached. (Default = None)
This is used on Google App Engine since pyc files cannot be saved.
"""
try:
t = stat(filename).st_mtime
except OSError:
return filter() if callable(filter) else ''
cfs_lock.acquire()
item = cfs.get(key, None)
cfs_lock.release()
if item and item[0] == t:
return item[1]
if not callable(filter):
data = read_file(filename)
else:
data = filter()
cfs_lock.acquire()
cfs[key] = (t, data)
cfs_lock.release()
return data
| ajibawa-2023/Python-Code-Large/train/row_469 | 24 | 53 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_469:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 13], "level": 0, "parent": null, "vector": [8, 0, 0.1604, 0.1887, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis file is part of the web2py Web Framework\nCopyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>\nLicense: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)\n\nFunctions required to execute app components\n============================================\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_469:ImportFrom_L15_C0", "label": "from os import stat", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.283, 0.0189, 0, 0.66, 0.1429, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["stat"], "rhs_call_name": "", "annotation": ""}, "snippet": "from os import stat"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_469:Import_L16_C0", "label": "thread import thread", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.3019, 0.0189, 0, 0.66, 0.2857, 260, 0, 1, 0, 0, 260, 0, 0], "semantic": {"name": "thread", "arg_names": [], "import_names": ["thread"], "rhs_call_name": "", "annotation": ""}, "snippet": "import thread"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_469:Import_L17_C0", "label": "logging import logging", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.3208, 0.0189, 0, 0.66, 0.4286, 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_469:ImportFrom_L18_C0", "label": "from fileutils import read_file", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.3396, 0.0189, 0, 0.66, 0.5714, 687, 0, 1, 0, 0, 687, 0, 0], "semantic": {"name": "fileutils", "arg_names": [], "import_names": ["read_file"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fileutils import read_file"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_469:Assign_L20_C0", "label": "cfs =", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.3774, 0.0189, 0, 0.66, 0.7143, 169, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "cfs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "cfs = {} # for speed-up"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_469:Assign_L21_C0", "label": "cfs_lock = allocate_lock()", "type": "assigned_variable", "loc": [21, 21], "level": 0, "parent": null, "vector": [14, 0, 0.3962, 0.0189, 0, 0.66, 0.8571, 212, 3, 0, 0, 0, 538, 10, 1], "semantic": {"name": "cfs_lock", "arg_names": [], "import_names": [], "rhs_call_name": "allocate_lock", "annotation": ""}, "snippet": "cfs_lock = thread.allocate_lock() # and thread safety"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "label": "getcfs", "type": "function", "loc": [24, 53], "level": 0, "parent": null, "vector": [2, 0, 0.7264, 0.566, 0, 0.66, 1.0, 342, 0, 3, 1, 0, 0, 0, 11], "semantic": {"name": "getcfs", "arg_names": ["key", "filename", "filter"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def getcfs(key, filename, filter=None):\n \"\"\"\n Caches the *filtered* file `filename` with `key` until the file is\n modified.\n\n :param key: the cache key\n :param filename: the file to cache\n :param filter: is the function used for filtering. Normally `filename` is a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_469:Expr_L25_C4", "label": "expression", "type": "expression", "loc": [25, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "vector": [8, 1, 0.5755, 0.2264, 1, 0.6, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Caches the *filtered* file `filename` with `key` until the file is\n modified.\n\n :param key: the cache key\n :param filename: the file to cache\n :param filter: is the function used for filtering. Normally `filename` is a\n .py file and `filter` is a function that bytecode compiles the file."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_469:Try_L37_C4", "label": "try", "type": "try", "loc": [37, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "vector": [7, 1, 0.7264, 0.0755, 1, 0.6, 0.1, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n t = stat(filename).st_mtime\n except OSError:\n return filter() if callable(filter) else ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_469:Assign_L38_C8", "label": "t =", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_469:Try_L37_C4", "vector": [14, 2, 0.717, 0.0189, 2, 0.51, 0.0, 15, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t = stat(filename).st_mtime"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_469:Return_L40_C8", "label": "return", "type": "return", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_469:Try_L37_C4", "vector": [13, 2, 0.7547, 0.0189, 2, 0.51, 0.0, 0, 8, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return filter() if callable(filter) else ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_469:Expr_L41_C4", "label": "acquire()", "type": "expression", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "vector": [8, 1, 0.7736, 0.0189, 1, 0.6, 0.2, 229, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "acquire", "arg_names": [], "import_names": [], "rhs_call_name": "acquire", "annotation": ""}, "snippet": " cfs_lock.acquire()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_469:Assign_L42_C4", "label": "item = get()", "type": "assigned_variable", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "vector": [14, 1, 0.7925, 0.0189, 1, 0.6, 0.3, 434, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " item = cfs.get(key, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_469:Expr_L43_C4", "label": "release()", "type": "expression", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "vector": [8, 1, 0.8113, 0.0189, 1, 0.6, 0.4, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " cfs_lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_469:If_L44_C4", "label": "if", "type": "if", "loc": [44, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "vector": [4, 1, 0.8396, 0.0377, 1, 0.6, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if item and item[0] == t:\n return item[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_469:Return_L45_C8", "label": "return", "type": "return", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_469:If_L44_C4", "vector": [13, 2, 0.8491, 0.0189, 2, 0.87, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return item[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_469:If_L46_C4", "label": "if", "type": "if", "loc": [46, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "vector": [4, 1, 0.8962, 0.0755, 1, 0.6, 0.6, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not callable(filter):\n data = read_file(filename)\n else:\n data = filter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_469:Assign_L47_C8", "label": "data = read_file()", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_469:If_L46_C4", "vector": [14, 2, 0.8868, 0.0189, 2, 0.15, 0.0, 929, 3, 1, 0, 0, 542, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "read_file", "annotation": ""}, "snippet": " data = read_file(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_469:Assign_L49_C8", "label": "data = filter()", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_469:If_L46_C4", "vector": [14, 2, 0.9245, 0.0189, 2, 0.15, 1.0, 929, 3, 0, 0, 0, 526, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " data = filter()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_469:Expr_L50_C4", "label": "acquire()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "vector": [8, 1, 0.9434, 0.0189, 1, 0.6, 0.7, 229, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "acquire", "arg_names": [], "import_names": [], "rhs_call_name": "acquire", "annotation": ""}, "snippet": " cfs_lock.acquire()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_469:Assign_L51_C4", "label": "assign", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "vector": [14, 1, 0.9623, 0.0189, 1, 0.6, 0.8, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cfs[key] = (t, data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_469:Expr_L52_C4", "label": "release()", "type": "expression", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "vector": [8, 1, 0.9811, 0.0189, 1, 0.6, 0.9, 784, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "release", "arg_names": [], "import_names": [], "rhs_call_name": "release", "annotation": ""}, "snippet": " cfs_lock.release()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_469:Return_L53_C4", "label": "return", "type": "return", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "vector": [13, 1, 1.0, 0.0189, 1, 0.6, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return data"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_469:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_469:Try_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_469:Try_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_469:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_469:Try_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_469:Return_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_469:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_469:Assign_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_469:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_469:If_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_469:If_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_469:Return_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_469:If_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_469:If_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_469:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_469:If_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_469:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_469:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_469:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_469:Expr_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_469:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_469:Return_L53_C4"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
CONTENT_TYPE dictionary created against freedesktop.org' shared mime info
database version 1.1.
Deviations from official standards:
- '.md': 'application/x-genesis-rom' --> 'text/x-markdown'
- '.png': 'image/x-apple-ios-png' --> 'image/png'
Additions:
- '.load': 'text/html'
- '.json': 'application/json'
- '.jsonp': 'application/jsonp'
- '.pickle': 'application/python-pickle'
- '.w2p': 'application/w2p'
"""
__all__ = ['contenttype']
CONTENT_TYPE = {
'.123': 'application/vnd.lotus-1-2-3',
'.3ds': 'image/x-3ds',
'.3g2': 'video/3gpp2',
'.3ga': 'video/3gpp',
'.3gp': 'video/3gpp',
'.3gp2': 'video/3gpp2',
'.3gpp': 'video/3gpp',
'.3gpp2': 'video/3gpp2',
'.602': 'application/x-t602',
'.669': 'audio/x-mod',
'.7z': 'application/x-7z-compressed',
'.a': 'application/x-archive',
'.aac': 'audio/aac',
'.abw': 'application/x-abiword',
'.abw.crashed': 'application/x-abiword',
'.abw.gz': 'application/x-abiword',
'.ac3': 'audio/ac3',
'.ace': 'application/x-ace',
'.adb': 'text/x-adasrc',
'.ads': 'text/x-adasrc',
'.afm': 'application/x-font-afm',
'.ag': 'image/x-applix-graphics',
'.ai': 'application/illustrator',
'.aif': 'audio/x-aiff',
'.aifc': 'audio/x-aifc',
'.aiff': 'audio/x-aiff',
'.aiffc': 'audio/x-aifc',
'.al': 'application/x-perl',
'.alz': 'application/x-alz',
'.amr': 'audio/amr',
'.amz': 'audio/x-amzxml',
'.ani': 'application/x-navi-animation',
'.anim[1-9j]': 'video/x-anim',
'.anx': 'application/annodex',
'.ape': 'audio/x-ape',
'.apk': 'application/vnd.android.package-archive',
'.ar': 'application/x-archive',
'.arj': 'application/x-arj',
'.arw': 'image/x-sony-arw',
'.as': 'application/x-applix-spreadsheet',
'.asc': 'text/plain',
'.asf': 'video/x-ms-asf',
'.asp': 'application/x-asp',
'.ass': 'text/x-ssa',
'.asx': 'audio/x-ms-asx',
'.atom': 'application/atom+xml',
'.au': 'audio/basic',
'.avf': 'video/x-msvideo',
'.avi': 'video/x-msvideo',
'.aw': 'application/x-applix-word',
'.awb': 'audio/amr-wb',
'.awk': 'application/x-awk',
'.axa': 'audio/annodex',
'.axv': 'video/annodex',
'.bak': 'application/x-trash',
'.bcpio': 'application/x-bcpio',
'.bdf': 'application/x-font-bdf',
'.bdm': 'video/mp2t',
'.bdmv': 'video/mp2t',
'.bib': 'text/x-bibtex',
'.bin': 'application/octet-stream',
'.blend': 'application/x-blender',
'.blender': 'application/x-blender',
'.bmp': 'image/bmp',
'.bz': 'application/x-bzip',
'.bz2': 'application/x-bzip',
'.c': 'text/x-csrc',
'.c++': 'text/x-c++src',
'.cab': 'application/vnd.ms-cab-compressed',
'.cap': 'application/vnd.tcpdump.pcap',
'.cb7': 'application/x-cb7',
'.cbl': 'text/x-cobol',
'.cbr': 'application/x-cbr',
'.cbt': 'application/x-cbt',
'.cbz': 'application/x-cbz',
'.cc': 'text/x-c++src',
'.ccmx': 'application/x-ccmx',
'.cdf': 'application/x-netcdf',
'.cdr': 'application/vnd.corel-draw',
'.cer': 'application/pkix-cert',
'.cert': 'application/x-x509-ca-cert',
'.cgm': 'image/cgm',
'.chm': 'application/vnd.ms-htmlhelp',
'.chrt': 'application/x-kchart',
'.class': 'application/x-java',
'.clpi': 'video/mp2t',
'.cls': 'text/x-tex',
'.cmake': 'text/x-cmake',
'.cob': 'text/x-cobol',
'.cpi': 'video/mp2t',
'.cpio': 'application/x-cpio',
'.cpio.gz': 'application/x-cpio-compressed',
'.cpp': 'text/x-c++src',
'.cr2': 'image/x-canon-cr2',
'.crl': 'application/pkix-crl',
'.crt': 'application/x-x509-ca-cert',
'.crw': 'image/x-canon-crw',
'.cs': 'text/x-csharp',
'.csh': 'application/x-csh',
'.css': 'text/css',
'.cssl': 'text/css',
'.csv': 'text/csv',
'.cue': 'application/x-cue',
'.cur': 'image/x-win-bitmap',
'.cxx': 'text/x-c++src',
'.d': 'text/x-dsrc',
'.dar': 'application/x-dar',
'.dbf': 'application/x-dbf',
'.dc': 'application/x-dc-rom',
'.dcl': 'text/x-dcl',
'.dcm': 'application/dicom',
'.dcr': 'image/x-kodak-dcr',
'.dds': 'image/x-dds',
'.deb': 'application/x-deb',
'.der': 'application/x-x509-ca-cert',
'.desktop': 'application/x-desktop',
'.di': 'text/x-dsrc',
'.dia': 'application/x-dia-diagram',
'.diff': 'text/x-patch',
'.divx': 'video/x-msvideo',
'.djv': 'image/vnd.djvu',
'.djvu': 'image/vnd.djvu',
'.dmg': 'application/x-apple-diskimage',
'.dmp': 'application/vnd.tcpdump.pcap',
'.dng': 'image/x-adobe-dng',
'.doc': 'application/msword',
'.docbook': 'application/x-docbook+xml',
'.docm': 'application/vnd.ms-word.document.macroenabled.12',
'.docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'.dot': 'text/vnd.graphviz',
'.dotm': 'application/vnd.ms-word.template.macroenabled.12',
'.dotx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
'.dsl': 'text/x-dsl',
'.dtd': 'application/xml-dtd',
'.dts': 'audio/vnd.dts',
'.dtshd': 'audio/vnd.dts.hd',
'.dtx': 'text/x-tex',
'.dv': 'video/dv',
'.dvi': 'application/x-dvi',
'.dvi.bz2': 'application/x-bzdvi',
'.dvi.gz': 'application/x-gzdvi',
'.dwg': 'image/vnd.dwg',
'.dxf': 'image/vnd.dxf',
'.e': 'text/x-eiffel',
'.egon': 'application/x-egon',
'.eif': 'text/x-eiffel',
'.el': 'text/x-emacs-lisp',
'.emf': 'image/x-emf',
'.eml': 'message/rfc822',
'.emp': 'application/vnd.emusic-emusic_package',
'.ent': 'application/xml-external-parsed-entity',
'.eps': 'image/x-eps',
'.eps.bz2': 'image/x-bzeps',
'.eps.gz': 'image/x-gzeps',
'.epsf': 'image/x-eps',
'.epsf.bz2': 'image/x-bzeps',
'.epsf.gz': 'image/x-gzeps',
'.epsi': 'image/x-eps',
'.epsi.bz2': 'image/x-bzeps',
'.epsi.gz': 'image/x-gzeps',
'.epub': 'application/epub+zip',
'.erl': 'text/x-erlang',
'.es': 'application/ecmascript',
'.etheme': 'application/x-e-theme',
'.etx': 'text/x-setext',
'.exe': 'application/x-ms-dos-executable',
'.exr': 'image/x-exr',
'.ez': 'application/andrew-inset',
'.f': 'text/x-fortran',
'.f4a': 'audio/mp4',
'.f4b': 'audio/x-m4b',
'.f4v': 'video/mp4',
'.f90': 'text/x-fortran',
'.f95': 'text/x-fortran',
'.fb2': 'application/x-fictionbook+xml',
'.fig': 'image/x-xfig',
'.fits': 'image/fits',
'.fl': 'application/x-fluid',
'.flac': 'audio/flac',
'.flc': 'video/x-flic',
'.fli': 'video/x-flic',
'.flv': 'video/x-flv',
'.flw': 'application/x-kivio',
'.fo': 'text/x-xslfo',
'.fodg': 'application/vnd.oasis.opendocument.graphics-flat-xml',
'.fodp': 'application/vnd.oasis.opendocument.presentation-flat-xml',
'.fods': 'application/vnd.oasis.opendocument.spreadsheet-flat-xml',
'.fodt': 'application/vnd.oasis.opendocument.text-flat-xml',
'.for': 'text/x-fortran',
'.fxm': 'video/x-javafx',
'.g3': 'image/fax-g3',
'.gb': 'application/x-gameboy-rom',
'.gba': 'application/x-gba-rom',
'.gcrd': 'text/vcard',
'.ged': 'application/x-gedcom',
'.gedcom': 'application/x-gedcom',
'.gem': 'application/x-tar',
'.gen': 'application/x-genesis-rom',
'.gf': 'application/x-tex-gf',
'.gg': 'application/x-sms-rom',
'.gif': 'image/gif',
'.glade': 'application/x-glade',
'.gml': 'application/gml+xml',
'.gmo': 'application/x-gettext-translation',
'.gnc': 'application/x-gnucash',
'.gnd': 'application/gnunet-directory',
'.gnucash': 'application/x-gnucash',
'.gnumeric': 'application/x-gnumeric',
'.gnuplot': 'application/x-gnuplot',
'.go': 'text/x-go',
'.gp': 'application/x-gnuplot',
'.gpg': 'application/pgp-encrypted',
'.gplt': 'application/x-gnuplot',
'.gra': 'application/x-graphite',
'.gsf': 'application/x-font-type1',
'.gsm': 'audio/x-gsm',
'.gtar': 'application/x-tar',
'.gv': 'text/vnd.graphviz',
'.gvp': 'text/x-google-video-pointer',
'.gz': 'application/gzip',
'.h': 'text/x-chdr',
'.h++': 'text/x-c++hdr',
'.h4': 'application/x-hdf',
'.h5': 'application/x-hdf',
'.hdf': 'application/x-hdf',
'.hdf4': 'application/x-hdf',
'.hdf5': 'application/x-hdf',
'.hh': 'text/x-c++hdr',
'.hlp': 'application/winhlp',
'.hp': 'text/x-c++hdr',
'.hpgl': 'application/vnd.hp-hpgl',
'.hpp': 'text/x-c++hdr',
'.hs': 'text/x-haskell',
'.htm': 'text/html',
'.html': 'text/html',
'.hwp': 'application/x-hwp',
'.hwt': 'application/x-hwt',
'.hxx': 'text/x-c++hdr',
'.ica': 'application/x-ica',
'.icb': 'image/x-tga',
'.icc': 'application/vnd.iccprofile',
'.icm': 'application/vnd.iccprofile',
'.icns': 'image/x-icns',
'.ico': 'image/vnd.microsoft.icon',
'.ics': 'text/calendar',
'.idl': 'text/x-idl',
'.ief': 'image/ief',
'.iff': 'image/x-ilbm',
'.ilbm': 'image/x-ilbm',
'.ime': 'text/x-imelody',
'.imy': 'text/x-imelody',
'.ins': 'text/x-tex',
'.iptables': 'text/x-iptables',
'.iso': 'application/x-cd-image',
'.iso9660': 'application/x-cd-image',
'.it': 'audio/x-it',
'.it87': 'application/x-it87',
'.j2k': 'image/jp2',
'.jad': 'text/vnd.sun.j2me.app-descriptor',
'.jar': 'application/x-java-archive',
'.java': 'text/x-java',
'.jceks': 'application/x-java-jce-keystore',
'.jks': 'application/x-java-keystore',
'.jng': 'image/x-jng',
'.jnlp': 'application/x-java-jnlp-file',
'.jp2': 'image/jp2',
'.jpc': 'image/jp2',
'.jpe': 'image/jpeg',
'.jpeg': 'image/jpeg',
'.jpf': 'image/jp2',
'.jpg': 'image/jpeg',
'.jpr': 'application/x-jbuilder-project',
'.jpx': 'image/jp2',
'.js': 'application/javascript',
'.json': 'application/json',
'.jsonp': 'application/jsonp',
'.k25': 'image/x-kodak-k25',
'.kar': 'audio/midi',
'.karbon': 'application/x-karbon',
'.kdc': 'image/x-kodak-kdc',
'.kdelnk': 'application/x-desktop',
'.kexi': 'application/x-kexiproject-sqlite3',
'.kexic': 'application/x-kexi-connectiondata',
'.kexis': 'application/x-kexiproject-shortcut',
'.kfo': 'application/x-kformula',
'.kil': 'application/x-killustrator',
'.kino': 'application/smil',
'.kml': 'application/vnd.google-earth.kml+xml',
'.kmz': 'application/vnd.google-earth.kmz',
'.kon': 'application/x-kontour',
'.kpm': 'application/x-kpovmodeler',
'.kpr': 'application/x-kpresenter',
'.kpt': 'application/x-kpresenter',
'.kra': 'application/x-krita',
'.ks': 'application/x-java-keystore',
'.ksp': 'application/x-kspread',
'.kud': 'application/x-kugar',
'.kwd': 'application/x-kword',
'.kwt': 'application/x-kword',
'.la': 'application/x-shared-library-la',
'.latex': 'text/x-tex',
'.lbm': 'image/x-ilbm',
'.ldif': 'text/x-ldif',
'.lha': 'application/x-lha',
'.lhs': 'text/x-literate-haskell',
'.lhz': 'application/x-lhz',
'.load' : 'text/html',
'.log': 'text/x-log',
'.lrz': 'application/x-lrzip',
'.ltx': 'text/x-tex',
'.lua': 'text/x-lua',
'.lwo': 'image/x-lwo',
'.lwob': 'image/x-lwo',
'.lwp': 'application/vnd.lotus-wordpro',
'.lws': 'image/x-lws',
'.ly': 'text/x-lilypond',
'.lyx': 'application/x-lyx',
'.lz': 'application/x-lzip',
'.lzh': 'application/x-lha',
'.lzma': 'application/x-lzma',
'.lzo': 'application/x-lzop',
'.m': 'text/x-matlab',
'.m15': 'audio/x-mod',
'.m1u': 'video/vnd.mpegurl',
'.m2t': 'video/mp2t',
'.m2ts': 'video/mp2t',
'.m3u': 'application/vnd.apple.mpegurl',
'.m3u8': 'application/vnd.apple.mpegurl',
'.m4': 'application/x-m4',
'.m4a': 'audio/mp4',
'.m4b': 'audio/x-m4b',
'.m4u': 'video/vnd.mpegurl',
'.m4v': 'video/mp4',
'.mab': 'application/x-markaby',
'.mak': 'text/x-makefile',
'.man': 'application/x-troff-man',
'.manifest': 'text/cache-manifest',
'.markdown': 'text/x-markdown',
'.mbox': 'application/mbox',
'.md': 'text/x-markdown',
'.mdb': 'application/vnd.ms-access',
'.mdi': 'image/vnd.ms-modi',
'.me': 'text/x-troff-me',
'.med': 'audio/x-mod',
'.meta4': 'application/metalink4+xml',
'.metalink': 'application/metalink+xml',
'.mgp': 'application/x-magicpoint',
'.mht': 'application/x-mimearchive',
'.mhtml': 'application/x-mimearchive',
'.mid': 'audio/midi',
'.midi': 'audio/midi',
'.mif': 'application/x-mif',
'.minipsf': 'audio/x-minipsf',
'.mk': 'text/x-makefile',
'.mka': 'audio/x-matroska',
'.mkd': 'text/x-markdown',
'.mkv': 'video/x-matroska',
'.ml': 'text/x-ocaml',
'.mli': 'text/x-ocaml',
'.mm': 'text/x-troff-mm',
'.mmf': 'application/x-smaf',
'.mml': 'application/mathml+xml',
'.mng': 'video/x-mng',
'.mo': 'text/x-modelica',
'.mo3': 'audio/x-mo3',
'.mobi': 'application/x-mobipocket-ebook',
'.moc': 'text/x-moc',
'.mod': 'audio/x-mod',
'.mof': 'text/x-mof',
'.moov': 'video/quicktime',
'.mov': 'video/quicktime',
'.movie': 'video/x-sgi-movie',
'.mp+': 'audio/x-musepack',
'.mp2': 'video/mpeg',
'.mp3': 'audio/mpeg',
'.mp4': 'video/mp4',
'.mpc': 'audio/x-musepack',
'.mpe': 'video/mpeg',
'.mpeg': 'video/mpeg',
'.mpg': 'video/mpeg',
'.mpga': 'audio/mpeg',
'.mpl': 'video/mp2t',
'.mpls': 'video/mp2t',
'.mpp': 'audio/x-musepack',
'.mrl': 'text/x-mrml',
'.mrml': 'text/x-mrml',
'.mrw': 'image/x-minolta-mrw',
'.ms': 'text/x-troff-ms',
'.msi': 'application/x-msi',
'.msod': 'image/x-msod',
'.msx': 'application/x-msx-rom',
'.mtm': 'audio/x-mod',
'.mts': 'video/mp2t',
'.mup': 'text/x-mup',
'.mxf': 'application/mxf',
'.mxu': 'video/vnd.mpegurl',
'.n64': 'application/x-n64-rom',
'.nb': 'application/mathematica',
'.nc': 'application/x-netcdf',
'.nds': 'application/x-nintendo-ds-rom',
'.nef': 'image/x-nikon-nef',
'.nes': 'application/x-nes-rom',
'.nfo': 'text/x-nfo',
'.not': 'text/x-mup',
'.nsc': 'application/x-netshow-channel',
'.nsv': 'video/x-nsv',
'.nzb': 'application/x-nzb',
'.o': 'application/x-object',
'.obj': 'application/x-tgif',
'.ocl': 'text/x-ocl',
'.oda': 'application/oda',
'.odb': 'application/vnd.oasis.opendocument.database',
'.odc': 'application/vnd.oasis.opendocument.chart',
'.odf': 'application/vnd.oasis.opendocument.formula',
'.odg': 'application/vnd.oasis.opendocument.graphics',
'.odi': 'application/vnd.oasis.opendocument.image',
'.odm': 'application/vnd.oasis.opendocument.text-master',
'.odp': 'application/vnd.oasis.opendocument.presentation',
'.ods': 'application/vnd.oasis.opendocument.spreadsheet',
'.odt': 'application/vnd.oasis.opendocument.text',
'.oga': 'audio/ogg',
'.ogg': 'application/ogg',
'.ogm': 'video/x-ogm+ogg',
'.ogv': 'video/ogg',
'.ogx': 'application/ogg',
'.old': 'application/x-trash',
'.oleo': 'application/x-oleo',
'.ooc': 'text/x-ooc',
'.opml': 'text/x-opml+xml',
'.oprc': 'application/vnd.palm',
'.ora': 'image/openraster',
'.orf': 'image/x-olympus-orf',
'.otc': 'application/vnd.oasis.opendocument.chart-template',
'.otf': 'application/x-font-otf',
'.otg': 'application/vnd.oasis.opendocument.graphics-template',
'.oth': 'application/vnd.oasis.opendocument.text-web',
'.otp': 'application/vnd.oasis.opendocument.presentation-template',
'.ots': 'application/vnd.oasis.opendocument.spreadsheet-template',
'.ott': 'application/vnd.oasis.opendocument.text-template',
'.owl': 'application/rdf+xml',
'.oxps': 'application/oxps',
'.oxt': 'application/vnd.openofficeorg.extension',
'.p': 'text/x-pascal',
'.p10': 'application/pkcs10',
'.p12': 'application/x-pkcs12',
'.p7b': 'application/x-pkcs7-certificates',
'.p7c': 'application/pkcs7-mime',
'.p7m': 'application/pkcs7-mime',
'.p7s': 'application/pkcs7-signature',
'.p8': 'application/pkcs8',
'.pack': 'application/x-java-pack200',
'.pak': 'application/x-pak',
'.par2': 'application/x-par2',
'.pas': 'text/x-pascal',
'.patch': 'text/x-patch',
'.pbm': 'image/x-portable-bitmap',
'.pcap': 'application/vnd.tcpdump.pcap',
'.pcd': 'image/x-photo-cd',
'.pcf': 'application/x-cisco-vpn-settings',
'.pcf.gz': 'application/x-font-pcf',
'.pcf.z': 'application/x-font-pcf',
'.pcl': 'application/vnd.hp-pcl',
'.pct': 'image/x-pict',
'.pcx': 'image/x-pcx',
'.pdb': 'chemical/x-pdb',
'.pdc': 'application/x-aportisdoc',
'.pdf': 'application/pdf',
'.pdf.bz2': 'application/x-bzpdf',
'.pdf.gz': 'application/x-gzpdf',
'.pdf.xz': 'application/x-xzpdf',
'.pef': 'image/x-pentax-pef',
'.pem': 'application/x-x509-ca-cert',
'.perl': 'application/x-perl',
'.pfa': 'application/x-font-type1',
'.pfb': 'application/x-font-type1',
'.pfx': 'application/x-pkcs12',
'.pgm': 'image/x-portable-graymap',
'.pgn': 'application/x-chess-pgn',
'.pgp': 'application/pgp-encrypted',
'.php': 'application/x-php',
'.php3': 'application/x-php',
'.php4': 'application/x-php',
'.php5': 'application/x-php',
'.phps': 'application/x-php',
'.pict': 'image/x-pict',
'.pict1': 'image/x-pict',
'.pict2': 'image/x-pict',
'.pk': 'application/x-tex-pk',
'.pkipath': 'application/pkix-pkipath',
'.pkr': 'application/pgp-keys',
'.pl': 'application/x-perl',
'.pla': 'audio/x-iriver-pla',
'.pln': 'application/x-planperfect',
'.pls': 'audio/x-scpls',
'.pm': 'application/x-perl',
'.png': 'image/png',
'.pnm': 'image/x-portable-anymap',
'.pntg': 'image/x-macpaint',
'.po': 'text/x-gettext-translation',
'.por': 'application/x-spss-por',
'.pot': 'text/x-gettext-translation-template',
'.potm': 'application/vnd.ms-powerpoint.template.macroenabled.12',
'.potx': 'application/vnd.openxmlformats-officedocument.presentationml.template',
'.ppam': 'application/vnd.ms-powerpoint.addin.macroenabled.12',
'.ppm': 'image/x-portable-pixmap',
'.pps': 'application/vnd.ms-powerpoint',
'.ppsm': 'application/vnd.ms-powerpoint.slideshow.macroenabled.12',
'.ppsx': 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
'.ppt': 'application/vnd.ms-powerpoint',
'.pptm': 'application/vnd.ms-powerpoint.presentation.macroenabled.12',
'.pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'.ppz': 'application/vnd.ms-powerpoint',
'.pqa': 'application/vnd.palm',
'.prc': 'application/vnd.palm',
'.ps': 'application/postscript',
'.ps.bz2': 'application/x-bzpostscript',
'.ps.gz': 'application/x-gzpostscript',
'.psd': 'image/vnd.adobe.photoshop',
'.psf': 'audio/x-psf',
'.psf.gz': 'application/x-gz-font-linux-psf',
'.psflib': 'audio/x-psflib',
'.psid': 'audio/prs.sid',
'.psw': 'application/x-pocket-word',
'.pw': 'application/x-pw',
'.py': 'text/x-python',
'.pyc': 'application/x-python-bytecode',
'.pickle': 'application/python-pickle',
'.pyo': 'application/x-python-bytecode',
'.qif': 'image/x-quicktime',
'.qml': 'text/x-qml',
'.qt': 'video/quicktime',
'.qti': 'application/x-qtiplot',
'.qti.gz': 'application/x-qtiplot',
'.qtif': 'image/x-quicktime',
'.qtl': 'application/x-quicktime-media-link',
'.qtvr': 'video/quicktime',
'.ra': 'audio/vnd.rn-realaudio',
'.raf': 'image/x-fuji-raf',
'.ram': 'application/ram',
'.rar': 'application/x-rar',
'.ras': 'image/x-cmu-raster',
'.raw': 'image/x-panasonic-raw',
'.rax': 'audio/vnd.rn-realaudio',
'.rb': 'application/x-ruby',
'.rdf': 'application/rdf+xml',
'.rdfs': 'application/rdf+xml',
'.reg': 'text/x-ms-regedit',
'.rej': 'text/x-reject',
'.rgb': 'image/x-rgb',
'.rle': 'image/rle',
'.rm': 'application/vnd.rn-realmedia',
'.rmj': 'application/vnd.rn-realmedia',
'.rmm': 'application/vnd.rn-realmedia',
'.rms': 'application/vnd.rn-realmedia',
'.rmvb': 'application/vnd.rn-realmedia',
'.rmx': 'application/vnd.rn-realmedia',
'.rnc': 'application/relax-ng-compact-syntax',
'.rng': 'application/xml',
'.roff': 'text/troff',
'.rp': 'image/vnd.rn-realpix',
'.rpm': 'application/x-rpm',
'.rss': 'application/rss+xml',
'.rt': 'text/vnd.rn-realtext',
'.rtf': 'application/rtf',
'.rtx': 'text/richtext',
'.rv': 'video/vnd.rn-realvideo',
'.rvx': 'video/vnd.rn-realvideo',
'.rw2': 'image/x-panasonic-raw2',
'.s3m': 'audio/x-s3m',
'.sam': 'application/x-amipro',
'.sami': 'application/x-sami',
'.sav': 'application/x-spss-sav',
'.scala': 'text/x-scala',
'.scm': 'text/x-scheme',
'.sda': 'application/vnd.stardivision.draw',
'.sdc': 'application/vnd.stardivision.calc',
'.sdd': 'application/vnd.stardivision.impress',
'.sdp': 'application/sdp',
'.sds': 'application/vnd.stardivision.chart',
'.sdw': 'application/vnd.stardivision.writer',
'.sgf': 'application/x-go-sgf',
'.sgi': 'image/x-sgi',
'.sgl': 'application/vnd.stardivision.writer',
'.sgm': 'text/sgml',
'.sgml': 'text/sgml',
'.sh': 'application/x-shellscript',
'.shape': 'application/x-dia-shape',
'.shar': 'application/x-shar',
'.shn': 'application/x-shorten',
'.siag': 'application/x-siag',
'.sid': 'audio/prs.sid',
'.sik': 'application/x-trash',
'.sis': 'application/vnd.symbian.install',
'.sisx': 'x-epoc/x-sisx-app',
'.sit': 'application/x-stuffit',
'.siv': 'application/sieve',
'.sk': 'image/x-skencil',
'.sk1': 'image/x-skencil',
'.skr': 'application/pgp-keys',
'.sldm': 'application/vnd.ms-powerpoint.slide.macroenabled.12',
'.sldx': 'application/vnd.openxmlformats-officedocument.presentationml.slide',
'.slk': 'text/spreadsheet',
'.smaf': 'application/x-smaf',
'.smc': 'application/x-snes-rom',
'.smd': 'application/vnd.stardivision.mail',
'.smf': 'application/vnd.stardivision.math',
'.smi': 'application/x-sami',
'.smil': 'application/smil',
'.sml': 'application/smil',
'.sms': 'application/x-sms-rom',
'.snd': 'audio/basic',
'.so': 'application/x-sharedlib',
'.spc': 'application/x-pkcs7-certificates',
'.spd': 'application/x-font-speedo',
'.spec': 'text/x-rpm-spec',
'.spl': 'application/x-shockwave-flash',
'.spm': 'application/x-source-rpm',
'.spx': 'audio/x-speex',
'.sql': 'text/x-sql',
'.sr2': 'image/x-sony-sr2',
'.src': 'application/x-wais-source',
'.src.rpm': 'application/x-source-rpm',
'.srf': 'image/x-sony-srf',
'.srt': 'application/x-subrip',
'.ss': 'text/x-scheme',
'.ssa': 'text/x-ssa',
'.stc': 'application/vnd.sun.xml.calc.template',
'.std': 'application/vnd.sun.xml.draw.template',
'.sti': 'application/vnd.sun.xml.impress.template',
'.stm': 'audio/x-stm',
'.stw': 'application/vnd.sun.xml.writer.template',
'.sty': 'text/x-tex',
'.sub': 'text/x-subviewer',
'.sun': 'image/x-sun-raster',
'.sv': 'text/x-svsrc',
'.sv4cpio': 'application/x-sv4cpio',
'.sv4crc': 'application/x-sv4crc',
'.svg': 'image/svg+xml',
'.svgz': 'image/svg+xml-compressed',
'.svh': 'text/x-svhdr',
'.swf': 'application/x-shockwave-flash',
'.swm': 'application/x-ms-wim',
'.sxc': 'application/vnd.sun.xml.calc',
'.sxd': 'application/vnd.sun.xml.draw',
'.sxg': 'application/vnd.sun.xml.writer.global',
'.sxi': 'application/vnd.sun.xml.impress',
'.sxm': 'application/vnd.sun.xml.math',
'.sxw': 'application/vnd.sun.xml.writer',
'.sylk': 'text/spreadsheet',
'.t': 'text/troff',
'.t2t': 'text/x-txt2tags',
'.tar': 'application/x-tar',
'.tar.bz': 'application/x-bzip-compressed-tar',
'.tar.bz2': 'application/x-bzip-compressed-tar',
'.tar.gz': 'application/x-compressed-tar',
'.tar.lrz': 'application/x-lrzip-compressed-tar',
'.tar.lzma': 'application/x-lzma-compressed-tar',
'.tar.lzo': 'application/x-tzo',
'.tar.xz': 'application/x-xz-compressed-tar',
'.tar.z': 'application/x-tarz',
'.taz': 'application/x-tarz',
'.tb2': 'application/x-bzip-compressed-tar',
'.tbz': 'application/x-bzip-compressed-tar',
'.tbz2': 'application/x-bzip-compressed-tar',
'.tcl': 'text/x-tcl',
'.tex': 'text/x-tex',
'.texi': 'text/x-texinfo',
'.texinfo': 'text/x-texinfo',
'.tga': 'image/x-tga',
'.tgz': 'application/x-compressed-tar',
'.theme': 'application/x-theme',
'.themepack': 'application/x-windows-themepack',
'.tif': 'image/tiff',
'.tiff': 'image/tiff',
'.tk': 'text/x-tcl',
'.tlrz': 'application/x-lrzip-compressed-tar',
'.tlz': 'application/x-lzma-compressed-tar',
'.tnef': 'application/vnd.ms-tnef',
'.tnf': 'application/vnd.ms-tnef',
'.toc': 'application/x-cdrdao-toc',
'.torrent': 'application/x-bittorrent',
'.tpic': 'image/x-tga',
'.tr': 'text/troff',
'.ts': 'video/mp2t',
'.tsv': 'text/tab-separated-values',
'.tta': 'audio/x-tta',
'.ttc': 'application/x-font-ttf',
'.ttf': 'application/x-font-ttf',
'.ttx': 'application/x-font-ttx',
'.txt': 'text/plain',
'.txz': 'application/x-xz-compressed-tar',
'.tzo': 'application/x-tzo',
'.ufraw': 'application/x-ufraw',
'.ui': 'application/x-gtk-builder',
'.uil': 'text/x-uil',
'.ult': 'audio/x-mod',
'.uni': 'audio/x-mod',
'.url': 'application/x-mswinurl',
'.ustar': 'application/x-ustar',
'.uue': 'text/x-uuencode',
'.v': 'text/x-verilog',
'.vala': 'text/x-vala',
'.vapi': 'text/x-vala',
'.vcard': 'text/vcard',
'.vcf': 'text/vcard',
'.vcs': 'text/calendar',
'.vct': 'text/vcard',
'.vda': 'image/x-tga',
'.vhd': 'text/x-vhdl',
'.vhdl': 'text/x-vhdl',
'.viv': 'video/vivo',
'.vivo': 'video/vivo',
'.vlc': 'audio/x-mpegurl',
'.vob': 'video/mpeg',
'.voc': 'audio/x-voc',
'.vor': 'application/vnd.stardivision.writer',
'.vrm': 'model/vrml',
'.vrml': 'model/vrml',
'.vsd': 'application/vnd.visio',
'.vss': 'application/vnd.visio',
'.vst': 'image/x-tga',
'.vsw': 'application/vnd.visio',
'.vtt': 'text/vtt',
'.w2p': 'application/w2p',
'.wav': 'audio/x-wav',
'.wax': 'audio/x-ms-asx',
'.wb1': 'application/x-quattropro',
'.wb2': 'application/x-quattropro',
'.wb3': 'application/x-quattropro',
'.wbmp': 'image/vnd.wap.wbmp',
'.wcm': 'application/vnd.ms-works',
'.wdb': 'application/vnd.ms-works',
'.webm': 'video/webm',
'.wim': 'application/x-ms-wim',
'.wk1': 'application/vnd.lotus-1-2-3',
'.wk3': 'application/vnd.lotus-1-2-3',
'.wk4': 'application/vnd.lotus-1-2-3',
'.wks': 'application/vnd.ms-works',
'.wma': 'audio/x-ms-wma',
'.wmf': 'image/x-wmf',
'.wml': 'text/vnd.wap.wml',
'.wmls': 'text/vnd.wap.wmlscript',
'.wmv': 'video/x-ms-wmv',
'.wmx': 'audio/x-ms-asx',
'.woff': 'application/font-woff',
'.wp': 'application/vnd.wordperfect',
'.wp4': 'application/vnd.wordperfect',
'.wp5': 'application/vnd.wordperfect',
'.wp6': 'application/vnd.wordperfect',
'.wpd': 'application/vnd.wordperfect',
'.wpg': 'application/x-wpg',
'.wpl': 'application/vnd.ms-wpl',
'.wpp': 'application/vnd.wordperfect',
'.wps': 'application/vnd.ms-works',
'.wri': 'application/x-mswrite',
'.wrl': 'model/vrml',
'.wsgi': 'text/x-python',
'.wv': 'audio/x-wavpack',
'.wvc': 'audio/x-wavpack-correction',
'.wvp': 'audio/x-wavpack',
'.wvx': 'audio/x-ms-asx',
'.wwf': 'application/x-wwf',
'.x3f': 'image/x-sigma-x3f',
'.xac': 'application/x-gnucash',
'.xbel': 'application/x-xbel',
'.xbl': 'application/xml',
'.xbm': 'image/x-xbitmap',
'.xcf': 'image/x-xcf',
'.xcf.bz2': 'image/x-compressed-xcf',
'.xcf.gz': 'image/x-compressed-xcf',
'.xhtml': 'application/xhtml+xml',
'.xi': 'audio/x-xi',
'.xla': 'application/vnd.ms-excel',
'.xlam': 'application/vnd.ms-excel.addin.macroenabled.12',
'.xlc': 'application/vnd.ms-excel',
'.xld': 'application/vnd.ms-excel',
'.xlf': 'application/x-xliff',
'.xliff': 'application/x-xliff',
'.xll': 'application/vnd.ms-excel',
'.xlm': 'application/vnd.ms-excel',
'.xlr': 'application/vnd.ms-works',
'.xls': 'application/vnd.ms-excel',
'.xlsb': 'application/vnd.ms-excel.sheet.binary.macroenabled.12',
'.xlsm': 'application/vnd.ms-excel.sheet.macroenabled.12',
'.xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'.xlt': 'application/vnd.ms-excel',
'.xltm': 'application/vnd.ms-excel.template.macroenabled.12',
'.xltx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
'.xlw': 'application/vnd.ms-excel',
'.xm': 'audio/x-xm',
'.xmf': 'audio/x-xmf',
'.xmi': 'text/x-xmi',
'.xml': 'application/xml',
'.xpi': 'application/x-xpinstall',
'.xpm': 'image/x-xpixmap',
'.xps': 'application/oxps',
'.xsd': 'application/xml',
'.xsl': 'application/xslt+xml',
'.xslfo': 'text/x-xslfo',
'.xslt': 'application/xslt+xml',
'.xspf': 'application/xspf+xml',
'.xul': 'application/vnd.mozilla.xul+xml',
'.xwd': 'image/x-xwindowdump',
'.xyz': 'chemical/x-pdb',
'.xz': 'application/x-xz',
'.yaml': 'application/x-yaml',
'.yml': 'application/x-yaml',
'.z': 'application/x-compress',
'.zabw': 'application/x-abiword',
'.zip': 'application/zip',
'.zoo': 'application/x-zoo',
}
def contenttype(filename, default='text/plain'):
"""
Returns the Content-Type string matching extension of the given filename.
"""
i = filename.rfind('.')
if i >= 0:
default = CONTENT_TYPE.get(filename[i:].lower(), default)
j = filename.rfind('.', 0, i)
if j >= 0:
default = CONTENT_TYPE.get(filename[j:].lower(), default)
if default.startswith('text/'):
default += '; charset=utf-8'
return default
| ajibawa-2023/Python-Code-Large/train/row_470 | 13 | 853 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_470:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 21], "level": 0, "parent": null, "vector": [8, 0, 0.0147, 0.0211, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis file is part of the web2py Web Framework\nCopyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>\nLicense: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)\n\nCONTENT_TYPE dictionary created against freedesktop.org' shared mime info\ndatabase version 1.1.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_470:Assign_L23_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [23, 23], "level": 0, "parent": null, "vector": [14, 0, 0.027, 0.0012, 0, 0.66, 0.3333, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = ['contenttype']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_470:Assign_L25_C0", "label": "CONTENT_TYPE =", "type": "assigned_variable", "loc": [25, 837], "level": 0, "parent": null, "vector": [14, 0, 0.5053, 0.9531, 0, 0.66, 0.6667, 818, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "CONTENT_TYPE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "CONTENT_TYPE = {\n '.123': 'application/vnd.lotus-1-2-3',\n '.3ds': 'image/x-3ds',\n '.3g2': 'video/3gpp2',\n '.3ga': 'video/3gpp',\n '.3gp': 'video/3gpp',\n '.3gp2': 'video/3gpp2',\n '.3gpp': 'video/3gpp',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_470:FunctionDef_L840_C0", "label": "contenttype", "type": "function", "loc": [840, 853], "level": 0, "parent": null, "vector": [2, 0, 0.9924, 0.0164, 0, 0.66, 1.0, 97, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "contenttype", "arg_names": ["filename", "default"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def contenttype(filename, default='text/plain'):\n \"\"\"\n Returns the Content-Type string matching extension of the given filename.\n \"\"\"\n\n i = filename.rfind('.')\n if i >= 0:\n default = CONTENT_TYPE.get(filename[i:].lower(), default)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_470:Expr_L841_C4", "label": "expression", "type": "expression", "loc": [841, 843], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_470:FunctionDef_L840_C0", "vector": [8, 1, 0.9871, 0.0035, 1, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Returns the Content-Type string matching extension of the given filename.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_470:Assign_L845_C4", "label": "i = rfind()", "type": "assigned_variable", "loc": [845, 845], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_470:FunctionDef_L840_C0", "vector": [14, 1, 0.9906, 0.0012, 1, 0.03, 0.25, 826, 3, 1, 0, 0, 634, 10, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "rfind", "annotation": ""}, "snippet": " i = filename.rfind('.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_470:If_L846_C4", "label": "if", "type": "if", "loc": [846, 850], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_470:FunctionDef_L840_C0", "vector": [4, 1, 0.9941, 0.0059, 1, 0.03, 0.5, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i >= 0:\n default = CONTENT_TYPE.get(filename[i:].lower(), default)\n j = filename.rfind('.', 0, i)\n if j >= 0:\n default = CONTENT_TYPE.get(filename[j:].lower(), default)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_470:Assign_L847_C8", "label": "default = get()", "type": "assigned_variable", "loc": [847, 847], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_470:If_L846_C4", "vector": [14, 2, 0.993, 0.0012, 2, 0.05, 0.0, 977, 3, 2, 0, 0, 607, 10, 2], "semantic": {"name": "default", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " default = CONTENT_TYPE.get(filename[i:].lower(), default)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_470:Assign_L848_C8", "label": "j = rfind()", "type": "assigned_variable", "loc": [848, 848], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_470:If_L846_C4", "vector": [14, 2, 0.9941, 0.0012, 2, 0.05, 0.5, 100, 3, 3, 0, 0, 634, 10, 1], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "rfind", "annotation": ""}, "snippet": " j = filename.rfind('.', 0, i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_470:If_L849_C8", "label": "if", "type": "if", "loc": [849, 850], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_470:If_L846_C4", "vector": [4, 2, 0.9959, 0.0023, 2, 0.05, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if j >= 0:\n default = CONTENT_TYPE.get(filename[j:].lower(), default)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_470:Assign_L850_C12", "label": "default = get()", "type": "assigned_variable", "loc": [850, 850], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_470:If_L849_C8", "vector": [14, 3, 0.9965, 0.0012, 3, 0.95, 0.0, 977, 3, 2, 0, 0, 607, 10, 2], "semantic": {"name": "default", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " default = CONTENT_TYPE.get(filename[j:].lower(), default)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_470:If_L851_C4", "label": "if", "type": "if", "loc": [851, 852], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_470:FunctionDef_L840_C0", "vector": [4, 1, 0.9982, 0.0023, 1, 0.03, 0.75, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if default.startswith('text/'):\n default += '; charset=utf-8'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_470:Return_L853_C4", "label": "return", "type": "return", "loc": [853, 853], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_470:FunctionDef_L840_C0", "vector": [13, 1, 1.0, 0.0012, 1, 0.03, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return default"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_470:FunctionDef_L840_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_470:Expr_L841_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_470:FunctionDef_L840_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_470:Assign_L845_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_470:FunctionDef_L840_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_470:If_L846_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_470:If_L846_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_470:Assign_L847_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_470:If_L846_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_470:Assign_L848_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_470:If_L846_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_470:If_L849_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_470:If_L849_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_470:Assign_L850_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_470:FunctionDef_L840_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_470:If_L851_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_470:FunctionDef_L840_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_470:Return_L853_C4"}] |
from test_http import *
from test_cache import *
from test_dal import *
from test_html import *
from test_is_url import *
from test_languages import *
from test_router import *
from test_routes import *
from test_storage import *
from test_template import *
from test_utils import *
from test_contribs import *
from test_web import *
import sys
if sys.version[:3] == '2.7':
from test_old_doctests import *
| ajibawa-2023/Python-Code-Large/train/row_472 | 16 | 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_472:ImportFrom_L1_C0", "label": "from test_http import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0588, 0, 0.66, 0.0, 891, 0, 1, 0, 0, 891, 0, 0], "semantic": {"name": "test_http", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from test_http import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_472:ImportFrom_L2_C0", "label": "from test_cache import *", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1176, 0.0588, 0, 0.66, 0.0714, 215, 0, 1, 0, 0, 215, 0, 0], "semantic": {"name": "test_cache", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from test_cache import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_472:ImportFrom_L3_C0", "label": "from test_dal import *", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.1765, 0.0588, 0, 0.66, 0.1429, 409, 0, 1, 0, 0, 409, 0, 0], "semantic": {"name": "test_dal", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from test_dal import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_472:ImportFrom_L4_C0", "label": "from test_html import *", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.2353, 0.0588, 0, 0.66, 0.2143, 556, 0, 1, 0, 0, 556, 0, 0], "semantic": {"name": "test_html", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from test_html import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_472:ImportFrom_L5_C0", "label": "from test_is_url import *", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.2941, 0.0588, 0, 0.66, 0.2857, 264, 0, 1, 0, 0, 264, 0, 0], "semantic": {"name": "test_is_url", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from test_is_url import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_472:ImportFrom_L6_C0", "label": "from test_languages import *", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.3529, 0.0588, 0, 0.66, 0.3571, 942, 0, 1, 0, 0, 942, 0, 0], "semantic": {"name": "test_languages", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from test_languages import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_472:ImportFrom_L7_C0", "label": "from test_router import *", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.4118, 0.0588, 0, 0.66, 0.4286, 661, 0, 1, 0, 0, 661, 0, 0], "semantic": {"name": "test_router", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from test_router import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_472:ImportFrom_L8_C0", "label": "from test_routes import *", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.4706, 0.0588, 0, 0.66, 0.5, 134, 0, 1, 0, 0, 134, 0, 0], "semantic": {"name": "test_routes", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from test_routes import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_472:ImportFrom_L9_C0", "label": "from test_storage import *", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.5294, 0.0588, 0, 0.66, 0.5714, 583, 0, 1, 0, 0, 583, 0, 0], "semantic": {"name": "test_storage", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from test_storage import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_472:ImportFrom_L10_C0", "label": "from test_template import *", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.5882, 0.0588, 0, 0.66, 0.6429, 26, 0, 1, 0, 0, 26, 0, 0], "semantic": {"name": "test_template", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from test_template import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_472:ImportFrom_L11_C0", "label": "from test_utils import *", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.6471, 0.0588, 0, 0.66, 0.7143, 329, 0, 1, 0, 0, 329, 0, 0], "semantic": {"name": "test_utils", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from test_utils import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_472:ImportFrom_L12_C0", "label": "from test_contribs import *", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.7059, 0.0588, 0, 0.66, 0.7857, 709, 0, 1, 0, 0, 709, 0, 0], "semantic": {"name": "test_contribs", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from test_contribs import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_472:ImportFrom_L13_C0", "label": "from test_web import *", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.7647, 0.0588, 0, 0.66, 0.8571, 446, 0, 1, 0, 0, 446, 0, 0], "semantic": {"name": "test_web", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from test_web import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_472:Import_L15_C0", "label": "sys import sys", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.8824, 0.0588, 0, 0.66, 0.9286, 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_472:If_L16_C0", "label": "if", "type": "if", "loc": [16, 17], "level": 0, "parent": null, "vector": [4, 0, 0.9706, 0.1176, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if sys.version[:3] == '2.7':\n from test_old_doctests import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_472:ImportFrom_L17_C4", "label": "from test_old_doctests import *", "type": "import", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_472:If_L16_C0", "vector": [1, 1, 1.0, 0.0588, 1, 0.59, 0.0, 909, 0, 1, 0, 0, 909, 0, 0], "semantic": {"name": "test_old_doctests", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": " from test_old_doctests import *"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_472:If_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_472:ImportFrom_L17_C4"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
"""
from SimpleXMLRPCServer import SimpleXMLRPCDispatcher
def handler(request, response, methods):
response.session_id = None # no sessions for xmlrpc
dispatcher = SimpleXMLRPCDispatcher(allow_none=True, encoding=None)
for method in methods:
dispatcher.register_function(method)
dispatcher.register_introspection_functions()
response.headers['Content-Type'] = 'text/xml'
dispatch = getattr(dispatcher, '_dispatch', None)
return dispatcher._marshaled_dispatch(request.body.read(), dispatch)
| ajibawa-2023/Python-Code-Large/train/row_473 | 11 | 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_473:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 8], "level": 0, "parent": null, "vector": [8, 0, 0.2857, 0.2381, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis file is part of the web2py Web Framework\nCopyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>\nLicense: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_473:ImportFrom_L10_C0", "label": "from SimpleXMLRPCServer import SimpleXMLRPCDispatcher", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.4762, 0.0476, 0, 0.66, 0.5, 73, 0, 1, 0, 0, 73, 0, 0], "semantic": {"name": "SimpleXMLRPCServer", "arg_names": [], "import_names": ["SimpleXMLRPCDispatcher"], "rhs_call_name": "", "annotation": ""}, "snippet": "from SimpleXMLRPCServer import SimpleXMLRPCDispatcher"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_473:FunctionDef_L13_C0", "label": "handler", "type": "function", "loc": [13, 21], "level": 0, "parent": null, "vector": [2, 0, 0.8095, 0.4286, 0, 0.66, 1.0, 388, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "handler", "arg_names": ["request", "response", "methods"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def handler(request, response, methods):\n response.session_id = None # no sessions for xmlrpc\n dispatcher = SimpleXMLRPCDispatcher(allow_none=True, encoding=None)\n for method in methods:\n dispatcher.register_function(method)\n dispatcher.register_introspection_functions()\n response.headers['Content-Type'] = 'text/xml'\n dispatch = getattr(dispatcher, '_dispatch', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_473:Assign_L14_C4", "label": "response.session_id =", "type": "assigned_variable", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_473:FunctionDef_L13_C0", "vector": [14, 1, 0.6667, 0.0476, 1, 0.67, 0.0, 212, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "response.session_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.session_id = None # no sessions for xmlrpc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_473:Assign_L15_C4", "label": "dispatcher = SimpleXMLRPCDispatcher()", "type": "assigned_variable", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_473:FunctionDef_L13_C0", "vector": [14, 1, 0.7143, 0.0476, 1, 0.67, 0.1667, 350, 3, 2, 0, 0, 649, 10, 1], "semantic": {"name": "dispatcher", "arg_names": [], "import_names": [], "rhs_call_name": "SimpleXMLRPCDispatcher", "annotation": ""}, "snippet": " dispatcher = SimpleXMLRPCDispatcher(allow_none=True, encoding=None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_473:For_L16_C4", "label": "for method", "type": "for", "loc": [16, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_473:FunctionDef_L13_C0", "vector": [6, 1, 0.7857, 0.0952, 1, 0.67, 0.3333, 445, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for method in methods:\n dispatcher.register_function(method)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_473:Expr_L17_C8", "label": "register_function()", "type": "expression", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_473:For_L16_C4", "vector": [8, 2, 0.8095, 0.0476, 2, 0.01, 0.0, 885, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "register_function", "arg_names": [], "import_names": [], "rhs_call_name": "register_function", "annotation": ""}, "snippet": " dispatcher.register_function(method)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_473:Expr_L18_C4", "label": "register_introspection_functions()", "type": "expression", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_473:FunctionDef_L13_C0", "vector": [8, 1, 0.8571, 0.0476, 1, 0.67, 0.5, 350, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "register_introspection_functions", "arg_names": [], "import_names": [], "rhs_call_name": "register_introspection_functions", "annotation": ""}, "snippet": " dispatcher.register_introspection_functions()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_473:Assign_L19_C4", "label": "assign", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_473:FunctionDef_L13_C0", "vector": [14, 1, 0.9048, 0.0476, 1, 0.67, 0.6667, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response.headers['Content-Type'] = 'text/xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_473:Assign_L20_C4", "label": "dispatch = getattr()", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_473:FunctionDef_L13_C0", "vector": [14, 1, 0.9524, 0.0476, 1, 0.67, 0.8333, 416, 3, 3, 0, 0, 121, 10, 1], "semantic": {"name": "dispatch", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " dispatch = getattr(dispatcher, '_dispatch', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_473:Return_L21_C4", "label": "return", "type": "return", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_473:FunctionDef_L13_C0", "vector": [13, 1, 1.0, 0.0476, 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 dispatcher._marshaled_dispatch(request.body.read(), dispatch)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_473:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_473:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_473:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_473:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_473:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_473:For_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_473:For_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_473:Expr_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_473:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_473:Expr_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_473:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_473:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_473:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_473:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_473:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_473:Return_L21_C4"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu> and
Limodou <limodou@gmail.com>.
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
This makes uses of the pywin32 package
(http://sourceforge.net/projects/pywin32/).
You do not need to install this package to use web2py.
"""
import time
import os
import sys
import traceback
try:
import win32serviceutil
import win32service
import win32event
except:
if os.name == 'nt':
print "Warning, winservice is unable to install the Mark Hammond Win32 extensions"
import servicemanager
import _winreg
from fileutils import up
__all__ = ['web2py_windows_service_handler']
class Service(win32serviceutil.ServiceFramework):
_svc_name_ = '_unNamed'
_svc_display_name_ = '_Service Template'
def __init__(self, *args):
win32serviceutil.ServiceFramework.__init__(self, *args)
self.stop_event = win32event.CreateEvent(None, 0, 0, None)
def log(self, msg):
servicemanager.LogInfoMsg(str(msg))
def SvcDoRun(self):
self.ReportServiceStatus(win32service.SERVICE_START_PENDING)
try:
self.ReportServiceStatus(win32service.SERVICE_RUNNING)
self.start()
win32event.WaitForSingleObject(self.stop_event,
win32event.INFINITE)
except:
self.log(traceback.format_exc(sys.exc_info))
self.SvcStop()
self.ReportServiceStatus(win32service.SERVICE_STOPPED)
def SvcStop(self):
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
try:
self.stop()
except:
self.log(traceback.format_exc(sys.exc_info))
win32event.SetEvent(self.stop_event)
self.ReportServiceStatus(win32service.SERVICE_STOPPED)
# to be overridden
def start(self):
pass
# to be overridden
def stop(self):
pass
class Web2pyService(Service):
_svc_name_ = 'web2py'
_svc_display_name_ = 'web2py Service'
_exe_args_ = 'options'
server = None
def chdir(self):
try:
h = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
r'SYSTEM\CurrentControlSet\Services\%s'
% self._svc_name_)
try:
cls = _winreg.QueryValue(h, 'PythonClass')
finally:
_winreg.CloseKey(h)
dir = os.path.dirname(cls)
os.chdir(dir)
from gluon.settings import global_settings
global_settings.gluon_parent = dir
return True
except:
self.log("Can't change to web2py working path; server is stopped")
return False
def start(self):
self.log('web2py server starting')
if not self.chdir():
return
if len(sys.argv) == 2:
opt_mod = sys.argv[1]
else:
opt_mod = self._exe_args_
options = __import__(opt_mod, [], [], '')
if True: # legacy support for old options files, which have only (deprecated) numthreads
if hasattr(options, 'numthreads') and not hasattr(options, 'minthreads'):
options.minthreads = options.numthreads
if not hasattr(options, 'minthreads'):
options.minthreads = None
if not hasattr(options, 'maxthreads'):
options.maxthreads = None
import main
self.server = main.HttpServer(
ip=options.ip,
port=options.port,
password=options.password,
pid_filename=options.pid_filename,
log_filename=options.log_filename,
profiler_filename=options.profiler_filename,
ssl_certificate=options.ssl_certificate,
ssl_private_key=options.ssl_private_key,
min_threads=options.minthreads,
max_threads=options.maxthreads,
server_name=options.server_name,
request_queue_size=options.request_queue_size,
timeout=options.timeout,
shutdown_timeout=options.shutdown_timeout,
path=options.folder
)
try:
from rewrite import load
load()
self.server.start()
except:
# self.server.stop()
self.server = None
raise
def stop(self):
self.log('web2py server stopping')
if not self.chdir():
return
if self.server:
self.server.stop()
time.sleep(1)
class Web2pyCronService(Web2pyService):
_svc_name_ = 'web2py_cron'
_svc_display_name_ = 'web2py Cron Service'
_exe_args_ = 'options'
def start(self):
import newcron
import global_settings
self.log('web2py server starting')
if not self.chdir():
return
if len(sys.argv) == 2:
opt_mod = sys.argv[1]
else:
opt_mod = self._exe_args_
options = __import__(opt_mod, [], [], '')
global_settings.global_settings.web2py_crontype = 'external'
if options.scheduler: # -K
apps = [app.strip() for app in options.scheduler.split(
',') if check_existent_app(options, app.strip())]
else:
apps = None
self.extcron = newcron.extcron(options.folder, apps=apps)
try:
self.extcron.start()
except:
# self.server.stop()
self.extcron = None
raise
def stop(self):
self.log('web2py cron stopping')
if not self.chdir():
return
if self.extcron:
self.extcron.join()
def register_service_handler(argv=None, opt_file='options', cls=Web2pyService):
path = os.path.dirname(__file__)
web2py_path = up(path)
if web2py_path.endswith('.zip'): # in case bianry distro 'library.zip'
web2py_path = os.path.dirname(web2py_path)
os.chdir(web2py_path)
classstring = os.path.normpath(
os.path.join(web2py_path, 'gluon.winservice.'+cls.__name__))
if opt_file:
cls._exe_args_ = opt_file
win32serviceutil.HandleCommandLine(
cls, serviceClassString=classstring, argv=['', 'install'])
win32serviceutil.HandleCommandLine(
cls, serviceClassString=classstring, argv=argv)
if __name__ == '__main__':
register_service_handler(cls=Web2pyService)
register_service_handler(cls=Web2pyCronService)
| ajibawa-2023/Python-Code-Large/train/row_474 | 130 | 213 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L3_C0", "label": "expression", "type": "expression", "loc": [3, 14], "level": 0, "parent": null, "vector": [8, 0, 0.0399, 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": "\"\"\"\nThis file is part of the web2py Web Framework\nDeveloped by Massimo Di Pierro <mdipierro@cs.depaul.edu> and\nLimodou <limodou@gmail.com>.\nLicense: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)\n\nThis makes uses of the pywin32 package\n(http://sourceforge.net/projects/pywin32/)."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Import_L16_C0", "label": "time import time", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0751, 0.0047, 0, 0.66, 0.0714, 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_474:Import_L17_C0", "label": "os import os", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0798, 0.0047, 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_474:Import_L18_C0", "label": "sys import sys", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0845, 0.0047, 0, 0.66, 0.2143, 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_474:Import_L19_C0", "label": "traceback import traceback", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0892, 0.0047, 0, 0.66, 0.2857, 423, 0, 1, 0, 0, 423, 0, 0], "semantic": {"name": "traceback", "arg_names": [], "import_names": ["traceback"], "rhs_call_name": "", "annotation": ""}, "snippet": "import traceback"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L20_C0", "label": "try", "type": "try", "loc": [20, 26], "level": 0, "parent": null, "vector": [7, 0, 0.108, 0.0329, 0, 0.66, 0.3571, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n import win32serviceutil\n import win32service\n import win32event\nexcept:\n if os.name == 'nt':\n print(\"Warning, winservice is unable to install the Mark Hammond Win32 extensions\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Import_L21_C4", "label": "win32serviceutil import win32serviceutil", "type": "import", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L20_C0", "vector": [1, 1, 0.0986, 0.0047, 1, 0.53, 0.0, 545, 0, 1, 0, 0, 545, 0, 0], "semantic": {"name": "win32serviceutil", "arg_names": [], "import_names": ["win32serviceutil"], "rhs_call_name": "", "annotation": ""}, "snippet": " import win32serviceutil"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Import_L22_C4", "label": "win32service import win32service", "type": "import", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L20_C0", "vector": [1, 1, 0.1033, 0.0047, 1, 0.53, 0.5, 29, 0, 1, 0, 0, 29, 0, 0], "semantic": {"name": "win32service", "arg_names": [], "import_names": ["win32service"], "rhs_call_name": "", "annotation": ""}, "snippet": " import win32service"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Import_L23_C4", "label": "win32event import win32event", "type": "import", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L20_C0", "vector": [1, 1, 0.108, 0.0047, 1, 0.53, 1.0, 130, 0, 1, 0, 0, 130, 0, 0], "semantic": {"name": "win32event", "arg_names": [], "import_names": ["win32event"], "rhs_call_name": "", "annotation": ""}, "snippet": " import win32event"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:If_L25_C4", "label": "if", "type": "if", "loc": [25, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L20_C0", "vector": [4, 1, 0.1197, 0.0094, 1, 0.53, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.name == 'nt':\n print(\"Warning, winservice is unable to install the Mark Hammond Win32 extensions\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L26_C8", "label": "print()", "type": "expression", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L25_C4", "vector": [8, 2, 0.1221, 0.0047, 2, 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(\"Warning, winservice is unable to install the Mark Hammond Win32 extensions\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Import_L27_C0", "label": "servicemanager import servicemanager", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.1268, 0.0047, 0, 0.66, 0.4286, 512, 0, 1, 0, 0, 512, 0, 0], "semantic": {"name": "servicemanager", "arg_names": [], "import_names": ["servicemanager"], "rhs_call_name": "", "annotation": ""}, "snippet": "import servicemanager"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Import_L28_C0", "label": "_winreg import _winreg", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.1315, 0.0047, 0, 0.66, 0.5, 90, 0, 1, 0, 0, 90, 0, 0], "semantic": {"name": "_winreg", "arg_names": [], "import_names": ["_winreg"], "rhs_call_name": "", "annotation": ""}, "snippet": "import _winreg"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:ImportFrom_L29_C0", "label": "from fileutils import up", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.1362, 0.0047, 0, 0.66, 0.5714, 687, 0, 1, 0, 0, 687, 0, 0], "semantic": {"name": "fileutils", "arg_names": [], "import_names": ["up"], "rhs_call_name": "", "annotation": ""}, "snippet": "from fileutils import up"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L32_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.1502, 0.0047, 0, 0.66, 0.6429, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = ['web2py_windows_service_handler']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L35_C0", "label": "Service", "type": "class", "loc": [35, 76], "level": 0, "parent": null, "vector": [3, 0, 0.2606, 0.1972, 0, 0.66, 0.7143, 451, 0, 6, 0, 0, 342, 0, 18], "semantic": {"name": "Service", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Service(win32serviceutil.ServiceFramework):\n\n _svc_name_ = '_unNamed'\n _svc_display_name_ = '_Service Template'\n\n def __init__(self, *args):\n win32serviceutil.ServiceFramework.__init__(self, *args)\n self.stop_event = win32event.CreateEvent(None, 0, 0, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L37_C4", "label": "_svc_name_ =", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L35_C0", "vector": [14, 1, 0.1737, 0.0047, 1, 0.27, 0.0, 210, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_svc_name_", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _svc_name_ = '_unNamed'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L38_C4", "label": "_svc_display_name_ =", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L35_C0", "vector": [14, 1, 0.1784, 0.0047, 1, 0.27, 0.1429, 193, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_svc_display_name_", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _svc_display_name_ = '_Service Template'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L40_C4", "label": "__init__", "type": "function", "loc": [40, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L35_C0", "vector": [2, 1, 0.1925, 0.0141, 1, 0.27, 0.2857, 555, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *args):\n win32serviceutil.ServiceFramework.__init__(self, *args)\n self.stop_event = win32event.CreateEvent(None, 0, 0, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L41_C8", "label": "__init__()", "type": "expression", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L40_C4", "vector": [8, 2, 0.1925, 0.0047, 2, 0.94, 0.0, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " win32serviceutil.ServiceFramework.__init__(self, *args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L42_C8", "label": "self.stop_event = CreateEvent()", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L40_C4", "vector": [14, 2, 0.1972, 0.0047, 2, 0.94, 1.0, 453, 3, 4, 0, 0, 264, 10, 1], "semantic": {"name": "self.stop_event", "arg_names": [], "import_names": [], "rhs_call_name": "CreateEvent", "annotation": ""}, "snippet": " self.stop_event = win32event.CreateEvent(None, 0, 0, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L44_C4", "label": "log", "type": "function", "loc": [44, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L35_C0", "vector": [2, 1, 0.2089, 0.0094, 1, 0.27, 0.4286, 432, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "log", "arg_names": ["self", "msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def log(self, msg):\n servicemanager.LogInfoMsg(str(msg))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L45_C8", "label": "LogInfoMsg()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L44_C4", "vector": [8, 2, 0.2113, 0.0047, 2, 0.89, 0.0, 439, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "LogInfoMsg", "arg_names": [], "import_names": [], "rhs_call_name": "LogInfoMsg", "annotation": ""}, "snippet": " servicemanager.LogInfoMsg(str(msg))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L47_C4", "label": "SvcDoRun", "type": "function", "loc": [47, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L35_C0", "vector": [2, 1, 0.2441, 0.0516, 1, 0.27, 0.5714, 865, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "SvcDoRun", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def SvcDoRun(self):\n self.ReportServiceStatus(win32service.SERVICE_START_PENDING)\n try:\n self.ReportServiceStatus(win32service.SERVICE_RUNNING)\n self.start()\n win32event.WaitForSingleObject(self.stop_event,\n win32event.INFINITE)\n except:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L48_C8", "label": "ReportServiceStatus()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L47_C4", "vector": [8, 2, 0.2254, 0.0047, 2, 0.28, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ReportServiceStatus", "arg_names": [], "import_names": [], "rhs_call_name": "ReportServiceStatus", "annotation": ""}, "snippet": " self.ReportServiceStatus(win32service.SERVICE_START_PENDING)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L49_C8", "label": "try", "type": "try", "loc": [49, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L47_C4", "vector": [7, 2, 0.2465, 0.0376, 2, 0.28, 0.5, 0, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.ReportServiceStatus(win32service.SERVICE_RUNNING)\n self.start()\n win32event.WaitForSingleObject(self.stop_event,\n win32event.INFINITE)\n except:\n self.log(traceback.format_exc(sys.exc_info))\n self.SvcStop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L50_C12", "label": "ReportServiceStatus()", "type": "expression", "loc": [50, 50], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L49_C8", "vector": [8, 3, 0.2347, 0.0047, 3, 0.2, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ReportServiceStatus", "arg_names": [], "import_names": [], "rhs_call_name": "ReportServiceStatus", "annotation": ""}, "snippet": " self.ReportServiceStatus(win32service.SERVICE_RUNNING)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L51_C12", "label": "start()", "type": "expression", "loc": [51, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L49_C8", "vector": [8, 3, 0.2394, 0.0047, 3, 0.2, 0.5, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " self.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L52_C12", "label": "WaitForSingleObject()", "type": "expression", "loc": [52, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L49_C8", "vector": [8, 3, 0.2465, 0.0094, 3, 0.2, 1.0, 283, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "WaitForSingleObject", "arg_names": [], "import_names": [], "rhs_call_name": "WaitForSingleObject", "annotation": ""}, "snippet": " win32event.WaitForSingleObject(self.stop_event,\n win32event.INFINITE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L55_C12", "label": "log()", "type": "expression", "loc": [55, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L49_C8", "vector": [8, 3, 0.2582, 0.0047, 3, 0.2, 0.0, 432, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "log", "arg_names": [], "import_names": [], "rhs_call_name": "log", "annotation": ""}, "snippet": " self.log(traceback.format_exc(sys.exc_info))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L56_C12", "label": "SvcStop()", "type": "expression", "loc": [56, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L49_C8", "vector": [8, 3, 0.2629, 0.0047, 3, 0.2, 1.0, 416, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "SvcStop", "arg_names": [], "import_names": [], "rhs_call_name": "SvcStop", "annotation": ""}, "snippet": " self.SvcStop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L57_C8", "label": "ReportServiceStatus()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L47_C4", "vector": [8, 2, 0.2676, 0.0047, 2, 0.28, 1.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ReportServiceStatus", "arg_names": [], "import_names": [], "rhs_call_name": "ReportServiceStatus", "annotation": ""}, "snippet": " self.ReportServiceStatus(win32service.SERVICE_STOPPED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L59_C4", "label": "SvcStop", "type": "function", "loc": [59, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L35_C0", "vector": [2, 1, 0.2934, 0.0376, 1, 0.27, 0.7143, 416, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "SvcStop", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def SvcStop(self):\n self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)\n try:\n self.stop()\n except:\n self.log(traceback.format_exc(sys.exc_info))\n win32event.SetEvent(self.stop_event)\n self.ReportServiceStatus(win32service.SERVICE_STOPPED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L60_C8", "label": "ReportServiceStatus()", "type": "expression", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L59_C4", "vector": [8, 2, 0.2817, 0.0047, 2, 0.51, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ReportServiceStatus", "arg_names": [], "import_names": [], "rhs_call_name": "ReportServiceStatus", "annotation": ""}, "snippet": " self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L61_C8", "label": "try", "type": "try", "loc": [61, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L59_C4", "vector": [7, 2, 0.2934, 0.0188, 2, 0.51, 0.3333, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.stop()\n except:\n self.log(traceback.format_exc(sys.exc_info))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L62_C12", "label": "stop()", "type": "expression", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L61_C8", "vector": [8, 3, 0.2911, 0.0047, 3, 0.21, 0.0, 343, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "stop", "annotation": ""}, "snippet": " self.stop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L64_C12", "label": "log()", "type": "expression", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L61_C8", "vector": [8, 3, 0.3005, 0.0047, 3, 0.21, 0.0, 432, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "log", "arg_names": [], "import_names": [], "rhs_call_name": "log", "annotation": ""}, "snippet": " self.log(traceback.format_exc(sys.exc_info))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L65_C8", "label": "SetEvent()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L59_C4", "vector": [8, 2, 0.3052, 0.0047, 2, 0.51, 0.6667, 892, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "SetEvent", "arg_names": [], "import_names": [], "rhs_call_name": "SetEvent", "annotation": ""}, "snippet": " win32event.SetEvent(self.stop_event)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L66_C8", "label": "ReportServiceStatus()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L59_C4", "vector": [8, 2, 0.3099, 0.0047, 2, 0.51, 1.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ReportServiceStatus", "arg_names": [], "import_names": [], "rhs_call_name": "ReportServiceStatus", "annotation": ""}, "snippet": " self.ReportServiceStatus(win32service.SERVICE_STOPPED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L70_C4", "label": "start", "type": "function", "loc": [70, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L35_C0", "vector": [2, 1, 0.331, 0.0094, 1, 0.27, 0.8571, 511, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "start", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def start(self):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L75_C4", "label": "stop", "type": "function", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L35_C0", "vector": [2, 1, 0.3545, 0.0094, 1, 0.27, 1.0, 343, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "stop", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def stop(self):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L79_C0", "label": "Web2pyService", "type": "class", "loc": [79, 155], "level": 0, "parent": null, "vector": [3, 0, 0.5493, 0.3615, 0, 0.66, 0.7857, 750, 0, 3, 0, 0, 451, 0, 21], "semantic": {"name": "Web2pyService", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Web2pyService(Service):\n\n _svc_name_ = 'web2py'\n _svc_display_name_ = 'web2py Service'\n _exe_args_ = 'options'\n server = None\n\n def chdir(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L81_C4", "label": "_svc_name_ =", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L79_C0", "vector": [14, 1, 0.3803, 0.0047, 1, 0.75, 0.0, 210, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_svc_name_", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _svc_name_ = 'web2py'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L82_C4", "label": "_svc_display_name_ =", "type": "assigned_variable", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L79_C0", "vector": [14, 1, 0.385, 0.0047, 1, 0.75, 0.1667, 193, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_svc_display_name_", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _svc_display_name_ = 'web2py Service'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L83_C4", "label": "_exe_args_ =", "type": "assigned_variable", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L79_C0", "vector": [14, 1, 0.3897, 0.0047, 1, 0.75, 0.3333, 683, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_exe_args_", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _exe_args_ = 'options'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L84_C4", "label": "server =", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L79_C0", "vector": [14, 1, 0.3944, 0.0047, 1, 0.75, 0.5, 268, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "server", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " server = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L86_C4", "label": "chdir", "type": "function", "loc": [86, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L79_C0", "vector": [2, 1, 0.4413, 0.0798, 1, 0.75, 0.6667, 122, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "chdir", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def chdir(self):\n try:\n h = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,\n r'SYSTEM\\CurrentControlSet\\Services\\%s'\n % self._svc_name_)\n try:\n cls = _winreg.QueryValue(h, 'PythonClass')\n finally:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L87_C8", "label": "try", "type": "try", "loc": [87, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L86_C4", "vector": [7, 2, 0.4437, 0.0751, 2, 0.15, 0.0, 0, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n h = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,\n r'SYSTEM\\CurrentControlSet\\Services\\%s'\n % self._svc_name_)\n try:\n cls = _winreg.QueryValue(h, 'PythonClass')\n finally:\n _winreg.CloseKey(h)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L88_C12", "label": "h = OpenKey()", "type": "assigned_variable", "loc": [88, 90], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L87_C8", "vector": [14, 3, 0.4178, 0.0141, 3, 0.06, 0.0, 686, 3, 2, 0, 0, 828, 10, 1], "semantic": {"name": "h", "arg_names": [], "import_names": [], "rhs_call_name": "OpenKey", "annotation": ""}, "snippet": " h = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,\n r'SYSTEM\\CurrentControlSet\\Services\\%s'\n % self._svc_name_)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L91_C12", "label": "try", "type": "try", "loc": [91, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L87_C8", "vector": [7, 3, 0.4343, 0.0188, 3, 0.06, 0.1667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n cls = _winreg.QueryValue(h, 'PythonClass')\n finally:\n _winreg.CloseKey(h)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L92_C16", "label": "cls = QueryValue()", "type": "assigned_variable", "loc": [92, 92], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L91_C12", "vector": [14, 4, 0.4319, 0.0047, 4, 0.11, 0.0, 594, 3, 2, 0, 0, 547, 10, 1], "semantic": {"name": "cls", "arg_names": [], "import_names": [], "rhs_call_name": "QueryValue", "annotation": ""}, "snippet": " cls = _winreg.QueryValue(h, 'PythonClass')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L94_C16", "label": "CloseKey()", "type": "expression", "loc": [94, 94], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L91_C12", "vector": [8, 4, 0.4413, 0.0047, 4, 0.11, 1.0, 298, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "CloseKey", "arg_names": [], "import_names": [], "rhs_call_name": "CloseKey", "annotation": ""}, "snippet": " _winreg.CloseKey(h)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L95_C12", "label": "dir = dirname()", "type": "assigned_variable", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L87_C8", "vector": [14, 3, 0.446, 0.0047, 3, 0.06, 0.3333, 152, 3, 1, 0, 0, 959, 10, 1], "semantic": {"name": "dir", "arg_names": [], "import_names": [], "rhs_call_name": "dirname", "annotation": ""}, "snippet": " dir = os.path.dirname(cls)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L96_C12", "label": "chdir()", "type": "expression", "loc": [96, 96], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L87_C8", "vector": [8, 3, 0.4507, 0.0047, 3, 0.06, 0.5, 122, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "chdir", "arg_names": [], "import_names": [], "rhs_call_name": "chdir", "annotation": ""}, "snippet": " os.chdir(dir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:ImportFrom_L97_C12", "label": "from gluon.settings import global_settings", "type": "import", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L87_C8", "vector": [1, 3, 0.4554, 0.0047, 3, 0.06, 0.6667, 883, 0, 1, 0, 0, 883, 0, 0], "semantic": {"name": "gluon.settings", "arg_names": [], "import_names": ["global_settings"], "rhs_call_name": "", "annotation": ""}, "snippet": " from gluon.settings import global_settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L98_C12", "label": "global_settings.gluon_parent =", "type": "assigned_variable", "loc": [98, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L87_C8", "vector": [14, 3, 0.4601, 0.0047, 3, 0.06, 0.8333, 207, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "global_settings.gluon_parent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " global_settings.gluon_parent = dir"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Return_L99_C12", "label": "return", "type": "return", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L87_C8", "vector": [13, 3, 0.4648, 0.0047, 3, 0.06, 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_474:Expr_L101_C12", "label": "log()", "type": "expression", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L87_C8", "vector": [8, 3, 0.4742, 0.0047, 3, 0.06, 0.0, 432, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "log", "arg_names": [], "import_names": [], "rhs_call_name": "log", "annotation": ""}, "snippet": " self.log(\"Can't change to web2py working path; server is stopped\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Return_L102_C12", "label": "return", "type": "return", "loc": [102, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L87_C8", "vector": [13, 3, 0.4789, 0.0047, 3, 0.06, 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_474:FunctionDef_L104_C4", "label": "start", "type": "function", "loc": [104, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L79_C0", "vector": [2, 1, 0.5892, 0.2066, 1, 0.75, 0.8333, 511, 0, 1, 0, 0, 0, 0, 11], "semantic": {"name": "start", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def start(self):\n self.log('web2py server starting')\n if not self.chdir():\n return\n if len(sys.argv) == 2:\n opt_mod = sys.argv[1]\n else:\n opt_mod = self._exe_args_"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L105_C8", "label": "log()", "type": "expression", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L104_C4", "vector": [8, 2, 0.493, 0.0047, 2, 0.32, 0.0, 432, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "log", "arg_names": [], "import_names": [], "rhs_call_name": "log", "annotation": ""}, "snippet": " self.log('web2py server starting')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:If_L106_C8", "label": "if", "type": "if", "loc": [106, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L104_C4", "vector": [4, 2, 0.5, 0.0094, 2, 0.32, 0.1429, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.chdir():\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Return_L107_C12", "label": "return", "type": "return", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L106_C8", "vector": [13, 3, 0.5023, 0.0047, 3, 0.94, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:If_L108_C8", "label": "if", "type": "if", "loc": [108, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L104_C4", "vector": [4, 2, 0.5141, 0.0188, 2, 0.32, 0.2857, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) == 2:\n opt_mod = sys.argv[1]\n else:\n opt_mod = self._exe_args_"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L109_C12", "label": "opt_mod =", "type": "assigned_variable", "loc": [109, 109], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L108_C8", "vector": [14, 3, 0.5117, 0.0047, 3, 0.82, 0.0, 742, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "opt_mod", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " opt_mod = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L111_C12", "label": "opt_mod =", "type": "assigned_variable", "loc": [111, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L108_C8", "vector": [14, 3, 0.5211, 0.0047, 3, 0.82, 1.0, 742, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "opt_mod", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " opt_mod = self._exe_args_"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L112_C8", "label": "options = __import__()", "type": "assigned_variable", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L104_C4", "vector": [14, 2, 0.5258, 0.0047, 2, 0.32, 0.4286, 707, 3, 4, 0, 0, 744, 10, 1], "semantic": {"name": "options", "arg_names": [], "import_names": [], "rhs_call_name": "__import__", "annotation": ""}, "snippet": " options = __import__(opt_mod, [], [], '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:If_L113_C8", "label": "if", "type": "if", "loc": [113, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L104_C4", "vector": [4, 2, 0.5446, 0.0329, 2, 0.32, 0.5714, 0, 1, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if True: # legacy support for old options files, which have only (deprecated) numthreads\n if hasattr(options, 'numthreads') and not hasattr(options, 'minthreads'):\n options.minthreads = options.numthreads\n if not hasattr(options, 'minthreads'):\n options.minthreads = None\n if not hasattr(options, 'maxthreads'):\n options.maxthreads = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:If_L114_C12", "label": "if", "type": "if", "loc": [114, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L113_C8", "vector": [4, 3, 0.5376, 0.0094, 3, 0.63, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(options, 'numthreads') and not hasattr(options, 'minthreads'):\n options.minthreads = options.numthreads"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L115_C16", "label": "options.minthreads =", "type": "assigned_variable", "loc": [115, 115], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L114_C12", "vector": [14, 4, 0.5399, 0.0047, 4, 0.26, 0.0, 370, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "options.minthreads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " options.minthreads = options.numthreads"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:If_L116_C12", "label": "if", "type": "if", "loc": [116, 117], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L113_C8", "vector": [4, 3, 0.5469, 0.0094, 3, 0.63, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hasattr(options, 'minthreads'):\n options.minthreads = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L117_C16", "label": "options.minthreads =", "type": "assigned_variable", "loc": [117, 117], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L116_C12", "vector": [14, 4, 0.5493, 0.0047, 4, 0.42, 0.0, 370, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "options.minthreads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " options.minthreads = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:If_L118_C12", "label": "if", "type": "if", "loc": [118, 119], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L113_C8", "vector": [4, 3, 0.5563, 0.0094, 3, 0.63, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hasattr(options, 'maxthreads'):\n options.maxthreads = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L119_C16", "label": "options.maxthreads =", "type": "assigned_variable", "loc": [119, 119], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L118_C12", "vector": [14, 4, 0.5587, 0.0047, 4, 0.95, 0.0, 160, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "options.maxthreads", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " options.maxthreads = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Import_L120_C8", "label": "main import main", "type": "import", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L104_C4", "vector": [1, 2, 0.5634, 0.0047, 2, 0.32, 0.7143, 624, 0, 1, 0, 0, 624, 0, 0], "semantic": {"name": "main", "arg_names": [], "import_names": ["main"], "rhs_call_name": "", "annotation": ""}, "snippet": " import main"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L121_C8", "label": "self.server = HttpServer()", "type": "assigned_variable", "loc": [121, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L104_C4", "vector": [14, 2, 0.6056, 0.0798, 2, 0.32, 0.8571, 81, 3, 15, 0, 0, 661, 10, 1], "semantic": {"name": "self.server", "arg_names": [], "import_names": [], "rhs_call_name": "HttpServer", "annotation": ""}, "snippet": " self.server = main.HttpServer(\n ip=options.ip,\n port=options.port,\n password=options.password,\n pid_filename=options.pid_filename,\n log_filename=options.log_filename,\n profiler_filename=options.profiler_filename,\n ssl_certificate=options.ssl_certificate,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L138_C8", "label": "try", "type": "try", "loc": [138, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L104_C4", "vector": [7, 2, 0.669, 0.0469, 2, 0.32, 1.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n from rewrite import load\n load()\n self.server.start()\n except:\n\n # self.server.stop()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:ImportFrom_L139_C12", "label": "from rewrite import load", "type": "import", "loc": [139, 139], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L138_C8", "vector": [1, 3, 0.6526, 0.0047, 3, 0.85, 0.0, 669, 0, 1, 0, 0, 669, 0, 0], "semantic": {"name": "rewrite", "arg_names": [], "import_names": ["load"], "rhs_call_name": "", "annotation": ""}, "snippet": " from rewrite import load"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L140_C12", "label": "load()", "type": "expression", "loc": [140, 140], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L138_C8", "vector": [8, 3, 0.6573, 0.0047, 3, 0.85, 0.5, 37, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "load", "arg_names": [], "import_names": [], "rhs_call_name": "load", "annotation": ""}, "snippet": " load()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L141_C12", "label": "start()", "type": "expression", "loc": [141, 141], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L138_C8", "vector": [8, 3, 0.662, 0.0047, 3, 0.85, 1.0, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " self.server.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L146_C12", "label": "self.server =", "type": "assigned_variable", "loc": [146, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L138_C8", "vector": [14, 3, 0.6854, 0.0047, 3, 0.85, 0.0, 81, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.server", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.server = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L149_C4", "label": "stop", "type": "function", "loc": [149, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L79_C0", "vector": [2, 1, 0.7136, 0.0329, 1, 0.75, 1.0, 343, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "stop", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def stop(self):\n self.log('web2py server stopping')\n if not self.chdir():\n return\n if self.server:\n self.server.stop()\n time.sleep(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L150_C8", "label": "log()", "type": "expression", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L149_C4", "vector": [8, 2, 0.7042, 0.0047, 2, 0.67, 0.0, 432, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "log", "arg_names": [], "import_names": [], "rhs_call_name": "log", "annotation": ""}, "snippet": " self.log('web2py server stopping')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:If_L151_C8", "label": "if", "type": "if", "loc": [151, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L149_C4", "vector": [4, 2, 0.7113, 0.0094, 2, 0.67, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.chdir():\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Return_L152_C12", "label": "return", "type": "return", "loc": [152, 152], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L151_C8", "vector": [13, 3, 0.7136, 0.0047, 3, 0.23, 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_474:If_L153_C8", "label": "if", "type": "if", "loc": [153, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L149_C4", "vector": [4, 2, 0.7207, 0.0094, 2, 0.67, 0.6667, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.server:\n self.server.stop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L154_C12", "label": "stop()", "type": "expression", "loc": [154, 154], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L153_C8", "vector": [8, 3, 0.723, 0.0047, 3, 0.59, 0.0, 343, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "stop", "arg_names": [], "import_names": [], "rhs_call_name": "stop", "annotation": ""}, "snippet": " self.server.stop()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L155_C8", "label": "sleep()", "type": "expression", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L149_C4", "vector": [8, 2, 0.7277, 0.0047, 2, 0.67, 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(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L158_C0", "label": "Web2pyCronService", "type": "class", "loc": [158, 194], "level": 0, "parent": null, "vector": [3, 0, 0.8263, 0.1737, 0, 0.66, 0.8571, 18, 0, 2, 0, 0, 750, 0, 13], "semantic": {"name": "Web2pyCronService", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Web2pyCronService(Web2pyService):\n\n _svc_name_ = 'web2py_cron'\n _svc_display_name_ = 'web2py Cron Service'\n _exe_args_ = 'options'\n\n def start(self):\n import newcron"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L160_C4", "label": "_svc_name_ =", "type": "assigned_variable", "loc": [160, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L158_C0", "vector": [14, 1, 0.7512, 0.0047, 1, 0.25, 0.0, 210, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_svc_name_", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _svc_name_ = 'web2py_cron'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L161_C4", "label": "_svc_display_name_ =", "type": "assigned_variable", "loc": [161, 161], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L158_C0", "vector": [14, 1, 0.7559, 0.0047, 1, 0.25, 0.25, 193, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_svc_display_name_", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _svc_display_name_ = 'web2py Cron Service'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L162_C4", "label": "_exe_args_ =", "type": "assigned_variable", "loc": [162, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L158_C0", "vector": [14, 1, 0.7606, 0.0047, 1, 0.25, 0.5, 683, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_exe_args_", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _exe_args_ = 'options'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L164_C4", "label": "start", "type": "function", "loc": [164, 187], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L158_C0", "vector": [2, 1, 0.8239, 0.1127, 1, 0.25, 0.75, 511, 0, 1, 0, 0, 0, 0, 10], "semantic": {"name": "start", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def start(self):\n import newcron\n import global_settings\n self.log('web2py server starting')\n if not self.chdir():\n return\n if len(sys.argv) == 2:\n opt_mod = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Import_L165_C8", "label": "newcron import newcron", "type": "import", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L164_C4", "vector": [1, 2, 0.7746, 0.0047, 2, 0.77, 0.0, 240, 0, 1, 0, 0, 240, 0, 0], "semantic": {"name": "newcron", "arg_names": [], "import_names": ["newcron"], "rhs_call_name": "", "annotation": ""}, "snippet": " import newcron"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Import_L166_C8", "label": "global_settings import global_settings", "type": "import", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L164_C4", "vector": [1, 2, 0.7793, 0.0047, 2, 0.77, 0.1111, 493, 0, 1, 0, 0, 493, 0, 0], "semantic": {"name": "global_settings", "arg_names": [], "import_names": ["global_settings"], "rhs_call_name": "", "annotation": ""}, "snippet": " import global_settings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L167_C8", "label": "log()", "type": "expression", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L164_C4", "vector": [8, 2, 0.784, 0.0047, 2, 0.77, 0.2222, 432, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "log", "arg_names": [], "import_names": [], "rhs_call_name": "log", "annotation": ""}, "snippet": " self.log('web2py server starting')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:If_L168_C8", "label": "if", "type": "if", "loc": [168, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L164_C4", "vector": [4, 2, 0.7911, 0.0094, 2, 0.77, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.chdir():\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Return_L169_C12", "label": "return", "type": "return", "loc": [169, 169], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L168_C8", "vector": [13, 3, 0.7934, 0.0047, 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_474:If_L170_C8", "label": "if", "type": "if", "loc": [170, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L164_C4", "vector": [4, 2, 0.8052, 0.0188, 2, 0.77, 0.4444, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) == 2:\n opt_mod = sys.argv[1]\n else:\n opt_mod = self._exe_args_"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L171_C12", "label": "opt_mod =", "type": "assigned_variable", "loc": [171, 171], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L170_C8", "vector": [14, 3, 0.8028, 0.0047, 3, 0.75, 0.0, 742, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "opt_mod", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " opt_mod = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L173_C12", "label": "opt_mod =", "type": "assigned_variable", "loc": [173, 173], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L170_C8", "vector": [14, 3, 0.8122, 0.0047, 3, 0.75, 1.0, 742, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "opt_mod", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " opt_mod = self._exe_args_"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L174_C8", "label": "options = __import__()", "type": "assigned_variable", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L164_C4", "vector": [14, 2, 0.8169, 0.0047, 2, 0.77, 0.5556, 707, 3, 4, 0, 0, 744, 10, 1], "semantic": {"name": "options", "arg_names": [], "import_names": [], "rhs_call_name": "__import__", "annotation": ""}, "snippet": " options = __import__(opt_mod, [], [], '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L175_C8", "label": "global_settings.global_settings.web2py_crontype =", "type": "assigned_variable", "loc": [175, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L164_C4", "vector": [14, 2, 0.8216, 0.0047, 2, 0.77, 0.6667, 712, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "global_settings.global_settings.web2py_crontype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " global_settings.global_settings.web2py_crontype = 'external'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:If_L176_C8", "label": "if", "type": "if", "loc": [176, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L164_C4", "vector": [4, 2, 0.8357, 0.0235, 2, 0.77, 0.7778, 0, 7, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if options.scheduler: # -K\n apps = [app.strip() for app in options.scheduler.split(\n ',') if check_existent_app(options, app.strip())]\n else:\n apps = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L177_C12", "label": "apps =", "type": "assigned_variable", "loc": [177, 178], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L176_C8", "vector": [14, 3, 0.8333, 0.0094, 3, 0.85, 0.0, 556, 5, 0, 0, 0, 0, 0, 4], "semantic": {"name": "apps", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " apps = [app.strip() for app in options.scheduler.split(\n ',') if check_existent_app(options, app.strip())]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L180_C12", "label": "apps =", "type": "assigned_variable", "loc": [180, 180], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L176_C8", "vector": [14, 3, 0.8451, 0.0047, 3, 0.85, 1.0, 556, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "apps", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " apps = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L181_C8", "label": "self.extcron = extcron()", "type": "assigned_variable", "loc": [181, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L164_C4", "vector": [14, 2, 0.8498, 0.0047, 2, 0.77, 0.8889, 171, 3, 2, 0, 0, 460, 10, 1], "semantic": {"name": "self.extcron", "arg_names": [], "import_names": [], "rhs_call_name": "extcron", "annotation": ""}, "snippet": " self.extcron = newcron.extcron(options.folder, apps=apps)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L182_C8", "label": "try", "type": "try", "loc": [182, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L164_C4", "vector": [7, 2, 0.8662, 0.0282, 2, 0.77, 1.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.extcron.start()\n except:\n # self.server.stop()\n self.extcron = None\n raise"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L183_C12", "label": "start()", "type": "expression", "loc": [183, 183], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L182_C8", "vector": [8, 3, 0.8592, 0.0047, 3, 0.34, 0.0, 511, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " self.extcron.start()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L186_C12", "label": "self.extcron =", "type": "assigned_variable", "loc": [186, 186], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L182_C8", "vector": [14, 3, 0.8732, 0.0047, 3, 0.34, 0.0, 171, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.extcron", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.extcron = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L189_C4", "label": "stop", "type": "function", "loc": [189, 194], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L158_C0", "vector": [2, 1, 0.8991, 0.0282, 1, 0.25, 1.0, 343, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "stop", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def stop(self):\n self.log('web2py cron stopping')\n if not self.chdir():\n return\n if self.extcron:\n self.extcron.join()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L190_C8", "label": "log()", "type": "expression", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L189_C4", "vector": [8, 2, 0.892, 0.0047, 2, 0.61, 0.0, 432, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "log", "arg_names": [], "import_names": [], "rhs_call_name": "log", "annotation": ""}, "snippet": " self.log('web2py cron stopping')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:If_L191_C8", "label": "if", "type": "if", "loc": [191, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L189_C4", "vector": [4, 2, 0.8991, 0.0094, 2, 0.61, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.chdir():\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Return_L192_C12", "label": "return", "type": "return", "loc": [192, 192], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L191_C8", "vector": [13, 3, 0.9014, 0.0047, 3, 0.58, 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_474:If_L193_C8", "label": "if", "type": "if", "loc": [193, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L189_C4", "vector": [4, 2, 0.9085, 0.0094, 2, 0.61, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.extcron:\n self.extcron.join()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L194_C12", "label": "join()", "type": "expression", "loc": [194, 194], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L193_C8", "vector": [8, 3, 0.9108, 0.0047, 3, 0.69, 0.0, 933, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "join", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " self.extcron.join()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L196_C0", "label": "register_service_handler", "type": "function", "loc": [196, 209], "level": 0, "parent": null, "vector": [2, 0, 0.9507, 0.0657, 0, 0.66, 0.9286, 756, 0, 3, 0, 0, 0, 0, 9], "semantic": {"name": "register_service_handler", "arg_names": ["argv", "opt_file", "cls"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def register_service_handler(argv=None, opt_file='options', cls=Web2pyService):\n path = os.path.dirname(__file__)\n web2py_path = up(path)\n if web2py_path.endswith('.zip'): # in case bianry distro 'library.zip'\n web2py_path = os.path.dirname(web2py_path)\n os.chdir(web2py_path)\n classstring = os.path.normpath(\n os.path.join(web2py_path, 'gluon.winservice.'+cls.__name__))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L197_C4", "label": "path = dirname()", "type": "assigned_variable", "loc": [197, 197], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L196_C0", "vector": [14, 1, 0.9249, 0.0047, 1, 0.18, 0.0, 358, 3, 1, 0, 0, 959, 10, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "dirname", "annotation": ""}, "snippet": " path = os.path.dirname(__file__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L198_C4", "label": "web2py_path = up()", "type": "assigned_variable", "loc": [198, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L196_C0", "vector": [14, 1, 0.9296, 0.0047, 1, 0.18, 0.1667, 576, 3, 1, 0, 0, 895, 10, 1], "semantic": {"name": "web2py_path", "arg_names": [], "import_names": [], "rhs_call_name": "up", "annotation": ""}, "snippet": " web2py_path = up(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:If_L199_C4", "label": "if", "type": "if", "loc": [199, 200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L196_C0", "vector": [4, 1, 0.9366, 0.0094, 1, 0.18, 0.3333, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if web2py_path.endswith('.zip'): # in case bianry distro 'library.zip'\n web2py_path = os.path.dirname(web2py_path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L200_C8", "label": "web2py_path = dirname()", "type": "assigned_variable", "loc": [200, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L199_C4", "vector": [14, 2, 0.939, 0.0047, 2, 0.18, 0.0, 576, 3, 1, 0, 0, 959, 10, 1], "semantic": {"name": "web2py_path", "arg_names": [], "import_names": [], "rhs_call_name": "dirname", "annotation": ""}, "snippet": " web2py_path = os.path.dirname(web2py_path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L201_C4", "label": "chdir()", "type": "expression", "loc": [201, 201], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L196_C0", "vector": [8, 1, 0.9437, 0.0047, 1, 0.18, 0.5, 122, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "chdir", "arg_names": [], "import_names": [], "rhs_call_name": "chdir", "annotation": ""}, "snippet": " os.chdir(web2py_path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L202_C4", "label": "classstring = normpath()", "type": "assigned_variable", "loc": [202, 203], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L196_C0", "vector": [14, 1, 0.9507, 0.0094, 1, 0.18, 0.6667, 828, 3, 1, 0, 0, 638, 10, 2], "semantic": {"name": "classstring", "arg_names": [], "import_names": [], "rhs_call_name": "normpath", "annotation": ""}, "snippet": " classstring = os.path.normpath(\n os.path.join(web2py_path, 'gluon.winservice.'+cls.__name__))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:If_L204_C4", "label": "if", "type": "if", "loc": [204, 207], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L196_C0", "vector": [4, 1, 0.9648, 0.0188, 1, 0.18, 0.8333, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if opt_file:\n cls._exe_args_ = opt_file\n win32serviceutil.HandleCommandLine(\n cls, serviceClassString=classstring, argv=['', 'install'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L205_C8", "label": "cls._exe_args_ =", "type": "assigned_variable", "loc": [205, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L204_C4", "vector": [14, 2, 0.9624, 0.0047, 2, 0.92, 0.0, 463, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cls._exe_args_", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cls._exe_args_ = opt_file"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L206_C8", "label": "HandleCommandLine()", "type": "expression", "loc": [206, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L204_C4", "vector": [8, 2, 0.9695, 0.0094, 2, 0.92, 1.0, 144, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "HandleCommandLine", "arg_names": [], "import_names": [], "rhs_call_name": "HandleCommandLine", "annotation": ""}, "snippet": " win32serviceutil.HandleCommandLine(\n cls, serviceClassString=classstring, argv=['', 'install'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L208_C4", "label": "HandleCommandLine()", "type": "expression", "loc": [208, 209], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L196_C0", "vector": [8, 1, 0.9789, 0.0094, 1, 0.18, 1.0, 144, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "HandleCommandLine", "arg_names": [], "import_names": [], "rhs_call_name": "HandleCommandLine", "annotation": ""}, "snippet": " win32serviceutil.HandleCommandLine(\n cls, serviceClassString=classstring, argv=argv)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:If_L211_C0", "label": "if", "type": "if", "loc": [211, 213], "level": 0, "parent": null, "vector": [4, 0, 0.9953, 0.0141, 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 register_service_handler(cls=Web2pyService)\n register_service_handler(cls=Web2pyCronService)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L212_C4", "label": "register_service_handler()", "type": "expression", "loc": [212, 212], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L211_C0", "vector": [8, 1, 0.9953, 0.0047, 1, 0.77, 0.0, 756, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "register_service_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_service_handler", "annotation": ""}, "snippet": " register_service_handler(cls=Web2pyService)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L213_C4", "label": "register_service_handler()", "type": "expression", "loc": [213, 213], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_474:If_L211_C0", "vector": [8, 1, 1.0, 0.0047, 1, 0.77, 1.0, 756, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "register_service_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_service_handler", "annotation": ""}, "snippet": " register_service_handler(cls=Web2pyCronService)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Import_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Import_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Import_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:If_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L44_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L49_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L50_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L49_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L49_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L52_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L49_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L49_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L56_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L62_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L61_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L64_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L88_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L91_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L91_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L92_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L91_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L94_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L95_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L96_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:ImportFrom_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L98_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Return_L99_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L87_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Return_L102_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:If_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L106_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Return_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:If_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L108_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L109_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L108_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:If_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L113_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:If_L114_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L114_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L115_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L113_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:If_L116_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L116_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L117_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L113_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:If_L118_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L118_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L119_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Import_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:ImportFrom_L139_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L140_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L141_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L146_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:If_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L151_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Return_L152_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:If_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L153_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L154_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L158_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L158_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L158_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L158_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Import_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Import_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:If_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L168_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Return_L169_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:If_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L171_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L170_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L173_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L175_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:If_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L176_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L177_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L176_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L180_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L181_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L182_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L182_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L183_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:Try_L182_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L186_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:ClassDef_L158_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:If_L191_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L191_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Return_L192_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L189_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:If_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L193_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L194_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L196_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L196_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L196_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:If_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L199_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L196_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L201_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L196_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L196_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:If_L204_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L204_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Assign_L205_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L204_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L206_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:FunctionDef_L196_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L208_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L211_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L212_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_474:If_L211_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_474:Expr_L213_C4"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
"""
import cgi
import os
import re
import copy
import types
import urllib
import base64
import sanitizer
import itertools
import decoder
import copy_reg
import cPickle
import marshal
from HTMLParser import HTMLParser
from htmlentitydefs import name2codepoint
from storage import Storage
from utils import web2py_uuid, simple_hash, compare
from highlight import highlight
regex_crlf = re.compile('\r|\n')
join = ''.join
# name2codepoint is incomplete respect to xhtml (and xml): 'apos' is missing.
entitydefs = dict(map(lambda (
k, v): (k, unichr(v).encode('utf-8')), name2codepoint.iteritems()))
entitydefs.setdefault('apos', u"'".encode('utf-8'))
__all__ = [
'A',
'B',
'BEAUTIFY',
'BODY',
'BR',
'BUTTON',
'CENTER',
'CAT',
'CODE',
'COL',
'COLGROUP',
'DIV',
'EM',
'EMBED',
'FIELDSET',
'FORM',
'H1',
'H2',
'H3',
'H4',
'H5',
'H6',
'HEAD',
'HR',
'HTML',
'I',
'IFRAME',
'IMG',
'INPUT',
'LABEL',
'LEGEND',
'LI',
'LINK',
'OL',
'UL',
'MARKMIN',
'MENU',
'META',
'OBJECT',
'ON',
'OPTION',
'P',
'PRE',
'SCRIPT',
'OPTGROUP',
'SELECT',
'SPAN',
'STRONG',
'STYLE',
'TABLE',
'TAG',
'TD',
'TEXTAREA',
'TH',
'THEAD',
'TBODY',
'TFOOT',
'TITLE',
'TR',
'TT',
'URL',
'XHTML',
'XML',
'xmlescape',
'embed64',
]
def xmlescape(data, quote=True):
"""
returns an escaped string of the provided data
:param data: the data to be escaped
:param quote: optional (default False)
"""
# first try the xml function
if hasattr(data, 'xml') and callable(data.xml):
return data.xml()
# otherwise, make it a string
if not isinstance(data, (str, unicode)):
data = str(data)
elif isinstance(data, unicode):
data = data.encode('utf8', 'xmlcharrefreplace')
# ... and do the escaping
data = cgi.escape(data, quote).replace("'", "'")
return data
def call_as_list(f,*a,**b):
if not isinstance(f, (list,tuple)):
f = [f]
for item in f:
item(*a,**b)
def truncate_string(text, length, dots='...'):
text = text.decode('utf-8')
if len(text) > length:
text = text[:length - len(dots)].encode('utf-8') + dots
return text
def URL(
a=None,
c=None,
f=None,
r=None,
args=None,
vars=None,
anchor='',
extension=None,
env=None,
hmac_key=None,
hash_vars=True,
salt=None,
user_signature=None,
scheme=None,
host=None,
port=None,
encode_embedded_slash=False,
url_encode=True
):
"""
generate a URL
example::
>>> str(URL(a='a', c='c', f='f', args=['x', 'y', 'z'],
... vars={'p':1, 'q':2}, anchor='1'))
'/a/c/f/x/y/z?p=1&q=2#1'
>>> str(URL(a='a', c='c', f='f', args=['x', 'y', 'z'],
... vars={'p':(1,3), 'q':2}, anchor='1'))
'/a/c/f/x/y/z?p=1&p=3&q=2#1'
>>> str(URL(a='a', c='c', f='f', args=['x', 'y', 'z'],
... vars={'p':(3,1), 'q':2}, anchor='1'))
'/a/c/f/x/y/z?p=3&p=1&q=2#1'
>>> str(URL(a='a', c='c', f='f', anchor='1+2'))
'/a/c/f#1%2B2'
>>> str(URL(a='a', c='c', f='f', args=['x', 'y', 'z'],
... vars={'p':(1,3), 'q':2}, anchor='1', hmac_key='key'))
'/a/c/f/x/y/z?p=1&p=3&q=2&_signature=a32530f0d0caa80964bb92aad2bedf8a4486a31f#1'
>>> str(URL(a='a', c='c', f='f', args=['w/x', 'y/z']))
'/a/c/f/w/x/y/z'
>>> str(URL(a='a', c='c', f='f', args=['w/x', 'y/z'], encode_embedded_slash=True))
'/a/c/f/w%2Fx/y%2Fz'
>>> str(URL(a='a', c='c', f='f', args=['%(id)d'], url_encode=False))
'/a/c/f/%(id)d'
>>> str(URL(a='a', c='c', f='f', args=['%(id)d'], url_encode=True))
'/a/c/f/%25%28id%29d'
>>> str(URL(a='a', c='c', f='f', vars={'id' : '%(id)d' }, url_encode=False))
'/a/c/f?id=%(id)d'
>>> str(URL(a='a', c='c', f='f', vars={'id' : '%(id)d' }, url_encode=True))
'/a/c/f?id=%25%28id%29d'
>>> str(URL(a='a', c='c', f='f', anchor='%(id)d', url_encode=False))
'/a/c/f#%(id)d'
>>> str(URL(a='a', c='c', f='f', anchor='%(id)d', url_encode=True))
'/a/c/f#%25%28id%29d'
generates a url '/a/c/f' corresponding to application a, controller c
and function f. If r=request is passed, a, c, f are set, respectively,
to r.application, r.controller, r.function.
The more typical usage is:
URL(r=request, f='index') that generates a url for the index function
within the present application and controller.
:param a: application (default to current if r is given)
:param c: controller (default to current if r is given)
:param f: function (default to current if r is given)
:param r: request (optional)
:param args: any arguments (optional)
:param vars: any variables (optional)
:param anchor: anchorname, without # (optional)
:param hmac_key: key to use when generating hmac signature (optional)
:param hash_vars: which of the vars to include in our hmac signature
True (default) - hash all vars, False - hash none of the vars,
iterable - hash only the included vars ['key1','key2']
:param scheme: URI scheme (True, 'http' or 'https', etc); forces absolute URL (optional)
:param host: string to force absolute URL with host (True means http_host)
:param port: optional port number (forces absolute URL)
:raises SyntaxError: when no application, controller or function is
available
:raises SyntaxError: when a CRLF is found in the generated url
"""
from rewrite import url_out # done here in case used not-in web2py
if args in (None, []):
args = []
vars = vars or {}
application = None
controller = None
function = None
if not isinstance(args, (list, tuple)):
args = [args]
if not r:
if a and not c and not f:
(f, a, c) = (a, c, f)
elif a and c and not f:
(c, f, a) = (a, c, f)
from globals import current
if hasattr(current, 'request'):
r = current.request
if r:
application = r.application
controller = r.controller
function = r.function
env = r.env
if extension is None and r.extension != 'html':
extension = r.extension
if a:
application = a
if c:
controller = c
if f:
if not isinstance(f, str):
if hasattr(f, '__name__'):
function = f.__name__
else:
raise SyntaxError(
'when calling URL, function or function name required')
elif '/' in f:
if f.startswith("/"):
f = f[1:]
items = f.split('/')
function = f = items[0]
args = items[1:] + args
else:
function = f
# if the url gets a static resource, don't force extention
if controller == 'static':
extension = None
if '.' in function:
function, extension = function.rsplit('.', 1)
function2 = '%s.%s' % (function, extension or 'html')
if not (application and controller and function):
raise SyntaxError('not enough information to build the url (%s %s %s)' % (application, controller, function))
if args:
if url_encode:
if encode_embedded_slash:
other = '/' + '/'.join([urllib.quote(str(
x), '') for x in args])
else:
other = args and urllib.quote(
'/' + '/'.join([str(x) for x in args]))
else:
other = args and ('/' + '/'.join([str(x) for x in args]))
else:
other = ''
if other.endswith('/'):
other += '/' # add trailing slash to make last trailing empty arg explicit
list_vars = []
for (key, vals) in sorted(vars.items()):
if key == '_signature':
continue
if not isinstance(vals, (list, tuple)):
vals = [vals]
for val in vals:
list_vars.append((key, val))
if user_signature:
from globals import current
if current.session.auth:
hmac_key = current.session.auth.hmac_key
if hmac_key:
# generate an hmac signature of the vars & args so can later
# verify the user hasn't messed with anything
h_args = '/%s/%s/%s%s' % (application, controller, function2, other)
# how many of the vars should we include in our hash?
if hash_vars is True: # include them all
h_vars = list_vars
elif hash_vars is False: # include none of them
h_vars = ''
else: # include just those specified
if hash_vars and not isinstance(hash_vars, (list, tuple)):
hash_vars = [hash_vars]
h_vars = [(k, v) for (k, v) in list_vars if k in hash_vars]
# re-assembling the same way during hash authentication
message = h_args + '?' + urllib.urlencode(sorted(h_vars))
sig = simple_hash(
message, hmac_key or '', salt or '', digest_alg='sha1')
# add the signature into vars
list_vars.append(('_signature', sig))
if list_vars:
if url_encode:
other += '?%s' % urllib.urlencode(list_vars)
else:
other += '?%s' % '&'.join(['%s=%s' % var[:2] for var in list_vars])
if anchor:
if url_encode:
other += '#' + urllib.quote(str(anchor))
else:
other += '#' + (str(anchor))
if extension:
function += '.' + extension
if regex_crlf.search(join([application, controller, function, other])):
raise SyntaxError('CRLF Injection Detected')
url = url_out(r, env, application, controller, function,
args, other, scheme, host, port)
return url
def verifyURL(request, hmac_key=None, hash_vars=True, salt=None, user_signature=None):
"""
Verifies that a request's args & vars have not been tampered with by the user
:param request: web2py's request object
:param hmac_key: the key to authenticate with, must be the same one previously
used when calling URL()
:param hash_vars: which vars to include in our hashing. (Optional)
Only uses the 1st value currently
True (or undefined) means all, False none,
an iterable just the specified keys
do not call directly. Use instead:
URL.verify(hmac_key='...')
the key has to match the one used to generate the URL.
>>> r = Storage()
>>> gv = Storage(p=(1,3),q=2,_signature='a32530f0d0caa80964bb92aad2bedf8a4486a31f')
>>> r.update(dict(application='a', controller='c', function='f', extension='html'))
>>> r['args'] = ['x', 'y', 'z']
>>> r['get_vars'] = gv
>>> verifyURL(r, 'key')
True
>>> verifyURL(r, 'kay')
False
>>> r.get_vars.p = (3, 1)
>>> verifyURL(r, 'key')
True
>>> r.get_vars.p = (3, 2)
>>> verifyURL(r, 'key')
False
"""
if not '_signature' in request.get_vars:
return False # no signature in the request URL
# check if user_signature requires
if user_signature:
from globals import current
if not current.session or not current.session.auth:
return False
hmac_key = current.session.auth.hmac_key
if not hmac_key:
return False
# get our sig from request.get_vars for later comparison
original_sig = request.get_vars._signature
# now generate a new hmac for the remaining args & vars
vars, args = request.get_vars, request.args
# remove the signature var since it was not part of our signed message
request.get_vars.pop('_signature')
# join all the args & vars into one long string
# always include all of the args
other = args and urllib.quote('/' + '/'.join([str(x) for x in args])) or ''
h_args = '/%s/%s/%s.%s%s' % (request.application,
request.controller,
request.function,
request.extension,
other)
# but only include those vars specified (allows more flexibility for use with
# forms or ajax)
list_vars = []
for (key, vals) in sorted(vars.items()):
if not isinstance(vals, (list, tuple)):
vals = [vals]
for val in vals:
list_vars.append((key, val))
# which of the vars are to be included?
if hash_vars is True: # include them all
h_vars = list_vars
elif hash_vars is False: # include none of them
h_vars = ''
else: # include just those specified
# wrap in a try - if the desired vars have been removed it'll fail
try:
if hash_vars and not isinstance(hash_vars, (list, tuple)):
hash_vars = [hash_vars]
h_vars = [(k, v) for (k, v) in list_vars if k in hash_vars]
except:
# user has removed one of our vars! Immediate fail
return False
# build the full message string with both args & vars
message = h_args + '?' + urllib.urlencode(sorted(h_vars))
# hash with the hmac_key provided
sig = simple_hash(message, str(hmac_key), salt or '', digest_alg='sha1')
# put _signature back in get_vars just in case a second call to URL.verify is performed
# (otherwise it'll immediately return false)
request.get_vars['_signature'] = original_sig
# return whether or not the signature in the request matched the one we just generated
# (I.E. was the message the same as the one we originally signed)
return compare(original_sig, sig)
URL.verify = verifyURL
ON = True
class XmlComponent(object):
"""
Abstract root for all Html components
"""
# TODO: move some DIV methods to here
def xml(self):
raise NotImplementedError
def __mul__(self, n):
return CAT(*[self for i in range(n)])
def __add__(self, other):
if isinstance(self, CAT):
components = self.components
else:
components = [self]
if isinstance(other, CAT):
components += other.components
else:
components += [other]
return CAT(*components)
def add_class(self, name):
""" add a class to _class attribute """
c = self['_class']
classes = (set(c.split()) if c else set()) | set(name.split())
self['_class'] = ' '.join(classes) if classes else None
return self
def remove_class(self, name):
""" remove a class from _class attribute """
c = self['_class']
classes = (set(c.split()) if c else set()) - set(name.split())
self['_class'] = ' '.join(classes) if classes else None
return self
class XML(XmlComponent):
"""
use it to wrap a string that contains XML/HTML so that it will not be
escaped by the template
example:
>>> XML('<h1>Hello</h1>').xml()
'<h1>Hello</h1>'
"""
def __init__(
self,
text,
sanitize=False,
permitted_tags=[
'a',
'b',
'blockquote',
'br/',
'i',
'li',
'ol',
'ul',
'p',
'cite',
'code',
'pre',
'img/',
'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
'table', 'tr', 'td', 'div',
'strong','span',
],
allowed_attributes={
'a': ['href', 'title', 'target'],
'img': ['src', 'alt'],
'blockquote': ['type'],
'td': ['colspan'],
},
):
"""
:param text: the XML text
:param sanitize: sanitize text using the permitted tags and allowed
attributes (default False)
:param permitted_tags: list of permitted tags (default: simple list of
tags)
:param allowed_attributes: dictionary of allowed attributed (default
for A, IMG and BlockQuote).
The key is the tag; the value is a list of allowed attributes.
"""
if sanitize:
text = sanitizer.sanitize(text, permitted_tags,
allowed_attributes)
if isinstance(text, unicode):
text = text.encode('utf8', 'xmlcharrefreplace')
elif not isinstance(text, str):
text = str(text)
self.text = text
def xml(self):
return self.text
def __str__(self):
return self.text
def __add__(self, other):
return '%s%s' % (self, other)
def __radd__(self, other):
return '%s%s' % (other, self)
def __cmp__(self, other):
return cmp(str(self), str(other))
def __hash__(self):
return hash(str(self))
# why was this here? Break unpickling in sessions
# def __getattr__(self, name):
# return getattr(str(self), name)
def __getitem__(self, i):
return str(self)[i]
def __getslice__(self, i, j):
return str(self)[i:j]
def __iter__(self):
for c in str(self):
yield c
def __len__(self):
return len(str(self))
def flatten(self, render=None):
"""
return the text stored by the XML object rendered by the render function
"""
if render:
return render(self.text, None, {})
return self.text
def elements(self, *args, **kargs):
"""
to be considered experimental since the behavior of this method is questionable
another options could be TAG(self.text).elements(*args,**kargs)
"""
return []
### important to allow safe session.flash=T(....)
def XML_unpickle(data):
return marshal.loads(data)
def XML_pickle(data):
return XML_unpickle, (marshal.dumps(str(data)),)
copy_reg.pickle(XML, XML_pickle, XML_unpickle)
class DIV(XmlComponent):
"""
HTML helper, for easy generating and manipulating a DOM structure.
Little or no validation is done.
Behaves like a dictionary regarding updating of attributes.
Behaves like a list regarding inserting/appending components.
example::
>>> DIV('hello', 'world', _style='color:red;').xml()
'<div style=\"color:red;\">helloworld</div>'
all other HTML helpers are derived from DIV.
_something=\"value\" attributes are transparently translated into
something=\"value\" HTML attributes
"""
# name of the tag, subclasses should update this
# tags ending with a '/' denote classes that cannot
# contain components
tag = 'div'
def __init__(self, *components, **attributes):
"""
:param *components: any components that should be nested in this element
:param **attributes: any attributes you want to give to this element
:raises SyntaxError: when a stand alone tag receives components
"""
if self.tag[-1:] == '/' and components:
raise SyntaxError('<%s> tags cannot have components'
% self.tag)
if len(components) == 1 and isinstance(components[0], (list, tuple)):
self.components = list(components[0])
else:
self.components = list(components)
self.attributes = attributes
self._fixup()
# converts special attributes in components attributes
self.parent = None
for c in self.components:
self._setnode(c)
self._postprocessing()
def update(self, **kargs):
"""
dictionary like updating of the tag attributes
"""
for (key, value) in kargs.iteritems():
self[key] = value
return self
def append(self, value):
"""
list style appending of components
>>> a=DIV()
>>> a.append(SPAN('x'))
>>> print a
<div><span>x</span></div>
"""
self._setnode(value)
ret = self.components.append(value)
self._fixup()
return ret
def insert(self, i, value):
"""
list style inserting of components
>>> a=DIV()
>>> a.insert(0,SPAN('x'))
>>> print a
<div><span>x</span></div>
"""
self._setnode(value)
ret = self.components.insert(i, value)
self._fixup()
return ret
def __getitem__(self, i):
"""
gets attribute with name 'i' or component #i.
If attribute 'i' is not found returns None
:param i: index
if i is a string: the name of the attribute
otherwise references to number of the component
"""
if isinstance(i, str):
try:
return self.attributes[i]
except KeyError:
return None
else:
return self.components[i]
def __setitem__(self, i, value):
"""
sets attribute with name 'i' or component #i.
:param i: index
if i is a string: the name of the attribute
otherwise references to number of the component
:param value: the new value
"""
self._setnode(value)
if isinstance(i, (str, unicode)):
self.attributes[i] = value
else:
self.components[i] = value
def __delitem__(self, i):
"""
deletes attribute with name 'i' or component #i.
:param i: index
if i is a string: the name of the attribute
otherwise references to number of the component
"""
if isinstance(i, str):
del self.attributes[i]
else:
del self.components[i]
def __len__(self):
"""
returns the number of included components
"""
return len(self.components)
def __nonzero__(self):
"""
always return True
"""
return True
def _fixup(self):
"""
Handling of provided components.
Nothing to fixup yet. May be overridden by subclasses,
eg for wrapping some components in another component or blocking them.
"""
return
def _wrap_components(self, allowed_parents,
wrap_parent=None,
wrap_lambda=None):
"""
helper for _fixup. Checks if a component is in allowed_parents,
otherwise wraps it in wrap_parent
:param allowed_parents: (tuple) classes that the component should be an
instance of
:param wrap_parent: the class to wrap the component in, if needed
:param wrap_lambda: lambda to use for wrapping, if needed
"""
components = []
for c in self.components:
if isinstance(c, allowed_parents):
pass
elif wrap_lambda:
c = wrap_lambda(c)
else:
c = wrap_parent(c)
if isinstance(c, DIV):
c.parent = self
components.append(c)
self.components = components
def _postprocessing(self):
"""
Handling of attributes (normally the ones not prefixed with '_').
Nothing to postprocess yet. May be overridden by subclasses
"""
return
def _traverse(self, status, hideerror=False):
# TODO: docstring
newstatus = status
for c in self.components:
if hasattr(c, '_traverse') and callable(c._traverse):
c.vars = self.vars
c.request_vars = self.request_vars
c.errors = self.errors
c.latest = self.latest
c.session = self.session
c.formname = self.formname
c['hideerror'] = hideerror or \
self.attributes.get('hideerror', False)
newstatus = c._traverse(status, hideerror) and newstatus
# for input, textarea, select, option
# deal with 'value' and 'validation'
name = self['_name']
if newstatus:
newstatus = self._validate()
self._postprocessing()
elif 'old_value' in self.attributes:
self['value'] = self['old_value']
self._postprocessing()
elif name and name in self.vars:
self['value'] = self.vars[name]
self._postprocessing()
if name:
self.latest[name] = self['value']
return newstatus
def _validate(self):
"""
nothing to validate yet. May be overridden by subclasses
"""
return True
def _setnode(self, value):
if isinstance(value, DIV):
value.parent = self
def _xml(self):
"""
helper for xml generation. Returns separately:
- the component attributes
- the generated xml of the inner components
Component attributes start with an underscore ('_') and
do not have a False or None value. The underscore is removed.
A value of True is replaced with the attribute name.
:returns: tuple: (attributes, components)
"""
# get the attributes for this component
# (they start with '_', others may have special meanings)
attr = []
for key, value in self.attributes.iteritems():
if key[:1] != '_':
continue
name = key[1:]
if value is True:
value = name
elif value is False or value is None:
continue
attr.append((name, value))
data = self.attributes.get('data',{})
for key, value in data.iteritems():
name = 'data-' + key
value = data[key]
attr.append((name,value))
attr.sort()
fa = ''
for name,value in attr:
fa += ' %s="%s"' % (name, xmlescape(value, True))
# get the xml for the inner components
co = join([xmlescape(component) for component in
self.components])
return (fa, co)
def xml(self):
"""
generates the xml for this component.
"""
(fa, co) = self._xml()
if not self.tag:
return co
if self.tag[-1:] == '/':
# <tag [attributes] />
return '<%s%s />' % (self.tag[:-1], fa)
# else: <tag [attributes]> inner components xml </tag>
return '<%s%s>%s</%s>' % (self.tag, fa, co, self.tag)
def __str__(self):
"""
str(COMPONENT) returns equals COMPONENT.xml()
"""
return self.xml()
def flatten(self, render=None):
"""
return the text stored by the DIV object rendered by the render function
the render function must take text, tagname, and attributes
render=None is equivalent to render=lambda text, tag, attr: text
>>> markdown = lambda text,tag=None,attributes={}: \
{None: re.sub('\s+',' ',text), \
'h1':'#'+text+'\\n\\n', \
'p':text+'\\n'}.get(tag,text)
>>> a=TAG('<h1>Header</h1><p>this is a test</p>')
>>> a.flatten(markdown)
'#Header\\n\\nthis is a test\\n'
"""
text = ''
for c in self.components:
if isinstance(c, XmlComponent):
s = c.flatten(render)
elif render:
s = render(str(c))
else:
s = str(c)
text += s
if render:
text = render(text, self.tag, self.attributes)
return text
regex_tag = re.compile('^[\w\-\:]+')
regex_id = re.compile('#([\w\-]+)')
regex_class = re.compile('\.([\w\-]+)')
regex_attr = re.compile('\[([\w\-\:]+)=(.*?)\]')
def elements(self, *args, **kargs):
"""
find all component that match the supplied attribute dictionary,
or None if nothing could be found
All components of the components are searched.
>>> a = DIV(DIV(SPAN('x'),3,DIV(SPAN('y'))))
>>> for c in a.elements('span',first_only=True): c[0]='z'
>>> print a
<div><div><span>z</span>3<div><span>y</span></div></div></div>
>>> for c in a.elements('span'): c[0]='z'
>>> print a
<div><div><span>z</span>3<div><span>z</span></div></div></div>
It also supports a syntax compatible with jQuery
>>> a=TAG('<div><span><a id="1-1" u:v=$>hello</a></span><p class="this is a test">world</p></div>')
>>> for e in a.elements('div a#1-1, p.is'): print e.flatten()
hello
world
>>> for e in a.elements('#1-1'): print e.flatten()
hello
>>> a.elements('a[u:v=$]')[0].xml()
'<a id="1-1" u:v="$">hello</a>'
>>> a=FORM( INPUT(_type='text'), SELECT(range(1)), TEXTAREA() )
>>> for c in a.elements('input, select, textarea'): c['_disabled'] = 'disabled'
>>> a.xml()
'<form action="#" enctype="multipart/form-data" method="post"><input disabled="disabled" type="text" /><select disabled="disabled"><option value="0">0</option></select><textarea cols="40" disabled="disabled" rows="10"></textarea></form>'
Elements that are matched can also be replaced or removed by specifying
a "replace" argument (note, a list of the original matching elements
is still returned as usual).
>>> a = DIV(DIV(SPAN('x', _class='abc'), DIV(SPAN('y', _class='abc'), SPAN('z', _class='abc'))))
>>> b = a.elements('span.abc', replace=P('x', _class='xyz'))
>>> print a
<div><div><p class="xyz">x</p><div><p class="xyz">x</p><p class="xyz">x</p></div></div></div>
"replace" can be a callable, which will be passed the original element and
should return a new element to replace it.
>>> a = DIV(DIV(SPAN('x', _class='abc'), DIV(SPAN('y', _class='abc'), SPAN('z', _class='abc'))))
>>> b = a.elements('span.abc', replace=lambda el: P(el[0], _class='xyz'))
>>> print a
<div><div><p class="xyz">x</p><div><p class="xyz">y</p><p class="xyz">z</p></div></div></div>
If replace=None, matching elements will be removed completely.
>>> a = DIV(DIV(SPAN('x', _class='abc'), DIV(SPAN('y', _class='abc'), SPAN('z', _class='abc'))))
>>> b = a.elements('span', find='y', replace=None)
>>> print a
<div><div><span class="abc">x</span><div><span class="abc">z</span></div></div></div>
If a "find_text" argument is specified, elements will be searched for text
components that match find_text, and any matching text components will be
replaced (find_text is ignored if "replace" is not also specified).
Like the "find" argument, "find_text" can be a string or a compiled regex.
>>> a = DIV(DIV(SPAN('x', _class='abc'), DIV(SPAN('y', _class='abc'), SPAN('z', _class='abc'))))
>>> b = a.elements(find_text=re.compile('x|y|z'), replace='hello')
>>> print a
<div><div><span class="abc">hello</span><div><span class="abc">hello</span><span class="abc">hello</span></div></div></div>
If other attributes are specified along with find_text, then only components
that match the specified attributes will be searched for find_text.
>>> a = DIV(DIV(SPAN('x', _class='abc'), DIV(SPAN('y', _class='efg'), SPAN('z', _class='abc'))))
>>> b = a.elements('span.efg', find_text=re.compile('x|y|z'), replace='hello')
>>> print a
<div><div><span class="abc">x</span><div><span class="efg">hello</span><span class="abc">z</span></div></div></div>
"""
if len(args) == 1:
args = [a.strip() for a in args[0].split(',')]
if len(args) > 1:
subset = [self.elements(a, **kargs) for a in args]
return reduce(lambda a, b: a + b, subset, [])
elif len(args) == 1:
items = args[0].split()
if len(items) > 1:
subset = [a.elements(' '.join(
items[1:]), **kargs) for a in self.elements(items[0])]
return reduce(lambda a, b: a + b, subset, [])
else:
item = items[0]
if '#' in item or '.' in item or '[' in item:
match_tag = self.regex_tag.search(item)
match_id = self.regex_id.search(item)
match_class = self.regex_class.search(item)
match_attr = self.regex_attr.finditer(item)
args = []
if match_tag:
args = [match_tag.group()]
if match_id:
kargs['_id'] = match_id.group(1)
if match_class:
kargs['_class'] = re.compile('(?<!\w)%s(?!\w)' %
match_class.group(1).replace('-', '\\-').replace(':', '\\:'))
for item in match_attr:
kargs['_' + item.group(1)] = item.group(2)
return self.elements(*args, **kargs)
# make a copy of the components
matches = []
# check if the component has an attribute with the same
# value as provided
check = True
tag = getattr(self, 'tag').replace('/', '')
if args and tag not in args:
check = False
for (key, value) in kargs.iteritems():
if key not in ['first_only', 'replace', 'find_text']:
if isinstance(value, (str, int)):
if self[key] != str(value):
check = False
elif key in self.attributes:
if not value.search(str(self[key])):
check = False
else:
check = False
if 'find' in kargs:
find = kargs['find']
is_regex = not isinstance(find, (str, int))
for c in self.components:
if (isinstance(c, str) and ((is_regex and find.search(c)) or
(str(find) in c))):
check = True
# if found, return the component
if check:
matches.append(self)
first_only = kargs.get('first_only', False)
replace = kargs.get('replace', False)
find_text = replace is not False and kargs.get('find_text', False)
is_regex = not isinstance(find_text, (str, int, bool))
find_components = not (check and first_only)
def replace_component(i):
if replace is None:
del self[i]
elif callable(replace):
self[i] = replace(self[i])
else:
self[i] = replace
# loop the components
if find_text or find_components:
for i, c in enumerate(self.components):
if check and find_text and isinstance(c, str) and \
((is_regex and find_text.search(c)) or (str(find_text) in c)):
replace_component(i)
if find_components and isinstance(c, XmlComponent):
child_matches = c.elements(*args, **kargs)
if len(child_matches):
if not find_text and replace is not False and child_matches[0] is c:
replace_component(i)
if first_only:
return child_matches
matches.extend(child_matches)
return matches
def element(self, *args, **kargs):
"""
find the first component that matches the supplied attribute dictionary,
or None if nothing could be found
Also the components of the components are searched.
"""
kargs['first_only'] = True
elements = self.elements(*args, **kargs)
if not elements:
# we found nothing
return None
return elements[0]
def siblings(self, *args, **kargs):
"""
find all sibling components that match the supplied argument list
and attribute dictionary, or None if nothing could be found
"""
sibs = [s for s in self.parent.components if not s == self]
matches = []
first_only = False
if 'first_only' in kargs:
first_only = kargs.pop('first_only')
for c in sibs:
try:
check = True
tag = getattr(c, 'tag').replace("/", "")
if args and tag not in args:
check = False
for (key, value) in kargs.iteritems():
if c[key] != value:
check = False
if check:
matches.append(c)
if first_only:
break
except:
pass
return matches
def sibling(self, *args, **kargs):
"""
find the first sibling component that match the supplied argument list
and attribute dictionary, or None if nothing could be found
"""
kargs['first_only'] = True
sibs = self.siblings(*args, **kargs)
if not sibs:
return None
return sibs[0]
class CAT(DIV):
tag = ''
def TAG_unpickler(data):
return cPickle.loads(data)
def TAG_pickler(data):
d = DIV()
d.__dict__ = data.__dict__
marshal_dump = cPickle.dumps(d)
return (TAG_unpickler, (marshal_dump,))
class __TAG__(XmlComponent):
"""
TAG factory example::
>>> print TAG.first(TAG.second('test'), _key = 3)
<first key=\"3\"><second>test</second></first>
"""
def __getitem__(self, name):
return self.__getattr__(name)
def __getattr__(self, name):
if name[-1:] == '_':
name = name[:-1] + '/'
if isinstance(name, unicode):
name = name.encode('utf-8')
class __tag__(DIV):
tag = name
copy_reg.pickle(__tag__, TAG_pickler, TAG_unpickler)
return lambda *a, **b: __tag__(*a, **b)
def __call__(self, html):
return web2pyHTMLParser(decoder.decoder(html)).tree
TAG = __TAG__()
class HTML(DIV):
"""
There are four predefined document type definitions.
They can be specified in the 'doctype' parameter:
-'strict' enables strict doctype
-'transitional' enables transitional doctype (default)
-'frameset' enables frameset doctype
-'html5' enables HTML 5 doctype
-any other string will be treated as user's own doctype
'lang' parameter specifies the language of the document.
Defaults to 'en'.
See also :class:`DIV`
"""
tag = 'html'
strict = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\n'
transitional = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\n'
frameset = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">\n'
html5 = '<!DOCTYPE HTML>\n'
def xml(self):
lang = self['lang']
if not lang:
lang = 'en'
self.attributes['_lang'] = lang
doctype = self['doctype']
if doctype is None:
doctype = self.transitional
elif doctype == 'strict':
doctype = self.strict
elif doctype == 'transitional':
doctype = self.transitional
elif doctype == 'frameset':
doctype = self.frameset
elif doctype == 'html5':
doctype = self.html5
elif doctype == '':
doctype = ''
else:
doctype = '%s\n' % doctype
(fa, co) = self._xml()
return '%s<%s%s>%s</%s>' % (doctype, self.tag, fa, co, self.tag)
class XHTML(DIV):
"""
This is XHTML version of the HTML helper.
There are three predefined document type definitions.
They can be specified in the 'doctype' parameter:
-'strict' enables strict doctype
-'transitional' enables transitional doctype (default)
-'frameset' enables frameset doctype
-any other string will be treated as user's own doctype
'lang' parameter specifies the language of the document and the xml document.
Defaults to 'en'.
'xmlns' parameter specifies the xml namespace.
Defaults to 'http://www.w3.org/1999/xhtml'.
See also :class:`DIV`
"""
tag = 'html'
strict = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n'
transitional = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n'
frameset = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">\n'
xmlns = 'http://www.w3.org/1999/xhtml'
def xml(self):
xmlns = self['xmlns']
if xmlns:
self.attributes['_xmlns'] = xmlns
else:
self.attributes['_xmlns'] = self.xmlns
lang = self['lang']
if not lang:
lang = 'en'
self.attributes['_lang'] = lang
self.attributes['_xml:lang'] = lang
doctype = self['doctype']
if doctype:
if doctype == 'strict':
doctype = self.strict
elif doctype == 'transitional':
doctype = self.transitional
elif doctype == 'frameset':
doctype = self.frameset
else:
doctype = '%s\n' % doctype
else:
doctype = self.transitional
(fa, co) = self._xml()
return '%s<%s%s>%s</%s>' % (doctype, self.tag, fa, co, self.tag)
class HEAD(DIV):
tag = 'head'
class TITLE(DIV):
tag = 'title'
class META(DIV):
tag = 'meta/'
class LINK(DIV):
tag = 'link/'
class SCRIPT(DIV):
tag = 'script'
def xml(self):
(fa, co) = self._xml()
# no escaping of subcomponents
co = '\n'.join([str(component) for component in
self.components])
if co:
# <script [attributes]><!--//--><![CDATA[//><!--
# script body
# //--><!]]></script>
# return '<%s%s><!--//--><![CDATA[//><!--\n%s\n//--><!]]></%s>' % (self.tag, fa, co, self.tag)
return '<%s%s><!--\n%s\n//--></%s>' % (self.tag, fa, co, self.tag)
else:
return DIV.xml(self)
class STYLE(DIV):
tag = 'style'
def xml(self):
(fa, co) = self._xml()
# no escaping of subcomponents
co = '\n'.join([str(component) for component in
self.components])
if co:
# <style [attributes]><!--/*--><![CDATA[/*><!--*/
# style body
# /*]]>*/--></style>
return '<%s%s><!--/*--><![CDATA[/*><!--*/\n%s\n/*]]>*/--></%s>' % (self.tag, fa, co, self.tag)
else:
return DIV.xml(self)
class IMG(DIV):
tag = 'img/'
class SPAN(DIV):
tag = 'span'
class BODY(DIV):
tag = 'body'
class H1(DIV):
tag = 'h1'
class H2(DIV):
tag = 'h2'
class H3(DIV):
tag = 'h3'
class H4(DIV):
tag = 'h4'
class H5(DIV):
tag = 'h5'
class H6(DIV):
tag = 'h6'
class P(DIV):
"""
Will replace ``\\n`` by ``<br />`` if the `cr2br` attribute is provided.
see also :class:`DIV`
"""
tag = 'p'
def xml(self):
text = DIV.xml(self)
if self['cr2br']:
text = text.replace('\n', '<br />')
return text
class STRONG(DIV):
tag = 'strong'
class B(DIV):
tag = 'b'
class BR(DIV):
tag = 'br/'
class HR(DIV):
tag = 'hr/'
class A(DIV):
tag = 'a'
def xml(self):
if not self.components and self['_href']:
self.append(self['_href'])
if self['delete']:
d = "jQuery(this).closest('%s').remove();" % self['delete']
else:
d = ''
if self['component']:
self['_onclick'] = "web2py_component('%s','%s');%sreturn false;" % \
(self['component'], self['target'] or '', d)
self['_href'] = self['_href'] or '#null'
elif self['callback']:
returnfalse = "var e = arguments[0] || window.event; e.cancelBubble=true; if (e.stopPropagation) {e.stopPropagation(); e.stopImmediatePropagation(); e.preventDefault();}"
if d and not self['noconfirm']:
self['_onclick'] = "if(confirm(w2p_ajax_confirm_message||'Are you sure you want to delete this object?')){ajax('%s',[],'%s');%s};%s" % \
(self['callback'], self['target'] or '', d, returnfalse)
else:
self['_onclick'] = "ajax('%s',[],'%s');%sreturn false" % \
(self['callback'], self['target'] or '', d)
self['_href'] = self['_href'] or '#null'
elif self['cid']:
pre = self['pre_call'] + ';' if self['pre_call'] else ''
self['_onclick'] = '%sweb2py_component("%s","%s");%sreturn false;' % \
(pre,self['_href'], self['cid'], d)
return DIV.xml(self)
class BUTTON(DIV):
tag = 'button'
class EM(DIV):
tag = 'em'
class EMBED(DIV):
tag = 'embed/'
class TT(DIV):
tag = 'tt'
class PRE(DIV):
tag = 'pre'
class CENTER(DIV):
tag = 'center'
class CODE(DIV):
"""
displays code in HTML with syntax highlighting.
:param attributes: optional attributes:
- language: indicates the language, otherwise PYTHON is assumed
- link: can provide a link
- styles: for styles
Example::
{{=CODE(\"print 'hello world'\", language='python', link=None,
counter=1, styles={}, highlight_line=None)}}
supported languages are \"python\", \"html_plain\", \"c\", \"cpp\",
\"web2py\", \"html\".
The \"html\" language interprets {{ and }} tags as \"web2py\" code,
\"html_plain\" doesn't.
if a link='/examples/global/vars/' is provided web2py keywords are linked to
the online docs.
the counter is used for line numbering, counter can be None or a prompt
string.
"""
def xml(self):
language = self['language'] or 'PYTHON'
link = self['link']
counter = self.attributes.get('counter', 1)
highlight_line = self.attributes.get('highlight_line', None)
context_lines = self.attributes.get('context_lines', None)
styles = self['styles'] or {}
return highlight(
join(self.components),
language=language,
link=link,
counter=counter,
styles=styles,
attributes=self.attributes,
highlight_line=highlight_line,
context_lines=context_lines,
)
class LABEL(DIV):
tag = 'label'
class LI(DIV):
tag = 'li'
class UL(DIV):
"""
UL Component.
If subcomponents are not LI-components they will be wrapped in a LI
see also :class:`DIV`
"""
tag = 'ul'
def _fixup(self):
self._wrap_components(LI, LI)
class OL(UL):
tag = 'ol'
class TD(DIV):
tag = 'td'
class TH(DIV):
tag = 'th'
class TR(DIV):
"""
TR Component.
If subcomponents are not TD/TH-components they will be wrapped in a TD
see also :class:`DIV`
"""
tag = 'tr'
def _fixup(self):
self._wrap_components((TD, TH), TD)
class THEAD(DIV):
tag = 'thead'
def _fixup(self):
self._wrap_components(TR, TR)
class TBODY(DIV):
tag = 'tbody'
def _fixup(self):
self._wrap_components(TR, TR)
class TFOOT(DIV):
tag = 'tfoot'
def _fixup(self):
self._wrap_components(TR, TR)
class COL(DIV):
tag = 'col'
class COLGROUP(DIV):
tag = 'colgroup'
class TABLE(DIV):
"""
TABLE Component.
If subcomponents are not TR/TBODY/THEAD/TFOOT-components
they will be wrapped in a TR
see also :class:`DIV`
"""
tag = 'table'
def _fixup(self):
self._wrap_components((TR, TBODY, THEAD, TFOOT, COL, COLGROUP), TR)
class I(DIV):
tag = 'i'
class IFRAME(DIV):
tag = 'iframe'
class INPUT(DIV):
"""
INPUT Component
examples::
>>> INPUT(_type='text', _name='name', value='Max').xml()
'<input name=\"name\" type=\"text\" value=\"Max\" />'
>>> INPUT(_type='checkbox', _name='checkbox', value='on').xml()
'<input checked=\"checked\" name=\"checkbox\" type=\"checkbox\" value=\"on\" />'
>>> INPUT(_type='radio', _name='radio', _value='yes', value='yes').xml()
'<input checked=\"checked\" name=\"radio\" type=\"radio\" value=\"yes\" />'
>>> INPUT(_type='radio', _name='radio', _value='no', value='yes').xml()
'<input name=\"radio\" type=\"radio\" value=\"no\" />'
the input helper takes two special attributes value= and requires=.
:param value: used to pass the initial value for the input field.
value differs from _value because it works for checkboxes, radio,
textarea and select/option too.
- for a checkbox value should be '' or 'on'.
- for a radio or select/option value should be the _value
of the checked/selected item.
:param requires: should be None, or a validator or a list of validators
for the value of the field.
"""
tag = 'input/'
def _validate(self):
# # this only changes value, not _value
name = self['_name']
if name is None or name == '':
return True
name = str(name)
request_vars_get = self.request_vars.get
if self['_type'] != 'checkbox':
self['old_value'] = self['value'] or self['_value'] or ''
value = request_vars_get(name, '')
self['value'] = value if not hasattr(value,'file') else None
else:
self['old_value'] = self['value'] or False
value = request_vars_get(name)
if isinstance(value, (tuple, list)):
self['value'] = self['_value'] in value
else:
self['value'] = self['_value'] == value
requires = self['requires']
if requires:
if not isinstance(requires, (list, tuple)):
requires = [requires]
for validator in requires:
(value, errors) = validator(value)
if not errors is None:
self.vars[name] = value
self.errors[name] = errors
break
if not name in self.errors:
self.vars[name] = value
return True
return False
def _postprocessing(self):
t = self['_type']
if not t:
t = self['_type'] = 'text'
t = t.lower()
value = self['value']
if self['_value'] is None or isinstance(self['_value'],cgi.FieldStorage):
_value = None
else:
_value = str(self['_value'])
if '_checked' in self.attributes and not 'value' in self.attributes:
pass
elif t == 'checkbox':
if not _value:
_value = self['_value'] = 'on'
if not value:
value = []
elif value is True:
value = [_value]
elif not isinstance(value, (list, tuple)):
value = str(value).split('|')
self['_checked'] = _value in value and 'checked' or None
elif t == 'radio':
if str(value) == str(_value):
self['_checked'] = 'checked'
else:
self['_checked'] = None
elif not t == 'submit':
if value is None:
self['value'] = _value
elif not isinstance(value, list):
self['_value'] = value
def xml(self):
name = self.attributes.get('_name', None)
if name and hasattr(self, 'errors') \
and self.errors.get(name, None) \
and self['hideerror'] != True:
self['_class'] = (self['_class'] and self['_class']
+ ' ' or '') + 'invalidinput'
return DIV.xml(self) + DIV(
DIV(
self.errors[name], _class='error',
errors=None, _id='%s__error' % name),
_class='error_wrapper').xml()
else:
if self['_class'] and self['_class'].endswith('invalidinput'):
self['_class'] = self['_class'][:-12]
if self['_class'] == '':
self['_class'] = None
return DIV.xml(self)
class TEXTAREA(INPUT):
"""
example::
TEXTAREA(_name='sometext', value='blah '*100, requires=IS_NOT_EMPTY())
'blah blah blah ...' will be the content of the textarea field.
"""
tag = 'textarea'
def _postprocessing(self):
if not '_rows' in self.attributes:
self['_rows'] = 10
if not '_cols' in self.attributes:
self['_cols'] = 40
if not self['value'] is None:
self.components = [self['value']]
elif self.components:
self['value'] = self.components[0]
class OPTION(DIV):
tag = 'option'
def _fixup(self):
if not '_value' in self.attributes:
self.attributes['_value'] = str(self.components[0])
class OBJECT(DIV):
tag = 'object'
class OPTGROUP(DIV):
tag = 'optgroup'
def _fixup(self):
components = []
for c in self.components:
if isinstance(c, OPTION):
components.append(c)
else:
components.append(OPTION(c, _value=str(c)))
self.components = components
class SELECT(INPUT):
"""
example::
>>> from validators import IS_IN_SET
>>> SELECT('yes', 'no', _name='selector', value='yes',
... requires=IS_IN_SET(['yes', 'no'])).xml()
'<select name=\"selector\"><option selected=\"selected\" value=\"yes\">yes</option><option value=\"no\">no</option></select>'
"""
tag = 'select'
def _fixup(self):
components = []
for c in self.components:
if isinstance(c, (OPTION, OPTGROUP)):
components.append(c)
else:
components.append(OPTION(c, _value=str(c)))
self.components = components
def _postprocessing(self):
component_list = []
for c in self.components:
if isinstance(c, OPTGROUP):
component_list.append(c.components)
else:
component_list.append([c])
options = itertools.chain(*component_list)
value = self['value']
if not value is None:
if not self['_multiple']:
for c in options: # my patch
if ((value is not None) and
(str(c['_value']) == str(value))):
c['_selected'] = 'selected'
else:
c['_selected'] = None
else:
if isinstance(value, (list, tuple)):
values = [str(item) for item in value]
else:
values = [str(value)]
for c in options: # my patch
if ((value is not None) and
(str(c['_value']) in values)):
c['_selected'] = 'selected'
else:
c['_selected'] = None
class FIELDSET(DIV):
tag = 'fieldset'
class LEGEND(DIV):
tag = 'legend'
class FORM(DIV):
"""
example::
>>> from validators import IS_NOT_EMPTY
>>> form=FORM(INPUT(_name=\"test\", requires=IS_NOT_EMPTY()))
>>> form.xml()
'<form action=\"#\" enctype=\"multipart/form-data\" method=\"post\"><input name=\"test\" type=\"text\" /></form>'
a FORM is container for INPUT, TEXTAREA, SELECT and other helpers
form has one important method::
form.accepts(request.vars, session)
if form is accepted (and all validators pass) form.vars contains the
accepted vars, otherwise form.errors contains the errors.
in case of errors the form is modified to present the errors to the user.
"""
tag = 'form'
def __init__(self, *components, **attributes):
DIV.__init__(self, *components, **attributes)
self.vars = Storage()
self.errors = Storage()
self.latest = Storage()
self.accepted = None # none for not submitted
def assert_status(self, status, request_vars):
return status
def accepts(
self,
request_vars,
session=None,
formname='default',
keepvalues=False,
onvalidation=None,
hideerror=False,
**kwargs
):
"""
kwargs is not used but allows to specify the same interface for FORM and SQLFORM
"""
if request_vars.__class__.__name__ == 'Request':
request_vars = request_vars.post_vars
self.errors.clear()
self.request_vars = Storage()
self.request_vars.update(request_vars)
self.session = session
self.formname = formname
self.keepvalues = keepvalues
# if this tag is a form and we are in accepting mode (status=True)
# check formname and formkey
status = True
changed = False
request_vars = self.request_vars
if session is not None:
formkey = session.get('_formkey[%s]' % formname, None)
# check if user tampering with form and void CSRF
if not formkey or formkey != request_vars._formkey:
status = False
if formname != request_vars._formname:
status = False
if status and session:
# check if editing a record that has been modified by the server
if hasattr(self, 'record_hash') and self.record_hash != formkey:
status = False
self.record_changed = changed = True
status = self._traverse(status, hideerror)
status = self.assert_status(status, request_vars)
if onvalidation:
if isinstance(onvalidation, dict):
onsuccess = onvalidation.get('onsuccess', None)
onfailure = onvalidation.get('onfailure', None)
onchange = onvalidation.get('onchange', None)
if [k for k in onvalidation if not k in (
'onsuccess','onfailure','onchange')]:
raise RuntimeError('Invalid key in onvalidate dict')
if onsuccess and status:
call_as_list(onsuccess,self)
if onfailure and request_vars and not status:
call_as_list(onfailure,self)
status = len(self.errors) == 0
if changed:
if onchange and self.record_changed and \
self.detect_record_change:
call_as_list(onchange,self)
elif status:
call_as_list(onvalidation, self)
if self.errors:
status = False
if not session is None:
if hasattr(self, 'record_hash'):
formkey = self.record_hash
else:
formkey = web2py_uuid()
self.formkey = session['_formkey[%s]' % formname] = formkey
if status and not keepvalues:
self._traverse(False, hideerror)
self.accepted = status
return status
def _postprocessing(self):
if not '_action' in self.attributes:
self['_action'] = '#'
if not '_method' in self.attributes:
self['_method'] = 'post'
if not '_enctype' in self.attributes:
self['_enctype'] = 'multipart/form-data'
def hidden_fields(self):
c = []
attr = self.attributes.get('hidden', {})
if 'hidden' in self.attributes:
c = [INPUT(_type='hidden', _name=key, _value=value)
for (key, value) in attr.iteritems()]
if hasattr(self, 'formkey') and self.formkey:
c.append(INPUT(_type='hidden', _name='_formkey',
_value=self.formkey))
if hasattr(self, 'formname') and self.formname:
c.append(INPUT(_type='hidden', _name='_formname',
_value=self.formname))
return DIV(c, _style="display:none;")
def xml(self):
newform = FORM(*self.components, **self.attributes)
hidden_fields = self.hidden_fields()
if hidden_fields.components:
newform.append(hidden_fields)
return DIV.xml(newform)
def validate(self, **kwargs):
"""
This function validates the form,
you can use it instead of directly form.accepts.
Usage:
In controller
def action():
form=FORM(INPUT(_name=\"test\", requires=IS_NOT_EMPTY()))
form.validate() #you can pass some args here - see below
return dict(form=form)
This can receive a bunch of arguments
onsuccess = 'flash' - will show message_onsuccess in response.flash
None - will do nothing
can be a function (lambda form: pass)
onfailure = 'flash' - will show message_onfailure in response.flash
None - will do nothing
can be a function (lambda form: pass)
onchange = 'flash' - will show message_onchange in response.flash
None - will do nothing
can be a function (lambda form: pass)
message_onsuccess
message_onfailure
message_onchange
next = where to redirect in case of success
any other kwargs will be passed for form.accepts(...)
"""
from gluon import current, redirect
kwargs['request_vars'] = kwargs.get(
'request_vars', current.request.post_vars)
kwargs['session'] = kwargs.get('session', current.session)
kwargs['dbio'] = kwargs.get('dbio', False)
# necessary for SQLHTML forms
onsuccess = kwargs.get('onsuccess', 'flash')
onfailure = kwargs.get('onfailure', 'flash')
onchange = kwargs.get('onchange', 'flash')
message_onsuccess = kwargs.get('message_onsuccess',
current.T("Success!"))
message_onfailure = kwargs.get('message_onfailure',
current.T("Errors in form, please check it out."))
message_onchange = kwargs.get('message_onchange',
current.T("Form consecutive submissions not allowed. " +
"Try re-submitting or refreshing the form page."))
next = kwargs.get('next', None)
for key in ('message_onsuccess', 'message_onfailure', 'onsuccess',
'onfailure', 'next', 'message_onchange', 'onchange'):
if key in kwargs:
del kwargs[key]
if self.accepts(**kwargs):
if onsuccess == 'flash':
if next:
current.session.flash = message_onsuccess
else:
current.response.flash = message_onsuccess
elif callable(onsuccess):
onsuccess(self)
if next:
if self.vars:
for key, value in self.vars.iteritems():
next = next.replace('[%s]' % key,
urllib.quote(str(value)))
if not next.startswith('/'):
next = URL(next)
redirect(next)
return True
elif self.errors:
if onfailure == 'flash':
current.response.flash = message_onfailure
elif callable(onfailure):
onfailure(self)
return False
elif hasattr(self, "record_changed"):
if self.record_changed and self.detect_record_change:
if onchange == 'flash':
current.response.flash = message_onchange
elif callable(onchange):
onchange(self)
return False
def process(self, **kwargs):
"""
Perform the .validate() method but returns the form
Usage in controllers:
# directly on return
def action():
#some code here
return dict(form=FORM(...).process(...))
You can use it with FORM, SQLFORM or FORM based plugins
Examples:
#response.flash messages
def action():
form = SQLFORM(db.table).process(message_onsuccess='Sucess!')
retutn dict(form=form)
# callback function
# callback receives True or False as first arg, and a list of args.
def my_callback(status, msg):
response.flash = "Success! "+msg if status else "Errors occured"
# after argument can be 'flash' to response.flash messages
# or a function name to use as callback or None to do nothing.
def action():
return dict(form=SQLFORM(db.table).process(onsuccess=my_callback)
"""
kwargs['dbio'] = kwargs.get('dbio', True)
# necessary for SQLHTML forms
self.validate(**kwargs)
return self
REDIRECT_JS = "window.location='%s';return false"
def add_button(self, value, url, _class=None):
submit = self.element('input[type=submit]')
submit.parent.append(
INPUT(_type="button", _value=value, _class=_class,
_onclick=self.REDIRECT_JS % url))
@staticmethod
def confirm(text='OK', buttons=None, hidden=None):
if not buttons:
buttons = {}
if not hidden:
hidden = {}
inputs = [INPUT(_type='button',
_value=name,
_onclick=FORM.REDIRECT_JS % link)
for name, link in buttons.iteritems()]
inputs += [INPUT(_type='hidden',
_name=name,
_value=value)
for name, value in hidden.iteritems()]
form = FORM(INPUT(_type='submit', _value=text), *inputs)
form.process()
return form
def as_dict(self, flat=False, sanitize=True):
"""EXPERIMENTAL
Sanitize is naive. It should catch any unsafe value
for client retrieval.
"""
SERIALIZABLE = (int, float, bool, basestring, long,
set, list, dict, tuple, Storage, type(None))
UNSAFE = ("PASSWORD", "CRYPT")
d = self.__dict__
def sanitizer(obj):
if isinstance(obj, dict):
for k in obj.keys():
if any([unsafe in str(k).upper() for
unsafe in UNSAFE]):
# erease unsafe pair
obj.pop(k)
else:
# not implemented
pass
return obj
def flatten(obj):
if isinstance(obj, (dict, Storage)):
newobj = obj.copy()
else:
newobj = obj
if sanitize:
newobj = sanitizer(newobj)
if flat:
if type(obj) in SERIALIZABLE:
if isinstance(newobj, (dict, Storage)):
for k in newobj:
newk = flatten(k)
newobj[newk] = flatten(newobj[k])
if k != newk:
newobj.pop(k)
return newobj
elif isinstance(newobj, (list, tuple, set)):
return [flatten(item) for item in newobj]
else:
return newobj
else: return str(newobj)
else: return newobj
return flatten(d)
def as_json(self, sanitize=True):
d = self.as_dict(flat=True, sanitize=sanitize)
from serializers import json
return json(d)
def as_yaml(self, sanitize=True):
d = self.as_dict(flat=True, sanitize=sanitize)
from serializers import yaml
return yaml(d)
def as_xml(self, sanitize=True):
d = self.as_dict(flat=True, sanitize=sanitize)
from serializers import xml
return xml(d)
class BEAUTIFY(DIV):
"""
example::
>>> BEAUTIFY(['a', 'b', {'hello': 'world'}]).xml()
'<div><table><tr><td><div>a</div></td></tr><tr><td><div>b</div></td></tr><tr><td><div><table><tr><td style="font-weight:bold;vertical-align:top">hello</td><td valign="top">:</td><td><div>world</div></td></tr></table></div></td></tr></table></div>'
turns any list, dictionary, etc into decent looking html.
Two special attributes are
:sorted: a function that takes the dict and returned sorted keys
:keyfilter: a funciton that takes a key and returns its representation
or None if the key is to be skipped. By default key[:1]=='_' is skipped.
"""
tag = 'div'
@staticmethod
def no_underscore(key):
if key[:1] == '_':
return None
return key
def __init__(self, component, **attributes):
self.components = [component]
self.attributes = attributes
sorter = attributes.get('sorted', sorted)
keyfilter = attributes.get('keyfilter', BEAUTIFY.no_underscore)
components = []
attributes = copy.copy(self.attributes)
level = attributes['level'] = attributes.get('level', 6) - 1
if '_class' in attributes:
attributes['_class'] += 'i'
if level == 0:
return
for c in self.components:
if hasattr(c, 'value') and not callable(c.value):
if c.value:
components.append(c.value)
if hasattr(c, 'xml') and callable(c.xml):
components.append(c)
continue
elif hasattr(c, 'keys') and callable(c.keys):
rows = []
try:
keys = (sorter and sorter(c)) or c
for key in keys:
if isinstance(key, (str, unicode)) and keyfilter:
filtered_key = keyfilter(key)
else:
filtered_key = str(key)
if filtered_key is None:
continue
value = c[key]
if isinstance(value, types.LambdaType):
continue
rows.append(
TR(
TD(filtered_key, _style='font-weight:bold;vertical-align:top'),
TD(':', _valign='top'),
TD(BEAUTIFY(value, **attributes))))
components.append(TABLE(*rows, **attributes))
continue
except:
pass
if isinstance(c, str):
components.append(str(c))
elif isinstance(c, unicode):
components.append(c.encode('utf8'))
elif isinstance(c, (list, tuple)):
items = [TR(TD(BEAUTIFY(item, **attributes)))
for item in c]
components.append(TABLE(*items, **attributes))
elif isinstance(c, cgi.FieldStorage):
components.append('FieldStorage object')
else:
components.append(repr(c))
self.components = components
class MENU(DIV):
"""
Used to build menus
Optional arguments
_class: defaults to 'web2py-menu web2py-menu-vertical'
ul_class: defaults to 'web2py-menu-vertical'
li_class: defaults to 'web2py-menu-expand'
li_first: defaults to 'web2py-menu-first'
li_last: defaults to 'web2py-menu-last'
Example:
menu = MENU([['name', False, URL(...), [submenu]], ...])
{{=menu}}
"""
tag = 'ul'
def __init__(self, data, **args):
self.data = data
self.attributes = args
self.components = []
if not '_class' in self.attributes:
self['_class'] = 'web2py-menu web2py-menu-vertical'
if not 'ul_class' in self.attributes:
self['ul_class'] = 'web2py-menu-vertical'
if not 'li_class' in self.attributes:
self['li_class'] = 'web2py-menu-expand'
if not 'li_first' in self.attributes:
self['li_first'] = 'web2py-menu-first'
if not 'li_last' in self.attributes:
self['li_last'] = 'web2py-menu-last'
if not 'li_active' in self.attributes:
self['li_active'] = 'web2py-menu-active'
if not 'mobile' in self.attributes:
self['mobile'] = False
def serialize(self, data, level=0):
if level == 0:
ul = UL(**self.attributes)
else:
ul = UL(_class=self['ul_class'])
for item in data:
if isinstance(item,LI):
ul.append(item)
else:
(name, active, link) = item[:3]
if isinstance(link, DIV):
li = LI(link)
elif 'no_link_url' in self.attributes and self['no_link_url'] == link:
li = LI(DIV(name))
elif isinstance(link,dict):
li = LI(A(name, **link))
elif link:
li = LI(A(name, _href=link))
elif not link and isinstance(name, A):
li = LI(name)
else:
li = LI(A(name, _href='#',
_onclick='javascript:void(0);return false;'))
if level == 0 and item == data[0]:
li['_class'] = self['li_first']
elif level == 0 and item == data[-1]:
li['_class'] = self['li_last']
if len(item) > 3 and item[3]:
li['_class'] = self['li_class']
li.append(self.serialize(item[3], level + 1))
if active or ('active_url' in self.attributes and self['active_url'] == link):
if li['_class']:
li['_class'] = li['_class'] + ' ' + self['li_active']
else:
li['_class'] = self['li_active']
if len(item) <= 4 or item[4] == True:
ul.append(li)
return ul
def serialize_mobile(self, data, select=None, prefix=''):
if not select:
select = SELECT(**self.attributes)
for item in data:
if len(item) <= 4 or item[4] == True:
select.append(OPTION(CAT(prefix, item[0]),
_value=item[2], _selected=item[1]))
if len(item) > 3 and len(item[3]):
self.serialize_mobile(
item[3], select, prefix=CAT(prefix, item[0], '/'))
select['_onchange'] = 'window.location=this.value'
return select
def xml(self):
if self['mobile']:
return self.serialize_mobile(self.data, 0).xml()
else:
return self.serialize(self.data, 0).xml()
def embed64(
filename=None,
file=None,
data=None,
extension='image/gif',
):
"""
helper to encode the provided (binary) data into base64.
:param filename: if provided, opens and reads this file in 'rb' mode
:param file: if provided, reads this file
:param data: if provided, uses the provided data
"""
if filename and os.path.exists(file):
fp = open(filename, 'rb')
data = fp.read()
fp.close()
data = base64.b64encode(data)
return 'data:%s;base64,%s' % (extension, data)
def test():
"""
Example:
>>> from validators import *
>>> print DIV(A('click me', _href=URL(a='a', c='b', f='c')), BR(), HR(), DIV(SPAN(\"World\"), _class='unknown')).xml()
<div><a href=\"/a/b/c\">click me</a><br /><hr /><div class=\"unknown\"><span>World</span></div></div>
>>> print DIV(UL(\"doc\",\"cat\",\"mouse\")).xml()
<div><ul><li>doc</li><li>cat</li><li>mouse</li></ul></div>
>>> print DIV(UL(\"doc\", LI(\"cat\", _class='feline'), 18)).xml()
<div><ul><li>doc</li><li class=\"feline\">cat</li><li>18</li></ul></div>
>>> print TABLE(['a', 'b', 'c'], TR('d', 'e', 'f'), TR(TD(1), TD(2), TD(3))).xml()
<table><tr><td>a</td><td>b</td><td>c</td></tr><tr><td>d</td><td>e</td><td>f</td></tr><tr><td>1</td><td>2</td><td>3</td></tr></table>
>>> form=FORM(INPUT(_type='text', _name='myvar', requires=IS_EXPR('int(value)<10')))
>>> print form.xml()
<form action=\"#\" enctype=\"multipart/form-data\" method=\"post\"><input name=\"myvar\" type=\"text\" /></form>
>>> print form.accepts({'myvar':'34'}, formname=None)
False
>>> print form.xml()
<form action="#" enctype="multipart/form-data" method="post"><input class="invalidinput" name="myvar" type="text" value="34" /><div class="error_wrapper"><div class="error" id="myvar__error">invalid expression</div></div></form>
>>> print form.accepts({'myvar':'4'}, formname=None, keepvalues=True)
True
>>> print form.xml()
<form action=\"#\" enctype=\"multipart/form-data\" method=\"post\"><input name=\"myvar\" type=\"text\" value=\"4\" /></form>
>>> form=FORM(SELECT('cat', 'dog', _name='myvar'))
>>> print form.accepts({'myvar':'dog'}, formname=None, keepvalues=True)
True
>>> print form.xml()
<form action=\"#\" enctype=\"multipart/form-data\" method=\"post\"><select name=\"myvar\"><option value=\"cat\">cat</option><option selected=\"selected\" value=\"dog\">dog</option></select></form>
>>> form=FORM(INPUT(_type='text', _name='myvar', requires=IS_MATCH('^\w+$', 'only alphanumeric!')))
>>> print form.accepts({'myvar':'as df'}, formname=None)
False
>>> print form.xml()
<form action="#" enctype="multipart/form-data" method="post"><input class="invalidinput" name="myvar" type="text" value="as df" /><div class="error_wrapper"><div class="error" id="myvar__error">only alphanumeric!</div></div></form>
>>> session={}
>>> form=FORM(INPUT(value=\"Hello World\", _name=\"var\", requires=IS_MATCH('^\w+$')))
>>> isinstance(form.as_dict(), dict)
True
>>> form.as_dict(flat=True).has_key("vars")
True
>>> isinstance(form.as_json(), basestring) and len(form.as_json(sanitize=False)) > 0
True
>>> if form.accepts({}, session,formname=None): print 'passed'
>>> if form.accepts({'var':'test ', '_formkey': session['_formkey[None]']}, session, formname=None): print 'passed'
"""
pass
class web2pyHTMLParser(HTMLParser):
"""
obj = web2pyHTMLParser(text) parses and html/xml text into web2py helpers.
obj.tree contains the root of the tree, and tree can be manipulated
>>> str(web2pyHTMLParser('hello<div a="b" c=3>wor<ld<span>xxx</span>y<script/>yy</div>zzz').tree)
'hello<div a="b" c="3">wor<ld<span>xxx</span>y<script></script>yy</div>zzz'
>>> str(web2pyHTMLParser('<div>a<span>b</div>c').tree)
'<div>a<span>b</span></div>c'
>>> tree = web2pyHTMLParser('hello<div a="b">world</div>').tree
>>> tree.element(_a='b')['_c']=5
>>> str(tree)
'hello<div a="b" c="5">world</div>'
"""
def __init__(self, text, closed=('input', 'link')):
HTMLParser.__init__(self)
self.tree = self.parent = TAG['']()
self.closed = closed
self.tags = [x for x in __all__ if isinstance(eval(x), DIV)]
self.last = None
self.feed(text)
def handle_starttag(self, tagname, attrs):
if tagname.upper() in self.tags:
tag = eval(tagname.upper())
else:
if tagname in self.closed:
tagname += '/'
tag = TAG[tagname]()
for key, value in attrs:
tag['_' + key] = value
tag.parent = self.parent
self.parent.append(tag)
if not tag.tag.endswith('/'):
self.parent = tag
else:
self.last = tag.tag[:-1]
def handle_data(self, data):
if not isinstance(data, unicode):
try:
data = data.decode('utf8')
except:
data = data.decode('latin1')
self.parent.append(data.encode('utf8', 'xmlcharref'))
def handle_charref(self, name):
if name.startswith('x'):
self.parent.append(unichr(int(name[1:], 16)).encode('utf8'))
else:
self.parent.append(unichr(int(name)).encode('utf8'))
def handle_entityref(self, name):
self.parent.append(entitydefs[name])
def handle_endtag(self, tagname):
# this deals with unbalanced tags
if tagname == self.last:
return
while True:
try:
parent_tagname = self.parent.tag
self.parent = self.parent.parent
except:
raise RuntimeError("unable to balance tag %s" % tagname)
if parent_tagname[:len(tagname)] == tagname: break
def markdown_serializer(text, tag=None, attr=None):
attr = attr or {}
if tag is None:
return re.sub('\s+', ' ', text)
if tag == 'br':
return '\n\n'
if tag == 'h1':
return '#' + text + '\n\n'
if tag == 'h2':
return '#' * 2 + text + '\n\n'
if tag == 'h3':
return '#' * 3 + text + '\n\n'
if tag == 'h4':
return '#' * 4 + text + '\n\n'
if tag == 'p':
return text + '\n\n'
if tag == 'b' or tag == 'strong':
return '**%s**' % text
if tag == 'em' or tag == 'i':
return '*%s*' % text
if tag == 'tt' or tag == 'code':
return '`%s`' % text
if tag == 'a':
return '[%s](%s)' % (text, attr.get('_href', ''))
if tag == 'img':
return '' % (attr.get('_alt', ''), attr.get('_src', ''))
return text
def markmin_serializer(text, tag=None, attr=None):
attr = attr or {}
# if tag is None: return re.sub('\s+',' ',text)
if tag == 'br':
return '\n\n'
if tag == 'h1':
return '# ' + text + '\n\n'
if tag == 'h2':
return '#' * 2 + ' ' + text + '\n\n'
if tag == 'h3':
return '#' * 3 + ' ' + text + '\n\n'
if tag == 'h4':
return '#' * 4 + ' ' + text + '\n\n'
if tag == 'p':
return text + '\n\n'
if tag == 'li':
return '\n- ' + text.replace('\n', ' ')
if tag == 'tr':
return text[3:].replace('\n', ' ') + '\n'
if tag in ['table', 'blockquote']:
return '\n-----\n' + text + '\n------\n'
if tag in ['td', 'th']:
return ' | ' + text
if tag in ['b', 'strong', 'label']:
return '**%s**' % text
if tag in ['em', 'i']:
return "''%s''" % text
if tag in ['tt']:
return '``%s``' % text.strip()
if tag in ['code']:
return '``\n%s``' % text
if tag == 'a':
return '[[%s %s]]' % (text, attr.get('_href', ''))
if tag == 'img':
return '[[%s %s left]]' % (attr.get('_alt', 'no title'), attr.get('_src', ''))
return text
class MARKMIN(XmlComponent):
"""
For documentation: http://web2py.com/examples/static/markmin.html
"""
def __init__(self, text, extra=None, allowed=None, sep='p',
url=None, environment=None, latex='google',
autolinks='default',
protolinks='default',
class_prefix='',
id_prefix='markmin_'):
self.text = text
self.extra = extra or {}
self.allowed = allowed or {}
self.sep = sep
self.url = URL if url == True else url
self.environment = environment
self.latex = latex
self.autolinks = autolinks
self.protolinks = protolinks
self.class_prefix = class_prefix
self.id_prefix = id_prefix
def xml(self):
"""
calls the gluon.contrib.markmin render function to convert the wiki syntax
"""
from contrib.markmin.markmin2html import render
return render(self.text, extra=self.extra,
allowed=self.allowed, sep=self.sep, latex=self.latex,
URL=self.url, environment=self.environment,
autolinks=self.autolinks, protolinks=self.protolinks,
class_prefix=self.class_prefix, id_prefix=self.id_prefix)
def __str__(self):
return self.xml()
def flatten(self, render=None):
"""
return the text stored by the MARKMIN object rendered by the render function
"""
return self.text
def elements(self, *args, **kargs):
"""
to be considered experimental since the behavior of this method is questionable
another options could be TAG(self.text).elements(*args,**kargs)
"""
return [self.text]
if __name__ == '__main__':
import doctest
doctest.testmod()
| ajibawa-2023/Python-Code-Large/train/row_475 | 1,301 | 2,708 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0022, 0.0018, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis file is part of the web2py Web Framework\nCopyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>\nLicense: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Import_L10_C0", "label": "cgi import cgi", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0037, 0.0004, 0, 0.66, 0.0097, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Import_L11_C0", "label": "os import os", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0041, 0.0004, 0, 0.66, 0.0194, 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_475:Import_L12_C0", "label": "re import re", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0044, 0.0004, 0, 0.66, 0.0291, 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_475:Import_L13_C0", "label": "copy import copy", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0048, 0.0004, 0, 0.66, 0.0388, 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_475:Import_L14_C0", "label": "types import types", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0052, 0.0004, 0, 0.66, 0.0485, 209, 0, 1, 0, 0, 209, 0, 0], "semantic": {"name": "types", "arg_names": [], "import_names": ["types"], "rhs_call_name": "", "annotation": ""}, "snippet": "import types"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Import_L15_C0", "label": "urllib import urllib", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0055, 0.0004, 0, 0.66, 0.0583, 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_475:Import_L16_C0", "label": "base64 import base64", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0059, 0.0004, 0, 0.66, 0.068, 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_475:Import_L17_C0", "label": "sanitizer import sanitizer", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0063, 0.0004, 0, 0.66, 0.0777, 308, 0, 1, 0, 0, 308, 0, 0], "semantic": {"name": "sanitizer", "arg_names": [], "import_names": ["sanitizer"], "rhs_call_name": "", "annotation": ""}, "snippet": "import sanitizer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Import_L18_C0", "label": "itertools import itertools", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0066, 0.0004, 0, 0.66, 0.0874, 808, 0, 1, 0, 0, 808, 0, 0], "semantic": {"name": "itertools", "arg_names": [], "import_names": ["itertools"], "rhs_call_name": "", "annotation": ""}, "snippet": "import itertools"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Import_L19_C0", "label": "decoder import decoder", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.007, 0.0004, 0, 0.66, 0.0971, 404, 0, 1, 0, 0, 404, 0, 0], "semantic": {"name": "decoder", "arg_names": [], "import_names": ["decoder"], "rhs_call_name": "", "annotation": ""}, "snippet": "import decoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Import_L20_C0", "label": "copy_reg import copy_reg", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.0074, 0.0004, 0, 0.66, 0.1068, 527, 0, 1, 0, 0, 527, 0, 0], "semantic": {"name": "copy_reg", "arg_names": [], "import_names": ["copy_reg"], "rhs_call_name": "", "annotation": ""}, "snippet": "import copy_reg"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Import_L21_C0", "label": "cPickle import cPickle", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.0078, 0.0004, 0, 0.66, 0.1165, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "cPickle", "arg_names": [], "import_names": ["cPickle"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cPickle"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Import_L22_C0", "label": "marshal import marshal", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.0081, 0.0004, 0, 0.66, 0.1262, 291, 0, 1, 0, 0, 291, 0, 0], "semantic": {"name": "marshal", "arg_names": [], "import_names": ["marshal"], "rhs_call_name": "", "annotation": ""}, "snippet": "import marshal"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L24_C0", "label": "from HTMLParser import HTMLParser", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.0089, 0.0004, 0, 0.66, 0.1359, 217, 0, 1, 0, 0, 217, 0, 0], "semantic": {"name": "HTMLParser", "arg_names": [], "import_names": ["HTMLParser"], "rhs_call_name": "", "annotation": ""}, "snippet": "from HTMLParser import HTMLParser"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L25_C0", "label": "from htmlentitydefs import name2codepoint", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.0092, 0.0004, 0, 0.66, 0.1456, 744, 0, 1, 0, 0, 744, 0, 0], "semantic": {"name": "htmlentitydefs", "arg_names": [], "import_names": ["name2codepoint"], "rhs_call_name": "", "annotation": ""}, "snippet": "from htmlentitydefs import name2codepoint"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L27_C0", "label": "from storage import Storage", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.01, 0.0004, 0, 0.66, 0.1553, 864, 0, 1, 0, 0, 864, 0, 0], "semantic": {"name": "storage", "arg_names": [], "import_names": ["Storage"], "rhs_call_name": "", "annotation": ""}, "snippet": "from storage import Storage"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L28_C0", "label": "from utils import web2py_uuid, simple_hash, compare", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.0103, 0.0004, 0, 0.66, 0.165, 970, 0, 3, 0, 0, 970, 0, 0], "semantic": {"name": "utils", "arg_names": [], "import_names": ["web2py_uuid", "simple_hash", "compare"], "rhs_call_name": "", "annotation": ""}, "snippet": "from utils import web2py_uuid, simple_hash, compare"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L29_C0", "label": "from highlight import highlight", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.0107, 0.0004, 0, 0.66, 0.1748, 449, 0, 1, 0, 0, 449, 0, 0], "semantic": {"name": "highlight", "arg_names": [], "import_names": ["highlight"], "rhs_call_name": "", "annotation": ""}, "snippet": "from highlight import highlight"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L31_C0", "label": "regex_crlf = compile()", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.0114, 0.0004, 0, 0.66, 0.1845, 870, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "regex_crlf", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "regex_crlf = re.compile('\\r|\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L33_C0", "label": "join =", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.0122, 0.0004, 0, 0.66, 0.1942, 933, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "join", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "join = ''.join"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L36_C0", "label": "setdefault()", "type": "expression", "loc": [36, 36], "level": 0, "parent": null, "vector": [8, 0, 0.0133, 0.0004, 0, 0.66, 0.2039, 262, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": "entitydefs.setdefault('apos', u\"'\".encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L39_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [39, 105], "level": 0, "parent": null, "vector": [14, 0, 0.0266, 0.0247, 0, 0.66, 0.2136, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = [\n 'A',\n 'B',\n 'BEAUTIFY',\n 'BODY',\n 'BR',\n 'BUTTON',\n 'CENTER',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L108_C0", "label": "xmlescape", "type": "function", "loc": [108, 128], "level": 0, "parent": null, "vector": [2, 0, 0.0436, 0.0078, 0, 0.66, 0.2233, 49, 0, 2, 1, 0, 0, 0, 9], "semantic": {"name": "xmlescape", "arg_names": ["data", "quote"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def xmlescape(data, quote=True):\n \"\"\"\n returns an escaped string of the provided data\n\n :param data: the data to be escaped\n :param quote: optional (default False)\n \"\"\"\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L109_C4", "label": "expression", "type": "expression", "loc": [109, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L108_C0", "vector": [8, 1, 0.0412, 0.0022, 1, 0.53, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n returns an escaped string of the provided data\n\n :param data: the data to be escaped\n :param quote: optional (default False)\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L117_C4", "label": "if", "type": "if", "loc": [117, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L108_C0", "vector": [4, 1, 0.0434, 0.0007, 1, 0.53, 0.25, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(data, 'xml') and callable(data.xml):\n return data.xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L118_C8", "label": "return", "type": "return", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L117_C4", "vector": [13, 2, 0.0436, 0.0004, 2, 0.58, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return data.xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L121_C4", "label": "if", "type": "if", "loc": [121, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L108_C0", "vector": [4, 1, 0.0452, 0.0015, 1, 0.53, 0.5, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(data, (str, unicode)):\n data = str(data)\n elif isinstance(data, unicode):\n data = data.encode('utf8', 'xmlcharrefreplace')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L122_C8", "label": "data = str()", "type": "assigned_variable", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L121_C4", "vector": [14, 2, 0.0451, 0.0004, 2, 0.16, 0.0, 929, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " data = str(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L123_C4", "label": "if", "type": "if", "loc": [123, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L121_C4", "vector": [4, 2, 0.0456, 0.0007, 2, 0.16, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(data, unicode):\n data = data.encode('utf8', 'xmlcharrefreplace')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L124_C8", "label": "data = encode()", "type": "assigned_variable", "loc": [124, 124], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L123_C4", "vector": [14, 3, 0.0458, 0.0004, 3, 0.31, 0.0, 929, 3, 2, 0, 0, 623, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": " data = data.encode('utf8', 'xmlcharrefreplace')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L127_C4", "label": "data = replace()", "type": "assigned_variable", "loc": [127, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L108_C0", "vector": [14, 1, 0.0469, 0.0004, 1, 0.53, 0.75, 929, 3, 2, 0, 0, 293, 10, 2], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " data = cgi.escape(data, quote).replace(\"'\", \"'\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L128_C4", "label": "return", "type": "return", "loc": [128, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L108_C0", "vector": [13, 1, 0.0473, 0.0004, 1, 0.53, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L130_C0", "label": "call_as_list", "type": "function", "loc": [130, 134], "level": 0, "parent": null, "vector": [2, 0, 0.0487, 0.0018, 0, 0.66, 0.233, 656, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "call_as_list", "arg_names": ["f", "a", "b"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def call_as_list(f,*a,**b):\n if not isinstance(f, (list,tuple)):\n f = [f]\n for item in f:\n item(*a,**b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L131_C4", "label": "if", "type": "if", "loc": [131, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L130_C0", "vector": [4, 1, 0.0486, 0.0007, 1, 0.08, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(f, (list,tuple)):\n f = [f]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L132_C8", "label": "f =", "type": "assigned_variable", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L131_C4", "vector": [14, 2, 0.0487, 0.0004, 2, 0.39, 0.0, 899, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " f = [f]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L133_C4", "label": "for item", "type": "for", "loc": [133, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L130_C0", "vector": [6, 1, 0.0493, 0.0007, 1, 0.08, 1.0, 434, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in f:\n item(*a,**b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L134_C8", "label": "item()", "type": "expression", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L133_C4", "vector": [8, 2, 0.0495, 0.0004, 2, 0.46, 0.0, 434, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "item", "annotation": ""}, "snippet": " item(*a,**b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L136_C0", "label": "truncate_string", "type": "function", "loc": [136, 140], "level": 0, "parent": null, "vector": [2, 0, 0.051, 0.0018, 0, 0.66, 0.2427, 561, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "truncate_string", "arg_names": ["text", "length", "dots"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def truncate_string(text, length, dots='...'):\n text = text.decode('utf-8')\n if len(text) > length:\n text = text[:length - len(dots)].encode('utf-8') + dots\n return text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L137_C4", "label": "text = decode()", "type": "assigned_variable", "loc": [137, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L136_C0", "vector": [14, 1, 0.0506, 0.0004, 1, 0.66, 0.0, 439, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " text = text.decode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L138_C4", "label": "if", "type": "if", "loc": [138, 139], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L136_C0", "vector": [4, 1, 0.0511, 0.0007, 1, 0.66, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(text) > length:\n text = text[:length - len(dots)].encode('utf-8') + dots"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L139_C8", "label": "text =", "type": "assigned_variable", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L138_C4", "vector": [14, 2, 0.0513, 0.0004, 2, 0.9, 0.0, 439, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = text[:length - len(dots)].encode('utf-8') + dots"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L140_C4", "label": "return", "type": "return", "loc": [140, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L136_C0", "vector": [13, 1, 0.0517, 0.0004, 1, 0.66, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "label": "URL", "type": "function", "loc": [143, 371], "level": 0, "parent": null, "vector": [2, 0, 0.0949, 0.0846, 0, 0.66, 0.2524, 759, 0, 18, 1, 0, 0, 0, 36], "semantic": {"name": "URL", "arg_names": ["a", "c", "f", "r", "args", "vars", "anchor", "extension", "env", "hmac_key", "hash_vars", "salt", "user_signature", "scheme", "host", "port", "encode_embedded_slash", "url_encode"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def URL(\n a=None,\n c=None,\n f=None,\n r=None,\n args=None,\n vars=None,\n anchor='',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L163_C4", "label": "expression", "type": "expression", "loc": [163, 238], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [8, 1, 0.074, 0.0281, 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 generate a URL\n\n example::\n\n >>> str(URL(a='a', c='c', f='f', args=['x', 'y', 'z'],\n ... vars={'p':1, 'q':2}, anchor='1'))\n '/a/c/f/x/y/z?p=1&q=2#1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L240_C4", "label": "from rewrite import url_out", "type": "import", "loc": [240, 240], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [1, 1, 0.0886, 0.0004, 1, 0.07, 0.0385, 669, 0, 1, 0, 0, 669, 0, 0], "semantic": {"name": "rewrite", "arg_names": [], "import_names": ["url_out"], "rhs_call_name": "", "annotation": ""}, "snippet": " from rewrite import url_out # done here in case used not-in web2py"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L242_C4", "label": "if", "type": "if", "loc": [242, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [4, 1, 0.0895, 0.0007, 1, 0.07, 0.0769, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args in (None, []):\n args = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L243_C8", "label": "args =", "type": "assigned_variable", "loc": [243, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L242_C4", "vector": [14, 2, 0.0897, 0.0004, 2, 0.75, 0.0, 805, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L244_C4", "label": "vars =", "type": "assigned_variable", "loc": [244, 244], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [14, 1, 0.0901, 0.0004, 1, 0.07, 0.1154, 302, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "vars", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " vars = vars or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L245_C4", "label": "application =", "type": "assigned_variable", "loc": [245, 245], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [14, 1, 0.0905, 0.0004, 1, 0.07, 0.1538, 244, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "application", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " application = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L246_C4", "label": "controller =", "type": "assigned_variable", "loc": [246, 246], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [14, 1, 0.0908, 0.0004, 1, 0.07, 0.1923, 360, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "controller", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " controller = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L247_C4", "label": "function =", "type": "assigned_variable", "loc": [247, 247], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [14, 1, 0.0912, 0.0004, 1, 0.07, 0.2308, 275, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "function", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " function = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L249_C4", "label": "if", "type": "if", "loc": [249, 250], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [4, 1, 0.0921, 0.0007, 1, 0.07, 0.2692, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(args, (list, tuple)):\n args = [args]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L250_C8", "label": "args =", "type": "assigned_variable", "loc": [250, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L249_C4", "vector": [14, 2, 0.0923, 0.0004, 2, 0.14, 0.0, 805, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = [args]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L252_C4", "label": "if", "type": "if", "loc": [252, 259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [4, 1, 0.0944, 0.003, 1, 0.07, 0.3077, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not r:\n if a and not c and not f:\n (f, a, c) = (a, c, f)\n elif a and c and not f:\n (c, f, a) = (a, c, f)\n from globals import current\n if hasattr(current, 'request'):\n r = current.request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L253_C8", "label": "if", "type": "if", "loc": [253, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L252_C4", "vector": [4, 2, 0.094, 0.0015, 2, 0.54, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if a and not c and not f:\n (f, a, c) = (a, c, f)\n elif a and c and not f:\n (c, f, a) = (a, c, f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L254_C12", "label": "f, a, c =", "type": "assigned_variable", "loc": [254, 254], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L253_C8", "vector": [14, 3, 0.0938, 0.0004, 3, 0.48, 0.0, 230, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "f, a, c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (f, a, c) = (a, c, f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L255_C8", "label": "if", "type": "if", "loc": [255, 256], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L253_C8", "vector": [4, 3, 0.0944, 0.0007, 3, 0.48, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif a and c and not f:\n (c, f, a) = (a, c, f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L256_C12", "label": "c, f, a =", "type": "assigned_variable", "loc": [256, 256], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L255_C8", "vector": [14, 4, 0.0945, 0.0004, 4, 0.56, 0.0, 500, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "c, f, a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (c, f, a) = (a, c, f)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L257_C8", "label": "from globals import current", "type": "import", "loc": [257, 257], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L252_C4", "vector": [1, 2, 0.0949, 0.0004, 2, 0.54, 0.5, 926, 0, 1, 0, 0, 926, 0, 0], "semantic": {"name": "globals", "arg_names": [], "import_names": ["current"], "rhs_call_name": "", "annotation": ""}, "snippet": " from globals import current"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L258_C8", "label": "if", "type": "if", "loc": [258, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L252_C4", "vector": [4, 2, 0.0955, 0.0007, 2, 0.54, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(current, 'request'):\n r = current.request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L259_C12", "label": "r =", "type": "assigned_variable", "loc": [259, 259], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L258_C8", "vector": [14, 3, 0.0956, 0.0004, 3, 0.84, 0.0, 436, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r = current.request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L261_C4", "label": "if", "type": "if", "loc": [261, 267], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [4, 1, 0.0975, 0.0026, 1, 0.07, 0.3462, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if r:\n application = r.application\n controller = r.controller\n function = r.function\n env = r.env\n if extension is None and r.extension != 'html':\n extension = r.extension"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L262_C8", "label": "application =", "type": "assigned_variable", "loc": [262, 262], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L261_C4", "vector": [14, 2, 0.0968, 0.0004, 2, 0.63, 0.0, 244, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "application", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " application = r.application"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L263_C8", "label": "controller =", "type": "assigned_variable", "loc": [263, 263], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L261_C4", "vector": [14, 2, 0.0971, 0.0004, 2, 0.63, 0.25, 360, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "controller", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " controller = r.controller"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L264_C8", "label": "function =", "type": "assigned_variable", "loc": [264, 264], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L261_C4", "vector": [14, 2, 0.0975, 0.0004, 2, 0.63, 0.5, 275, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "function", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " function = r.function"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L265_C8", "label": "env =", "type": "assigned_variable", "loc": [265, 265], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L261_C4", "vector": [14, 2, 0.0979, 0.0004, 2, 0.63, 0.75, 803, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "env", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " env = r.env"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L266_C8", "label": "if", "type": "if", "loc": [266, 267], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L261_C4", "vector": [4, 2, 0.0984, 0.0007, 2, 0.63, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if extension is None and r.extension != 'html':\n extension = r.extension"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L267_C12", "label": "extension =", "type": "assigned_variable", "loc": [267, 267], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L266_C8", "vector": [14, 3, 0.0986, 0.0004, 3, 0.0, 0.0, 14, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "extension", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " extension = r.extension"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L268_C4", "label": "if", "type": "if", "loc": [268, 269], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [4, 1, 0.0992, 0.0007, 1, 0.07, 0.3846, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if a:\n application = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L269_C8", "label": "application =", "type": "assigned_variable", "loc": [269, 269], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L268_C4", "vector": [14, 2, 0.0993, 0.0004, 2, 0.7, 0.0, 244, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "application", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " application = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L270_C4", "label": "if", "type": "if", "loc": [270, 271], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [4, 1, 0.0999, 0.0007, 1, 0.07, 0.4231, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if c:\n controller = c"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L271_C8", "label": "controller =", "type": "assigned_variable", "loc": [271, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L270_C4", "vector": [14, 2, 0.1001, 0.0004, 2, 0.25, 0.0, 360, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "controller", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " controller = c"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L272_C4", "label": "if", "type": "if", "loc": [272, 293], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [4, 1, 0.1043, 0.0081, 1, 0.07, 0.4615, 0, 2, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if f:\n if not isinstance(f, str):\n if hasattr(f, '__name__'):\n function = f.__name__\n else:\n raise SyntaxError(\n 'when calling URL, function or function name required')\n elif '/' in f:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L273_C8", "label": "if", "type": "if", "loc": [273, 286], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L272_C4", "vector": [4, 2, 0.1032, 0.0052, 2, 0.37, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(f, str):\n if hasattr(f, '__name__'):\n function = f.__name__\n else:\n raise SyntaxError(\n 'when calling URL, function or function name required')\n elif '/' in f:\n if f.startswith(\"/\"):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L274_C12", "label": "if", "type": "if", "loc": [274, 278], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L273_C8", "vector": [4, 3, 0.1019, 0.0018, 3, 0.19, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(f, '__name__'):\n function = f.__name__\n else:\n raise SyntaxError(\n 'when calling URL, function or function name required')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L275_C16", "label": "function =", "type": "assigned_variable", "loc": [275, 275], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L274_C12", "vector": [14, 4, 0.1016, 0.0004, 4, 0.19, 0.0, 275, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "function", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " function = f.__name__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L279_C8", "label": "if", "type": "if", "loc": [279, 286], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L273_C8", "vector": [4, 3, 0.1043, 0.003, 3, 0.19, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif '/' in f:\n if f.startswith(\"/\"):\n f = f[1:]\n items = f.split('/')\n function = f = items[0]\n args = items[1:] + args\n else:\n function = f"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L280_C12", "label": "if", "type": "if", "loc": [280, 281], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L279_C8", "vector": [4, 4, 0.1036, 0.0007, 4, 0.5, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if f.startswith(\"/\"):\n f = f[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L281_C16", "label": "f =", "type": "assigned_variable", "loc": [281, 281], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L280_C12", "vector": [14, 5, 0.1038, 0.0004, 5, 0.34, 0.0, 899, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " f = f[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L282_C12", "label": "items = split()", "type": "assigned_variable", "loc": [282, 282], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L279_C8", "vector": [14, 4, 0.1041, 0.0004, 4, 0.5, 0.25, 339, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " items = f.split('/')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L283_C12", "label": "function =", "type": "assigned_variable", "loc": [283, 283], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L279_C8", "vector": [14, 4, 0.1045, 0.0004, 4, 0.5, 0.5, 275, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "function", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " function = f = items[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L284_C12", "label": "args =", "type": "assigned_variable", "loc": [284, 284], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L279_C8", "vector": [14, 4, 0.1049, 0.0004, 4, 0.5, 0.75, 805, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = items[1:] + args"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L286_C12", "label": "function =", "type": "assigned_variable", "loc": [286, 286], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L279_C8", "vector": [14, 4, 0.1056, 0.0004, 4, 0.5, 1.0, 275, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "function", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " function = f"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L289_C8", "label": "if", "type": "if", "loc": [289, 290], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L272_C4", "vector": [4, 2, 0.1069, 0.0007, 2, 0.37, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if controller == 'static':\n extension = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L290_C12", "label": "extension =", "type": "assigned_variable", "loc": [290, 290], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L289_C8", "vector": [14, 3, 0.1071, 0.0004, 3, 0.43, 0.0, 14, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "extension", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " extension = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L292_C8", "label": "if", "type": "if", "loc": [292, 293], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L272_C4", "vector": [4, 2, 0.108, 0.0007, 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 '.' in function:\n function, extension = function.rsplit('.', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L293_C12", "label": "function, extension = rsplit()", "type": "assigned_variable", "loc": [293, 293], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L292_C8", "vector": [14, 3, 0.1082, 0.0004, 3, 0.14, 0.0, 705, 3, 2, 0, 0, 310, 10, 1], "semantic": {"name": "function, extension", "arg_names": [], "import_names": [], "rhs_call_name": "rsplit", "annotation": ""}, "snippet": " function, extension = function.rsplit('.', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L295_C4", "label": "function2 =", "type": "assigned_variable", "loc": [295, 295], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [14, 1, 0.1089, 0.0004, 1, 0.07, 0.5, 364, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "function2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " function2 = '%s.%s' % (function, extension or 'html')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L297_C4", "label": "if", "type": "if", "loc": [297, 298], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [4, 1, 0.1099, 0.0007, 1, 0.07, 0.5385, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not (application and controller and function):\n raise SyntaxError('not enough information to build the url (%s %s %s)' % (application, controller, function))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L300_C4", "label": "if", "type": "if", "loc": [300, 311], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [4, 1, 0.1128, 0.0044, 1, 0.07, 0.5769, 0, 2, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args:\n if url_encode:\n if encode_embedded_slash:\n other = '/' + '/'.join([urllib.quote(str(\n x), '') for x in args])\n else:\n other = args and urllib.quote(\n '/' + '/'.join([str(x) for x in args]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L301_C8", "label": "if", "type": "if", "loc": [301, 309], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L300_C4", "vector": [4, 2, 0.1126, 0.0033, 2, 0.55, 0.0, 0, 2, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if url_encode:\n if encode_embedded_slash:\n other = '/' + '/'.join([urllib.quote(str(\n x), '') for x in args])\n else:\n other = args and urllib.quote(\n '/' + '/'.join([str(x) for x in args]))\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L302_C12", "label": "if", "type": "if", "loc": [302, 307], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L301_C8", "vector": [4, 3, 0.1124, 0.0022, 3, 0.7, 0.0, 0, 2, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if encode_embedded_slash:\n other = '/' + '/'.join([urllib.quote(str(\n x), '') for x in args])\n else:\n other = args and urllib.quote(\n '/' + '/'.join([str(x) for x in args]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L303_C16", "label": "other =", "type": "assigned_variable", "loc": [303, 304], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L302_C12", "vector": [14, 4, 0.1121, 0.0007, 4, 0.08, 0.0, 341, 4, 0, 0, 0, 0, 0, 3], "semantic": {"name": "other", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " other = '/' + '/'.join([urllib.quote(str(\n x), '') for x in args])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L306_C16", "label": "other =", "type": "assigned_variable", "loc": [306, 307], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L302_C12", "vector": [14, 4, 0.1132, 0.0007, 4, 0.08, 1.0, 341, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "other", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " other = args and urllib.quote(\n '/' + '/'.join([str(x) for x in args]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L309_C12", "label": "other =", "type": "assigned_variable", "loc": [309, 309], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L301_C8", "vector": [14, 3, 0.1141, 0.0004, 3, 0.7, 1.0, 341, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "other", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " other = args and ('/' + '/'.join([str(x) for x in args]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L311_C8", "label": "other =", "type": "assigned_variable", "loc": [311, 311], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L300_C4", "vector": [14, 2, 0.1148, 0.0004, 2, 0.55, 1.0, 341, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "other", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " other = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L313_C4", "label": "if", "type": "if", "loc": [313, 314], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [4, 1, 0.1158, 0.0007, 1, 0.07, 0.6154, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if other.endswith('/'):\n other += '/' # add trailing slash to make last trailing empty arg explicit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L316_C4", "label": "list_vars =", "type": "assigned_variable", "loc": [316, 316], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [14, 1, 0.1167, 0.0004, 1, 0.07, 0.6538, 996, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "list_vars", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " list_vars = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L317_C4", "label": "for key, vals", "type": "for", "loc": [317, 323], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [6, 1, 0.1182, 0.0026, 1, 0.07, 0.6923, 447, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "key, vals", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for (key, vals) in sorted(vars.items()):\n if key == '_signature':\n continue\n if not isinstance(vals, (list, tuple)):\n vals = [vals]\n for val in vals:\n list_vars.append((key, val))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L318_C8", "label": "if", "type": "if", "loc": [318, 319], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L317_C4", "vector": [4, 2, 0.1176, 0.0007, 2, 0.38, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if key == '_signature':\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L320_C8", "label": "if", "type": "if", "loc": [320, 321], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L317_C4", "vector": [4, 2, 0.1184, 0.0007, 2, 0.38, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(vals, (list, tuple)):\n vals = [vals]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L321_C12", "label": "vals =", "type": "assigned_variable", "loc": [321, 321], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L320_C8", "vector": [14, 3, 0.1185, 0.0004, 3, 0.13, 0.0, 17, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "vals", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " vals = [vals]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L322_C8", "label": "for val", "type": "for", "loc": [322, 323], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L317_C4", "vector": [6, 2, 0.1191, 0.0007, 2, 0.38, 1.0, 618, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "val", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for val in vals:\n list_vars.append((key, val))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L323_C12", "label": "append()", "type": "expression", "loc": [323, 323], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L322_C8", "vector": [8, 3, 0.1193, 0.0004, 3, 0.94, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " list_vars.append((key, val))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L325_C4", "label": "if", "type": "if", "loc": [325, 328], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [4, 1, 0.1206, 0.0015, 1, 0.07, 0.7308, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user_signature:\n from globals import current\n if current.session.auth:\n hmac_key = current.session.auth.hmac_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L326_C8", "label": "from globals import current", "type": "import", "loc": [326, 326], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L325_C4", "vector": [1, 2, 0.1204, 0.0004, 2, 0.64, 0.0, 926, 0, 1, 0, 0, 926, 0, 0], "semantic": {"name": "globals", "arg_names": [], "import_names": ["current"], "rhs_call_name": "", "annotation": ""}, "snippet": " from globals import current"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L327_C8", "label": "if", "type": "if", "loc": [327, 328], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L325_C4", "vector": [4, 2, 0.1209, 0.0007, 2, 0.64, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if current.session.auth:\n hmac_key = current.session.auth.hmac_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L328_C12", "label": "hmac_key =", "type": "assigned_variable", "loc": [328, 328], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L327_C8", "vector": [14, 3, 0.1211, 0.0004, 3, 0.98, 0.0, 3, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "hmac_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hmac_key = current.session.auth.hmac_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L330_C4", "label": "if", "type": "if", "loc": [330, 351], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [4, 1, 0.1257, 0.0081, 1, 0.07, 0.7692, 0, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hmac_key:\n # generate an hmac signature of the vars & args so can later\n # verify the user hasn't messed with anything\n\n h_args = '/%s/%s/%s%s' % (application, controller, function2, other)\n\n # how many of the vars should we include in our hash?\n if hash_vars is True: # include them all"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L334_C8", "label": "h_args =", "type": "assigned_variable", "loc": [334, 334], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L330_C4", "vector": [14, 2, 0.1233, 0.0004, 2, 0.32, 0.0, 22, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "h_args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " h_args = '/%s/%s/%s%s' % (application, controller, function2, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L337_C8", "label": "if", "type": "if", "loc": [337, 344], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L330_C4", "vector": [4, 2, 0.1257, 0.003, 2, 0.32, 0.25, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hash_vars is True: # include them all\n h_vars = list_vars\n elif hash_vars is False: # include none of them\n h_vars = ''\n else: # include just those specified\n if hash_vars and not isinstance(hash_vars, (list, tuple)):\n hash_vars = [hash_vars]\n h_vars = [(k, v) for (k, v) in list_vars if k in hash_vars]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L338_C12", "label": "h_vars =", "type": "assigned_variable", "loc": [338, 338], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L337_C8", "vector": [14, 3, 0.1248, 0.0004, 3, 0.42, 0.0, 486, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "h_vars", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " h_vars = list_vars"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L339_C8", "label": "if", "type": "if", "loc": [339, 344], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L337_C8", "vector": [4, 3, 0.1261, 0.0022, 3, 0.42, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif hash_vars is False: # include none of them\n h_vars = ''\n else: # include just those specified\n if hash_vars and not isinstance(hash_vars, (list, tuple)):\n hash_vars = [hash_vars]\n h_vars = [(k, v) for (k, v) in list_vars if k in hash_vars]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L340_C12", "label": "h_vars =", "type": "assigned_variable", "loc": [340, 340], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L339_C8", "vector": [14, 4, 0.1256, 0.0004, 4, 0.99, 0.0, 486, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "h_vars", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " h_vars = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L342_C12", "label": "if", "type": "if", "loc": [342, 343], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L339_C8", "vector": [4, 4, 0.1265, 0.0007, 4, 0.99, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hash_vars and not isinstance(hash_vars, (list, tuple)):\n hash_vars = [hash_vars]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L343_C16", "label": "hash_vars =", "type": "assigned_variable", "loc": [343, 343], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L342_C12", "vector": [14, 5, 0.1267, 0.0004, 5, 0.72, 0.0, 545, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "hash_vars", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hash_vars = [hash_vars]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L344_C12", "label": "h_vars =", "type": "assigned_variable", "loc": [344, 344], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L339_C8", "vector": [14, 4, 0.127, 0.0004, 4, 0.99, 1.0, 486, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "h_vars", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " h_vars = [(k, v) for (k, v) in list_vars if k in hash_vars]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L347_C8", "label": "message =", "type": "assigned_variable", "loc": [347, 347], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L330_C4", "vector": [14, 2, 0.1281, 0.0004, 2, 0.32, 0.5, 635, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " message = h_args + '?' + urllib.urlencode(sorted(h_vars))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L348_C8", "label": "sig = simple_hash()", "type": "assigned_variable", "loc": [348, 349], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L330_C4", "vector": [14, 2, 0.1287, 0.0007, 2, 0.32, 0.75, 899, 3, 4, 0, 0, 827, 10, 1], "semantic": {"name": "sig", "arg_names": [], "import_names": [], "rhs_call_name": "simple_hash", "annotation": ""}, "snippet": " sig = simple_hash(\n message, hmac_key or '', salt or '', digest_alg='sha1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L351_C8", "label": "append()", "type": "expression", "loc": [351, 351], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L330_C4", "vector": [8, 2, 0.1296, 0.0004, 2, 0.32, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " list_vars.append(('_signature', sig))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L353_C4", "label": "if", "type": "if", "loc": [353, 357], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [4, 1, 0.1311, 0.0018, 1, 0.07, 0.8077, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if list_vars:\n if url_encode:\n other += '?%s' % urllib.urlencode(list_vars)\n else:\n other += '?%s' % '&'.join(['%s=%s' % var[:2] for var in list_vars])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L354_C8", "label": "if", "type": "if", "loc": [354, 357], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L353_C4", "vector": [4, 2, 0.1313, 0.0015, 2, 0.72, 0.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if url_encode:\n other += '?%s' % urllib.urlencode(list_vars)\n else:\n other += '?%s' % '&'.join(['%s=%s' % var[:2] for var in list_vars])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L358_C4", "label": "if", "type": "if", "loc": [358, 362], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [4, 1, 0.1329, 0.0018, 1, 0.07, 0.8462, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if anchor:\n if url_encode:\n other += '#' + urllib.quote(str(anchor))\n else:\n other += '#' + (str(anchor))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L359_C8", "label": "if", "type": "if", "loc": [359, 362], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L358_C4", "vector": [4, 2, 0.1331, 0.0015, 2, 0.02, 0.0, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if url_encode:\n other += '#' + urllib.quote(str(anchor))\n else:\n other += '#' + (str(anchor))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L363_C4", "label": "if", "type": "if", "loc": [363, 364], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [4, 1, 0.1342, 0.0007, 1, 0.07, 0.8846, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if extension:\n function += '.' + extension"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L366_C4", "label": "if", "type": "if", "loc": [366, 367], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [4, 1, 0.1353, 0.0007, 1, 0.07, 0.9231, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if regex_crlf.search(join([application, controller, function, other])):\n raise SyntaxError('CRLF Injection Detected')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L369_C4", "label": "url = url_out()", "type": "assigned_variable", "loc": [369, 370], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [14, 1, 0.1364, 0.0007, 1, 0.07, 0.9615, 789, 3, 10, 0, 0, 115, 10, 1], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "url_out", "annotation": ""}, "snippet": " url = url_out(r, env, application, controller, function,\n args, other, scheme, host, port)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L371_C4", "label": "return", "type": "return", "loc": [371, 371], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "vector": [13, 1, 0.137, 0.0004, 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 url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "label": "verifyURL", "type": "function", "loc": [374, 478], "level": 0, "parent": null, "vector": [2, 0, 0.1573, 0.0388, 0, 0.66, 0.2621, 649, 0, 5, 1, 0, 0, 0, 14], "semantic": {"name": "verifyURL", "arg_names": ["request", "hmac_key", "hash_vars", "salt", "user_signature"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def verifyURL(request, hmac_key=None, hash_vars=True, salt=None, user_signature=None):\n \"\"\"\n Verifies that a request's args & vars have not been tampered with by the user\n\n :param request: web2py's request object\n :param hmac_key: the key to authenticate with, must be the same one previously\n used when calling URL()\n :param hash_vars: which vars to include in our hashing. (Optional)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L375_C4", "label": "expression", "type": "expression", "loc": [375, 408], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "vector": [8, 1, 0.1446, 0.0126, 1, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Verifies that a request's args & vars have not been tampered with by the user\n\n :param request: web2py's request object\n :param hmac_key: the key to authenticate with, must be the same one previously\n used when calling URL()\n :param hash_vars: which vars to include in our hashing. (Optional)\n Only uses the 1st value currently"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L410_C4", "label": "if", "type": "if", "loc": [410, 411], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "vector": [4, 1, 0.1516, 0.0007, 1, 0.67, 0.0667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not '_signature' in request.get_vars:\n return False # no signature in the request URL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L411_C8", "label": "return", "type": "return", "loc": [411, 411], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L410_C4", "vector": [13, 2, 0.1518, 0.0004, 2, 0.53, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False # no signature in the request URL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L414_C4", "label": "if", "type": "if", "loc": [414, 418], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "vector": [4, 1, 0.1536, 0.0018, 1, 0.67, 0.1333, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user_signature:\n from globals import current\n if not current.session or not current.session.auth:\n return False\n hmac_key = current.session.auth.hmac_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L415_C8", "label": "from globals import current", "type": "import", "loc": [415, 415], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L414_C4", "vector": [1, 2, 0.1532, 0.0004, 2, 0.2, 0.0, 926, 0, 1, 0, 0, 926, 0, 0], "semantic": {"name": "globals", "arg_names": [], "import_names": ["current"], "rhs_call_name": "", "annotation": ""}, "snippet": " from globals import current"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L416_C8", "label": "if", "type": "if", "loc": [416, 417], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L414_C4", "vector": [4, 2, 0.1538, 0.0007, 2, 0.2, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not current.session or not current.session.auth:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L417_C12", "label": "return", "type": "return", "loc": [417, 417], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L416_C8", "vector": [13, 3, 0.154, 0.0004, 3, 0.37, 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_475:Assign_L418_C8", "label": "hmac_key =", "type": "assigned_variable", "loc": [418, 418], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L414_C4", "vector": [14, 2, 0.1544, 0.0004, 2, 0.2, 1.0, 3, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "hmac_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hmac_key = current.session.auth.hmac_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L419_C4", "label": "if", "type": "if", "loc": [419, 420], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "vector": [4, 1, 0.1549, 0.0007, 1, 0.67, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hmac_key:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L420_C8", "label": "return", "type": "return", "loc": [420, 420], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L419_C4", "vector": [13, 2, 0.1551, 0.0004, 2, 0.23, 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_475:Assign_L423_C4", "label": "original_sig =", "type": "assigned_variable", "loc": [423, 423], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "vector": [14, 1, 0.1562, 0.0004, 1, 0.67, 0.2667, 338, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "original_sig", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " original_sig = request.get_vars._signature"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L426_C4", "label": "vars, args =", "type": "assigned_variable", "loc": [426, 426], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "vector": [14, 1, 0.1573, 0.0004, 1, 0.67, 0.3333, 521, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "vars, args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " vars, args = request.get_vars, request.args"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L429_C4", "label": "pop()", "type": "expression", "loc": [429, 429], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "vector": [8, 1, 0.1584, 0.0004, 1, 0.67, 0.4, 969, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pop", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " request.get_vars.pop('_signature')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L434_C4", "label": "other =", "type": "assigned_variable", "loc": [434, 434], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "vector": [14, 1, 0.1603, 0.0004, 1, 0.67, 0.4667, 341, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "other", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " other = args and urllib.quote('/' + '/'.join([str(x) for x in args])) or ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L435_C4", "label": "h_args =", "type": "assigned_variable", "loc": [435, 439], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "vector": [14, 1, 0.1614, 0.0018, 1, 0.67, 0.5333, 22, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "h_args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " h_args = '/%s/%s/%s.%s%s' % (request.application,\n request.controller,\n request.function,\n request.extension,\n other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L444_C4", "label": "list_vars =", "type": "assigned_variable", "loc": [444, 444], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "vector": [14, 1, 0.164, 0.0004, 1, 0.67, 0.6, 996, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "list_vars", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " list_vars = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L445_C4", "label": "for key, vals", "type": "for", "loc": [445, 449], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "vector": [6, 1, 0.1651, 0.0018, 1, 0.67, 0.6667, 447, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "key, vals", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for (key, vals) in sorted(vars.items()):\n if not isinstance(vals, (list, tuple)):\n vals = [vals]\n for val in vals:\n list_vars.append((key, val))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L446_C8", "label": "if", "type": "if", "loc": [446, 447], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L445_C4", "vector": [4, 2, 0.1649, 0.0007, 2, 0.64, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(vals, (list, tuple)):\n vals = [vals]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L447_C12", "label": "vals =", "type": "assigned_variable", "loc": [447, 447], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L446_C8", "vector": [14, 3, 0.1651, 0.0004, 3, 0.87, 0.0, 17, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "vals", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " vals = [vals]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L448_C8", "label": "for val", "type": "for", "loc": [448, 449], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L445_C4", "vector": [6, 2, 0.1656, 0.0007, 2, 0.64, 1.0, 618, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "val", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for val in vals:\n list_vars.append((key, val))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L449_C12", "label": "append()", "type": "expression", "loc": [449, 449], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L448_C8", "vector": [8, 3, 0.1658, 0.0004, 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": " list_vars.append((key, val))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L452_C4", "label": "if", "type": "if", "loc": [452, 464], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "vector": [4, 1, 0.1691, 0.0048, 1, 0.67, 0.7333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hash_vars is True: # include them all\n h_vars = list_vars\n elif hash_vars is False: # include none of them\n h_vars = ''\n else: # include just those specified\n # wrap in a try - if the desired vars have been removed it'll fail\n try:\n if hash_vars and not isinstance(hash_vars, (list, tuple)):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L453_C8", "label": "h_vars =", "type": "assigned_variable", "loc": [453, 453], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L452_C4", "vector": [14, 2, 0.1673, 0.0004, 2, 0.85, 0.0, 486, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "h_vars", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " h_vars = list_vars"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L454_C4", "label": "if", "type": "if", "loc": [454, 464], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L452_C4", "vector": [4, 2, 0.1695, 0.0041, 2, 0.85, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif hash_vars is False: # include none of them\n h_vars = ''\n else: # include just those specified\n # wrap in a try - if the desired vars have been removed it'll fail\n try:\n if hash_vars and not isinstance(hash_vars, (list, tuple)):\n hash_vars = [hash_vars]\n h_vars = [(k, v) for (k, v) in list_vars if k in hash_vars]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L455_C8", "label": "h_vars =", "type": "assigned_variable", "loc": [455, 455], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L454_C4", "vector": [14, 3, 0.168, 0.0004, 3, 0.95, 0.0, 486, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "h_vars", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " h_vars = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L458_C8", "label": "try", "type": "try", "loc": [458, 464], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L454_C4", "vector": [7, 3, 0.1702, 0.0026, 3, 0.95, 1.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if hash_vars and not isinstance(hash_vars, (list, tuple)):\n hash_vars = [hash_vars]\n h_vars = [(k, v) for (k, v) in list_vars if k in hash_vars]\n except:\n # user has removed one of our vars! Immediate fail\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L459_C12", "label": "if", "type": "if", "loc": [459, 460], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L458_C8", "vector": [4, 4, 0.1697, 0.0007, 4, 0.93, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hash_vars and not isinstance(hash_vars, (list, tuple)):\n hash_vars = [hash_vars]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L460_C16", "label": "hash_vars =", "type": "assigned_variable", "loc": [460, 460], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L459_C12", "vector": [14, 5, 0.1699, 0.0004, 5, 0.29, 0.0, 545, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "hash_vars", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hash_vars = [hash_vars]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L461_C12", "label": "h_vars =", "type": "assigned_variable", "loc": [461, 461], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L458_C8", "vector": [14, 4, 0.1702, 0.0004, 4, 0.93, 1.0, 486, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "h_vars", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " h_vars = [(k, v) for (k, v) in list_vars if k in hash_vars]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L464_C12", "label": "return", "type": "return", "loc": [464, 464], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L458_C8", "vector": [13, 4, 0.1713, 0.0004, 4, 0.93, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L466_C4", "label": "message =", "type": "assigned_variable", "loc": [466, 466], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "vector": [14, 1, 0.1721, 0.0004, 1, 0.67, 0.8, 635, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " message = h_args + '?' + urllib.urlencode(sorted(h_vars))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L469_C4", "label": "sig = simple_hash()", "type": "assigned_variable", "loc": [469, 469], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "vector": [14, 1, 0.1732, 0.0004, 1, 0.67, 0.8667, 899, 3, 4, 0, 0, 827, 10, 2], "semantic": {"name": "sig", "arg_names": [], "import_names": [], "rhs_call_name": "simple_hash", "annotation": ""}, "snippet": " sig = simple_hash(message, str(hmac_key), salt or '', digest_alg='sha1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L473_C4", "label": "assign", "type": "assigned_variable", "loc": [473, 473], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "vector": [14, 1, 0.1747, 0.0004, 1, 0.67, 0.9333, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request.get_vars['_signature'] = original_sig"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L478_C4", "label": "return", "type": "return", "loc": [478, 478], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "vector": [13, 1, 0.1765, 0.0004, 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 compare(original_sig, sig)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L480_C0", "label": "URL.verify =", "type": "assigned_variable", "loc": [480, 480], "level": 0, "parent": null, "vector": [14, 0, 0.1773, 0.0004, 0, 0.66, 0.2718, 196, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "URL.verify", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "URL.verify = verifyURL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L482_C0", "label": "ON =", "type": "assigned_variable", "loc": [482, 482], "level": 0, "parent": null, "vector": [14, 0, 0.178, 0.0004, 0, 0.66, 0.2816, 73, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "ON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ON = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L485_C0", "label": "XmlComponent", "type": "class", "loc": [485, 521], "level": 0, "parent": null, "vector": [3, 0, 0.1857, 0.0137, 0, 0.66, 0.2913, 963, 0, 5, 0, 0, 186, 0, 17], "semantic": {"name": "XmlComponent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class XmlComponent(object):\n \"\"\"\n Abstract root for all Html components\n \"\"\"\n\n # TODO: move some DIV methods to here\n\n def xml(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L486_C4", "label": "expression", "type": "expression", "loc": [486, 488], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L485_C0", "vector": [8, 1, 0.1798, 0.0011, 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 Abstract root for all Html components\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L492_C4", "label": "xml", "type": "function", "loc": [492, 493], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L485_C0", "vector": [2, 1, 0.1819, 0.0007, 1, 0.88, 0.2, 324, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "xml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def xml(self):\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L495_C4", "label": "__mul__", "type": "function", "loc": [495, 496], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L485_C0", "vector": [2, 1, 0.183, 0.0007, 1, 0.88, 0.4, 215, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__mul__", "arg_names": ["self", "n"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __mul__(self, n):\n return CAT(*[self for i in range(n)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L496_C8", "label": "return", "type": "return", "loc": [496, 496], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L495_C4", "vector": [13, 2, 0.1832, 0.0004, 2, 0.06, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return CAT(*[self for i in range(n)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L498_C4", "label": "__add__", "type": "function", "loc": [498, 507], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L485_C0", "vector": [2, 1, 0.1856, 0.0037, 1, 0.88, 0.6, 899, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "__add__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __add__(self, other):\n if isinstance(self, CAT):\n components = self.components\n else:\n components = [self]\n if isinstance(other, CAT):\n components += other.components\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L499_C8", "label": "if", "type": "if", "loc": [499, 502], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L498_C4", "vector": [4, 2, 0.1848, 0.0015, 2, 0.47, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(self, CAT):\n components = self.components\n else:\n components = [self]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L500_C12", "label": "components =", "type": "assigned_variable", "loc": [500, 500], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L499_C8", "vector": [14, 3, 0.1846, 0.0004, 3, 0.84, 0.0, 11, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "components", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " components = self.components"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L502_C12", "label": "components =", "type": "assigned_variable", "loc": [502, 502], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L499_C8", "vector": [14, 3, 0.1854, 0.0004, 3, 0.84, 1.0, 11, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "components", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " components = [self]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L503_C8", "label": "if", "type": "if", "loc": [503, 506], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L498_C4", "vector": [4, 2, 0.1863, 0.0015, 2, 0.47, 0.5, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, CAT):\n components += other.components\n else:\n components += [other]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L507_C8", "label": "return", "type": "return", "loc": [507, 507], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L498_C4", "vector": [13, 2, 0.1872, 0.0004, 2, 0.47, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return CAT(*components)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L509_C4", "label": "add_class", "type": "function", "loc": [509, 514], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L485_C0", "vector": [2, 1, 0.1889, 0.0022, 1, 0.88, 0.8, 308, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "add_class", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_class(self, name):\n \"\"\" add a class to _class attribute \"\"\"\n c = self['_class']\n classes = (set(c.split()) if c else set()) | set(name.split())\n self['_class'] = ' '.join(classes) if classes else None\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L510_C8", "label": "expression", "type": "expression", "loc": [510, 510], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L509_C4", "vector": [8, 2, 0.1883, 0.0004, 2, 0.68, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" add a class to _class attribute \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L511_C8", "label": "c =", "type": "assigned_variable", "loc": [511, 511], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L509_C4", "vector": [14, 2, 0.1887, 0.0004, 2, 0.68, 0.25, 411, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c = self['_class']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L512_C8", "label": "classes =", "type": "assigned_variable", "loc": [512, 512], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L509_C4", "vector": [14, 2, 0.1891, 0.0004, 2, 0.68, 0.5, 124, 4, 0, 0, 0, 0, 0, 5], "semantic": {"name": "classes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " classes = (set(c.split()) if c else set()) | set(name.split())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L513_C8", "label": "assign", "type": "assigned_variable", "loc": [513, 513], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L509_C4", "vector": [14, 2, 0.1894, 0.0004, 2, 0.68, 0.75, 0, 8, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_class'] = ' '.join(classes) if classes else None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L514_C8", "label": "return", "type": "return", "loc": [514, 514], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L509_C4", "vector": [13, 2, 0.1898, 0.0004, 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 self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L516_C4", "label": "remove_class", "type": "function", "loc": [516, 521], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L485_C0", "vector": [2, 1, 0.1915, 0.0022, 1, 0.88, 1.0, 758, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "remove_class", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remove_class(self, name):\n \"\"\" remove a class from _class attribute \"\"\"\n c = self['_class']\n classes = (set(c.split()) if c else set()) - set(name.split())\n self['_class'] = ' '.join(classes) if classes else None\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L517_C8", "label": "expression", "type": "expression", "loc": [517, 517], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L516_C4", "vector": [8, 2, 0.1909, 0.0004, 2, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" remove a class from _class attribute \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L518_C8", "label": "c =", "type": "assigned_variable", "loc": [518, 518], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L516_C4", "vector": [14, 2, 0.1913, 0.0004, 2, 0.85, 0.25, 411, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c = self['_class']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L519_C8", "label": "classes =", "type": "assigned_variable", "loc": [519, 519], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L516_C4", "vector": [14, 2, 0.1917, 0.0004, 2, 0.85, 0.5, 124, 4, 0, 0, 0, 0, 0, 5], "semantic": {"name": "classes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " classes = (set(c.split()) if c else set()) - set(name.split())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L520_C8", "label": "assign", "type": "assigned_variable", "loc": [520, 520], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L516_C4", "vector": [14, 2, 0.192, 0.0004, 2, 0.85, 0.75, 0, 8, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_class'] = ' '.join(classes) if classes else None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L521_C8", "label": "return", "type": "return", "loc": [521, 521], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L516_C4", "vector": [13, 2, 0.1924, 0.0004, 2, 0.85, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "label": "XML", "type": "class", "loc": [523, 631], "level": 0, "parent": null, "vector": [3, 0, 0.2131, 0.0403, 0, 0.66, 0.301, 52, 0, 13, 0, 0, 963, 0, 16], "semantic": {"name": "XML", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class XML(XmlComponent):\n \"\"\"\n use it to wrap a string that contains XML/HTML so that it will not be\n escaped by the template\n\n example:\n\n >>> XML('<h1>Hello</h1>').xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L524_C4", "label": "expression", "type": "expression", "loc": [524, 532], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "vector": [8, 1, 0.195, 0.0033, 1, 0.08, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n use it to wrap a string that contains XML/HTML so that it will not be\n escaped by the template\n\n example:\n\n >>> XML('<h1>Hello</h1>').xml()\n '<h1>Hello</h1>'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L534_C4", "label": "__init__", "type": "function", "loc": [534, 581], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "vector": [2, 1, 0.2059, 0.0177, 1, 0.08, 0.0769, 555, 0, 5, 0, 0, 0, 0, 5], "semantic": {"name": "__init__", "arg_names": ["self", "text", "sanitize", "permitted_tags", "allowed_attributes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(\n self,\n text,\n sanitize=False,\n permitted_tags=[\n 'a',\n 'b',\n 'blockquote',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L563_C8", "label": "expression", "type": "expression", "loc": [563, 572], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L534_C4", "vector": [8, 2, 0.2096, 0.0037, 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 :param text: the XML text\n :param sanitize: sanitize text using the permitted tags and allowed\n attributes (default False)\n :param permitted_tags: list of permitted tags (default: simple list of\n tags)\n :param allowed_attributes: dictionary of allowed attributed (default\n for A, IMG and BlockQuote)."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L574_C8", "label": "if", "type": "if", "loc": [574, 576], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L534_C4", "vector": [4, 2, 0.2123, 0.0011, 2, 0.05, 0.3333, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if sanitize:\n text = sanitizer.sanitize(text, permitted_tags,\n allowed_attributes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L575_C12", "label": "text = sanitize()", "type": "assigned_variable", "loc": [575, 576], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L574_C8", "vector": [14, 3, 0.2125, 0.0007, 3, 0.5, 0.0, 439, 3, 3, 0, 0, 151, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "sanitize", "annotation": ""}, "snippet": " text = sanitizer.sanitize(text, permitted_tags,\n allowed_attributes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L577_C8", "label": "if", "type": "if", "loc": [577, 580], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L534_C4", "vector": [4, 2, 0.2136, 0.0015, 2, 0.05, 0.6667, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(text, unicode):\n text = text.encode('utf8', 'xmlcharrefreplace')\n elif not isinstance(text, str):\n text = str(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L578_C12", "label": "text = encode()", "type": "assigned_variable", "loc": [578, 578], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L577_C8", "vector": [14, 3, 0.2134, 0.0004, 3, 0.33, 0.0, 439, 3, 2, 0, 0, 623, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": " text = text.encode('utf8', 'xmlcharrefreplace')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L579_C8", "label": "if", "type": "if", "loc": [579, 580], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L577_C8", "vector": [4, 3, 0.214, 0.0007, 3, 0.33, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not isinstance(text, str):\n text = str(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L580_C12", "label": "text = str()", "type": "assigned_variable", "loc": [580, 580], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L579_C8", "vector": [14, 4, 0.2142, 0.0004, 4, 0.79, 0.0, 439, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " text = str(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L581_C8", "label": "self.text =", "type": "assigned_variable", "loc": [581, 581], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L534_C4", "vector": [14, 2, 0.2145, 0.0004, 2, 0.05, 1.0, 320, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.text = text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L583_C4", "label": "xml", "type": "function", "loc": [583, 584], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "vector": [2, 1, 0.2155, 0.0007, 1, 0.08, 0.1538, 324, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "xml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def xml(self):\n return self.text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L584_C8", "label": "return", "type": "return", "loc": [584, 584], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L583_C4", "vector": [13, 2, 0.2157, 0.0004, 2, 0.28, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L586_C4", "label": "__str__", "type": "function", "loc": [586, 587], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "vector": [2, 1, 0.2166, 0.0007, 1, 0.08, 0.2308, 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.text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L587_C8", "label": "return", "type": "return", "loc": [587, 587], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L586_C4", "vector": [13, 2, 0.2168, 0.0004, 2, 0.11, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L589_C4", "label": "__add__", "type": "function", "loc": [589, 590], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "vector": [2, 1, 0.2177, 0.0007, 1, 0.08, 0.3077, 899, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__add__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __add__(self, other):\n return '%s%s' % (self, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L590_C8", "label": "return", "type": "return", "loc": [590, 590], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L589_C4", "vector": [13, 2, 0.2179, 0.0004, 2, 0.64, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s%s' % (self, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L592_C4", "label": "__radd__", "type": "function", "loc": [592, 593], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "vector": [2, 1, 0.2188, 0.0007, 1, 0.08, 0.3846, 241, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__radd__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __radd__(self, other):\n return '%s%s' % (other, self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L593_C8", "label": "return", "type": "return", "loc": [593, 593], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L592_C4", "vector": [13, 2, 0.219, 0.0004, 2, 0.37, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s%s' % (other, self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L595_C4", "label": "__cmp__", "type": "function", "loc": [595, 596], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "vector": [2, 1, 0.2199, 0.0007, 1, 0.08, 0.4615, 271, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "__cmp__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __cmp__(self, other):\n return cmp(str(self), str(other))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L596_C8", "label": "return", "type": "return", "loc": [596, 596], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L595_C4", "vector": [13, 2, 0.2201, 0.0004, 2, 0.39, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cmp(str(self), str(other))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L598_C4", "label": "__hash__", "type": "function", "loc": [598, 599], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "vector": [2, 1, 0.221, 0.0007, 1, 0.08, 0.5385, 49, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "__hash__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __hash__(self):\n return hash(str(self))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L599_C8", "label": "return", "type": "return", "loc": [599, 599], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L598_C4", "vector": [13, 2, 0.2212, 0.0004, 2, 0.6, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return hash(str(self))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L605_C4", "label": "__getitem__", "type": "function", "loc": [605, 606], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "vector": [2, 1, 0.2236, 0.0007, 1, 0.08, 0.6154, 698, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__getitem__", "arg_names": ["self", "i"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, i):\n return str(self)[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L606_C8", "label": "return", "type": "return", "loc": [606, 606], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L605_C4", "vector": [13, 2, 0.2238, 0.0004, 2, 0.67, 0.0, 0, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(self)[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L608_C4", "label": "__getslice__", "type": "function", "loc": [608, 609], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "vector": [2, 1, 0.2247, 0.0007, 1, 0.08, 0.6923, 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 str(self)[i:j]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L609_C8", "label": "return", "type": "return", "loc": [609, 609], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L608_C4", "vector": [13, 2, 0.2249, 0.0004, 2, 0.2, 0.0, 0, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(self)[i:j]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L611_C4", "label": "__iter__", "type": "function", "loc": [611, 613], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "vector": [2, 1, 0.226, 0.0011, 1, 0.08, 0.7692, 891, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n for c in str(self):\n yield c"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L612_C8", "label": "for c", "type": "for", "loc": [612, 613], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L611_C4", "vector": [6, 2, 0.2262, 0.0007, 2, 0.03, 0.0, 411, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in str(self):\n yield c"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L613_C12", "label": "expression", "type": "expression", "loc": [613, 613], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L612_C8", "vector": [8, 3, 0.2264, 0.0004, 3, 0.3, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield c"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L615_C4", "label": "__len__", "type": "function", "loc": [615, 616], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "vector": [2, 1, 0.2273, 0.0007, 1, 0.08, 0.8462, 76, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "__len__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __len__(self):\n return len(str(self))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L616_C8", "label": "return", "type": "return", "loc": [616, 616], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L615_C4", "vector": [13, 2, 0.2275, 0.0004, 2, 0.6, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(str(self))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L618_C4", "label": "flatten", "type": "function", "loc": [618, 624], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "vector": [2, 1, 0.2293, 0.0026, 1, 0.08, 0.9231, 893, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "flatten", "arg_names": ["self", "render"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def flatten(self, render=None):\n \"\"\"\n return the text stored by the XML object rendered by the render function\n \"\"\"\n if render:\n return render(self.text, None, {})\n return self.text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L619_C8", "label": "expression", "type": "expression", "loc": [619, 621], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L618_C4", "vector": [8, 2, 0.229, 0.0011, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n return the text stored by the XML object rendered by the render function\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L622_C8", "label": "if", "type": "if", "loc": [622, 623], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L618_C4", "vector": [4, 2, 0.2299, 0.0007, 2, 0.98, 0.5, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if render:\n return render(self.text, None, {})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L623_C12", "label": "return", "type": "return", "loc": [623, 623], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L622_C8", "vector": [13, 3, 0.2301, 0.0004, 3, 0.52, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render(self.text, None, {})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L624_C8", "label": "return", "type": "return", "loc": [624, 624], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L618_C4", "vector": [13, 2, 0.2304, 0.0004, 2, 0.98, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L626_C4", "label": "elements", "type": "function", "loc": [626, 631], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "vector": [2, 1, 0.2321, 0.0022, 1, 0.08, 1.0, 915, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "elements", "arg_names": ["self", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def elements(self, *args, **kargs):\n \"\"\"\n to be considered experimental since the behavior of this method is questionable\n another options could be TAG(self.text).elements(*args,**kargs)\n \"\"\"\n return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L627_C8", "label": "expression", "type": "expression", "loc": [627, 630], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L626_C4", "vector": [8, 2, 0.2321, 0.0015, 2, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n to be considered experimental since the behavior of this method is questionable\n another options could be TAG(self.text).elements(*args,**kargs)\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L631_C8", "label": "return", "type": "return", "loc": [631, 631], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L626_C4", "vector": [13, 2, 0.233, 0.0004, 2, 0.4, 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_475:FunctionDef_L636_C0", "label": "XML_unpickle", "type": "function", "loc": [636, 637], "level": 0, "parent": null, "vector": [2, 0, 0.235, 0.0007, 0, 0.66, 0.3107, 221, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "XML_unpickle", "arg_names": ["data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def XML_unpickle(data):\n return marshal.loads(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L637_C4", "label": "return", "type": "return", "loc": [637, 637], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L636_C0", "vector": [13, 1, 0.2352, 0.0004, 1, 0.79, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return marshal.loads(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L640_C0", "label": "XML_pickle", "type": "function", "loc": [640, 641], "level": 0, "parent": null, "vector": [2, 0, 0.2365, 0.0007, 0, 0.66, 0.3204, 520, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "XML_pickle", "arg_names": ["data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def XML_pickle(data):\n return XML_unpickle, (marshal.dumps(str(data)),)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L641_C4", "label": "return", "type": "return", "loc": [641, 641], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L640_C0", "vector": [13, 1, 0.2367, 0.0004, 1, 0.19, 0.0, 0, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return XML_unpickle, (marshal.dumps(str(data)),)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L642_C0", "label": "pickle()", "type": "expression", "loc": [642, 642], "level": 0, "parent": null, "vector": [8, 0, 0.2371, 0.0004, 0, 0.66, 0.3301, 848, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "pickle", "arg_names": [], "import_names": [], "rhs_call_name": "pickle", "annotation": ""}, "snippet": "copy_reg.pickle(XML, XML_pickle, XML_unpickle)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "label": "DIV", "type": "class", "loc": [645, 1180], "level": 0, "parent": null, "vector": [3, 0, 0.337, 0.1979, 0, 0.66, 0.3398, 697, 0, 24, 0, 0, 963, 0, 99], "semantic": {"name": "DIV", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DIV(XmlComponent):\n \"\"\"\n HTML helper, for easy generating and manipulating a DOM structure.\n Little or no validation is done.\n\n Behaves like a dictionary regarding updating of attributes.\n Behaves like a list regarding inserting/appending components.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L646_C4", "label": "expression", "type": "expression", "loc": [646, 662], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [8, 1, 0.2415, 0.0063, 1, 0.33, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n HTML helper, for easy generating and manipulating a DOM structure.\n Little or no validation is done.\n\n Behaves like a dictionary regarding updating of attributes.\n Behaves like a list regarding inserting/appending components.\n\n example::"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L667_C4", "label": "tag =", "type": "assigned_variable", "loc": [667, 667], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [14, 1, 0.2463, 0.0004, 1, 0.33, 0.0357, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'div'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L669_C4", "label": "__init__", "type": "function", "loc": [669, 690], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.2509, 0.0081, 1, 0.33, 0.0714, 555, 0, 3, 0, 0, 0, 0, 8], "semantic": {"name": "__init__", "arg_names": ["self", "components", "attributes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *components, **attributes):\n \"\"\"\n :param *components: any components that should be nested in this element\n :param **attributes: any attributes you want to give to this element\n\n :raises SyntaxError: when a stand alone tag receives components\n \"\"\"\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L670_C8", "label": "expression", "type": "expression", "loc": [670, 675], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L669_C4", "vector": [8, 2, 0.2483, 0.0022, 2, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n :param *components: any components that should be nested in this element\n :param **attributes: any attributes you want to give to this element\n\n :raises SyntaxError: when a stand alone tag receives components\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L677_C8", "label": "if", "type": "if", "loc": [677, 679], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L669_C4", "vector": [4, 2, 0.2504, 0.0011, 2, 0.2, 0.1429, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.tag[-1:] == '/' and components:\n raise SyntaxError('<%s> tags cannot have components'\n % self.tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L680_C8", "label": "if", "type": "if", "loc": [680, 683], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L669_C4", "vector": [4, 2, 0.2517, 0.0015, 2, 0.2, 0.2857, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(components) == 1 and isinstance(components[0], (list, tuple)):\n self.components = list(components[0])\n else:\n self.components = list(components)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L681_C12", "label": "self.components = list()", "type": "assigned_variable", "loc": [681, 681], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L680_C8", "vector": [14, 3, 0.2515, 0.0004, 3, 0.87, 0.0, 687, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "self.components", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " self.components = list(components[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L683_C12", "label": "self.components = list()", "type": "assigned_variable", "loc": [683, 683], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L680_C8", "vector": [14, 3, 0.2522, 0.0004, 3, 0.87, 1.0, 687, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "self.components", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " self.components = list(components)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L684_C8", "label": "self.attributes =", "type": "assigned_variable", "loc": [684, 684], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L669_C4", "vector": [14, 2, 0.2526, 0.0004, 2, 0.2, 0.4286, 21, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.attributes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.attributes = attributes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L685_C8", "label": "_fixup()", "type": "expression", "loc": [685, 685], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L669_C4", "vector": [8, 2, 0.253, 0.0004, 2, 0.2, 0.5714, 339, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_fixup", "arg_names": [], "import_names": [], "rhs_call_name": "_fixup", "annotation": ""}, "snippet": " self._fixup()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L687_C8", "label": "self.parent =", "type": "assigned_variable", "loc": [687, 687], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L669_C4", "vector": [14, 2, 0.2537, 0.0004, 2, 0.2, 0.7143, 428, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.parent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.parent = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L688_C8", "label": "for c", "type": "for", "loc": [688, 689], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L669_C4", "vector": [6, 2, 0.2542, 0.0007, 2, 0.2, 0.8571, 411, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in self.components:\n self._setnode(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L689_C12", "label": "_setnode()", "type": "expression", "loc": [689, 689], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L688_C8", "vector": [8, 3, 0.2544, 0.0004, 3, 0.46, 0.0, 697, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_setnode", "arg_names": [], "import_names": [], "rhs_call_name": "_setnode", "annotation": ""}, "snippet": " self._setnode(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L690_C8", "label": "_postprocessing()", "type": "expression", "loc": [690, 690], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L669_C4", "vector": [8, 2, 0.2548, 0.0004, 2, 0.2, 1.0, 455, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_postprocessing", "arg_names": [], "import_names": [], "rhs_call_name": "_postprocessing", "annotation": ""}, "snippet": " self._postprocessing()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L692_C4", "label": "update", "type": "function", "loc": [692, 699], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.2568, 0.003, 1, 0.33, 0.1071, 637, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": ["self", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update(self, **kargs):\n \"\"\"\n dictionary like updating of the tag attributes\n \"\"\"\n\n for (key, value) in kargs.iteritems():\n self[key] = value\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L693_C8", "label": "expression", "type": "expression", "loc": [693, 695], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L692_C4", "vector": [8, 2, 0.2563, 0.0011, 2, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n dictionary like updating of the tag attributes\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L697_C8", "label": "for key, value", "type": "for", "loc": [697, 698], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L692_C4", "vector": [6, 2, 0.2576, 0.0007, 2, 0.67, 0.5, 839, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for (key, value) in kargs.iteritems():\n self[key] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L698_C12", "label": "assign", "type": "assigned_variable", "loc": [698, 698], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L697_C8", "vector": [14, 3, 0.2578, 0.0004, 3, 0.1, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self[key] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L699_C8", "label": "return", "type": "return", "loc": [699, 699], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L692_C4", "vector": [13, 2, 0.2581, 0.0004, 2, 0.67, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L701_C4", "label": "append", "type": "function", "loc": [701, 713], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.2611, 0.0048, 1, 0.33, 0.1429, 243, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "append", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def append(self, value):\n \"\"\"\n list style appending of components\n\n >>> a=DIV()\n >>> a.append(SPAN('x'))\n >>> print a\n <div><span>x</span></div>"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L702_C8", "label": "expression", "type": "expression", "loc": [702, 709], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L701_C4", "vector": [8, 2, 0.2605, 0.003, 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 list style appending of components\n\n >>> a=DIV()\n >>> a.append(SPAN('x'))\n >>> print a\n <div><span>x</span></div>\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L710_C8", "label": "_setnode()", "type": "expression", "loc": [710, 710], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L701_C4", "vector": [8, 2, 0.2622, 0.0004, 2, 0.03, 0.25, 697, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_setnode", "arg_names": [], "import_names": [], "rhs_call_name": "_setnode", "annotation": ""}, "snippet": " self._setnode(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L711_C8", "label": "ret = append()", "type": "assigned_variable", "loc": [711, 711], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L701_C4", "vector": [14, 2, 0.2626, 0.0004, 2, 0.03, 0.5, 501, 3, 1, 0, 0, 243, 10, 1], "semantic": {"name": "ret", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " ret = self.components.append(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L712_C8", "label": "_fixup()", "type": "expression", "loc": [712, 712], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L701_C4", "vector": [8, 2, 0.2629, 0.0004, 2, 0.03, 0.75, 339, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_fixup", "arg_names": [], "import_names": [], "rhs_call_name": "_fixup", "annotation": ""}, "snippet": " self._fixup()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L713_C8", "label": "return", "type": "return", "loc": [713, 713], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L701_C4", "vector": [13, 2, 0.2633, 0.0004, 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 ret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L715_C4", "label": "insert", "type": "function", "loc": [715, 727], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.2662, 0.0048, 1, 0.33, 0.1786, 368, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "insert", "arg_names": ["self", "i", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def insert(self, i, value):\n \"\"\"\n list style inserting of components\n\n >>> a=DIV()\n >>> a.insert(0,SPAN('x'))\n >>> print a\n <div><span>x</span></div>"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L716_C8", "label": "expression", "type": "expression", "loc": [716, 723], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L715_C4", "vector": [8, 2, 0.2657, 0.003, 2, 0.63, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n list style inserting of components\n\n >>> a=DIV()\n >>> a.insert(0,SPAN('x'))\n >>> print a\n <div><span>x</span></div>\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L724_C8", "label": "_setnode()", "type": "expression", "loc": [724, 724], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L715_C4", "vector": [8, 2, 0.2674, 0.0004, 2, 0.63, 0.25, 697, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_setnode", "arg_names": [], "import_names": [], "rhs_call_name": "_setnode", "annotation": ""}, "snippet": " self._setnode(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L725_C8", "label": "ret = insert()", "type": "assigned_variable", "loc": [725, 725], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L715_C4", "vector": [14, 2, 0.2677, 0.0004, 2, 0.63, 0.5, 501, 3, 2, 0, 0, 368, 10, 1], "semantic": {"name": "ret", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " ret = self.components.insert(i, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L726_C8", "label": "_fixup()", "type": "expression", "loc": [726, 726], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L715_C4", "vector": [8, 2, 0.2681, 0.0004, 2, 0.63, 0.75, 339, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_fixup", "arg_names": [], "import_names": [], "rhs_call_name": "_fixup", "annotation": ""}, "snippet": " self._fixup()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L727_C8", "label": "return", "type": "return", "loc": [727, 727], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L715_C4", "vector": [13, 2, 0.2685, 0.0004, 2, 0.63, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L729_C4", "label": "__getitem__", "type": "function", "loc": [729, 745], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.2722, 0.0063, 1, 0.33, 0.2143, 698, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__getitem__", "arg_names": ["self", "i"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, i):\n \"\"\"\n gets attribute with name 'i' or component #i.\n If attribute 'i' is not found returns None\n\n :param i: index\n if i is a string: the name of the attribute\n otherwise references to number of the component"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L730_C8", "label": "expression", "type": "expression", "loc": [730, 737], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L729_C4", "vector": [8, 2, 0.2709, 0.003, 2, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n gets attribute with name 'i' or component #i.\n If attribute 'i' is not found returns None\n\n :param i: index\n if i is a string: the name of the attribute\n otherwise references to number of the component\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L739_C8", "label": "if", "type": "if", "loc": [739, 745], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L729_C4", "vector": [4, 2, 0.274, 0.0026, 2, 0.25, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(i, str):\n try:\n return self.attributes[i]\n except KeyError:\n return None\n else:\n return self.components[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L740_C12", "label": "try", "type": "try", "loc": [740, 743], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L739_C8", "vector": [7, 3, 0.2738, 0.0015, 3, 0.69, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return self.attributes[i]\n except KeyError:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L741_C16", "label": "return", "type": "return", "loc": [741, 741], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L740_C12", "vector": [13, 4, 0.2736, 0.0004, 4, 0.0, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.attributes[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L743_C16", "label": "return", "type": "return", "loc": [743, 743], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L740_C12", "vector": [13, 4, 0.2744, 0.0004, 4, 0.0, 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_475:Return_L745_C12", "label": "return", "type": "return", "loc": [745, 745], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L739_C8", "vector": [13, 3, 0.2751, 0.0004, 3, 0.69, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.components[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L747_C4", "label": "__setitem__", "type": "function", "loc": [747, 760], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.2782, 0.0052, 1, 0.33, 0.25, 343, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__setitem__", "arg_names": ["self", "i", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __setitem__(self, i, value):\n \"\"\"\n sets attribute with name 'i' or component #i.\n\n :param i: index\n if i is a string: the name of the attribute\n otherwise references to number of the component\n :param value: the new value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L748_C8", "label": "expression", "type": "expression", "loc": [748, 755], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L747_C4", "vector": [8, 2, 0.2775, 0.003, 2, 0.08, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n sets attribute with name 'i' or component #i.\n\n :param i: index\n if i is a string: the name of the attribute\n otherwise references to number of the component\n :param value: the new value\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L756_C8", "label": "_setnode()", "type": "expression", "loc": [756, 756], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L747_C4", "vector": [8, 2, 0.2792, 0.0004, 2, 0.08, 0.5, 697, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_setnode", "arg_names": [], "import_names": [], "rhs_call_name": "_setnode", "annotation": ""}, "snippet": " self._setnode(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L757_C8", "label": "if", "type": "if", "loc": [757, 760], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L747_C4", "vector": [4, 2, 0.2801, 0.0015, 2, 0.08, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(i, (str, unicode)):\n self.attributes[i] = value\n else:\n self.components[i] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L758_C12", "label": "assign", "type": "assigned_variable", "loc": [758, 758], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L757_C8", "vector": [14, 3, 0.2799, 0.0004, 3, 0.54, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.attributes[i] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L760_C12", "label": "assign", "type": "assigned_variable", "loc": [760, 760], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L757_C8", "vector": [14, 3, 0.2806, 0.0004, 3, 0.54, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.components[i] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L762_C4", "label": "__delitem__", "type": "function", "loc": [762, 774], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.2836, 0.0048, 1, 0.33, 0.2857, 66, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__delitem__", "arg_names": ["self", "i"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __delitem__(self, i):\n \"\"\"\n deletes attribute with name 'i' or component #i.\n\n :param i: index\n if i is a string: the name of the attribute\n otherwise references to number of the component\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L763_C8", "label": "expression", "type": "expression", "loc": [763, 769], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L762_C4", "vector": [8, 2, 0.2829, 0.0026, 2, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n deletes attribute with name 'i' or component #i.\n\n :param i: index\n if i is a string: the name of the attribute\n otherwise references to number of the component\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L771_C8", "label": "if", "type": "if", "loc": [771, 774], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L762_C4", "vector": [4, 2, 0.2853, 0.0015, 2, 0.54, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(i, str):\n del self.attributes[i]\n else:\n del self.components[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L776_C4", "label": "__len__", "type": "function", "loc": [776, 780], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.2873, 0.0018, 1, 0.33, 0.3214, 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 \"\"\"\n returns the number of included components\n \"\"\"\n return len(self.components)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L777_C8", "label": "expression", "type": "expression", "loc": [777, 779], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L776_C4", "vector": [8, 2, 0.2873, 0.0011, 2, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n returns the number of included components\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L780_C8", "label": "return", "type": "return", "loc": [780, 780], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L776_C4", "vector": [13, 2, 0.288, 0.0004, 2, 0.67, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self.components)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L782_C4", "label": "__nonzero__", "type": "function", "loc": [782, 786], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.2895, 0.0018, 1, 0.33, 0.3571, 322, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__nonzero__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __nonzero__(self):\n \"\"\"\n always return True\n \"\"\"\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L783_C8", "label": "expression", "type": "expression", "loc": [783, 785], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L782_C4", "vector": [8, 2, 0.2895, 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": " \"\"\"\n always return True\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L786_C8", "label": "return", "type": "return", "loc": [786, 786], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L782_C4", "vector": [13, 2, 0.2903, 0.0004, 2, 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_475:FunctionDef_L788_C4", "label": "_fixup", "type": "function", "loc": [788, 795], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.2923, 0.003, 1, 0.33, 0.3929, 339, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "_fixup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _fixup(self):\n \"\"\"\n Handling of provided components.\n\n Nothing to fixup yet. May be overridden by subclasses,\n eg for wrapping some components in another component or blocking them.\n \"\"\"\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L789_C8", "label": "expression", "type": "expression", "loc": [789, 794], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L788_C4", "vector": [8, 2, 0.2923, 0.0022, 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 Handling of provided components.\n\n Nothing to fixup yet. May be overridden by subclasses,\n eg for wrapping some components in another component or blocking them.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L795_C8", "label": "return", "type": "return", "loc": [795, 795], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L788_C4", "vector": [13, 2, 0.2936, 0.0004, 2, 0.36, 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_475:FunctionDef_L797_C4", "label": "_wrap_components", "type": "function", "loc": [797, 821], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.2987, 0.0092, 1, 0.33, 0.4286, 452, 0, 4, 0, 0, 0, 0, 5], "semantic": {"name": "_wrap_components", "arg_names": ["self", "allowed_parents", "wrap_parent", "wrap_lambda"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _wrap_components(self, allowed_parents,\n wrap_parent=None,\n wrap_lambda=None):\n \"\"\"\n helper for _fixup. Checks if a component is in allowed_parents,\n otherwise wraps it in wrap_parent\n\n :param allowed_parents: (tuple) classes that the component should be an"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L800_C8", "label": "expression", "type": "expression", "loc": [800, 809], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L797_C4", "vector": [8, 2, 0.2971, 0.0037, 2, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n helper for _fixup. Checks if a component is in allowed_parents,\n otherwise wraps it in wrap_parent\n\n :param allowed_parents: (tuple) classes that the component should be an\n instance of\n :param wrap_parent: the class to wrap the component in, if needed\n :param wrap_lambda: lambda to use for wrapping, if needed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L810_C8", "label": "components =", "type": "assigned_variable", "loc": [810, 810], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L797_C4", "vector": [14, 2, 0.2991, 0.0004, 2, 0.76, 0.3333, 11, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "components", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " components = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L811_C8", "label": "for c", "type": "for", "loc": [811, 820], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L797_C4", "vector": [6, 2, 0.3011, 0.0037, 2, 0.76, 0.6667, 411, 7, 0, 0, 0, 0, 0, 5], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in self.components:\n if isinstance(c, allowed_parents):\n pass\n elif wrap_lambda:\n c = wrap_lambda(c)\n else:\n c = wrap_parent(c)\n if isinstance(c, DIV):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L812_C12", "label": "if", "type": "if", "loc": [812, 817], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L811_C8", "vector": [4, 3, 0.3008, 0.0022, 3, 0.75, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(c, allowed_parents):\n pass\n elif wrap_lambda:\n c = wrap_lambda(c)\n else:\n c = wrap_parent(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L814_C12", "label": "if", "type": "if", "loc": [814, 817], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L812_C12", "vector": [4, 4, 0.3011, 0.0015, 4, 0.4, 0.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif wrap_lambda:\n c = wrap_lambda(c)\n else:\n c = wrap_parent(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L815_C16", "label": "c = wrap_lambda()", "type": "assigned_variable", "loc": [815, 815], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L814_C12", "vector": [14, 5, 0.301, 0.0004, 5, 0.0, 0.0, 411, 3, 1, 0, 0, 495, 10, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "wrap_lambda", "annotation": ""}, "snippet": " c = wrap_lambda(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L817_C16", "label": "c = wrap_parent()", "type": "assigned_variable", "loc": [817, 817], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L814_C12", "vector": [14, 5, 0.3017, 0.0004, 5, 0.0, 1.0, 411, 3, 1, 0, 0, 188, 10, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "wrap_parent", "annotation": ""}, "snippet": " c = wrap_parent(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L818_C12", "label": "if", "type": "if", "loc": [818, 819], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L811_C8", "vector": [4, 3, 0.3023, 0.0007, 3, 0.75, 0.5, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(c, DIV):\n c.parent = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L819_C16", "label": "c.parent =", "type": "assigned_variable", "loc": [819, 819], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L818_C12", "vector": [14, 4, 0.3024, 0.0004, 4, 0.43, 0.0, 769, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "c.parent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c.parent = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L820_C12", "label": "append()", "type": "expression", "loc": [820, 820], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L811_C8", "vector": [8, 3, 0.3028, 0.0004, 3, 0.75, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " components.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L821_C8", "label": "self.components =", "type": "assigned_variable", "loc": [821, 821], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L797_C4", "vector": [14, 2, 0.3032, 0.0004, 2, 0.76, 1.0, 687, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.components", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.components = components"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L823_C4", "label": "_postprocessing", "type": "function", "loc": [823, 829], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.305, 0.0026, 1, 0.33, 0.4643, 455, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "_postprocessing", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _postprocessing(self):\n \"\"\"\n Handling of attributes (normally the ones not prefixed with '_').\n\n Nothing to postprocess yet. May be overridden by subclasses\n \"\"\"\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L824_C8", "label": "expression", "type": "expression", "loc": [824, 828], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L823_C4", "vector": [8, 2, 0.305, 0.0018, 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 Handling of attributes (normally the ones not prefixed with '_').\n\n Nothing to postprocess yet. May be overridden by subclasses\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L829_C8", "label": "return", "type": "return", "loc": [829, 829], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L823_C4", "vector": [13, 2, 0.3061, 0.0004, 2, 0.34, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L831_C4", "label": "_traverse", "type": "function", "loc": [831, 861], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.3124, 0.0114, 1, 0.33, 0.5, 319, 0, 3, 1, 0, 0, 0, 8], "semantic": {"name": "_traverse", "arg_names": ["self", "status", "hideerror"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _traverse(self, status, hideerror=False):\n # TODO: docstring\n newstatus = status\n for c in self.components:\n if hasattr(c, '_traverse') and callable(c._traverse):\n c.vars = self.vars\n c.request_vars = self.request_vars\n c.errors = self.errors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L833_C8", "label": "newstatus =", "type": "assigned_variable", "loc": [833, 833], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L831_C4", "vector": [14, 2, 0.3076, 0.0004, 2, 0.32, 0.0, 465, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "newstatus", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newstatus = status"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L834_C8", "label": "for c", "type": "for", "loc": [834, 844], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L831_C4", "vector": [6, 2, 0.3098, 0.0041, 2, 0.32, 0.2, 411, 7, 0, 0, 0, 0, 0, 4], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in self.components:\n if hasattr(c, '_traverse') and callable(c._traverse):\n c.vars = self.vars\n c.request_vars = self.request_vars\n c.errors = self.errors\n c.latest = self.latest\n c.session = self.session\n c.formname = self.formname"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L835_C12", "label": "if", "type": "if", "loc": [835, 844], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L834_C8", "vector": [4, 3, 0.31, 0.0037, 3, 0.7, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(c, '_traverse') and callable(c._traverse):\n c.vars = self.vars\n c.request_vars = self.request_vars\n c.errors = self.errors\n c.latest = self.latest\n c.session = self.session\n c.formname = self.formname\n c['hideerror'] = hideerror or \\"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L836_C16", "label": "c.vars =", "type": "assigned_variable", "loc": [836, 836], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L835_C12", "vector": [14, 4, 0.3087, 0.0004, 4, 0.54, 0.0, 711, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "c.vars", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c.vars = self.vars"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L837_C16", "label": "c.request_vars =", "type": "assigned_variable", "loc": [837, 837], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L835_C12", "vector": [14, 4, 0.3091, 0.0004, 4, 0.54, 0.1429, 543, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "c.request_vars", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c.request_vars = self.request_vars"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L838_C16", "label": "c.errors =", "type": "assigned_variable", "loc": [838, 838], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L835_C12", "vector": [14, 4, 0.3095, 0.0004, 4, 0.54, 0.2857, 189, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "c.errors", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c.errors = self.errors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L839_C16", "label": "c.latest =", "type": "assigned_variable", "loc": [839, 839], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L835_C12", "vector": [14, 4, 0.3098, 0.0004, 4, 0.54, 0.4286, 120, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "c.latest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c.latest = self.latest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L840_C16", "label": "c.session =", "type": "assigned_variable", "loc": [840, 840], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L835_C12", "vector": [14, 4, 0.3102, 0.0004, 4, 0.54, 0.5714, 207, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "c.session", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c.session = self.session"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L841_C16", "label": "c.formname =", "type": "assigned_variable", "loc": [841, 841], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L835_C12", "vector": [14, 4, 0.3106, 0.0004, 4, 0.54, 0.7143, 163, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "c.formname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c.formname = self.formname"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L842_C16", "label": "assign", "type": "assigned_variable", "loc": [842, 843], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L835_C12", "vector": [14, 4, 0.3111, 0.0007, 4, 0.54, 0.8571, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c['hideerror'] = hideerror or \\\n self.attributes.get('hideerror', False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L844_C16", "label": "newstatus =", "type": "assigned_variable", "loc": [844, 844], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L835_C12", "vector": [14, 4, 0.3117, 0.0004, 4, 0.54, 1.0, 465, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "newstatus", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newstatus = c._traverse(status, hideerror) and newstatus"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L849_C8", "label": "name =", "type": "assigned_variable", "loc": [849, 849], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L831_C4", "vector": [14, 2, 0.3135, 0.0004, 2, 0.32, 0.4, 57, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = self['_name']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L850_C8", "label": "if", "type": "if", "loc": [850, 858], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L831_C4", "vector": [4, 2, 0.3154, 0.0033, 2, 0.32, 0.6, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if newstatus:\n newstatus = self._validate()\n self._postprocessing()\n elif 'old_value' in self.attributes:\n self['value'] = self['old_value']\n self._postprocessing()\n elif name and name in self.vars:\n self['value'] = self.vars[name]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L851_C12", "label": "newstatus = _validate()", "type": "assigned_variable", "loc": [851, 851], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L850_C8", "vector": [14, 3, 0.3143, 0.0004, 3, 0.08, 0.0, 465, 3, 0, 0, 0, 939, 10, 1], "semantic": {"name": "newstatus", "arg_names": [], "import_names": [], "rhs_call_name": "_validate", "annotation": ""}, "snippet": " newstatus = self._validate()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L852_C12", "label": "_postprocessing()", "type": "expression", "loc": [852, 852], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L850_C8", "vector": [8, 3, 0.3146, 0.0004, 3, 0.08, 0.5, 455, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_postprocessing", "arg_names": [], "import_names": [], "rhs_call_name": "_postprocessing", "annotation": ""}, "snippet": " self._postprocessing()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L853_C8", "label": "if", "type": "if", "loc": [853, 858], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L850_C8", "vector": [4, 3, 0.3159, 0.0022, 3, 0.08, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif 'old_value' in self.attributes:\n self['value'] = self['old_value']\n self._postprocessing()\n elif name and name in self.vars:\n self['value'] = self.vars[name]\n self._postprocessing()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L854_C12", "label": "assign", "type": "assigned_variable", "loc": [854, 854], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L853_C8", "vector": [14, 4, 0.3154, 0.0004, 4, 0.41, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['value'] = self['old_value']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L855_C12", "label": "_postprocessing()", "type": "expression", "loc": [855, 855], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L853_C8", "vector": [8, 4, 0.3157, 0.0004, 4, 0.41, 0.5, 455, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_postprocessing", "arg_names": [], "import_names": [], "rhs_call_name": "_postprocessing", "annotation": ""}, "snippet": " self._postprocessing()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L856_C8", "label": "if", "type": "if", "loc": [856, 858], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L853_C8", "vector": [4, 4, 0.3165, 0.0011, 4, 0.41, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif name and name in self.vars:\n self['value'] = self.vars[name]\n self._postprocessing()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L857_C12", "label": "assign", "type": "assigned_variable", "loc": [857, 857], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L856_C8", "vector": [14, 5, 0.3165, 0.0004, 5, 0.45, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['value'] = self.vars[name]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L858_C12", "label": "_postprocessing()", "type": "expression", "loc": [858, 858], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L856_C8", "vector": [8, 5, 0.3168, 0.0004, 5, 0.45, 1.0, 455, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_postprocessing", "arg_names": [], "import_names": [], "rhs_call_name": "_postprocessing", "annotation": ""}, "snippet": " self._postprocessing()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L859_C8", "label": "if", "type": "if", "loc": [859, 860], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L831_C4", "vector": [4, 2, 0.3174, 0.0007, 2, 0.32, 0.8, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name:\n self.latest[name] = self['value']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L860_C12", "label": "assign", "type": "assigned_variable", "loc": [860, 860], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L859_C8", "vector": [14, 3, 0.3176, 0.0004, 3, 0.17, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.latest[name] = self['value']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L861_C8", "label": "return", "type": "return", "loc": [861, 861], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L831_C4", "vector": [13, 2, 0.3179, 0.0004, 2, 0.32, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return newstatus"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L863_C4", "label": "_validate", "type": "function", "loc": [863, 867], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.3194, 0.0018, 1, 0.33, 0.5357, 939, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "_validate", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _validate(self):\n \"\"\"\n nothing to validate yet. May be overridden by subclasses\n \"\"\"\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L864_C8", "label": "expression", "type": "expression", "loc": [864, 866], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L863_C4", "vector": [8, 2, 0.3194, 0.0011, 2, 0.34, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n nothing to validate yet. May be overridden by subclasses\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L867_C8", "label": "return", "type": "return", "loc": [867, 867], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L863_C4", "vector": [13, 2, 0.3202, 0.0004, 2, 0.34, 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_475:FunctionDef_L869_C4", "label": "_setnode", "type": "function", "loc": [869, 871], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.3213, 0.0011, 1, 0.33, 0.5714, 697, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_setnode", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _setnode(self, value):\n if isinstance(value, DIV):\n value.parent = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L870_C8", "label": "if", "type": "if", "loc": [870, 871], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L869_C4", "vector": [4, 2, 0.3215, 0.0007, 2, 0.69, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, DIV):\n value.parent = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L871_C12", "label": "value.parent =", "type": "assigned_variable", "loc": [871, 871], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L870_C8", "vector": [14, 3, 0.3216, 0.0004, 3, 0.24, 0.0, 555, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value.parent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value.parent = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L873_C4", "label": "_xml", "type": "function", "loc": [873, 911], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.3294, 0.0144, 1, 0.33, 0.6071, 273, 0, 1, 1, 0, 0, 0, 9], "semantic": {"name": "_xml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _xml(self):\n \"\"\"\n helper for xml generation. Returns separately:\n - the component attributes\n - the generated xml of the inner components\n\n Component attributes start with an underscore ('_') and\n do not have a False or None value. The underscore is removed."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L874_C8", "label": "expression", "type": "expression", "loc": [874, 884], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L873_C4", "vector": [8, 2, 0.3246, 0.0041, 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 helper for xml generation. Returns separately:\n - the component attributes\n - the generated xml of the inner components\n\n Component attributes start with an underscore ('_') and\n do not have a False or None value. The underscore is removed.\n A value of True is replaced with the attribute name."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L888_C8", "label": "attr =", "type": "assigned_variable", "loc": [888, 888], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L873_C4", "vector": [14, 2, 0.3279, 0.0004, 2, 0.59, 0.1111, 400, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "attr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " attr = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L889_C8", "label": "for key, value", "type": "for", "loc": [889, 897], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L873_C4", "vector": [6, 2, 0.3298, 0.0033, 2, 0.59, 0.2222, 839, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, value in self.attributes.iteritems():\n if key[:1] != '_':\n continue\n name = key[1:]\n if value is True:\n value = name\n elif value is False or value is None:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L890_C12", "label": "if", "type": "if", "loc": [890, 891], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L889_C8", "vector": [4, 3, 0.3288, 0.0007, 3, 0.82, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if key[:1] != '_':\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L892_C12", "label": "name =", "type": "assigned_variable", "loc": [892, 892], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L889_C8", "vector": [14, 3, 0.3294, 0.0004, 3, 0.82, 0.3333, 57, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = key[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L893_C12", "label": "if", "type": "if", "loc": [893, 896], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L889_C8", "vector": [4, 3, 0.3303, 0.0015, 3, 0.82, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value is True:\n value = name\n elif value is False or value is None:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L894_C16", "label": "value =", "type": "assigned_variable", "loc": [894, 894], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L893_C12", "vector": [14, 4, 0.3301, 0.0004, 4, 0.9, 0.0, 441, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L895_C12", "label": "if", "type": "if", "loc": [895, 896], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L893_C12", "vector": [4, 4, 0.3307, 0.0007, 4, 0.9, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is False or value is None:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L897_C12", "label": "append()", "type": "expression", "loc": [897, 897], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L889_C8", "vector": [8, 3, 0.3312, 0.0004, 3, 0.82, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " attr.append((name, value))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L898_C8", "label": "data = get()", "type": "assigned_variable", "loc": [898, 898], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L873_C4", "vector": [14, 2, 0.3316, 0.0004, 2, 0.59, 0.3333, 929, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " data = self.attributes.get('data',{})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L899_C8", "label": "for key, value", "type": "for", "loc": [899, 902], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L873_C4", "vector": [6, 2, 0.3325, 0.0015, 2, 0.59, 0.4444, 839, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, value in data.iteritems():\n name = 'data-' + key\n value = data[key]\n attr.append((name,value))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L900_C12", "label": "name =", "type": "assigned_variable", "loc": [900, 900], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L899_C8", "vector": [14, 3, 0.3323, 0.0004, 3, 0.24, 0.0, 57, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = 'data-' + key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L901_C12", "label": "value =", "type": "assigned_variable", "loc": [901, 901], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L899_C8", "vector": [14, 3, 0.3327, 0.0004, 3, 0.24, 0.5, 441, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = data[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L902_C12", "label": "append()", "type": "expression", "loc": [902, 902], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L899_C8", "vector": [8, 3, 0.3331, 0.0004, 3, 0.24, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " attr.append((name,value))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L903_C8", "label": "sort()", "type": "expression", "loc": [903, 903], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L873_C4", "vector": [8, 2, 0.3335, 0.0004, 2, 0.59, 0.5556, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " attr.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L904_C8", "label": "fa =", "type": "assigned_variable", "loc": [904, 904], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L873_C4", "vector": [14, 2, 0.3338, 0.0004, 2, 0.59, 0.6667, 730, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "fa", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fa = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L905_C8", "label": "for name, value", "type": "for", "loc": [905, 906], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L873_C4", "vector": [6, 2, 0.3344, 0.0007, 2, 0.59, 0.7778, 509, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "name, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for name,value in attr:\n fa += ' %s=\"%s\"' % (name, xmlescape(value, True))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L908_C8", "label": "co = join()", "type": "assigned_variable", "loc": [908, 909], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L873_C4", "vector": [14, 2, 0.3355, 0.0007, 2, 0.59, 0.8889, 730, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "co", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " co = join([xmlescape(component) for component in\n self.components])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L911_C8", "label": "return", "type": "return", "loc": [911, 911], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L873_C4", "vector": [13, 2, 0.3364, 0.0004, 2, 0.59, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (fa, co)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L913_C4", "label": "xml", "type": "function", "loc": [913, 928], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.3399, 0.0059, 1, 0.33, 0.6429, 324, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "xml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def xml(self):\n \"\"\"\n generates the xml for this component.\n \"\"\"\n\n (fa, co) = self._xml()\n\n if not self.tag:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L914_C8", "label": "expression", "type": "expression", "loc": [914, 916], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L913_C4", "vector": [8, 2, 0.3379, 0.0011, 2, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n generates the xml for this component.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L918_C8", "label": "fa, co = _xml()", "type": "assigned_variable", "loc": [918, 918], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L913_C4", "vector": [14, 2, 0.339, 0.0004, 2, 0.43, 0.25, 114, 3, 0, 0, 0, 273, 10, 1], "semantic": {"name": "fa, co", "arg_names": [], "import_names": [], "rhs_call_name": "_xml", "annotation": ""}, "snippet": " (fa, co) = self._xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L920_C8", "label": "if", "type": "if", "loc": [920, 921], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L913_C4", "vector": [4, 2, 0.3399, 0.0007, 2, 0.43, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.tag:\n return co"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L921_C12", "label": "return", "type": "return", "loc": [921, 921], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L920_C8", "vector": [13, 3, 0.3401, 0.0004, 3, 0.74, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return co"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L923_C8", "label": "if", "type": "if", "loc": [923, 925], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L913_C4", "vector": [4, 2, 0.3412, 0.0011, 2, 0.43, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.tag[-1:] == '/':\n # <tag [attributes] />\n return '<%s%s />' % (self.tag[:-1], fa)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L925_C12", "label": "return", "type": "return", "loc": [925, 925], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L923_C8", "vector": [13, 3, 0.3416, 0.0004, 3, 0.02, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '<%s%s />' % (self.tag[:-1], fa)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L928_C8", "label": "return", "type": "return", "loc": [928, 928], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L913_C4", "vector": [13, 2, 0.3427, 0.0004, 2, 0.43, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '<%s%s>%s</%s>' % (self.tag, fa, co, self.tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L930_C4", "label": "__str__", "type": "function", "loc": [930, 935], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.3444, 0.0022, 1, 0.33, 0.6786, 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 \"\"\"\n str(COMPONENT) returns equals COMPONENT.xml()\n \"\"\"\n\n return self.xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L931_C8", "label": "expression", "type": "expression", "loc": [931, 933], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L930_C4", "vector": [8, 2, 0.3442, 0.0011, 2, 0.1, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n str(COMPONENT) returns equals COMPONENT.xml()\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L935_C8", "label": "return", "type": "return", "loc": [935, 935], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L930_C4", "vector": [13, 2, 0.3453, 0.0004, 2, 0.1, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L937_C4", "label": "flatten", "type": "function", "loc": [937, 963], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.3508, 0.01, 1, 0.33, 0.7143, 893, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "flatten", "arg_names": ["self", "render"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def flatten(self, render=None):\n \"\"\"\n return the text stored by the DIV object rendered by the render function\n the render function must take text, tagname, and attributes\n render=None is equivalent to render=lambda text, tag, attr: text\n\n >>> markdown = lambda text,tag=None,attributes={}: \\\n {None: re.sub('\\s+',' ',text), \\"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L938_C8", "label": "expression", "type": "expression", "loc": [938, 950], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L937_C4", "vector": [8, 2, 0.3486, 0.0048, 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 return the text stored by the DIV object rendered by the render function\n the render function must take text, tagname, and attributes\n render=None is equivalent to render=lambda text, tag, attr: text\n\n >>> markdown = lambda text,tag=None,attributes={}: \\\n {None: re.sub('\\s+',' ',text), \\\n 'h1':'#'+text+'\\\\n\\\\n', \\"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L952_C8", "label": "text =", "type": "assigned_variable", "loc": [952, 952], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L937_C4", "vector": [14, 2, 0.3516, 0.0004, 2, 0.46, 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_475:For_L953_C8", "label": "for c", "type": "for", "loc": [953, 960], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L937_C4", "vector": [6, 2, 0.3532, 0.003, 2, 0.46, 0.5, 411, 7, 0, 0, 0, 0, 0, 5], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in self.components:\n if isinstance(c, XmlComponent):\n s = c.flatten(render)\n elif render:\n s = render(str(c))\n else:\n s = str(c)\n text += s"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L954_C12", "label": "if", "type": "if", "loc": [954, 959], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L953_C8", "vector": [4, 3, 0.3532, 0.0022, 3, 0.63, 0.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(c, XmlComponent):\n s = c.flatten(render)\n elif render:\n s = render(str(c))\n else:\n s = str(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L955_C16", "label": "s = flatten()", "type": "assigned_variable", "loc": [955, 955], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L954_C12", "vector": [14, 4, 0.3527, 0.0004, 4, 0.61, 0.0, 553, 3, 1, 0, 0, 893, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "flatten", "annotation": ""}, "snippet": " s = c.flatten(render)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L956_C12", "label": "if", "type": "if", "loc": [956, 959], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L954_C12", "vector": [4, 4, 0.3536, 0.0015, 4, 0.61, 1.0, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif render:\n s = render(str(c))\n else:\n s = str(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L957_C16", "label": "s = render()", "type": "assigned_variable", "loc": [957, 957], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L956_C12", "vector": [14, 5, 0.3534, 0.0004, 5, 0.05, 0.0, 553, 3, 1, 0, 0, 24, 10, 2], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "render", "annotation": ""}, "snippet": " s = render(str(c))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L959_C16", "label": "s = str()", "type": "assigned_variable", "loc": [959, 959], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L956_C12", "vector": [14, 5, 0.3541, 0.0004, 5, 0.05, 1.0, 553, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " s = str(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L961_C8", "label": "if", "type": "if", "loc": [961, 962], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L937_C4", "vector": [4, 2, 0.3551, 0.0007, 2, 0.46, 0.75, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if render:\n text = render(text, self.tag, self.attributes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L962_C12", "label": "text = render()", "type": "assigned_variable", "loc": [962, 962], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L961_C8", "vector": [14, 3, 0.3552, 0.0004, 3, 0.57, 0.0, 439, 3, 3, 0, 0, 24, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "render", "annotation": ""}, "snippet": " text = render(text, self.tag, self.attributes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L963_C8", "label": "return", "type": "return", "loc": [963, 963], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L937_C4", "vector": [13, 2, 0.3556, 0.0004, 2, 0.46, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L965_C4", "label": "regex_tag = compile()", "type": "assigned_variable", "loc": [965, 965], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [14, 1, 0.3564, 0.0004, 1, 0.33, 0.75, 313, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "regex_tag", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " regex_tag = re.compile('^[\\w\\-\\:]+')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L966_C4", "label": "regex_id = compile()", "type": "assigned_variable", "loc": [966, 966], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [14, 1, 0.3567, 0.0004, 1, 0.33, 0.7857, 614, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "regex_id", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " regex_id = re.compile('#([\\w\\-]+)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L967_C4", "label": "regex_class = compile()", "type": "assigned_variable", "loc": [967, 967], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [14, 1, 0.3571, 0.0004, 1, 0.33, 0.8214, 709, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "regex_class", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " regex_class = re.compile('\\.([\\w\\-]+)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L968_C4", "label": "regex_attr = compile()", "type": "assigned_variable", "loc": [968, 968], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [14, 1, 0.3575, 0.0004, 1, 0.33, 0.8571, 796, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "regex_attr", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " regex_attr = re.compile('\\[([\\w\\-\\:]+)=(.*?)\\]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "label": "elements", "type": "function", "loc": [970, 1128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.3874, 0.0587, 1, 0.33, 0.8929, 915, 0, 3, 1, 0, 0, 0, 54], "semantic": {"name": "elements", "arg_names": ["self", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def elements(self, *args, **kargs):\n \"\"\"\n find all component that match the supplied attribute dictionary,\n or None if nothing could be found\n\n All components of the components are searched.\n\n >>> a = DIV(DIV(SPAN('x'),3,DIV(SPAN('y'))))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L971_C8", "label": "expression", "type": "expression", "loc": [971, 1042], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "vector": [8, 2, 0.3717, 0.0266, 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 find all component that match the supplied attribute dictionary,\n or None if nothing could be found\n\n All components of the components are searched.\n\n >>> a = DIV(DIV(SPAN('x'),3,DIV(SPAN('y'))))\n >>> for c in a.elements('span',first_only=True): c[0]='z'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1043_C8", "label": "if", "type": "if", "loc": [1043, 1044], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "vector": [4, 2, 0.3853, 0.0007, 2, 0.68, 0.0588, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(args) == 1:\n args = [a.strip() for a in args[0].split(',')]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1044_C12", "label": "args =", "type": "assigned_variable", "loc": [1044, 1044], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1043_C8", "vector": [14, 3, 0.3855, 0.0004, 3, 0.63, 0.0, 805, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = [a.strip() for a in args[0].split(',')]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1045_C8", "label": "if", "type": "if", "loc": [1045, 1071], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "vector": [4, 2, 0.3907, 0.01, 2, 0.68, 0.1176, 0, 0, 0, 0, 0, 0, 0, 23], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(args) > 1:\n subset = [self.elements(a, **kargs) for a in args]\n return reduce(lambda a, b: a + b, subset, [])\n elif len(args) == 1:\n items = args[0].split()\n if len(items) > 1:\n subset = [a.elements(' '.join(\n items[1:]), **kargs) for a in self.elements(items[0])]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1046_C12", "label": "subset =", "type": "assigned_variable", "loc": [1046, 1046], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1045_C8", "vector": [14, 3, 0.3863, 0.0004, 3, 0.42, 0.0, 12, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "subset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " subset = [self.elements(a, **kargs) for a in args]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1047_C12", "label": "return", "type": "return", "loc": [1047, 1047], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1045_C8", "vector": [13, 3, 0.3866, 0.0004, 3, 0.42, 0.5, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return reduce(lambda a, b: a + b, subset, [])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1048_C8", "label": "if", "type": "if", "loc": [1048, 1071], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1045_C8", "vector": [4, 3, 0.3912, 0.0089, 3, 0.42, 1.0, 0, 0, 0, 0, 0, 0, 0, 20], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif len(args) == 1:\n items = args[0].split()\n if len(items) > 1:\n subset = [a.elements(' '.join(\n items[1:]), **kargs) for a in self.elements(items[0])]\n return reduce(lambda a, b: a + b, subset, [])\n else:\n item = items[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1049_C12", "label": "items = split()", "type": "assigned_variable", "loc": [1049, 1049], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1048_C8", "vector": [14, 4, 0.3874, 0.0004, 4, 0.07, 0.0, 339, 3, 0, 0, 0, 908, 10, 1], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " items = args[0].split()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1050_C12", "label": "if", "type": "if", "loc": [1050, 1071], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1048_C8", "vector": [4, 4, 0.3916, 0.0081, 4, 0.07, 1.0, 0, 0, 0, 0, 0, 0, 0, 18], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(items) > 1:\n subset = [a.elements(' '.join(\n items[1:]), **kargs) for a in self.elements(items[0])]\n return reduce(lambda a, b: a + b, subset, [])\n else:\n item = items[0]\n if '#' in item or '.' in item or '[' in item:\n match_tag = self.regex_tag.search(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1051_C16", "label": "subset =", "type": "assigned_variable", "loc": [1051, 1052], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1050_C12", "vector": [14, 5, 0.3883, 0.0007, 5, 0.69, 0.0, 12, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "subset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " subset = [a.elements(' '.join(\n items[1:]), **kargs) for a in self.elements(items[0])]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1053_C16", "label": "return", "type": "return", "loc": [1053, 1053], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1050_C12", "vector": [13, 5, 0.3888, 0.0004, 5, 0.69, 0.3333, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return reduce(lambda a, b: a + b, subset, [])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1055_C16", "label": "item =", "type": "assigned_variable", "loc": [1055, 1055], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1050_C12", "vector": [14, 5, 0.3896, 0.0004, 5, 0.69, 0.6667, 434, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item = items[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1056_C16", "label": "if", "type": "if", "loc": [1056, 1071], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1050_C12", "vector": [4, 5, 0.3927, 0.0059, 5, 0.69, 1.0, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if '#' in item or '.' in item or '[' in item:\n match_tag = self.regex_tag.search(item)\n match_id = self.regex_id.search(item)\n match_class = self.regex_class.search(item)\n match_attr = self.regex_attr.finditer(item)\n args = []\n if match_tag:\n args = [match_tag.group()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1057_C20", "label": "match_tag = search()", "type": "assigned_variable", "loc": [1057, 1057], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1056_C16", "vector": [14, 6, 0.3903, 0.0004, 6, 0.44, 0.0, 977, 3, 1, 0, 0, 163, 10, 1], "semantic": {"name": "match_tag", "arg_names": [], "import_names": [], "rhs_call_name": "search", "annotation": ""}, "snippet": " match_tag = self.regex_tag.search(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1058_C20", "label": "match_id = search()", "type": "assigned_variable", "loc": [1058, 1058], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1056_C16", "vector": [14, 6, 0.3907, 0.0004, 6, 0.44, 0.1111, 320, 3, 1, 0, 0, 163, 10, 1], "semantic": {"name": "match_id", "arg_names": [], "import_names": [], "rhs_call_name": "search", "annotation": ""}, "snippet": " match_id = self.regex_id.search(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1059_C20", "label": "match_class = search()", "type": "assigned_variable", "loc": [1059, 1059], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1056_C16", "vector": [14, 6, 0.3911, 0.0004, 6, 0.44, 0.2222, 485, 3, 1, 0, 0, 163, 10, 1], "semantic": {"name": "match_class", "arg_names": [], "import_names": [], "rhs_call_name": "search", "annotation": ""}, "snippet": " match_class = self.regex_class.search(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1060_C20", "label": "match_attr = finditer()", "type": "assigned_variable", "loc": [1060, 1060], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1056_C16", "vector": [14, 6, 0.3914, 0.0004, 6, 0.44, 0.3333, 271, 3, 1, 0, 0, 131, 10, 1], "semantic": {"name": "match_attr", "arg_names": [], "import_names": [], "rhs_call_name": "finditer", "annotation": ""}, "snippet": " match_attr = self.regex_attr.finditer(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1061_C20", "label": "args =", "type": "assigned_variable", "loc": [1061, 1061], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1056_C16", "vector": [14, 6, 0.3918, 0.0004, 6, 0.44, 0.4444, 805, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1062_C20", "label": "if", "type": "if", "loc": [1062, 1063], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1056_C16", "vector": [4, 6, 0.3924, 0.0007, 6, 0.44, 0.5556, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if match_tag:\n args = [match_tag.group()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1063_C24", "label": "args =", "type": "assigned_variable", "loc": [1063, 1063], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1062_C20", "vector": [14, 7, 0.3925, 0.0004, 7, 0.97, 0.0, 805, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = [match_tag.group()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1064_C20", "label": "if", "type": "if", "loc": [1064, 1065], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1056_C16", "vector": [4, 6, 0.3931, 0.0007, 6, 0.44, 0.6667, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if match_id:\n kargs['_id'] = match_id.group(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1065_C24", "label": " = group()", "type": "assigned_variable", "loc": [1065, 1065], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1064_C20", "vector": [14, 7, 0.3933, 0.0004, 7, 0.73, 0.0, 0, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": " kargs['_id'] = match_id.group(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1066_C20", "label": "if", "type": "if", "loc": [1066, 1068], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1056_C16", "vector": [4, 6, 0.394, 0.0011, 6, 0.44, 0.7778, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if match_class:\n kargs['_class'] = re.compile('(?<!\\w)%s(?!\\w)' %\n match_class.group(1).replace('-', '\\\\-').replace(':', '\\\\:'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1067_C24", "label": " = compile()", "type": "assigned_variable", "loc": [1067, 1068], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1066_C20", "vector": [14, 7, 0.3942, 0.0007, 7, 0.11, 0.0, 0, 3, 1, 0, 0, 821, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " kargs['_class'] = re.compile('(?<!\\w)%s(?!\\w)' %\n match_class.group(1).replace('-', '\\\\-').replace(':', '\\\\:'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1069_C20", "label": "for item", "type": "for", "loc": [1069, 1070], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1056_C16", "vector": [6, 6, 0.3949, 0.0007, 6, 0.44, 0.8889, 434, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in match_attr:\n kargs['_' + item.group(1)] = item.group(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1070_C24", "label": " = group()", "type": "assigned_variable", "loc": [1070, 1070], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1069_C20", "vector": [14, 7, 0.3951, 0.0004, 7, 0.89, 0.0, 0, 3, 1, 0, 0, 43, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": " kargs['_' + item.group(1)] = item.group(2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1071_C20", "label": "return", "type": "return", "loc": [1071, 1071], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1056_C16", "vector": [13, 6, 0.3955, 0.0004, 6, 0.44, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.elements(*args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1073_C8", "label": "matches =", "type": "assigned_variable", "loc": [1073, 1073], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "vector": [14, 2, 0.3962, 0.0004, 2, 0.68, 0.1765, 684, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "matches", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " matches = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1076_C8", "label": "check =", "type": "assigned_variable", "loc": [1076, 1076], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "vector": [14, 2, 0.3973, 0.0004, 2, 0.68, 0.2353, 803, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "check", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " check = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1077_C8", "label": "tag = replace()", "type": "assigned_variable", "loc": [1077, 1077], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "vector": [14, 2, 0.3977, 0.0004, 2, 0.68, 0.2941, 732, 3, 2, 0, 0, 293, 10, 2], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " tag = getattr(self, 'tag').replace('/', '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1078_C8", "label": "if", "type": "if", "loc": [1078, 1079], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "vector": [4, 2, 0.3983, 0.0007, 2, 0.68, 0.3529, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args and tag not in args:\n check = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1079_C12", "label": "check =", "type": "assigned_variable", "loc": [1079, 1079], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1078_C8", "vector": [14, 3, 0.3984, 0.0004, 3, 0.17, 0.0, 803, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "check", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " check = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1080_C8", "label": "for key, value", "type": "for", "loc": [1080, 1089], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "vector": [6, 2, 0.4005, 0.0037, 2, 0.68, 0.4118, 839, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for (key, value) in kargs.iteritems():\n if key not in ['first_only', 'replace', 'find_text']:\n if isinstance(value, (str, int)):\n if self[key] != str(value):\n check = False\n elif key in self.attributes:\n if not value.search(str(self[key])):\n check = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1081_C12", "label": "if", "type": "if", "loc": [1081, 1089], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1080_C8", "vector": [4, 3, 0.4007, 0.0033, 3, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if key not in ['first_only', 'replace', 'find_text']:\n if isinstance(value, (str, int)):\n if self[key] != str(value):\n check = False\n elif key in self.attributes:\n if not value.search(str(self[key])):\n check = False\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1082_C16", "label": "if", "type": "if", "loc": [1082, 1089], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1081_C12", "vector": [4, 4, 0.4008, 0.003, 4, 0.92, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, (str, int)):\n if self[key] != str(value):\n check = False\n elif key in self.attributes:\n if not value.search(str(self[key])):\n check = False\n else:\n check = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1083_C20", "label": "if", "type": "if", "loc": [1083, 1084], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1082_C16", "vector": [4, 5, 0.4001, 0.0007, 5, 0.76, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self[key] != str(value):\n check = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1084_C24", "label": "check =", "type": "assigned_variable", "loc": [1084, 1084], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1083_C20", "vector": [14, 6, 0.4003, 0.0004, 6, 0.09, 0.0, 803, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "check", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " check = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1085_C16", "label": "if", "type": "if", "loc": [1085, 1089], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1082_C16", "vector": [4, 5, 0.4014, 0.0018, 5, 0.76, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key in self.attributes:\n if not value.search(str(self[key])):\n check = False\n else:\n check = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1086_C20", "label": "if", "type": "if", "loc": [1086, 1087], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1085_C16", "vector": [4, 6, 0.4012, 0.0007, 6, 0.4, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not value.search(str(self[key])):\n check = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1087_C24", "label": "check =", "type": "assigned_variable", "loc": [1087, 1087], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1086_C20", "vector": [14, 7, 0.4014, 0.0004, 7, 0.05, 0.0, 803, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "check", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " check = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1089_C20", "label": "check =", "type": "assigned_variable", "loc": [1089, 1089], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1085_C16", "vector": [14, 6, 0.4021, 0.0004, 6, 0.4, 1.0, 803, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "check", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " check = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1090_C8", "label": "if", "type": "if", "loc": [1090, 1096], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "vector": [4, 2, 0.4036, 0.0026, 2, 0.68, 0.4706, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'find' in kargs:\n find = kargs['find']\n is_regex = not isinstance(find, (str, int))\n for c in self.components:\n if (isinstance(c, str) and ((is_regex and find.search(c)) or\n (str(find) in c))):\n check = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1091_C12", "label": "find =", "type": "assigned_variable", "loc": [1091, 1091], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1090_C8", "vector": [14, 3, 0.4029, 0.0004, 3, 0.17, 0.0, 340, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "find", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " find = kargs['find']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1092_C12", "label": "is_regex =", "type": "assigned_variable", "loc": [1092, 1092], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1090_C8", "vector": [14, 3, 0.4032, 0.0004, 3, 0.17, 0.5, 938, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "is_regex", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " is_regex = not isinstance(find, (str, int))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1093_C12", "label": "for c", "type": "for", "loc": [1093, 1096], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1090_C8", "vector": [6, 3, 0.4042, 0.0015, 3, 0.17, 1.0, 411, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in self.components:\n if (isinstance(c, str) and ((is_regex and find.search(c)) or\n (str(find) in c))):\n check = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1094_C16", "label": "if", "type": "if", "loc": [1094, 1096], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1093_C12", "vector": [4, 4, 0.4044, 0.0011, 4, 0.54, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (isinstance(c, str) and ((is_regex and find.search(c)) or\n (str(find) in c))):\n check = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1096_C20", "label": "check =", "type": "assigned_variable", "loc": [1096, 1096], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1094_C16", "vector": [14, 5, 0.4047, 0.0004, 5, 0.27, 0.0, 803, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "check", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " check = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1098_C8", "label": "if", "type": "if", "loc": [1098, 1099], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "vector": [4, 2, 0.4056, 0.0007, 2, 0.68, 0.5294, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if check:\n matches.append(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1099_C12", "label": "append()", "type": "expression", "loc": [1099, 1099], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1098_C8", "vector": [8, 3, 0.4058, 0.0004, 3, 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": " matches.append(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1101_C8", "label": "first_only = get()", "type": "assigned_variable", "loc": [1101, 1101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "vector": [14, 2, 0.4066, 0.0004, 2, 0.68, 0.5882, 2, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "first_only", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " first_only = kargs.get('first_only', False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1102_C8", "label": "replace = get()", "type": "assigned_variable", "loc": [1102, 1102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "vector": [14, 2, 0.4069, 0.0004, 2, 0.68, 0.6471, 293, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " replace = kargs.get('replace', False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1103_C8", "label": "find_text =", "type": "assigned_variable", "loc": [1103, 1103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "vector": [14, 2, 0.4073, 0.0004, 2, 0.68, 0.7059, 623, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "find_text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " find_text = replace is not False and kargs.get('find_text', False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1104_C8", "label": "is_regex =", "type": "assigned_variable", "loc": [1104, 1104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "vector": [14, 2, 0.4077, 0.0004, 2, 0.68, 0.7647, 938, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "is_regex", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " is_regex = not isinstance(find_text, (str, int, bool))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1105_C8", "label": "find_components =", "type": "assigned_variable", "loc": [1105, 1105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "vector": [14, 2, 0.4081, 0.0004, 2, 0.68, 0.8235, 624, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "find_components", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " find_components = not (check and first_only)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1107_C8", "label": "replace_component", "type": "function", "loc": [1107, 1113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "vector": [2, 2, 0.4099, 0.0026, 2, 0.68, 0.8824, 82, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace_component", "arg_names": ["i"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def replace_component(i):\n if replace is None:\n del self[i]\n elif callable(replace):\n self[i] = replace(self[i])\n else:\n self[i] = replace"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1108_C12", "label": "if", "type": "if", "loc": [1108, 1113], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1107_C8", "vector": [4, 3, 0.4101, 0.0022, 3, 0.5, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if replace is None:\n del self[i]\n elif callable(replace):\n self[i] = replace(self[i])\n else:\n self[i] = replace"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1110_C12", "label": "if", "type": "if", "loc": [1110, 1113], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1108_C12", "vector": [4, 4, 0.4105, 0.0015, 4, 0.33, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif callable(replace):\n self[i] = replace(self[i])\n else:\n self[i] = replace"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1111_C16", "label": " = replace()", "type": "assigned_variable", "loc": [1111, 1111], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1110_C12", "vector": [14, 5, 0.4103, 0.0004, 5, 0.3, 0.0, 0, 3, 1, 0, 0, 293, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " self[i] = replace(self[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1113_C16", "label": "assign", "type": "assigned_variable", "loc": [1113, 1113], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1110_C12", "vector": [14, 5, 0.411, 0.0004, 5, 0.3, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self[i] = replace"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1115_C8", "label": "if", "type": "if", "loc": [1115, 1127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "vector": [4, 2, 0.414, 0.0048, 2, 0.68, 0.9412, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if find_text or find_components:\n for i, c in enumerate(self.components):\n if check and find_text and isinstance(c, str) and \\\n ((is_regex and find_text.search(c)) or (str(find_text) in c)):\n replace_component(i)\n if find_components and isinstance(c, XmlComponent):\n child_matches = c.elements(*args, **kargs)\n if len(child_matches):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1116_C12", "label": "for i, c", "type": "for", "loc": [1116, 1127], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1115_C8", "vector": [6, 3, 0.4141, 0.0044, 3, 0.98, 0.0, 787, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "i, c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, c in enumerate(self.components):\n if check and find_text and isinstance(c, str) and \\\n ((is_regex and find_text.search(c)) or (str(find_text) in c)):\n replace_component(i)\n if find_components and isinstance(c, XmlComponent):\n child_matches = c.elements(*args, **kargs)\n if len(child_matches):\n if not find_text and replace is not False and child_matches[0] is c:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1117_C16", "label": "if", "type": "if", "loc": [1117, 1119], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1116_C12", "vector": [4, 4, 0.4129, 0.0011, 4, 0.94, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if check and find_text and isinstance(c, str) and \\\n ((is_regex and find_text.search(c)) or (str(find_text) in c)):\n replace_component(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1119_C20", "label": "replace_component()", "type": "expression", "loc": [1119, 1119], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1117_C16", "vector": [8, 5, 0.4132, 0.0004, 5, 0.64, 0.0, 82, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "replace_component", "arg_names": [], "import_names": [], "rhs_call_name": "replace_component", "annotation": ""}, "snippet": " replace_component(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1120_C16", "label": "if", "type": "if", "loc": [1120, 1127], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1116_C12", "vector": [4, 4, 0.4149, 0.003, 4, 0.94, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if find_components and isinstance(c, XmlComponent):\n child_matches = c.elements(*args, **kargs)\n if len(child_matches):\n if not find_text and replace is not False and child_matches[0] is c:\n replace_component(i)\n if first_only:\n return child_matches\n matches.extend(child_matches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1121_C20", "label": "child_matches = elements()", "type": "assigned_variable", "loc": [1121, 1121], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1120_C16", "vector": [14, 5, 0.414, 0.0004, 5, 0.62, 0.0, 530, 3, 2, 0, 0, 915, 10, 1], "semantic": {"name": "child_matches", "arg_names": [], "import_names": [], "rhs_call_name": "elements", "annotation": ""}, "snippet": " child_matches = c.elements(*args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1122_C20", "label": "if", "type": "if", "loc": [1122, 1127], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1120_C16", "vector": [4, 5, 0.4153, 0.0022, 5, 0.62, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(child_matches):\n if not find_text and replace is not False and child_matches[0] is c:\n replace_component(i)\n if first_only:\n return child_matches\n matches.extend(child_matches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1123_C24", "label": "if", "type": "if", "loc": [1123, 1124], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1122_C20", "vector": [4, 6, 0.4149, 0.0007, 6, 0.87, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not find_text and replace is not False and child_matches[0] is c:\n replace_component(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1124_C28", "label": "replace_component()", "type": "expression", "loc": [1124, 1124], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1123_C24", "vector": [8, 7, 0.4151, 0.0004, 7, 0.37, 0.0, 82, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "replace_component", "arg_names": [], "import_names": [], "rhs_call_name": "replace_component", "annotation": ""}, "snippet": " replace_component(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1125_C24", "label": "if", "type": "if", "loc": [1125, 1126], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1122_C20", "vector": [4, 6, 0.4156, 0.0007, 6, 0.87, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if first_only:\n return child_matches"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1126_C28", "label": "return", "type": "return", "loc": [1126, 1126], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1125_C24", "vector": [13, 7, 0.4158, 0.0004, 7, 0.64, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return child_matches"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1127_C24", "label": "extend()", "type": "expression", "loc": [1127, 1127], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1122_C20", "vector": [8, 6, 0.4162, 0.0004, 6, 0.87, 1.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " matches.extend(child_matches)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1128_C8", "label": "return", "type": "return", "loc": [1128, 1128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "vector": [13, 2, 0.4165, 0.0004, 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 matches"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1130_C4", "label": "element", "type": "function", "loc": [1130, 1142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.4195, 0.0048, 1, 0.33, 0.9286, 736, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "element", "arg_names": ["self", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def element(self, *args, **kargs):\n \"\"\"\n find the first component that matches the supplied attribute dictionary,\n or None if nothing could be found\n\n Also the components of the components are searched.\n \"\"\"\n kargs['first_only'] = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1131_C8", "label": "expression", "type": "expression", "loc": [1131, 1136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1130_C4", "vector": [8, 2, 0.4186, 0.0022, 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 find the first component that matches the supplied attribute dictionary,\n or None if nothing could be found\n\n Also the components of the components are searched.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1137_C8", "label": "assign", "type": "assigned_variable", "loc": [1137, 1137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1130_C4", "vector": [14, 2, 0.4199, 0.0004, 2, 0.62, 0.25, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kargs['first_only'] = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1138_C8", "label": "elements = elements()", "type": "assigned_variable", "loc": [1138, 1138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1130_C4", "vector": [14, 2, 0.4202, 0.0004, 2, 0.62, 0.5, 915, 3, 2, 0, 0, 915, 10, 1], "semantic": {"name": "elements", "arg_names": [], "import_names": [], "rhs_call_name": "elements", "annotation": ""}, "snippet": " elements = self.elements(*args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1139_C8", "label": "if", "type": "if", "loc": [1139, 1141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1130_C4", "vector": [4, 2, 0.421, 0.0011, 2, 0.62, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not elements:\n # we found nothing\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1141_C12", "label": "return", "type": "return", "loc": [1141, 1141], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1139_C8", "vector": [13, 3, 0.4213, 0.0004, 3, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1142_C8", "label": "return", "type": "return", "loc": [1142, 1142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1130_C4", "vector": [13, 2, 0.4217, 0.0004, 2, 0.62, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return elements[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1144_C4", "label": "siblings", "type": "function", "loc": [1144, 1169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.4271, 0.0096, 1, 0.33, 0.9643, 625, 0, 3, 1, 0, 0, 0, 5], "semantic": {"name": "siblings", "arg_names": ["self", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def siblings(self, *args, **kargs):\n \"\"\"\n find all sibling components that match the supplied argument list\n and attribute dictionary, or None if nothing could be found\n \"\"\"\n sibs = [s for s in self.parent.components if not s == self]\n matches = []\n first_only = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1145_C8", "label": "expression", "type": "expression", "loc": [1145, 1148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1144_C4", "vector": [8, 2, 0.4234, 0.0015, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n find all sibling components that match the supplied argument list\n and attribute dictionary, or None if nothing could be found\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1149_C8", "label": "sibs =", "type": "assigned_variable", "loc": [1149, 1149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1144_C4", "vector": [14, 2, 0.4243, 0.0004, 2, 0.98, 0.1667, 92, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sibs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sibs = [s for s in self.parent.components if not s == self]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1150_C8", "label": "matches =", "type": "assigned_variable", "loc": [1150, 1150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1144_C4", "vector": [14, 2, 0.4247, 0.0004, 2, 0.98, 0.3333, 684, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "matches", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " matches = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1151_C8", "label": "first_only =", "type": "assigned_variable", "loc": [1151, 1151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1144_C4", "vector": [14, 2, 0.425, 0.0004, 2, 0.98, 0.5, 2, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first_only", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first_only = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1152_C8", "label": "if", "type": "if", "loc": [1152, 1153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1144_C4", "vector": [4, 2, 0.4256, 0.0007, 2, 0.98, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'first_only' in kargs:\n first_only = kargs.pop('first_only')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1153_C12", "label": "first_only = pop()", "type": "assigned_variable", "loc": [1153, 1153], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1152_C8", "vector": [14, 3, 0.4258, 0.0004, 3, 0.58, 0.0, 2, 3, 1, 0, 0, 969, 10, 1], "semantic": {"name": "first_only", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " first_only = kargs.pop('first_only')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1154_C8", "label": "for c", "type": "for", "loc": [1154, 1168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1144_C4", "vector": [6, 2, 0.4287, 0.0055, 2, 0.98, 0.8333, 411, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in sibs:\n try:\n check = True\n tag = getattr(c, 'tag').replace(\"/\", \"\")\n if args and tag not in args:\n check = False\n for (key, value) in kargs.iteritems():\n if c[key] != value:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L1155_C12", "label": "try", "type": "try", "loc": [1155, 1168], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1154_C8", "vector": [7, 3, 0.4289, 0.0052, 3, 0.55, 0.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n check = True\n tag = getattr(c, 'tag').replace(\"/\", \"\")\n if args and tag not in args:\n check = False\n for (key, value) in kargs.iteritems():\n if c[key] != value:\n check = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1156_C16", "label": "check =", "type": "assigned_variable", "loc": [1156, 1156], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L1155_C12", "vector": [14, 4, 0.4269, 0.0004, 4, 0.73, 0.0, 803, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "check", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " check = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1157_C16", "label": "tag = replace()", "type": "assigned_variable", "loc": [1157, 1157], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L1155_C12", "vector": [14, 4, 0.4273, 0.0004, 4, 0.73, 0.25, 732, 3, 2, 0, 0, 293, 10, 2], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " tag = getattr(c, 'tag').replace(\"/\", \"\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1158_C16", "label": "if", "type": "if", "loc": [1158, 1159], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L1155_C12", "vector": [4, 4, 0.4278, 0.0007, 4, 0.73, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if args and tag not in args:\n check = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1159_C24", "label": "check =", "type": "assigned_variable", "loc": [1159, 1159], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1158_C16", "vector": [14, 5, 0.428, 0.0004, 5, 0.43, 0.0, 803, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "check", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " check = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1160_C16", "label": "for key, value", "type": "for", "loc": [1160, 1162], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L1155_C12", "vector": [6, 4, 0.4287, 0.0011, 4, 0.73, 0.75, 839, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for (key, value) in kargs.iteritems():\n if c[key] != value:\n check = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1161_C20", "label": "if", "type": "if", "loc": [1161, 1162], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1160_C16", "vector": [4, 5, 0.4289, 0.0007, 5, 0.29, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if c[key] != value:\n check = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1162_C28", "label": "check =", "type": "assigned_variable", "loc": [1162, 1162], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1161_C20", "vector": [14, 6, 0.4291, 0.0004, 6, 0.1, 0.0, 803, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "check", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " check = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1163_C16", "label": "if", "type": "if", "loc": [1163, 1166], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L1155_C12", "vector": [4, 4, 0.43, 0.0015, 4, 0.73, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if check:\n matches.append(c)\n if first_only:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1164_C20", "label": "append()", "type": "expression", "loc": [1164, 1164], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1163_C16", "vector": [8, 5, 0.4298, 0.0004, 5, 0.32, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " matches.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1165_C20", "label": "if", "type": "if", "loc": [1165, 1166], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1163_C16", "vector": [4, 5, 0.4304, 0.0007, 5, 0.32, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if first_only:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1169_C8", "label": "return", "type": "return", "loc": [1169, 1169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1144_C4", "vector": [13, 2, 0.4317, 0.0004, 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 matches"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1171_C4", "label": "sibling", "type": "function", "loc": [1171, 1180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "vector": [2, 1, 0.4341, 0.0037, 1, 0.33, 1.0, 667, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "sibling", "arg_names": ["self", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def sibling(self, *args, **kargs):\n \"\"\"\n find the first sibling component that match the supplied argument list\n and attribute dictionary, or None if nothing could be found\n \"\"\"\n kargs['first_only'] = True\n sibs = self.siblings(*args, **kargs)\n if not sibs:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1172_C8", "label": "expression", "type": "expression", "loc": [1172, 1175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1171_C4", "vector": [8, 2, 0.4333, 0.0015, 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 find the first sibling component that match the supplied argument list\n and attribute dictionary, or None if nothing could be found\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1176_C8", "label": "assign", "type": "assigned_variable", "loc": [1176, 1176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1171_C4", "vector": [14, 2, 0.4343, 0.0004, 2, 0.03, 0.25, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kargs['first_only'] = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1177_C8", "label": "sibs = siblings()", "type": "assigned_variable", "loc": [1177, 1177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1171_C4", "vector": [14, 2, 0.4346, 0.0004, 2, 0.03, 0.5, 92, 3, 2, 0, 0, 625, 10, 1], "semantic": {"name": "sibs", "arg_names": [], "import_names": [], "rhs_call_name": "siblings", "annotation": ""}, "snippet": " sibs = self.siblings(*args, **kargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1178_C8", "label": "if", "type": "if", "loc": [1178, 1179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1171_C4", "vector": [4, 2, 0.4352, 0.0007, 2, 0.03, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not sibs:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1179_C12", "label": "return", "type": "return", "loc": [1179, 1179], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1178_C8", "vector": [13, 3, 0.4354, 0.0004, 3, 0.73, 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_475:Return_L1180_C8", "label": "return", "type": "return", "loc": [1180, 1180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1171_C4", "vector": [13, 2, 0.4357, 0.0004, 2, 0.03, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sibs[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1183_C0", "label": "CAT", "type": "class", "loc": [1183, 1185], "level": 0, "parent": null, "vector": [3, 0, 0.4372, 0.0011, 0, 0.66, 0.3495, 481, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "CAT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CAT(DIV):\n\n tag = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1185_C4", "label": "tag =", "type": "assigned_variable", "loc": [1185, 1185], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1183_C0", "vector": [14, 1, 0.4376, 0.0004, 1, 0.1, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1188_C0", "label": "TAG_unpickler", "type": "function", "loc": [1188, 1189], "level": 0, "parent": null, "vector": [2, 0, 0.4389, 0.0007, 0, 0.66, 0.3592, 857, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "TAG_unpickler", "arg_names": ["data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def TAG_unpickler(data):\n return cPickle.loads(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1189_C4", "label": "return", "type": "return", "loc": [1189, 1189], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1188_C0", "vector": [13, 1, 0.4391, 0.0004, 1, 0.24, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cPickle.loads(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1192_C0", "label": "TAG_pickler", "type": "function", "loc": [1192, 1196], "level": 0, "parent": null, "vector": [2, 0, 0.4409, 0.0018, 0, 0.66, 0.3689, 253, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "TAG_pickler", "arg_names": ["data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def TAG_pickler(data):\n d = DIV()\n d.__dict__ = data.__dict__\n marshal_dump = cPickle.dumps(d)\n return (TAG_unpickler, (marshal_dump,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1193_C4", "label": "d = DIV()", "type": "assigned_variable", "loc": [1193, 1193], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1192_C0", "vector": [14, 1, 0.4405, 0.0004, 1, 0.52, 0.0, 355, 3, 0, 0, 0, 697, 10, 1], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "DIV", "annotation": ""}, "snippet": " d = DIV()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1194_C4", "label": "d.__dict__ =", "type": "assigned_variable", "loc": [1194, 1194], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1192_C0", "vector": [14, 1, 0.4409, 0.0004, 1, 0.52, 0.3333, 430, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "d.__dict__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d.__dict__ = data.__dict__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1195_C4", "label": "marshal_dump = dumps()", "type": "assigned_variable", "loc": [1195, 1195], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1192_C0", "vector": [14, 1, 0.4413, 0.0004, 1, 0.52, 0.6667, 140, 3, 1, 0, 0, 160, 10, 1], "semantic": {"name": "marshal_dump", "arg_names": [], "import_names": [], "rhs_call_name": "dumps", "annotation": ""}, "snippet": " marshal_dump = cPickle.dumps(d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1196_C4", "label": "return", "type": "return", "loc": [1196, 1196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1192_C0", "vector": [13, 1, 0.4417, 0.0004, 1, 0.52, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (TAG_unpickler, (marshal_dump,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1199_C0", "label": "__TAG__", "type": "class", "loc": [1199, 1224], "level": 0, "parent": null, "vector": [3, 0, 0.4474, 0.0096, 0, 0.66, 0.3786, 661, 0, 3, 0, 0, 963, 0, 7], "semantic": {"name": "__TAG__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class __TAG__(XmlComponent):\n\n \"\"\"\n TAG factory example::\n\n >>> print TAG.first(TAG.second('test'), _key = 3)\n <first key=\\\"3\\\"><second>test</second></first>\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1201_C4", "label": "expression", "type": "expression", "loc": [1201, 1207], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1199_C0", "vector": [8, 1, 0.4446, 0.0026, 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 TAG factory example::\n\n >>> print TAG.first(TAG.second('test'), _key = 3)\n <first key=\\\"3\\\"><second>test</second></first>\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1209_C4", "label": "__getitem__", "type": "function", "loc": [1209, 1210], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1199_C0", "vector": [2, 1, 0.4466, 0.0007, 1, 0.71, 0.3333, 698, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__getitem__", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, name):\n return self.__getattr__(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1210_C8", "label": "return", "type": "return", "loc": [1210, 1210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1209_C4", "vector": [13, 2, 0.4468, 0.0004, 2, 0.94, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.__getattr__(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1212_C4", "label": "__getattr__", "type": "function", "loc": [1212, 1221], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1199_C0", "vector": [2, 1, 0.4492, 0.0037, 1, 0.71, 0.6667, 210, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "__getattr__", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getattr__(self, name):\n if name[-1:] == '_':\n name = name[:-1] + '/'\n if isinstance(name, unicode):\n name = name.encode('utf-8')\n\n class __tag__(DIV):\n tag = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1213_C8", "label": "if", "type": "if", "loc": [1213, 1214], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1212_C4", "vector": [4, 2, 0.4481, 0.0007, 2, 0.61, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name[-1:] == '_':\n name = name[:-1] + '/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1214_C12", "label": "name =", "type": "assigned_variable", "loc": [1214, 1214], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1213_C8", "vector": [14, 3, 0.4483, 0.0004, 3, 0.59, 0.0, 57, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = name[:-1] + '/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1215_C8", "label": "if", "type": "if", "loc": [1215, 1216], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1212_C4", "vector": [4, 2, 0.4489, 0.0007, 2, 0.61, 0.25, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(name, unicode):\n name = name.encode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1216_C12", "label": "name = encode()", "type": "assigned_variable", "loc": [1216, 1216], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1215_C8", "vector": [14, 3, 0.449, 0.0004, 3, 0.08, 0.0, 57, 3, 1, 0, 0, 623, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": " name = name.encode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1218_C8", "label": "__tag__", "type": "class", "loc": [1218, 1219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1212_C4", "vector": [3, 2, 0.45, 0.0007, 2, 0.61, 0.5, 292, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "__tag__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class __tag__(DIV):\n tag = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1219_C12", "label": "tag =", "type": "assigned_variable", "loc": [1219, 1219], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1218_C8", "vector": [14, 3, 0.4501, 0.0004, 3, 0.57, 0.0, 732, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1220_C8", "label": "pickle()", "type": "expression", "loc": [1220, 1220], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1212_C4", "vector": [8, 2, 0.4505, 0.0004, 2, 0.61, 0.75, 848, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "pickle", "arg_names": [], "import_names": [], "rhs_call_name": "pickle", "annotation": ""}, "snippet": " copy_reg.pickle(__tag__, TAG_pickler, TAG_unpickler)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1221_C8", "label": "return", "type": "return", "loc": [1221, 1221], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1212_C4", "vector": [13, 2, 0.4509, 0.0004, 2, 0.61, 1.0, 0, 9, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return lambda *a, **b: __tag__(*a, **b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1223_C4", "label": "__call__", "type": "function", "loc": [1223, 1224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1199_C0", "vector": [2, 1, 0.4518, 0.0007, 1, 0.71, 1.0, 319, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__call__", "arg_names": ["self", "html"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __call__(self, html):\n return web2pyHTMLParser(decoder.decoder(html)).tree"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1224_C8", "label": "return", "type": "return", "loc": [1224, 1224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1223_C4", "vector": [13, 2, 0.452, 0.0004, 2, 0.78, 0.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return web2pyHTMLParser(decoder.decoder(html)).tree"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1226_C0", "label": "TAG = __TAG__()", "type": "assigned_variable", "loc": [1226, 1226], "level": 0, "parent": null, "vector": [14, 0, 0.4527, 0.0004, 0, 0.66, 0.3883, 262, 3, 0, 0, 0, 661, 10, 1], "semantic": {"name": "TAG", "arg_names": [], "import_names": [], "rhs_call_name": "__TAG__", "annotation": ""}, "snippet": "TAG = __TAG__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1229_C0", "label": "HTML", "type": "class", "loc": [1229, 1274], "level": 0, "parent": null, "vector": [3, 0, 0.4621, 0.017, 0, 0.66, 0.3981, 107, 0, 1, 0, 0, 697, 0, 1], "semantic": {"name": "HTML", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class HTML(DIV):\n \"\"\"\n There are four predefined document type definitions.\n They can be specified in the 'doctype' parameter:\n\n -'strict' enables strict doctype\n -'transitional' enables transitional doctype (default)\n -'frameset' enables frameset doctype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1230_C4", "label": "expression", "type": "expression", "loc": [1230, 1244], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1229_C0", "vector": [8, 1, 0.4568, 0.0055, 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 There are four predefined document type definitions.\n They can be specified in the 'doctype' parameter:\n\n -'strict' enables strict doctype\n -'transitional' enables transitional doctype (default)\n -'frameset' enables frameset doctype\n -'html5' enables HTML 5 doctype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1246_C4", "label": "tag =", "type": "assigned_variable", "loc": [1246, 1246], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1229_C0", "vector": [14, 1, 0.4601, 0.0004, 1, 0.9, 0.1667, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'html'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1248_C4", "label": "strict =", "type": "assigned_variable", "loc": [1248, 1248], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1229_C0", "vector": [14, 1, 0.4609, 0.0004, 1, 0.9, 0.3333, 697, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "strict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " strict = '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1249_C4", "label": "transitional =", "type": "assigned_variable", "loc": [1249, 1249], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1229_C0", "vector": [14, 1, 0.4612, 0.0004, 1, 0.9, 0.5, 102, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "transitional", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " transitional = '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1250_C4", "label": "frameset =", "type": "assigned_variable", "loc": [1250, 1250], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1229_C0", "vector": [14, 1, 0.4616, 0.0004, 1, 0.9, 0.6667, 859, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "frameset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " frameset = '<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1251_C4", "label": "html5 =", "type": "assigned_variable", "loc": [1251, 1251], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1229_C0", "vector": [14, 1, 0.462, 0.0004, 1, 0.9, 0.8333, 252, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "html5", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " html5 = '<!DOCTYPE HTML>\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1253_C4", "label": "xml", "type": "function", "loc": [1253, 1274], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1229_C0", "vector": [2, 1, 0.4666, 0.0081, 1, 0.9, 1.0, 324, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "xml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def xml(self):\n lang = self['lang']\n if not lang:\n lang = 'en'\n self.attributes['_lang'] = lang\n doctype = self['doctype']\n if doctype is None:\n doctype = self.transitional"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1254_C8", "label": "lang =", "type": "assigned_variable", "loc": [1254, 1254], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1253_C4", "vector": [14, 2, 0.4631, 0.0004, 2, 0.09, 0.0, 312, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lang", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lang = self['lang']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1255_C8", "label": "if", "type": "if", "loc": [1255, 1256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1253_C4", "vector": [4, 2, 0.4636, 0.0007, 2, 0.09, 0.1667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not lang:\n lang = 'en'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1256_C12", "label": "lang =", "type": "assigned_variable", "loc": [1256, 1256], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1255_C8", "vector": [14, 3, 0.4638, 0.0004, 3, 0.07, 0.0, 312, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "lang", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lang = 'en'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1257_C8", "label": "assign", "type": "assigned_variable", "loc": [1257, 1257], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1253_C4", "vector": [14, 2, 0.4642, 0.0004, 2, 0.09, 0.3333, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.attributes['_lang'] = lang"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1258_C8", "label": "doctype =", "type": "assigned_variable", "loc": [1258, 1258], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1253_C4", "vector": [14, 2, 0.4645, 0.0004, 2, 0.09, 0.5, 944, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "doctype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " doctype = self['doctype']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1259_C8", "label": "if", "type": "if", "loc": [1259, 1272], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1253_C4", "vector": [4, 2, 0.4673, 0.0052, 2, 0.09, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if doctype is None:\n doctype = self.transitional\n elif doctype == 'strict':\n doctype = self.strict\n elif doctype == 'transitional':\n doctype = self.transitional\n elif doctype == 'frameset':\n doctype = self.frameset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1260_C12", "label": "doctype =", "type": "assigned_variable", "loc": [1260, 1260], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1259_C8", "vector": [14, 3, 0.4653, 0.0004, 3, 0.14, 0.0, 944, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "doctype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " doctype = self.transitional"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1261_C8", "label": "if", "type": "if", "loc": [1261, 1272], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1259_C8", "vector": [4, 3, 0.4677, 0.0044, 3, 0.14, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif doctype == 'strict':\n doctype = self.strict\n elif doctype == 'transitional':\n doctype = self.transitional\n elif doctype == 'frameset':\n doctype = self.frameset\n elif doctype == 'html5':\n doctype = self.html5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1262_C12", "label": "doctype =", "type": "assigned_variable", "loc": [1262, 1262], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1261_C8", "vector": [14, 4, 0.466, 0.0004, 4, 0.07, 0.0, 944, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "doctype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " doctype = self.strict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1263_C8", "label": "if", "type": "if", "loc": [1263, 1272], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1261_C8", "vector": [4, 4, 0.4681, 0.0037, 4, 0.07, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif doctype == 'transitional':\n doctype = self.transitional\n elif doctype == 'frameset':\n doctype = self.frameset\n elif doctype == 'html5':\n doctype = self.html5\n elif doctype == '':\n doctype = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1264_C12", "label": "doctype =", "type": "assigned_variable", "loc": [1264, 1264], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1263_C8", "vector": [14, 5, 0.4668, 0.0004, 5, 0.9, 0.0, 944, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "doctype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " doctype = self.transitional"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1265_C8", "label": "if", "type": "if", "loc": [1265, 1272], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1263_C8", "vector": [4, 5, 0.4684, 0.003, 5, 0.9, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif doctype == 'frameset':\n doctype = self.frameset\n elif doctype == 'html5':\n doctype = self.html5\n elif doctype == '':\n doctype = ''\n else:\n doctype = '%s\\n' % doctype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1266_C12", "label": "doctype =", "type": "assigned_variable", "loc": [1266, 1266], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1265_C8", "vector": [14, 6, 0.4675, 0.0004, 6, 0.64, 0.0, 944, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "doctype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " doctype = self.frameset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1267_C8", "label": "if", "type": "if", "loc": [1267, 1272], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1265_C8", "vector": [4, 6, 0.4688, 0.0022, 6, 0.64, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif doctype == 'html5':\n doctype = self.html5\n elif doctype == '':\n doctype = ''\n else:\n doctype = '%s\\n' % doctype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1268_C12", "label": "doctype =", "type": "assigned_variable", "loc": [1268, 1268], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1267_C8", "vector": [14, 7, 0.4682, 0.0004, 7, 0.56, 0.0, 944, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "doctype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " doctype = self.html5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1269_C8", "label": "if", "type": "if", "loc": [1269, 1272], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1267_C8", "vector": [4, 7, 0.4692, 0.0015, 7, 0.56, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif doctype == '':\n doctype = ''\n else:\n doctype = '%s\\n' % doctype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1270_C12", "label": "doctype =", "type": "assigned_variable", "loc": [1270, 1270], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1269_C8", "vector": [14, 8, 0.469, 0.0004, 8, 0.04, 0.0, 944, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "doctype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " doctype = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1272_C12", "label": "doctype =", "type": "assigned_variable", "loc": [1272, 1272], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1269_C8", "vector": [14, 8, 0.4697, 0.0004, 8, 0.04, 1.0, 944, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "doctype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " doctype = '%s\\n' % doctype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1273_C8", "label": "fa, co = _xml()", "type": "assigned_variable", "loc": [1273, 1273], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1253_C4", "vector": [14, 2, 0.4701, 0.0004, 2, 0.09, 0.8333, 114, 3, 0, 0, 0, 273, 10, 1], "semantic": {"name": "fa, co", "arg_names": [], "import_names": [], "rhs_call_name": "_xml", "annotation": ""}, "snippet": " (fa, co) = self._xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1274_C8", "label": "return", "type": "return", "loc": [1274, 1274], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1253_C4", "vector": [13, 2, 0.4705, 0.0004, 2, 0.09, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s<%s%s>%s</%s>' % (doctype, self.tag, fa, co, self.tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1277_C0", "label": "XHTML", "type": "class", "loc": [1277, 1329], "level": 0, "parent": null, "vector": [3, 0, 0.4812, 0.0196, 0, 0.66, 0.4078, 386, 0, 1, 0, 0, 697, 0, 1], "semantic": {"name": "XHTML", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class XHTML(DIV):\n \"\"\"\n This is XHTML version of the HTML helper.\n\n There are three predefined document type definitions.\n They can be specified in the 'doctype' parameter:\n\n -'strict' enables strict doctype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1278_C4", "label": "expression", "type": "expression", "loc": [1278, 1296], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1277_C0", "vector": [8, 1, 0.4753, 0.007, 1, 0.17, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n This is XHTML version of the HTML helper.\n\n There are three predefined document type definitions.\n They can be specified in the 'doctype' parameter:\n\n -'strict' enables strict doctype\n -'transitional' enables transitional doctype (default)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1298_C4", "label": "tag =", "type": "assigned_variable", "loc": [1298, 1298], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1277_C0", "vector": [14, 1, 0.4793, 0.0004, 1, 0.17, 0.1667, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'html'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1300_C4", "label": "strict =", "type": "assigned_variable", "loc": [1300, 1300], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1277_C0", "vector": [14, 1, 0.4801, 0.0004, 1, 0.17, 0.3333, 697, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "strict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " strict = '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1301_C4", "label": "transitional =", "type": "assigned_variable", "loc": [1301, 1301], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1277_C0", "vector": [14, 1, 0.4804, 0.0004, 1, 0.17, 0.5, 102, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "transitional", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " transitional = '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1302_C4", "label": "frameset =", "type": "assigned_variable", "loc": [1302, 1302], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1277_C0", "vector": [14, 1, 0.4808, 0.0004, 1, 0.17, 0.6667, 859, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "frameset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " frameset = '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1303_C4", "label": "xmlns =", "type": "assigned_variable", "loc": [1303, 1303], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1277_C0", "vector": [14, 1, 0.4812, 0.0004, 1, 0.17, 0.8333, 311, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "xmlns", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xmlns = 'http://www.w3.org/1999/xhtml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1305_C4", "label": "xml", "type": "function", "loc": [1305, 1329], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1277_C0", "vector": [2, 1, 0.4863, 0.0092, 1, 0.17, 1.0, 324, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "xml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def xml(self):\n xmlns = self['xmlns']\n if xmlns:\n self.attributes['_xmlns'] = xmlns\n else:\n self.attributes['_xmlns'] = self.xmlns\n lang = self['lang']\n if not lang:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1306_C8", "label": "xmlns =", "type": "assigned_variable", "loc": [1306, 1306], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1305_C4", "vector": [14, 2, 0.4823, 0.0004, 2, 0.59, 0.0, 311, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "xmlns", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " xmlns = self['xmlns']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1307_C8", "label": "if", "type": "if", "loc": [1307, 1310], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1305_C4", "vector": [4, 2, 0.4832, 0.0015, 2, 0.59, 0.1111, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if xmlns:\n self.attributes['_xmlns'] = xmlns\n else:\n self.attributes['_xmlns'] = self.xmlns"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1308_C12", "label": "assign", "type": "assigned_variable", "loc": [1308, 1308], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1307_C8", "vector": [14, 3, 0.483, 0.0004, 3, 0.06, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.attributes['_xmlns'] = xmlns"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1310_C12", "label": "assign", "type": "assigned_variable", "loc": [1310, 1310], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1307_C8", "vector": [14, 3, 0.4838, 0.0004, 3, 0.06, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.attributes['_xmlns'] = self.xmlns"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1311_C8", "label": "lang =", "type": "assigned_variable", "loc": [1311, 1311], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1305_C4", "vector": [14, 2, 0.4841, 0.0004, 2, 0.59, 0.2222, 312, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lang", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lang = self['lang']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1312_C8", "label": "if", "type": "if", "loc": [1312, 1313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1305_C4", "vector": [4, 2, 0.4847, 0.0007, 2, 0.59, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not lang:\n lang = 'en'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1313_C12", "label": "lang =", "type": "assigned_variable", "loc": [1313, 1313], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1312_C8", "vector": [14, 3, 0.4849, 0.0004, 3, 0.82, 0.0, 312, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "lang", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lang = 'en'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1314_C8", "label": "assign", "type": "assigned_variable", "loc": [1314, 1314], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1305_C4", "vector": [14, 2, 0.4852, 0.0004, 2, 0.59, 0.4444, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.attributes['_lang'] = lang"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1315_C8", "label": "assign", "type": "assigned_variable", "loc": [1315, 1315], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1305_C4", "vector": [14, 2, 0.4856, 0.0004, 2, 0.59, 0.5556, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.attributes['_xml:lang'] = lang"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1316_C8", "label": "doctype =", "type": "assigned_variable", "loc": [1316, 1316], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1305_C4", "vector": [14, 2, 0.486, 0.0004, 2, 0.59, 0.6667, 944, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "doctype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " doctype = self['doctype']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1317_C8", "label": "if", "type": "if", "loc": [1317, 1327], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1305_C4", "vector": [4, 2, 0.4882, 0.0041, 2, 0.59, 0.7778, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if doctype:\n if doctype == 'strict':\n doctype = self.strict\n elif doctype == 'transitional':\n doctype = self.transitional\n elif doctype == 'frameset':\n doctype = self.frameset\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1318_C12", "label": "if", "type": "if", "loc": [1318, 1325], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1317_C8", "vector": [4, 3, 0.488, 0.003, 3, 0.26, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if doctype == 'strict':\n doctype = self.strict\n elif doctype == 'transitional':\n doctype = self.transitional\n elif doctype == 'frameset':\n doctype = self.frameset\n else:\n doctype = '%s\\n' % doctype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1319_C16", "label": "doctype =", "type": "assigned_variable", "loc": [1319, 1319], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1318_C12", "vector": [14, 4, 0.4871, 0.0004, 4, 0.2, 0.0, 944, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "doctype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " doctype = self.strict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1320_C12", "label": "if", "type": "if", "loc": [1320, 1325], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1318_C12", "vector": [4, 4, 0.4884, 0.0022, 4, 0.2, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif doctype == 'transitional':\n doctype = self.transitional\n elif doctype == 'frameset':\n doctype = self.frameset\n else:\n doctype = '%s\\n' % doctype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1321_C16", "label": "doctype =", "type": "assigned_variable", "loc": [1321, 1321], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1320_C12", "vector": [14, 5, 0.4878, 0.0004, 5, 0.2, 0.0, 944, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "doctype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " doctype = self.transitional"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1322_C12", "label": "if", "type": "if", "loc": [1322, 1325], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1320_C12", "vector": [4, 5, 0.4887, 0.0015, 5, 0.2, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif doctype == 'frameset':\n doctype = self.frameset\n else:\n doctype = '%s\\n' % doctype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1323_C16", "label": "doctype =", "type": "assigned_variable", "loc": [1323, 1323], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1322_C12", "vector": [14, 6, 0.4886, 0.0004, 6, 0.61, 0.0, 944, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "doctype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " doctype = self.frameset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1325_C16", "label": "doctype =", "type": "assigned_variable", "loc": [1325, 1325], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1322_C12", "vector": [14, 6, 0.4893, 0.0004, 6, 0.61, 1.0, 944, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "doctype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " doctype = '%s\\n' % doctype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1327_C12", "label": "doctype =", "type": "assigned_variable", "loc": [1327, 1327], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1317_C8", "vector": [14, 3, 0.49, 0.0004, 3, 0.26, 1.0, 944, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "doctype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " doctype = self.transitional"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1328_C8", "label": "fa, co = _xml()", "type": "assigned_variable", "loc": [1328, 1328], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1305_C4", "vector": [14, 2, 0.4904, 0.0004, 2, 0.59, 0.8889, 114, 3, 0, 0, 0, 273, 10, 1], "semantic": {"name": "fa, co", "arg_names": [], "import_names": [], "rhs_call_name": "_xml", "annotation": ""}, "snippet": " (fa, co) = self._xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1329_C8", "label": "return", "type": "return", "loc": [1329, 1329], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1305_C4", "vector": [13, 2, 0.4908, 0.0004, 2, 0.59, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s<%s%s>%s</%s>' % (doctype, self.tag, fa, co, self.tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1332_C0", "label": "HEAD", "type": "class", "loc": [1332, 1334], "level": 0, "parent": null, "vector": [3, 0, 0.4922, 0.0011, 0, 0.66, 0.4175, 578, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "HEAD", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class HEAD(DIV):\n\n tag = 'head'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1334_C4", "label": "tag =", "type": "assigned_variable", "loc": [1334, 1334], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1332_C0", "vector": [14, 1, 0.4926, 0.0004, 1, 0.87, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'head'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1337_C0", "label": "TITLE", "type": "class", "loc": [1337, 1339], "level": 0, "parent": null, "vector": [3, 0, 0.4941, 0.0011, 0, 0.66, 0.4272, 924, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "TITLE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TITLE(DIV):\n\n tag = 'title'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1339_C4", "label": "tag =", "type": "assigned_variable", "loc": [1339, 1339], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1337_C0", "vector": [14, 1, 0.4945, 0.0004, 1, 0.89, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'title'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1342_C0", "label": "META", "type": "class", "loc": [1342, 1344], "level": 0, "parent": null, "vector": [3, 0, 0.4959, 0.0011, 0, 0.66, 0.4369, 315, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "META", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class META(DIV):\n\n tag = 'meta/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1344_C4", "label": "tag =", "type": "assigned_variable", "loc": [1344, 1344], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1342_C0", "vector": [14, 1, 0.4963, 0.0004, 1, 0.7, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'meta/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1347_C0", "label": "LINK", "type": "class", "loc": [1347, 1349], "level": 0, "parent": null, "vector": [3, 0, 0.4978, 0.0011, 0, 0.66, 0.4466, 922, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "LINK", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class LINK(DIV):\n\n tag = 'link/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1349_C4", "label": "tag =", "type": "assigned_variable", "loc": [1349, 1349], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1347_C0", "vector": [14, 1, 0.4982, 0.0004, 1, 0.11, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'link/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1352_C0", "label": "SCRIPT", "type": "class", "loc": [1352, 1368], "level": 0, "parent": null, "vector": [3, 0, 0.5022, 0.0063, 0, 0.66, 0.4563, 8, 0, 1, 0, 0, 697, 0, 4], "semantic": {"name": "SCRIPT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SCRIPT(DIV):\n\n tag = 'script'\n\n def xml(self):\n (fa, co) = self._xml()\n # no escaping of subcomponents\n co = '\\n'.join([str(component) for component in"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1354_C4", "label": "tag =", "type": "assigned_variable", "loc": [1354, 1354], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1352_C0", "vector": [14, 1, 0.5, 0.0004, 1, 0.47, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'script'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1356_C4", "label": "xml", "type": "function", "loc": [1356, 1368], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1352_C0", "vector": [2, 1, 0.503, 0.0048, 1, 0.47, 1.0, 324, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "xml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def xml(self):\n (fa, co) = self._xml()\n # no escaping of subcomponents\n co = '\\n'.join([str(component) for component in\n self.components])\n if co:\n # <script [attributes]><!--//--><![CDATA[//><!--\n # script body"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1357_C8", "label": "fa, co = _xml()", "type": "assigned_variable", "loc": [1357, 1357], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1356_C4", "vector": [14, 2, 0.5011, 0.0004, 2, 0.89, 0.0, 114, 3, 0, 0, 0, 273, 10, 1], "semantic": {"name": "fa, co", "arg_names": [], "import_names": [], "rhs_call_name": "_xml", "annotation": ""}, "snippet": " (fa, co) = self._xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1359_C8", "label": "co = join()", "type": "assigned_variable", "loc": [1359, 1360], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1356_C4", "vector": [14, 2, 0.502, 0.0007, 2, 0.89, 0.5, 730, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "co", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " co = '\\n'.join([str(component) for component in\n self.components])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1361_C8", "label": "if", "type": "if", "loc": [1361, 1368], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1356_C4", "vector": [4, 2, 0.5039, 0.003, 2, 0.89, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if co:\n # <script [attributes]><!--//--><![CDATA[//><!--\n # script body\n # //--><!]]></script>\n # return '<%s%s><!--//--><![CDATA[//><!--\\n%s\\n//--><!]]></%s>' % (self.tag, fa, co, self.tag)\n return '<%s%s><!--\\n%s\\n//--></%s>' % (self.tag, fa, co, self.tag)\n else:\n return DIV.xml(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1366_C12", "label": "return", "type": "return", "loc": [1366, 1366], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1361_C8", "vector": [13, 3, 0.5044, 0.0004, 3, 0.44, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '<%s%s><!--\\n%s\\n//--></%s>' % (self.tag, fa, co, self.tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1368_C12", "label": "return", "type": "return", "loc": [1368, 1368], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1361_C8", "vector": [13, 3, 0.5052, 0.0004, 3, 0.44, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return DIV.xml(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1371_C0", "label": "STYLE", "type": "class", "loc": [1371, 1386], "level": 0, "parent": null, "vector": [3, 0, 0.509, 0.0059, 0, 0.66, 0.466, 759, 0, 1, 0, 0, 697, 0, 4], "semantic": {"name": "STYLE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class STYLE(DIV):\n\n tag = 'style'\n\n def xml(self):\n (fa, co) = self._xml()\n # no escaping of subcomponents\n co = '\\n'.join([str(component) for component in"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1373_C4", "label": "tag =", "type": "assigned_variable", "loc": [1373, 1373], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1371_C0", "vector": [14, 1, 0.507, 0.0004, 1, 0.87, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'style'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1375_C4", "label": "xml", "type": "function", "loc": [1375, 1386], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1371_C0", "vector": [2, 1, 0.5098, 0.0044, 1, 0.87, 1.0, 324, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "xml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def xml(self):\n (fa, co) = self._xml()\n # no escaping of subcomponents\n co = '\\n'.join([str(component) for component in\n self.components])\n if co:\n # <style [attributes]><!--/*--><![CDATA[/*><!--*/\n # style body"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1376_C8", "label": "fa, co = _xml()", "type": "assigned_variable", "loc": [1376, 1376], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1375_C4", "vector": [14, 2, 0.5081, 0.0004, 2, 0.56, 0.0, 114, 3, 0, 0, 0, 273, 10, 1], "semantic": {"name": "fa, co", "arg_names": [], "import_names": [], "rhs_call_name": "_xml", "annotation": ""}, "snippet": " (fa, co) = self._xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1378_C8", "label": "co = join()", "type": "assigned_variable", "loc": [1378, 1379], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1375_C4", "vector": [14, 2, 0.509, 0.0007, 2, 0.56, 0.5, 730, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "co", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " co = '\\n'.join([str(component) for component in\n self.components])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1380_C8", "label": "if", "type": "if", "loc": [1380, 1386], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1375_C4", "vector": [4, 2, 0.5107, 0.0026, 2, 0.56, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if co:\n # <style [attributes]><!--/*--><![CDATA[/*><!--*/\n # style body\n # /*]]>*/--></style>\n return '<%s%s><!--/*--><![CDATA[/*><!--*/\\n%s\\n/*]]>*/--></%s>' % (self.tag, fa, co, self.tag)\n else:\n return DIV.xml(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1384_C12", "label": "return", "type": "return", "loc": [1384, 1384], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1380_C8", "vector": [13, 3, 0.5111, 0.0004, 3, 0.13, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '<%s%s><!--/*--><![CDATA[/*><!--*/\\n%s\\n/*]]>*/--></%s>' % (self.tag, fa, co, self.tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1386_C12", "label": "return", "type": "return", "loc": [1386, 1386], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1380_C8", "vector": [13, 3, 0.5118, 0.0004, 3, 0.13, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return DIV.xml(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1389_C0", "label": "IMG", "type": "class", "loc": [1389, 1391], "level": 0, "parent": null, "vector": [3, 0, 0.5133, 0.0011, 0, 0.66, 0.4757, 275, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "IMG", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class IMG(DIV):\n\n tag = 'img/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1391_C4", "label": "tag =", "type": "assigned_variable", "loc": [1391, 1391], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1389_C0", "vector": [14, 1, 0.5137, 0.0004, 1, 0.33, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'img/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1394_C0", "label": "SPAN", "type": "class", "loc": [1394, 1396], "level": 0, "parent": null, "vector": [3, 0, 0.5151, 0.0011, 0, 0.66, 0.4854, 566, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "SPAN", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SPAN(DIV):\n\n tag = 'span'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1396_C4", "label": "tag =", "type": "assigned_variable", "loc": [1396, 1396], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1394_C0", "vector": [14, 1, 0.5155, 0.0004, 1, 0.25, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'span'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1399_C0", "label": "BODY", "type": "class", "loc": [1399, 1401], "level": 0, "parent": null, "vector": [3, 0, 0.517, 0.0011, 0, 0.66, 0.4951, 120, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "BODY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BODY(DIV):\n\n tag = 'body'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1401_C4", "label": "tag =", "type": "assigned_variable", "loc": [1401, 1401], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1399_C0", "vector": [14, 1, 0.5174, 0.0004, 1, 0.25, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'body'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1404_C0", "label": "H1", "type": "class", "loc": [1404, 1406], "level": 0, "parent": null, "vector": [3, 0, 0.5188, 0.0011, 0, 0.66, 0.5049, 216, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "H1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class H1(DIV):\n\n tag = 'h1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1406_C4", "label": "tag =", "type": "assigned_variable", "loc": [1406, 1406], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1404_C0", "vector": [14, 1, 0.5192, 0.0004, 1, 0.24, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'h1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1409_C0", "label": "H2", "type": "class", "loc": [1409, 1411], "level": 0, "parent": null, "vector": [3, 0, 0.5207, 0.0011, 0, 0.66, 0.5146, 595, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "H2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class H2(DIV):\n\n tag = 'h2'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1411_C4", "label": "tag =", "type": "assigned_variable", "loc": [1411, 1411], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1409_C0", "vector": [14, 1, 0.521, 0.0004, 1, 0.17, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'h2'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1414_C0", "label": "H3", "type": "class", "loc": [1414, 1416], "level": 0, "parent": null, "vector": [3, 0, 0.5225, 0.0011, 0, 0.66, 0.5243, 639, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "H3", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class H3(DIV):\n\n tag = 'h3'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1416_C4", "label": "tag =", "type": "assigned_variable", "loc": [1416, 1416], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1414_C0", "vector": [14, 1, 0.5229, 0.0004, 1, 0.32, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'h3'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1419_C0", "label": "H4", "type": "class", "loc": [1419, 1421], "level": 0, "parent": null, "vector": [3, 0, 0.5244, 0.0011, 0, 0.66, 0.534, 940, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "H4", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class H4(DIV):\n\n tag = 'h4'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1421_C4", "label": "tag =", "type": "assigned_variable", "loc": [1421, 1421], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1419_C0", "vector": [14, 1, 0.5247, 0.0004, 1, 0.57, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'h4'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1424_C0", "label": "H5", "type": "class", "loc": [1424, 1426], "level": 0, "parent": null, "vector": [3, 0, 0.5262, 0.0011, 0, 0.66, 0.5437, 428, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "H5", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class H5(DIV):\n\n tag = 'h5'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1426_C4", "label": "tag =", "type": "assigned_variable", "loc": [1426, 1426], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1424_C0", "vector": [14, 1, 0.5266, 0.0004, 1, 0.83, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'h5'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1429_C0", "label": "H6", "type": "class", "loc": [1429, 1431], "level": 0, "parent": null, "vector": [3, 0, 0.5281, 0.0011, 0, 0.66, 0.5534, 540, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "H6", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class H6(DIV):\n\n tag = 'h6'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1431_C4", "label": "tag =", "type": "assigned_variable", "loc": [1431, 1431], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1429_C0", "vector": [14, 1, 0.5284, 0.0004, 1, 0.08, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'h6'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1434_C0", "label": "P", "type": "class", "loc": [1434, 1447], "level": 0, "parent": null, "vector": [3, 0, 0.5319, 0.0052, 0, 0.66, 0.5631, 707, 0, 1, 0, 0, 697, 0, 2], "semantic": {"name": "P", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class P(DIV):\n \"\"\"\n Will replace ``\\\\n`` by ``<br />`` if the `cr2br` attribute is provided.\n\n see also :class:`DIV`\n \"\"\"\n\n tag = 'p'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1435_C4", "label": "expression", "type": "expression", "loc": [1435, 1439], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1434_C0", "vector": [8, 1, 0.5306, 0.0018, 1, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Will replace ``\\\\n`` by ``<br />`` if the `cr2br` attribute is provided.\n\n see also :class:`DIV`\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1441_C4", "label": "tag =", "type": "assigned_variable", "loc": [1441, 1441], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1434_C0", "vector": [14, 1, 0.5321, 0.0004, 1, 0.49, 0.5, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'p'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1443_C4", "label": "xml", "type": "function", "loc": [1443, 1447], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1434_C0", "vector": [2, 1, 0.5336, 0.0018, 1, 0.49, 1.0, 324, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "xml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def xml(self):\n text = DIV.xml(self)\n if self['cr2br']:\n text = text.replace('\\n', '<br />')\n return text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1444_C8", "label": "text = xml()", "type": "assigned_variable", "loc": [1444, 1444], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1443_C4", "vector": [14, 2, 0.5332, 0.0004, 2, 0.75, 0.0, 439, 3, 1, 0, 0, 324, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "xml", "annotation": ""}, "snippet": " text = DIV.xml(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1445_C8", "label": "if", "type": "if", "loc": [1445, 1446], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1443_C4", "vector": [4, 2, 0.5338, 0.0007, 2, 0.75, 0.5, 0, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self['cr2br']:\n text = text.replace('\\n', '<br />')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1446_C12", "label": "text = replace()", "type": "assigned_variable", "loc": [1446, 1446], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1445_C8", "vector": [14, 3, 0.534, 0.0004, 3, 0.14, 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('\\n', '<br />')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1447_C8", "label": "return", "type": "return", "loc": [1447, 1447], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1443_C4", "vector": [13, 2, 0.5343, 0.0004, 2, 0.75, 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_475:ClassDef_L1450_C0", "label": "STRONG", "type": "class", "loc": [1450, 1452], "level": 0, "parent": null, "vector": [3, 0, 0.5358, 0.0011, 0, 0.66, 0.5728, 478, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "STRONG", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class STRONG(DIV):\n\n tag = 'strong'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1452_C4", "label": "tag =", "type": "assigned_variable", "loc": [1452, 1452], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1450_C0", "vector": [14, 1, 0.5362, 0.0004, 1, 0.41, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'strong'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1455_C0", "label": "B", "type": "class", "loc": [1455, 1457], "level": 0, "parent": null, "vector": [3, 0, 0.5377, 0.0011, 0, 0.66, 0.5825, 197, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "B", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class B(DIV):\n\n tag = 'b'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1457_C4", "label": "tag =", "type": "assigned_variable", "loc": [1457, 1457], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1455_C0", "vector": [14, 1, 0.538, 0.0004, 1, 0.39, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'b'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1460_C0", "label": "BR", "type": "class", "loc": [1460, 1462], "level": 0, "parent": null, "vector": [3, 0, 0.5395, 0.0011, 0, 0.66, 0.5922, 920, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "BR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BR(DIV):\n\n tag = 'br/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1462_C4", "label": "tag =", "type": "assigned_variable", "loc": [1462, 1462], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1460_C0", "vector": [14, 1, 0.5399, 0.0004, 1, 0.01, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'br/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1465_C0", "label": "HR", "type": "class", "loc": [1465, 1467], "level": 0, "parent": null, "vector": [3, 0, 0.5414, 0.0011, 0, 0.66, 0.6019, 197, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "HR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class HR(DIV):\n\n tag = 'hr/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1467_C4", "label": "tag =", "type": "assigned_variable", "loc": [1467, 1467], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1465_C0", "vector": [14, 1, 0.5417, 0.0004, 1, 0.81, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'hr/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1470_C0", "label": "A", "type": "class", "loc": [1470, 1498], "level": 0, "parent": null, "vector": [3, 0, 0.548, 0.0107, 0, 0.66, 0.6117, 429, 0, 1, 0, 0, 697, 0, 2], "semantic": {"name": "A", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class A(DIV):\n\n tag = 'a'\n\n def xml(self):\n if not self.components and self['_href']:\n self.append(self['_href'])\n if self['delete']:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1472_C4", "label": "tag =", "type": "assigned_variable", "loc": [1472, 1472], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1470_C0", "vector": [14, 1, 0.5436, 0.0004, 1, 0.69, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'a'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1474_C4", "label": "xml", "type": "function", "loc": [1474, 1498], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1470_C0", "vector": [2, 1, 0.5487, 0.0092, 1, 0.69, 1.0, 324, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "xml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def xml(self):\n if not self.components and self['_href']:\n self.append(self['_href'])\n if self['delete']:\n d = \"jQuery(this).closest('%s').remove();\" % self['delete']\n else:\n d = ''\n if self['component']:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1475_C8", "label": "if", "type": "if", "loc": [1475, 1476], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1474_C4", "vector": [4, 2, 0.5449, 0.0007, 2, 0.52, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.components and self['_href']:\n self.append(self['_href'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1476_C12", "label": "append()", "type": "expression", "loc": [1476, 1476], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1475_C8", "vector": [8, 3, 0.5451, 0.0004, 3, 0.97, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.append(self['_href'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1477_C8", "label": "if", "type": "if", "loc": [1477, 1480], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1474_C4", "vector": [4, 2, 0.546, 0.0015, 2, 0.52, 0.3333, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self['delete']:\n d = \"jQuery(this).closest('%s').remove();\" % self['delete']\n else:\n d = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1478_C12", "label": "d =", "type": "assigned_variable", "loc": [1478, 1478], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1477_C8", "vector": [14, 3, 0.5458, 0.0004, 3, 0.14, 0.0, 355, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d = \"jQuery(this).closest('%s').remove();\" % self['delete']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1480_C12", "label": "d =", "type": "assigned_variable", "loc": [1480, 1480], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1477_C8", "vector": [14, 3, 0.5465, 0.0004, 3, 0.14, 1.0, 355, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1481_C8", "label": "if", "type": "if", "loc": [1481, 1497], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1474_C4", "vector": [4, 2, 0.5499, 0.0063, 2, 0.52, 0.6667, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self['component']:\n self['_onclick'] = \"web2py_component('%s','%s');%sreturn false;\" % \\\n (self['component'], self['target'] or '', d)\n self['_href'] = self['_href'] or '#null'\n elif self['callback']:\n returnfalse = \"var e = arguments[0] || window.event; e.cancelBubble=true; if (e.stopPropagation) {e.stopPropagation(); e.stopImmediatePropagation(); e.preventDefault();}\"\n if d and not self['noconfirm']:\n self['_onclick'] = \"if(confirm(w2p_ajax_confirm_message||'Are you sure you want to delete this object?')){ajax('%s',[],'%s');%s};%s\" % \\"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1482_C12", "label": "assign", "type": "assigned_variable", "loc": [1482, 1483], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1481_C8", "vector": [14, 3, 0.5475, 0.0007, 3, 0.14, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_onclick'] = \"web2py_component('%s','%s');%sreturn false;\" % \\\n (self['component'], self['target'] or '', d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1484_C12", "label": "assign", "type": "assigned_variable", "loc": [1484, 1484], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1481_C8", "vector": [14, 3, 0.548, 0.0004, 3, 0.14, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_href'] = self['_href'] or '#null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1485_C8", "label": "if", "type": "if", "loc": [1485, 1497], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1481_C8", "vector": [4, 3, 0.5506, 0.0048, 3, 0.14, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self['callback']:\n returnfalse = \"var e = arguments[0] || window.event; e.cancelBubble=true; if (e.stopPropagation) {e.stopPropagation(); e.stopImmediatePropagation(); e.preventDefault();}\"\n if d and not self['noconfirm']:\n self['_onclick'] = \"if(confirm(w2p_ajax_confirm_message||'Are you sure you want to delete this object?')){ajax('%s',[],'%s');%s};%s\" % \\\n (self['callback'], self['target'] or '', d, returnfalse)\n else:\n self['_onclick'] = \"ajax('%s',[],'%s');%sreturn false\" % \\\n (self['callback'], self['target'] or '', d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1486_C12", "label": "returnfalse =", "type": "assigned_variable", "loc": [1486, 1486], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1485_C8", "vector": [14, 4, 0.5487, 0.0004, 4, 0.9, 0.0, 836, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "returnfalse", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " returnfalse = \"var e = arguments[0] || window.event; e.cancelBubble=true; if (e.stopPropagation) {e.stopPropagation(); e.stopImmediatePropagation(); e.preventDefault();}\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1487_C12", "label": "if", "type": "if", "loc": [1487, 1492], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1485_C8", "vector": [4, 4, 0.55, 0.0022, 4, 0.9, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if d and not self['noconfirm']:\n self['_onclick'] = \"if(confirm(w2p_ajax_confirm_message||'Are you sure you want to delete this object?')){ajax('%s',[],'%s');%s};%s\" % \\\n (self['callback'], self['target'] or '', d, returnfalse)\n else:\n self['_onclick'] = \"ajax('%s',[],'%s');%sreturn false\" % \\\n (self['callback'], self['target'] or '', d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1488_C16", "label": "assign", "type": "assigned_variable", "loc": [1488, 1489], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1487_C12", "vector": [14, 5, 0.5497, 0.0007, 5, 0.88, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_onclick'] = \"if(confirm(w2p_ajax_confirm_message||'Are you sure you want to delete this object?')){ajax('%s',[],'%s');%s};%s\" % \\\n (self['callback'], self['target'] or '', d, returnfalse)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1491_C16", "label": "assign", "type": "assigned_variable", "loc": [1491, 1492], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1487_C12", "vector": [14, 5, 0.5508, 0.0007, 5, 0.88, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_onclick'] = \"ajax('%s',[],'%s');%sreturn false\" % \\\n (self['callback'], self['target'] or '', d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1493_C12", "label": "assign", "type": "assigned_variable", "loc": [1493, 1493], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1485_C8", "vector": [14, 4, 0.5513, 0.0004, 4, 0.9, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_href'] = self['_href'] or '#null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1494_C8", "label": "if", "type": "if", "loc": [1494, 1497], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1485_C8", "vector": [4, 4, 0.5523, 0.0015, 4, 0.9, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self['cid']:\n pre = self['pre_call'] + ';' if self['pre_call'] else ''\n self['_onclick'] = '%sweb2py_component(\"%s\",\"%s\");%sreturn false;' % \\\n (pre,self['_href'], self['cid'], d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1495_C12", "label": "pre =", "type": "assigned_variable", "loc": [1495, 1495], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1494_C8", "vector": [14, 5, 0.5521, 0.0004, 5, 0.48, 0.0, 793, 8, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pre", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pre = self['pre_call'] + ';' if self['pre_call'] else ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1496_C12", "label": "assign", "type": "assigned_variable", "loc": [1496, 1497], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1494_C8", "vector": [14, 5, 0.5526, 0.0007, 5, 0.48, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_onclick'] = '%sweb2py_component(\"%s\",\"%s\");%sreturn false;' % \\\n (pre,self['_href'], self['cid'], d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1498_C8", "label": "return", "type": "return", "loc": [1498, 1498], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1474_C4", "vector": [13, 2, 0.5532, 0.0004, 2, 0.52, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return DIV.xml(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1501_C0", "label": "BUTTON", "type": "class", "loc": [1501, 1503], "level": 0, "parent": null, "vector": [3, 0, 0.5547, 0.0011, 0, 0.66, 0.6214, 732, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "BUTTON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BUTTON(DIV):\n\n tag = 'button'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1503_C4", "label": "tag =", "type": "assigned_variable", "loc": [1503, 1503], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1501_C0", "vector": [14, 1, 0.555, 0.0004, 1, 0.55, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'button'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1506_C0", "label": "EM", "type": "class", "loc": [1506, 1508], "level": 0, "parent": null, "vector": [3, 0, 0.5565, 0.0011, 0, 0.66, 0.6311, 229, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "EM", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class EM(DIV):\n\n tag = 'em'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1508_C4", "label": "tag =", "type": "assigned_variable", "loc": [1508, 1508], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1506_C0", "vector": [14, 1, 0.5569, 0.0004, 1, 0.58, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'em'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1511_C0", "label": "EMBED", "type": "class", "loc": [1511, 1513], "level": 0, "parent": null, "vector": [3, 0, 0.5583, 0.0011, 0, 0.66, 0.6408, 359, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "EMBED", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class EMBED(DIV):\n\n tag = 'embed/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1513_C4", "label": "tag =", "type": "assigned_variable", "loc": [1513, 1513], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1511_C0", "vector": [14, 1, 0.5587, 0.0004, 1, 0.42, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'embed/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1516_C0", "label": "TT", "type": "class", "loc": [1516, 1518], "level": 0, "parent": null, "vector": [3, 0, 0.5602, 0.0011, 0, 0.66, 0.6505, 992, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "TT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TT(DIV):\n\n tag = 'tt'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1518_C4", "label": "tag =", "type": "assigned_variable", "loc": [1518, 1518], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1516_C0", "vector": [14, 1, 0.5606, 0.0004, 1, 0.2, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'tt'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1521_C0", "label": "PRE", "type": "class", "loc": [1521, 1523], "level": 0, "parent": null, "vector": [3, 0, 0.562, 0.0011, 0, 0.66, 0.6602, 623, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "PRE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PRE(DIV):\n\n tag = 'pre'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1523_C4", "label": "tag =", "type": "assigned_variable", "loc": [1523, 1523], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1521_C0", "vector": [14, 1, 0.5624, 0.0004, 1, 0.32, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'pre'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1526_C0", "label": "CENTER", "type": "class", "loc": [1526, 1528], "level": 0, "parent": null, "vector": [3, 0, 0.5639, 0.0011, 0, 0.66, 0.6699, 995, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "CENTER", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CENTER(DIV):\n\n tag = 'center'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1528_C4", "label": "tag =", "type": "assigned_variable", "loc": [1528, 1528], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1526_C0", "vector": [14, 1, 0.5643, 0.0004, 1, 0.09, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'center'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1531_C0", "label": "CODE", "type": "class", "loc": [1531, 1576], "level": 0, "parent": null, "vector": [3, 0, 0.5737, 0.017, 0, 0.66, 0.6796, 312, 0, 1, 0, 0, 697, 0, 5], "semantic": {"name": "CODE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CODE(DIV):\n\n \"\"\"\n displays code in HTML with syntax highlighting.\n\n :param attributes: optional attributes:\n\n - language: indicates the language, otherwise PYTHON is assumed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1533_C4", "label": "expression", "type": "expression", "loc": [1533, 1558], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1531_C0", "vector": [8, 1, 0.5707, 0.0096, 1, 0.63, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n displays code in HTML with syntax highlighting.\n\n :param attributes: optional attributes:\n\n - language: indicates the language, otherwise PYTHON is assumed\n - link: can provide a link\n - styles: for styles"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1560_C4", "label": "xml", "type": "function", "loc": [1560, 1576], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1531_C0", "vector": [2, 1, 0.579, 0.0063, 1, 0.63, 1.0, 324, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "xml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def xml(self):\n language = self['language'] or 'PYTHON'\n link = self['link']\n counter = self.attributes.get('counter', 1)\n highlight_line = self.attributes.get('highlight_line', None)\n context_lines = self.attributes.get('context_lines', None)\n styles = self['styles'] or {}\n return highlight("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1561_C8", "label": "language =", "type": "assigned_variable", "loc": [1561, 1561], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1560_C4", "vector": [14, 2, 0.5764, 0.0004, 2, 0.46, 0.0, 214, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "language", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " language = self['language'] or 'PYTHON'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1562_C8", "label": "link =", "type": "assigned_variable", "loc": [1562, 1562], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1560_C4", "vector": [14, 2, 0.5768, 0.0004, 2, 0.46, 0.1667, 880, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "link", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " link = self['link']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1563_C8", "label": "counter = get()", "type": "assigned_variable", "loc": [1563, 1563], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1560_C4", "vector": [14, 2, 0.5772, 0.0004, 2, 0.46, 0.3333, 7, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "counter", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " counter = self.attributes.get('counter', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1564_C8", "label": "highlight_line = get()", "type": "assigned_variable", "loc": [1564, 1564], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1560_C4", "vector": [14, 2, 0.5775, 0.0004, 2, 0.46, 0.5, 360, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "highlight_line", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " highlight_line = self.attributes.get('highlight_line', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1565_C8", "label": "context_lines = get()", "type": "assigned_variable", "loc": [1565, 1565], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1560_C4", "vector": [14, 2, 0.5779, 0.0004, 2, 0.46, 0.6667, 183, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "context_lines", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " context_lines = self.attributes.get('context_lines', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1566_C8", "label": "styles =", "type": "assigned_variable", "loc": [1566, 1566], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1560_C4", "vector": [14, 2, 0.5783, 0.0004, 2, 0.46, 0.8333, 752, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "styles", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " styles = self['styles'] or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1567_C8", "label": "return", "type": "return", "loc": [1567, 1576], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1560_C4", "vector": [13, 2, 0.5803, 0.0037, 2, 0.46, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return highlight(\n join(self.components),\n language=language,\n link=link,\n counter=counter,\n styles=styles,\n attributes=self.attributes,\n highlight_line=highlight_line,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1579_C0", "label": "LABEL", "type": "class", "loc": [1579, 1581], "level": 0, "parent": null, "vector": [3, 0, 0.5835, 0.0011, 0, 0.66, 0.6893, 436, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "LABEL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class LABEL(DIV):\n\n tag = 'label'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1581_C4", "label": "tag =", "type": "assigned_variable", "loc": [1581, 1581], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1579_C0", "vector": [14, 1, 0.5838, 0.0004, 1, 0.0, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'label'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1584_C0", "label": "LI", "type": "class", "loc": [1584, 1586], "level": 0, "parent": null, "vector": [3, 0, 0.5853, 0.0011, 0, 0.66, 0.699, 814, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "LI", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class LI(DIV):\n\n tag = 'li'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1586_C4", "label": "tag =", "type": "assigned_variable", "loc": [1586, 1586], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1584_C0", "vector": [14, 1, 0.5857, 0.0004, 1, 0.4, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'li'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1589_C0", "label": "UL", "type": "class", "loc": [1589, 1601], "level": 0, "parent": null, "vector": [3, 0, 0.589, 0.0048, 0, 0.66, 0.7087, 64, 0, 1, 0, 0, 697, 0, 1], "semantic": {"name": "UL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class UL(DIV):\n \"\"\"\n UL Component.\n\n If subcomponents are not LI-components they will be wrapped in a LI\n\n see also :class:`DIV`\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1590_C4", "label": "expression", "type": "expression", "loc": [1590, 1596], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1589_C0", "vector": [8, 1, 0.5883, 0.0026, 1, 0.53, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n UL Component.\n\n If subcomponents are not LI-components they will be wrapped in a LI\n\n see also :class:`DIV`\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1598_C4", "label": "tag =", "type": "assigned_variable", "loc": [1598, 1598], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1589_C0", "vector": [14, 1, 0.5901, 0.0004, 1, 0.53, 0.5, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'ul'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1600_C4", "label": "_fixup", "type": "function", "loc": [1600, 1601], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1589_C0", "vector": [2, 1, 0.591, 0.0007, 1, 0.53, 1.0, 339, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_fixup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _fixup(self):\n self._wrap_components(LI, LI)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1601_C8", "label": "_wrap_components()", "type": "expression", "loc": [1601, 1601], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1600_C4", "vector": [8, 2, 0.5912, 0.0004, 2, 0.21, 0.0, 452, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_wrap_components", "arg_names": [], "import_names": [], "rhs_call_name": "_wrap_components", "annotation": ""}, "snippet": " self._wrap_components(LI, LI)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1604_C0", "label": "OL", "type": "class", "loc": [1604, 1606], "level": 0, "parent": null, "vector": [3, 0, 0.5927, 0.0011, 0, 0.66, 0.7184, 655, 0, 0, 0, 0, 64, 0, 0], "semantic": {"name": "OL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OL(UL):\n\n tag = 'ol'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1606_C4", "label": "tag =", "type": "assigned_variable", "loc": [1606, 1606], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1604_C0", "vector": [14, 1, 0.5931, 0.0004, 1, 0.62, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'ol'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1609_C0", "label": "TD", "type": "class", "loc": [1609, 1611], "level": 0, "parent": null, "vector": [3, 0, 0.5945, 0.0011, 0, 0.66, 0.7282, 348, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "TD", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TD(DIV):\n\n tag = 'td'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1611_C4", "label": "tag =", "type": "assigned_variable", "loc": [1611, 1611], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1609_C0", "vector": [14, 1, 0.5949, 0.0004, 1, 0.08, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'td'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1614_C0", "label": "TH", "type": "class", "loc": [1614, 1616], "level": 0, "parent": null, "vector": [3, 0, 0.5964, 0.0011, 0, 0.66, 0.7379, 864, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "TH", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TH(DIV):\n\n tag = 'th'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1616_C4", "label": "tag =", "type": "assigned_variable", "loc": [1616, 1616], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1614_C0", "vector": [14, 1, 0.5968, 0.0004, 1, 0.17, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'th'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1619_C0", "label": "TR", "type": "class", "loc": [1619, 1631], "level": 0, "parent": null, "vector": [3, 0, 0.6001, 0.0048, 0, 0.66, 0.7476, 591, 0, 1, 0, 0, 697, 0, 1], "semantic": {"name": "TR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TR(DIV):\n \"\"\"\n TR Component.\n\n If subcomponents are not TD/TH-components they will be wrapped in a TD\n\n see also :class:`DIV`\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1620_C4", "label": "expression", "type": "expression", "loc": [1620, 1626], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1619_C0", "vector": [8, 1, 0.5993, 0.0026, 1, 0.53, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n TR Component.\n\n If subcomponents are not TD/TH-components they will be wrapped in a TD\n\n see also :class:`DIV`\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1628_C4", "label": "tag =", "type": "assigned_variable", "loc": [1628, 1628], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1619_C0", "vector": [14, 1, 0.6012, 0.0004, 1, 0.53, 0.5, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'tr'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1630_C4", "label": "_fixup", "type": "function", "loc": [1630, 1631], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1619_C0", "vector": [2, 1, 0.6021, 0.0007, 1, 0.53, 1.0, 339, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_fixup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _fixup(self):\n self._wrap_components((TD, TH), TD)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1631_C8", "label": "_wrap_components()", "type": "expression", "loc": [1631, 1631], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1630_C4", "vector": [8, 2, 0.6023, 0.0004, 2, 0.91, 0.0, 452, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_wrap_components", "arg_names": [], "import_names": [], "rhs_call_name": "_wrap_components", "annotation": ""}, "snippet": " self._wrap_components((TD, TH), TD)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1634_C0", "label": "THEAD", "type": "class", "loc": [1634, 1639], "level": 0, "parent": null, "vector": [3, 0, 0.6043, 0.0022, 0, 0.66, 0.7573, 340, 0, 1, 0, 0, 697, 0, 1], "semantic": {"name": "THEAD", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class THEAD(DIV):\n\n tag = 'thead'\n\n def _fixup(self):\n self._wrap_components(TR, TR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1636_C4", "label": "tag =", "type": "assigned_variable", "loc": [1636, 1636], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1634_C0", "vector": [14, 1, 0.6041, 0.0004, 1, 0.12, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'thead'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1638_C4", "label": "_fixup", "type": "function", "loc": [1638, 1639], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1634_C0", "vector": [2, 1, 0.6051, 0.0007, 1, 0.12, 1.0, 339, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_fixup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _fixup(self):\n self._wrap_components(TR, TR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1639_C8", "label": "_wrap_components()", "type": "expression", "loc": [1639, 1639], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1638_C4", "vector": [8, 2, 0.6052, 0.0004, 2, 0.4, 0.0, 452, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_wrap_components", "arg_names": [], "import_names": [], "rhs_call_name": "_wrap_components", "annotation": ""}, "snippet": " self._wrap_components(TR, TR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1642_C0", "label": "TBODY", "type": "class", "loc": [1642, 1647], "level": 0, "parent": null, "vector": [3, 0, 0.6073, 0.0022, 0, 0.66, 0.767, 275, 0, 1, 0, 0, 697, 0, 1], "semantic": {"name": "TBODY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TBODY(DIV):\n\n tag = 'tbody'\n\n def _fixup(self):\n self._wrap_components(TR, TR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1644_C4", "label": "tag =", "type": "assigned_variable", "loc": [1644, 1644], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1642_C0", "vector": [14, 1, 0.6071, 0.0004, 1, 0.32, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'tbody'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1646_C4", "label": "_fixup", "type": "function", "loc": [1646, 1647], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1642_C0", "vector": [2, 1, 0.608, 0.0007, 1, 0.32, 1.0, 339, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_fixup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _fixup(self):\n self._wrap_components(TR, TR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1647_C8", "label": "_wrap_components()", "type": "expression", "loc": [1647, 1647], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1646_C4", "vector": [8, 2, 0.6082, 0.0004, 2, 0.11, 0.0, 452, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_wrap_components", "arg_names": [], "import_names": [], "rhs_call_name": "_wrap_components", "annotation": ""}, "snippet": " self._wrap_components(TR, TR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1650_C0", "label": "TFOOT", "type": "class", "loc": [1650, 1655], "level": 0, "parent": null, "vector": [3, 0, 0.6102, 0.0022, 0, 0.66, 0.7767, 646, 0, 1, 0, 0, 697, 0, 1], "semantic": {"name": "TFOOT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TFOOT(DIV):\n\n tag = 'tfoot'\n\n def _fixup(self):\n self._wrap_components(TR, TR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1652_C4", "label": "tag =", "type": "assigned_variable", "loc": [1652, 1652], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1650_C0", "vector": [14, 1, 0.61, 0.0004, 1, 0.62, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'tfoot'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1654_C4", "label": "_fixup", "type": "function", "loc": [1654, 1655], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1650_C0", "vector": [2, 1, 0.611, 0.0007, 1, 0.62, 1.0, 339, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_fixup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _fixup(self):\n self._wrap_components(TR, TR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1655_C8", "label": "_wrap_components()", "type": "expression", "loc": [1655, 1655], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1654_C4", "vector": [8, 2, 0.6112, 0.0004, 2, 0.34, 0.0, 452, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_wrap_components", "arg_names": [], "import_names": [], "rhs_call_name": "_wrap_components", "annotation": ""}, "snippet": " self._wrap_components(TR, TR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1658_C0", "label": "COL", "type": "class", "loc": [1658, 1660], "level": 0, "parent": null, "vector": [3, 0, 0.6126, 0.0011, 0, 0.66, 0.7864, 735, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "COL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class COL(DIV):\n\n tag = 'col'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1660_C4", "label": "tag =", "type": "assigned_variable", "loc": [1660, 1660], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1658_C0", "vector": [14, 1, 0.613, 0.0004, 1, 0.72, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'col'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1663_C0", "label": "COLGROUP", "type": "class", "loc": [1663, 1665], "level": 0, "parent": null, "vector": [3, 0, 0.6145, 0.0011, 0, 0.66, 0.7961, 551, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "COLGROUP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class COLGROUP(DIV):\n\n tag = 'colgroup'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1665_C4", "label": "tag =", "type": "assigned_variable", "loc": [1665, 1665], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1663_C0", "vector": [14, 1, 0.6148, 0.0004, 1, 0.37, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'colgroup'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1668_C0", "label": "TABLE", "type": "class", "loc": [1668, 1681], "level": 0, "parent": null, "vector": [3, 0, 0.6184, 0.0052, 0, 0.66, 0.8058, 686, 0, 1, 0, 0, 697, 0, 1], "semantic": {"name": "TABLE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TABLE(DIV):\n \"\"\"\n TABLE Component.\n\n If subcomponents are not TR/TBODY/THEAD/TFOOT-components\n they will be wrapped in a TR\n\n see also :class:`DIV`"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1669_C4", "label": "expression", "type": "expression", "loc": [1669, 1676], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1668_C0", "vector": [8, 1, 0.6176, 0.003, 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 TABLE Component.\n\n If subcomponents are not TR/TBODY/THEAD/TFOOT-components\n they will be wrapped in a TR\n\n see also :class:`DIV`\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1678_C4", "label": "tag =", "type": "assigned_variable", "loc": [1678, 1678], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1668_C0", "vector": [14, 1, 0.6196, 0.0004, 1, 0.83, 0.5, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'table'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1680_C4", "label": "_fixup", "type": "function", "loc": [1680, 1681], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1668_C0", "vector": [2, 1, 0.6206, 0.0007, 1, 0.83, 1.0, 339, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_fixup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _fixup(self):\n self._wrap_components((TR, TBODY, THEAD, TFOOT, COL, COLGROUP), TR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1681_C8", "label": "_wrap_components()", "type": "expression", "loc": [1681, 1681], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1680_C4", "vector": [8, 2, 0.6208, 0.0004, 2, 0.29, 0.0, 452, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_wrap_components", "arg_names": [], "import_names": [], "rhs_call_name": "_wrap_components", "annotation": ""}, "snippet": " self._wrap_components((TR, TBODY, THEAD, TFOOT, COL, COLGROUP), TR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1684_C0", "label": "I", "type": "class", "loc": [1684, 1686], "level": 0, "parent": null, "vector": [3, 0, 0.6222, 0.0011, 0, 0.66, 0.8155, 134, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "I", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class I(DIV):\n\n tag = 'i'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1686_C4", "label": "tag =", "type": "assigned_variable", "loc": [1686, 1686], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1684_C0", "vector": [14, 1, 0.6226, 0.0004, 1, 0.25, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'i'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1689_C0", "label": "IFRAME", "type": "class", "loc": [1689, 1691], "level": 0, "parent": null, "vector": [3, 0, 0.6241, 0.0011, 0, 0.66, 0.8252, 37, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "IFRAME", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class IFRAME(DIV):\n\n tag = 'iframe'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1691_C4", "label": "tag =", "type": "assigned_variable", "loc": [1691, 1691], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1689_C0", "vector": [14, 1, 0.6244, 0.0004, 1, 0.36, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'iframe'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1694_C0", "label": "INPUT", "type": "class", "loc": [1694, 1814], "level": 0, "parent": null, "vector": [3, 0, 0.6477, 0.0447, 0, 0.66, 0.835, 514, 0, 3, 0, 0, 697, 0, 25], "semantic": {"name": "INPUT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class INPUT(DIV):\n\n \"\"\"\n INPUT Component\n\n examples::\n\n >>> INPUT(_type='text', _name='name', value='Max').xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1696_C4", "label": "expression", "type": "expression", "loc": [1696, 1725], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1694_C0", "vector": [8, 1, 0.6316, 0.0111, 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 INPUT Component\n\n examples::\n\n >>> INPUT(_type='text', _name='name', value='Max').xml()\n '<input name=\\\"name\\\" type=\\\"text\\\" value=\\\"Max\\\" />'\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1727_C4", "label": "tag =", "type": "assigned_variable", "loc": [1727, 1727], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1694_C0", "vector": [14, 1, 0.6377, 0.0004, 1, 0.13, 0.25, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'input/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1729_C4", "label": "_validate", "type": "function", "loc": [1729, 1762], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1694_C0", "vector": [2, 1, 0.6446, 0.0126, 1, 0.13, 0.5, 939, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "_validate", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _validate(self):\n\n # # this only changes value, not _value\n\n name = self['_name']\n if name is None or name == '':\n return True\n name = str(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1733_C8", "label": "name =", "type": "assigned_variable", "loc": [1733, 1733], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1729_C4", "vector": [14, 2, 0.64, 0.0004, 2, 0.12, 0.0, 57, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = self['_name']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1734_C8", "label": "if", "type": "if", "loc": [1734, 1735], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1729_C4", "vector": [4, 2, 0.6405, 0.0007, 2, 0.12, 0.125, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name is None or name == '':\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1735_C12", "label": "return", "type": "return", "loc": [1735, 1735], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1734_C8", "vector": [13, 3, 0.6407, 0.0004, 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 True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1736_C8", "label": "name = str()", "type": "assigned_variable", "loc": [1736, 1736], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1729_C4", "vector": [14, 2, 0.6411, 0.0004, 2, 0.12, 0.25, 57, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " name = str(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1737_C8", "label": "request_vars_get =", "type": "assigned_variable", "loc": [1737, 1737], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1729_C4", "vector": [14, 2, 0.6414, 0.0004, 2, 0.12, 0.375, 981, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "request_vars_get", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request_vars_get = self.request_vars.get"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1738_C8", "label": "if", "type": "if", "loc": [1738, 1748], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1729_C4", "vector": [4, 2, 0.6436, 0.0041, 2, 0.12, 0.5, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self['_type'] != 'checkbox':\n self['old_value'] = self['value'] or self['_value'] or ''\n value = request_vars_get(name, '')\n self['value'] = value if not hasattr(value,'file') else None\n else:\n self['old_value'] = self['value'] or False\n value = request_vars_get(name)\n if isinstance(value, (tuple, list)):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1739_C12", "label": "assign", "type": "assigned_variable", "loc": [1739, 1739], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1738_C8", "vector": [14, 3, 0.6422, 0.0004, 3, 0.62, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['old_value'] = self['value'] or self['_value'] or ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1740_C12", "label": "value = request_vars_get()", "type": "assigned_variable", "loc": [1740, 1740], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1738_C8", "vector": [14, 3, 0.6425, 0.0004, 3, 0.62, 0.2, 441, 3, 2, 0, 0, 981, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "request_vars_get", "annotation": ""}, "snippet": " value = request_vars_get(name, '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1741_C12", "label": "assign", "type": "assigned_variable", "loc": [1741, 1741], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1738_C8", "vector": [14, 3, 0.6429, 0.0004, 3, 0.62, 0.4, 0, 8, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['value'] = value if not hasattr(value,'file') else None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1743_C12", "label": "assign", "type": "assigned_variable", "loc": [1743, 1743], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1738_C8", "vector": [14, 3, 0.6436, 0.0004, 3, 0.62, 0.6, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['old_value'] = self['value'] or False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1744_C12", "label": "value = request_vars_get()", "type": "assigned_variable", "loc": [1744, 1744], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1738_C8", "vector": [14, 3, 0.644, 0.0004, 3, 0.62, 0.8, 441, 3, 1, 0, 0, 981, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "request_vars_get", "annotation": ""}, "snippet": " value = request_vars_get(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1745_C12", "label": "if", "type": "if", "loc": [1745, 1748], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1738_C8", "vector": [4, 3, 0.6449, 0.0015, 3, 0.62, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, (tuple, list)):\n self['value'] = self['_value'] in value\n else:\n self['value'] = self['_value'] == value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1746_C16", "label": "assign", "type": "assigned_variable", "loc": [1746, 1746], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1745_C12", "vector": [14, 4, 0.6448, 0.0004, 4, 0.51, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['value'] = self['_value'] in value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1748_C16", "label": "assign", "type": "assigned_variable", "loc": [1748, 1748], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1745_C12", "vector": [14, 4, 0.6455, 0.0004, 4, 0.51, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['value'] = self['_value'] == value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1749_C8", "label": "requires =", "type": "assigned_variable", "loc": [1749, 1749], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1729_C4", "vector": [14, 2, 0.6459, 0.0004, 2, 0.12, 0.625, 151, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "requires", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " requires = self['requires']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1750_C8", "label": "if", "type": "if", "loc": [1750, 1758], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1729_C4", "vector": [4, 2, 0.6477, 0.0033, 2, 0.12, 0.75, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if requires:\n if not isinstance(requires, (list, tuple)):\n requires = [requires]\n for validator in requires:\n (value, errors) = validator(value)\n if not errors is None:\n self.vars[name] = value\n self.errors[name] = errors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1751_C12", "label": "if", "type": "if", "loc": [1751, 1752], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1750_C8", "vector": [4, 3, 0.6468, 0.0007, 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 not isinstance(requires, (list, tuple)):\n requires = [requires]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1752_C16", "label": "requires =", "type": "assigned_variable", "loc": [1752, 1752], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1751_C12", "vector": [14, 4, 0.647, 0.0004, 4, 0.72, 0.0, 151, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "requires", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " requires = [requires]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1753_C12", "label": "for validator", "type": "for", "loc": [1753, 1758], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1750_C8", "vector": [6, 3, 0.6483, 0.0022, 3, 0.86, 1.0, 145, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "validator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for validator in requires:\n (value, errors) = validator(value)\n if not errors is None:\n self.vars[name] = value\n self.errors[name] = errors\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1754_C16", "label": "value, errors = validator()", "type": "assigned_variable", "loc": [1754, 1754], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1753_C12", "vector": [14, 4, 0.6477, 0.0004, 4, 0.09, 0.0, 722, 3, 1, 0, 0, 145, 10, 1], "semantic": {"name": "value, errors", "arg_names": [], "import_names": [], "rhs_call_name": "validator", "annotation": ""}, "snippet": " (value, errors) = validator(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1755_C16", "label": "if", "type": "if", "loc": [1755, 1758], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1753_C12", "vector": [4, 4, 0.6486, 0.0015, 4, 0.09, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not errors is None:\n self.vars[name] = value\n self.errors[name] = errors\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1756_C20", "label": "assign", "type": "assigned_variable", "loc": [1756, 1756], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1755_C16", "vector": [14, 5, 0.6484, 0.0004, 5, 0.19, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.vars[name] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1757_C20", "label": "assign", "type": "assigned_variable", "loc": [1757, 1757], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1755_C16", "vector": [14, 5, 0.6488, 0.0004, 5, 0.19, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.errors[name] = errors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1759_C8", "label": "if", "type": "if", "loc": [1759, 1761], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1729_C4", "vector": [4, 2, 0.6499, 0.0011, 2, 0.12, 0.875, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not name in self.errors:\n self.vars[name] = value\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1760_C12", "label": "assign", "type": "assigned_variable", "loc": [1760, 1760], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1759_C8", "vector": [14, 3, 0.6499, 0.0004, 3, 0.95, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.vars[name] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1761_C12", "label": "return", "type": "return", "loc": [1761, 1761], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1759_C8", "vector": [13, 3, 0.6503, 0.0004, 3, 0.95, 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_475:Return_L1762_C8", "label": "return", "type": "return", "loc": [1762, 1762], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1729_C4", "vector": [13, 2, 0.6507, 0.0004, 2, 0.12, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1764_C4", "label": "_postprocessing", "type": "function", "loc": [1764, 1795], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1694_C0", "vector": [2, 1, 0.6571, 0.0118, 1, 0.13, 0.75, 455, 0, 1, 0, 0, 0, 0, 9], "semantic": {"name": "_postprocessing", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _postprocessing(self):\n t = self['_type']\n if not t:\n t = self['_type'] = 'text'\n t = t.lower()\n value = self['value']\n if self['_value'] is None or isinstance(self['_value'],cgi.FieldStorage):\n _value = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1765_C8", "label": "t =", "type": "assigned_variable", "loc": [1765, 1765], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1764_C4", "vector": [14, 2, 0.6518, 0.0004, 2, 0.35, 0.0, 15, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t = self['_type']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1766_C8", "label": "if", "type": "if", "loc": [1766, 1767], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1764_C4", "vector": [4, 2, 0.6523, 0.0007, 2, 0.35, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not t:\n t = self['_type'] = 'text'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1767_C12", "label": "t =", "type": "assigned_variable", "loc": [1767, 1767], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1766_C8", "vector": [14, 3, 0.6525, 0.0004, 3, 0.2, 0.0, 15, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t = self['_type'] = 'text'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1768_C8", "label": "t = lower()", "type": "assigned_variable", "loc": [1768, 1768], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1764_C4", "vector": [14, 2, 0.6529, 0.0004, 2, 0.35, 0.4, 15, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " t = t.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1769_C8", "label": "value =", "type": "assigned_variable", "loc": [1769, 1769], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1764_C4", "vector": [14, 2, 0.6532, 0.0004, 2, 0.35, 0.6, 441, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = self['value']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1770_C8", "label": "if", "type": "if", "loc": [1770, 1773], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1764_C4", "vector": [4, 2, 0.6542, 0.0015, 2, 0.35, 0.8, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self['_value'] is None or isinstance(self['_value'],cgi.FieldStorage):\n _value = None\n else:\n _value = str(self['_value'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1771_C12", "label": "_value =", "type": "assigned_variable", "loc": [1771, 1771], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1770_C8", "vector": [14, 3, 0.654, 0.0004, 3, 0.88, 0.0, 54, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "_value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _value = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1773_C12", "label": "_value = str()", "type": "assigned_variable", "loc": [1773, 1773], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1770_C8", "vector": [14, 3, 0.6547, 0.0004, 3, 0.88, 1.0, 54, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "_value", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " _value = str(self['_value'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1774_C8", "label": "if", "type": "if", "loc": [1774, 1795], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1764_C4", "vector": [4, 2, 0.659, 0.0081, 2, 0.35, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if '_checked' in self.attributes and not 'value' in self.attributes:\n pass\n elif t == 'checkbox':\n if not _value:\n _value = self['_value'] = 'on'\n if not value:\n value = []\n elif value is True:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1776_C8", "label": "if", "type": "if", "loc": [1776, 1795], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1774_C8", "vector": [4, 3, 0.6593, 0.0074, 3, 0.77, 0.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif t == 'checkbox':\n if not _value:\n _value = self['_value'] = 'on'\n if not value:\n value = []\n elif value is True:\n value = [_value]\n elif not isinstance(value, (list, tuple)):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1777_C12", "label": "if", "type": "if", "loc": [1777, 1778], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1776_C8", "vector": [4, 4, 0.6564, 0.0007, 4, 0.62, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not _value:\n _value = self['_value'] = 'on'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1778_C16", "label": "_value =", "type": "assigned_variable", "loc": [1778, 1778], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1777_C12", "vector": [14, 5, 0.6566, 0.0004, 5, 0.27, 0.0, 54, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _value = self['_value'] = 'on'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1779_C12", "label": "if", "type": "if", "loc": [1779, 1784], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1776_C8", "vector": [4, 4, 0.6579, 0.0022, 4, 0.62, 0.3333, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not value:\n value = []\n elif value is True:\n value = [_value]\n elif not isinstance(value, (list, tuple)):\n value = str(value).split('|')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1780_C16", "label": "value =", "type": "assigned_variable", "loc": [1780, 1780], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1779_C12", "vector": [14, 5, 0.6573, 0.0004, 5, 0.84, 0.0, 441, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1781_C12", "label": "if", "type": "if", "loc": [1781, 1784], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1779_C12", "vector": [4, 5, 0.6582, 0.0015, 5, 0.84, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is True:\n value = [_value]\n elif not isinstance(value, (list, tuple)):\n value = str(value).split('|')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1782_C16", "label": "value =", "type": "assigned_variable", "loc": [1782, 1782], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1781_C12", "vector": [14, 6, 0.6581, 0.0004, 6, 0.71, 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_475:If_L1783_C12", "label": "if", "type": "if", "loc": [1783, 1784], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1781_C12", "vector": [4, 6, 0.6586, 0.0007, 6, 0.71, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not isinstance(value, (list, tuple)):\n value = str(value).split('|')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1784_C16", "label": "value = split()", "type": "assigned_variable", "loc": [1784, 1784], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1783_C12", "vector": [14, 7, 0.6588, 0.0004, 7, 0.58, 0.0, 441, 3, 1, 0, 0, 908, 10, 2], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " value = str(value).split('|')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1785_C12", "label": "assign", "type": "assigned_variable", "loc": [1785, 1785], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1776_C8", "vector": [14, 4, 0.6592, 0.0004, 4, 0.62, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_checked'] = _value in value and 'checked' or None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1786_C8", "label": "if", "type": "if", "loc": [1786, 1795], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1776_C8", "vector": [4, 4, 0.6612, 0.0037, 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 t == 'radio':\n if str(value) == str(_value):\n self['_checked'] = 'checked'\n else:\n self['_checked'] = None\n elif not t == 'submit':\n if value is None:\n self['value'] = _value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1787_C12", "label": "if", "type": "if", "loc": [1787, 1790], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1786_C8", "vector": [4, 5, 0.6605, 0.0015, 5, 0.79, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if str(value) == str(_value):\n self['_checked'] = 'checked'\n else:\n self['_checked'] = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1788_C16", "label": "assign", "type": "assigned_variable", "loc": [1788, 1788], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1787_C12", "vector": [14, 6, 0.6603, 0.0004, 6, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_checked'] = 'checked'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1790_C16", "label": "assign", "type": "assigned_variable", "loc": [1790, 1790], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1787_C12", "vector": [14, 6, 0.661, 0.0004, 6, 0.45, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_checked'] = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1791_C8", "label": "if", "type": "if", "loc": [1791, 1795], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1786_C8", "vector": [4, 5, 0.6621, 0.0018, 5, 0.79, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not t == 'submit':\n if value is None:\n self['value'] = _value\n elif not isinstance(value, list):\n self['_value'] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1792_C12", "label": "if", "type": "if", "loc": [1792, 1795], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1791_C8", "vector": [4, 6, 0.6623, 0.0015, 6, 0.17, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value is None:\n self['value'] = _value\n elif not isinstance(value, list):\n self['_value'] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1793_C16", "label": "assign", "type": "assigned_variable", "loc": [1793, 1793], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1792_C12", "vector": [14, 7, 0.6621, 0.0004, 7, 0.43, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['value'] = _value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1794_C12", "label": "if", "type": "if", "loc": [1794, 1795], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1792_C12", "vector": [4, 7, 0.6627, 0.0007, 7, 0.43, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not isinstance(value, list):\n self['_value'] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1795_C16", "label": "assign", "type": "assigned_variable", "loc": [1795, 1795], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1794_C12", "vector": [14, 8, 0.6629, 0.0004, 8, 0.46, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_value'] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1797_C4", "label": "xml", "type": "function", "loc": [1797, 1814], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1694_C0", "vector": [2, 1, 0.6667, 0.0066, 1, 0.13, 1.0, 324, 0, 1, 1, 0, 0, 0, 9], "semantic": {"name": "xml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def xml(self):\n name = self.attributes.get('_name', None)\n if name and hasattr(self, 'errors') \\\n and self.errors.get(name, None) \\\n and self['hideerror'] != True:\n self['_class'] = (self['_class'] and self['_class']\n + ' ' or '') + 'invalidinput'\n return DIV.xml(self) + DIV("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1798_C8", "label": "name = get()", "type": "assigned_variable", "loc": [1798, 1798], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1797_C4", "vector": [14, 2, 0.664, 0.0004, 2, 0.55, 0.0, 57, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " name = self.attributes.get('_name', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1799_C8", "label": "if", "type": "if", "loc": [1799, 1814], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1797_C4", "vector": [4, 2, 0.6671, 0.0059, 2, 0.55, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name and hasattr(self, 'errors') \\\n and self.errors.get(name, None) \\\n and self['hideerror'] != True:\n self['_class'] = (self['_class'] and self['_class']\n + ' ' or '') + 'invalidinput'\n return DIV.xml(self) + DIV(\n DIV(\n self.errors[name], _class='error',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1802_C12", "label": "assign", "type": "assigned_variable", "loc": [1802, 1803], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1799_C8", "vector": [14, 3, 0.6656, 0.0007, 3, 0.13, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_class'] = (self['_class'] and self['_class']\n + ' ' or '') + 'invalidinput'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1804_C12", "label": "return", "type": "return", "loc": [1804, 1808], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1799_C8", "vector": [13, 3, 0.6669, 0.0018, 3, 0.13, 0.3333, 0, 4, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return DIV.xml(self) + DIV(\n DIV(\n self.errors[name], _class='error',\n errors=None, _id='%s__error' % name),\n _class='error_wrapper').xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1810_C12", "label": "if", "type": "if", "loc": [1810, 1813], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1799_C8", "vector": [4, 3, 0.6689, 0.0015, 3, 0.13, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self['_class'] and self['_class'].endswith('invalidinput'):\n self['_class'] = self['_class'][:-12]\n if self['_class'] == '':\n self['_class'] = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1811_C16", "label": "assign", "type": "assigned_variable", "loc": [1811, 1811], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1810_C12", "vector": [14, 4, 0.6688, 0.0004, 4, 0.44, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_class'] = self['_class'][:-12]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1812_C16", "label": "if", "type": "if", "loc": [1812, 1813], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1810_C12", "vector": [4, 4, 0.6693, 0.0007, 4, 0.44, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self['_class'] == '':\n self['_class'] = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1813_C20", "label": "assign", "type": "assigned_variable", "loc": [1813, 1813], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1812_C16", "vector": [14, 5, 0.6695, 0.0004, 5, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_class'] = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1814_C12", "label": "return", "type": "return", "loc": [1814, 1814], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1799_C8", "vector": [13, 3, 0.6699, 0.0004, 3, 0.13, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return DIV.xml(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1817_C0", "label": "TEXTAREA", "type": "class", "loc": [1817, 1837], "level": 0, "parent": null, "vector": [3, 0, 0.6747, 0.0078, 0, 0.66, 0.8447, 90, 0, 1, 0, 0, 514, 0, 0], "semantic": {"name": "TEXTAREA", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TEXTAREA(INPUT):\n\n \"\"\"\n example::\n\n TEXTAREA(_name='sometext', value='blah '*100, requires=IS_NOT_EMPTY())\n\n 'blah blah blah ...' will be the content of the textarea field."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1819_C4", "label": "expression", "type": "expression", "loc": [1819, 1825], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1817_C0", "vector": [8, 1, 0.6728, 0.0026, 1, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n example::\n\n TEXTAREA(_name='sometext', value='blah '*100, requires=IS_NOT_EMPTY())\n\n 'blah blah blah ...' will be the content of the textarea field.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1827_C4", "label": "tag =", "type": "assigned_variable", "loc": [1827, 1827], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1817_C0", "vector": [14, 1, 0.6747, 0.0004, 1, 0.18, 0.5, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'textarea'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1829_C4", "label": "_postprocessing", "type": "function", "loc": [1829, 1837], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1817_C0", "vector": [2, 1, 0.6769, 0.0033, 1, 0.18, 1.0, 455, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "_postprocessing", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _postprocessing(self):\n if not '_rows' in self.attributes:\n self['_rows'] = 10\n if not '_cols' in self.attributes:\n self['_cols'] = 40\n if not self['value'] is None:\n self.components = [self['value']]\n elif self.components:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1830_C8", "label": "if", "type": "if", "loc": [1830, 1831], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1829_C4", "vector": [4, 2, 0.676, 0.0007, 2, 0.02, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not '_rows' in self.attributes:\n self['_rows'] = 10"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1831_C12", "label": "assign", "type": "assigned_variable", "loc": [1831, 1831], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1830_C8", "vector": [14, 3, 0.6761, 0.0004, 3, 0.17, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_rows'] = 10"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1832_C8", "label": "if", "type": "if", "loc": [1832, 1833], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1829_C4", "vector": [4, 2, 0.6767, 0.0007, 2, 0.02, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not '_cols' in self.attributes:\n self['_cols'] = 40"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1833_C12", "label": "assign", "type": "assigned_variable", "loc": [1833, 1833], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1832_C8", "vector": [14, 3, 0.6769, 0.0004, 3, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_cols'] = 40"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1834_C8", "label": "if", "type": "if", "loc": [1834, 1837], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1829_C4", "vector": [4, 2, 0.6778, 0.0015, 2, 0.02, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self['value'] is None:\n self.components = [self['value']]\n elif self.components:\n self['value'] = self.components[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1835_C12", "label": "self.components =", "type": "assigned_variable", "loc": [1835, 1835], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1834_C8", "vector": [14, 3, 0.6776, 0.0004, 3, 0.56, 0.0, 687, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.components", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.components = [self['value']]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1836_C8", "label": "if", "type": "if", "loc": [1836, 1837], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1834_C8", "vector": [4, 3, 0.6782, 0.0007, 3, 0.56, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.components:\n self['value'] = self.components[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1837_C12", "label": "assign", "type": "assigned_variable", "loc": [1837, 1837], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1836_C8", "vector": [14, 4, 0.6784, 0.0004, 4, 0.14, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['value'] = self.components[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1840_C0", "label": "OPTION", "type": "class", "loc": [1840, 1846], "level": 0, "parent": null, "vector": [3, 0, 0.6806, 0.0026, 0, 0.66, 0.8544, 71, 0, 1, 0, 0, 697, 0, 1], "semantic": {"name": "OPTION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OPTION(DIV):\n\n tag = 'option'\n\n def _fixup(self):\n if not '_value' in self.attributes:\n self.attributes['_value'] = str(self.components[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1842_C4", "label": "tag =", "type": "assigned_variable", "loc": [1842, 1842], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1840_C0", "vector": [14, 1, 0.6802, 0.0004, 1, 0.18, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'option'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1844_C4", "label": "_fixup", "type": "function", "loc": [1844, 1846], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1840_C0", "vector": [2, 1, 0.6813, 0.0011, 1, 0.18, 1.0, 339, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_fixup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _fixup(self):\n if not '_value' in self.attributes:\n self.attributes['_value'] = str(self.components[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1845_C8", "label": "if", "type": "if", "loc": [1845, 1846], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1844_C4", "vector": [4, 2, 0.6815, 0.0007, 2, 0.2, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not '_value' in self.attributes:\n self.attributes['_value'] = str(self.components[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1846_C12", "label": " = str()", "type": "assigned_variable", "loc": [1846, 1846], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1845_C8", "vector": [14, 3, 0.6817, 0.0004, 3, 0.14, 0.0, 0, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " self.attributes['_value'] = str(self.components[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1849_C0", "label": "OBJECT", "type": "class", "loc": [1849, 1851], "level": 0, "parent": null, "vector": [3, 0, 0.6832, 0.0011, 0, 0.66, 0.8641, 926, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "OBJECT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OBJECT(DIV):\n\n tag = 'object'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1851_C4", "label": "tag =", "type": "assigned_variable", "loc": [1851, 1851], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1849_C0", "vector": [14, 1, 0.6835, 0.0004, 1, 0.62, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'object'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1854_C0", "label": "OPTGROUP", "type": "class", "loc": [1854, 1865], "level": 0, "parent": null, "vector": [3, 0, 0.6867, 0.0044, 0, 0.66, 0.8738, 380, 0, 1, 0, 0, 697, 0, 5], "semantic": {"name": "OPTGROUP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OPTGROUP(DIV):\n\n tag = 'optgroup'\n\n def _fixup(self):\n components = []\n for c in self.components:\n if isinstance(c, OPTION):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1856_C4", "label": "tag =", "type": "assigned_variable", "loc": [1856, 1856], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1854_C0", "vector": [14, 1, 0.6854, 0.0004, 1, 0.32, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'optgroup'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1858_C4", "label": "_fixup", "type": "function", "loc": [1858, 1865], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1854_C0", "vector": [2, 1, 0.6874, 0.003, 1, 0.32, 1.0, 339, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "_fixup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _fixup(self):\n components = []\n for c in self.components:\n if isinstance(c, OPTION):\n components.append(c)\n else:\n components.append(OPTION(c, _value=str(c)))\n self.components = components"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1859_C8", "label": "components =", "type": "assigned_variable", "loc": [1859, 1859], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1858_C4", "vector": [14, 2, 0.6865, 0.0004, 2, 0.52, 0.0, 11, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "components", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " components = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1860_C8", "label": "for c", "type": "for", "loc": [1860, 1864], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1858_C4", "vector": [6, 2, 0.6876, 0.0018, 2, 0.52, 0.5, 411, 7, 0, 0, 0, 0, 0, 5], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in self.components:\n if isinstance(c, OPTION):\n components.append(c)\n else:\n components.append(OPTION(c, _value=str(c)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1861_C12", "label": "if", "type": "if", "loc": [1861, 1864], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1860_C8", "vector": [4, 3, 0.6878, 0.0015, 3, 0.95, 0.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(c, OPTION):\n components.append(c)\n else:\n components.append(OPTION(c, _value=str(c)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1862_C16", "label": "append()", "type": "expression", "loc": [1862, 1862], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1861_C12", "vector": [8, 4, 0.6876, 0.0004, 4, 0.37, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " components.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1864_C16", "label": "append()", "type": "expression", "loc": [1864, 1864], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1861_C12", "vector": [8, 4, 0.6883, 0.0004, 4, 0.37, 1.0, 243, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " components.append(OPTION(c, _value=str(c)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1865_C8", "label": "self.components =", "type": "assigned_variable", "loc": [1865, 1865], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1858_C4", "vector": [14, 2, 0.6887, 0.0004, 2, 0.52, 1.0, 687, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.components", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.components = components"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1868_C0", "label": "SELECT", "type": "class", "loc": [1868, 1919], "level": 0, "parent": null, "vector": [3, 0, 0.6992, 0.0192, 0, 0.66, 0.8835, 736, 0, 2, 0, 0, 514, 0, 15], "semantic": {"name": "SELECT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SELECT(INPUT):\n\n \"\"\"\n example::\n\n >>> from validators import IS_IN_SET\n >>> SELECT('yes', 'no', _name='selector', value='yes',\n ... requires=IS_IN_SET(['yes', 'no'])).xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1870_C4", "label": "expression", "type": "expression", "loc": [1870, 1878], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1868_C0", "vector": [8, 1, 0.692, 0.0033, 1, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n example::\n\n >>> from validators import IS_IN_SET\n >>> SELECT('yes', 'no', _name='selector', value='yes',\n ... requires=IS_IN_SET(['yes', 'no'])).xml()\n '<select name=\\\"selector\\\"><option selected=\\\"selected\\\" value=\\\"yes\\\">yes</option><option value=\\\"no\\\">no</option></select>'\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1880_C4", "label": "tag =", "type": "assigned_variable", "loc": [1880, 1880], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1868_C0", "vector": [14, 1, 0.6942, 0.0004, 1, 0.41, 0.3333, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'select'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1882_C4", "label": "_fixup", "type": "function", "loc": [1882, 1889], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1868_C0", "vector": [2, 1, 0.6963, 0.003, 1, 0.41, 0.6667, 339, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "_fixup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _fixup(self):\n components = []\n for c in self.components:\n if isinstance(c, (OPTION, OPTGROUP)):\n components.append(c)\n else:\n components.append(OPTION(c, _value=str(c)))\n self.components = components"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1883_C8", "label": "components =", "type": "assigned_variable", "loc": [1883, 1883], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1882_C4", "vector": [14, 2, 0.6953, 0.0004, 2, 0.74, 0.0, 11, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "components", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " components = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1884_C8", "label": "for c", "type": "for", "loc": [1884, 1888], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1882_C4", "vector": [6, 2, 0.6965, 0.0018, 2, 0.74, 0.5, 411, 7, 0, 0, 0, 0, 0, 5], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in self.components:\n if isinstance(c, (OPTION, OPTGROUP)):\n components.append(c)\n else:\n components.append(OPTION(c, _value=str(c)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1885_C12", "label": "if", "type": "if", "loc": [1885, 1888], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1884_C8", "vector": [4, 3, 0.6966, 0.0015, 3, 0.56, 0.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(c, (OPTION, OPTGROUP)):\n components.append(c)\n else:\n components.append(OPTION(c, _value=str(c)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1886_C16", "label": "append()", "type": "expression", "loc": [1886, 1886], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1885_C12", "vector": [8, 4, 0.6965, 0.0004, 4, 0.15, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " components.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1888_C16", "label": "append()", "type": "expression", "loc": [1888, 1888], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1885_C12", "vector": [8, 4, 0.6972, 0.0004, 4, 0.15, 1.0, 243, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " components.append(OPTION(c, _value=str(c)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1889_C8", "label": "self.components =", "type": "assigned_variable", "loc": [1889, 1889], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1882_C4", "vector": [14, 2, 0.6976, 0.0004, 2, 0.74, 1.0, 687, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.components", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.components = components"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1891_C4", "label": "_postprocessing", "type": "function", "loc": [1891, 1919], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1868_C0", "vector": [2, 1, 0.7035, 0.0107, 1, 0.41, 1.0, 455, 0, 1, 0, 0, 0, 0, 10], "semantic": {"name": "_postprocessing", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _postprocessing(self):\n component_list = []\n for c in self.components:\n if isinstance(c, OPTGROUP):\n component_list.append(c.components)\n else:\n component_list.append([c])\n options = itertools.chain(*component_list)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1892_C8", "label": "component_list =", "type": "assigned_variable", "loc": [1892, 1892], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1891_C4", "vector": [14, 2, 0.6987, 0.0004, 2, 0.49, 0.0, 698, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "component_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " component_list = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1893_C8", "label": "for c", "type": "for", "loc": [1893, 1897], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1891_C4", "vector": [6, 2, 0.6998, 0.0018, 2, 0.49, 0.25, 411, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in self.components:\n if isinstance(c, OPTGROUP):\n component_list.append(c.components)\n else:\n component_list.append([c])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1894_C12", "label": "if", "type": "if", "loc": [1894, 1897], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1893_C8", "vector": [4, 3, 0.7, 0.0015, 3, 0.51, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(c, OPTGROUP):\n component_list.append(c.components)\n else:\n component_list.append([c])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1895_C16", "label": "append()", "type": "expression", "loc": [1895, 1895], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1894_C12", "vector": [8, 4, 0.6998, 0.0004, 4, 0.74, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " component_list.append(c.components)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1897_C16", "label": "append()", "type": "expression", "loc": [1897, 1897], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1894_C12", "vector": [8, 4, 0.7005, 0.0004, 4, 0.74, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " component_list.append([c])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1898_C8", "label": "options = chain()", "type": "assigned_variable", "loc": [1898, 1898], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1891_C4", "vector": [14, 2, 0.7009, 0.0004, 2, 0.49, 0.5, 707, 3, 1, 0, 0, 271, 10, 1], "semantic": {"name": "options", "arg_names": [], "import_names": [], "rhs_call_name": "chain", "annotation": ""}, "snippet": " options = itertools.chain(*component_list)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1900_C8", "label": "value =", "type": "assigned_variable", "loc": [1900, 1900], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1891_C4", "vector": [14, 2, 0.7016, 0.0004, 2, 0.49, 0.75, 441, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = self['value']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1901_C8", "label": "if", "type": "if", "loc": [1901, 1919], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1891_C4", "vector": [4, 2, 0.7053, 0.007, 2, 0.49, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not value is None:\n if not self['_multiple']:\n for c in options: # my patch\n if ((value is not None) and\n (str(c['_value']) == str(value))):\n c['_selected'] = 'selected'\n else:\n c['_selected'] = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1902_C12", "label": "if", "type": "if", "loc": [1902, 1919], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1901_C8", "vector": [4, 3, 0.7055, 0.0066, 3, 0.09, 0.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self['_multiple']:\n for c in options: # my patch\n if ((value is not None) and\n (str(c['_value']) == str(value))):\n c['_selected'] = 'selected'\n else:\n c['_selected'] = None\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1903_C16", "label": "for c", "type": "for", "loc": [1903, 1908], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1902_C12", "vector": [6, 4, 0.7037, 0.0022, 4, 0.33, 0.0, 411, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in options: # my patch\n if ((value is not None) and\n (str(c['_value']) == str(value))):\n c['_selected'] = 'selected'\n else:\n c['_selected'] = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1904_C20", "label": "if", "type": "if", "loc": [1904, 1908], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1903_C16", "vector": [4, 5, 0.7038, 0.0018, 5, 0.18, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ((value is not None) and\n (str(c['_value']) == str(value))):\n c['_selected'] = 'selected'\n else:\n c['_selected'] = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1906_C24", "label": "assign", "type": "assigned_variable", "loc": [1906, 1906], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1904_C20", "vector": [14, 6, 0.7038, 0.0004, 6, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c['_selected'] = 'selected'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1908_C24", "label": "assign", "type": "assigned_variable", "loc": [1908, 1908], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1904_C20", "vector": [14, 6, 0.7046, 0.0004, 6, 0.75, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c['_selected'] = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1910_C16", "label": "if", "type": "if", "loc": [1910, 1913], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1902_C12", "vector": [4, 4, 0.7059, 0.0015, 4, 0.33, 0.5, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, (list, tuple)):\n values = [str(item) for item in value]\n else:\n values = [str(value)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1911_C20", "label": "values =", "type": "assigned_variable", "loc": [1911, 1911], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1910_C16", "vector": [14, 5, 0.7057, 0.0004, 5, 0.77, 0.0, 721, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "values", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " values = [str(item) for item in value]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1913_C20", "label": "values =", "type": "assigned_variable", "loc": [1913, 1913], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1910_C16", "vector": [14, 5, 0.7064, 0.0004, 5, 0.77, 1.0, 721, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "values", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " values = [str(value)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1914_C16", "label": "for c", "type": "for", "loc": [1914, 1919], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1902_C12", "vector": [6, 4, 0.7077, 0.0022, 4, 0.33, 1.0, 411, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in options: # my patch\n if ((value is not None) and\n (str(c['_value']) in values)):\n c['_selected'] = 'selected'\n else:\n c['_selected'] = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1915_C20", "label": "if", "type": "if", "loc": [1915, 1919], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1914_C16", "vector": [4, 5, 0.7079, 0.0018, 5, 0.18, 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) and\n (str(c['_value']) in values)):\n c['_selected'] = 'selected'\n else:\n c['_selected'] = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1917_C24", "label": "assign", "type": "assigned_variable", "loc": [1917, 1917], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1915_C20", "vector": [14, 6, 0.7079, 0.0004, 6, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c['_selected'] = 'selected'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1919_C24", "label": "assign", "type": "assigned_variable", "loc": [1919, 1919], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1915_C20", "vector": [14, 6, 0.7086, 0.0004, 6, 0.66, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c['_selected'] = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1922_C0", "label": "FIELDSET", "type": "class", "loc": [1922, 1924], "level": 0, "parent": null, "vector": [3, 0, 0.7101, 0.0011, 0, 0.66, 0.8932, 987, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "FIELDSET", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FIELDSET(DIV):\n\n tag = 'fieldset'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1924_C4", "label": "tag =", "type": "assigned_variable", "loc": [1924, 1924], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1922_C0", "vector": [14, 1, 0.7105, 0.0004, 1, 0.3, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'fieldset'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1927_C0", "label": "LEGEND", "type": "class", "loc": [1927, 1929], "level": 0, "parent": null, "vector": [3, 0, 0.712, 0.0011, 0, 0.66, 0.9029, 321, 0, 0, 0, 0, 697, 0, 0], "semantic": {"name": "LEGEND", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class LEGEND(DIV):\n\n tag = 'legend'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1929_C4", "label": "tag =", "type": "assigned_variable", "loc": [1929, 1929], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1927_C0", "vector": [14, 1, 0.7123, 0.0004, 1, 0.74, 0.0, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'legend'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "label": "FORM", "type": "class", "loc": [1932, 2272], "level": 0, "parent": null, "vector": [3, 0, 0.7762, 0.1259, 0, 0.66, 0.9126, 690, 0, 16, 0, 0, 697, 0, 99], "semantic": {"name": "FORM", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FORM(DIV):\n\n \"\"\"\n example::\n\n >>> from validators import IS_NOT_EMPTY\n >>> form=FORM(INPUT(_name=\\\"test\\\", requires=IS_NOT_EMPTY()))\n >>> form.xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1934_C4", "label": "expression", "type": "expression", "loc": [1934, 1951], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "vector": [8, 1, 0.7173, 0.0066, 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 example::\n\n >>> from validators import IS_NOT_EMPTY\n >>> form=FORM(INPUT(_name=\\\"test\\\", requires=IS_NOT_EMPTY()))\n >>> form.xml()\n '<form action=\\\"#\\\" enctype=\\\"multipart/form-data\\\" method=\\\"post\\\"><input name=\\\"test\\\" type=\\\"text\\\" /></form>'\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1953_C4", "label": "tag =", "type": "assigned_variable", "loc": [1953, 1953], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "vector": [14, 1, 0.7212, 0.0004, 1, 0.68, 0.0625, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'form'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1955_C4", "label": "__init__", "type": "function", "loc": [1955, 1960], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "vector": [2, 1, 0.7229, 0.0022, 1, 0.68, 0.125, 555, 0, 3, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self", "components", "attributes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *components, **attributes):\n DIV.__init__(self, *components, **attributes)\n self.vars = Storage()\n self.errors = Storage()\n self.latest = Storage()\n self.accepted = None # none for not submitted"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1956_C8", "label": "__init__()", "type": "expression", "loc": [1956, 1956], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1955_C4", "vector": [8, 2, 0.7223, 0.0004, 2, 0.16, 0.0, 555, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " DIV.__init__(self, *components, **attributes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1957_C8", "label": "self.vars = Storage()", "type": "assigned_variable", "loc": [1957, 1957], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1955_C4", "vector": [14, 2, 0.7227, 0.0004, 2, 0.16, 0.25, 359, 3, 0, 0, 0, 850, 10, 1], "semantic": {"name": "self.vars", "arg_names": [], "import_names": [], "rhs_call_name": "Storage", "annotation": ""}, "snippet": " self.vars = Storage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1958_C8", "label": "self.errors = Storage()", "type": "assigned_variable", "loc": [1958, 1958], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1955_C4", "vector": [14, 2, 0.723, 0.0004, 2, 0.16, 0.5, 165, 3, 0, 0, 0, 850, 10, 1], "semantic": {"name": "self.errors", "arg_names": [], "import_names": [], "rhs_call_name": "Storage", "annotation": ""}, "snippet": " self.errors = Storage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1959_C8", "label": "self.latest = Storage()", "type": "assigned_variable", "loc": [1959, 1959], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1955_C4", "vector": [14, 2, 0.7234, 0.0004, 2, 0.16, 0.75, 490, 3, 0, 0, 0, 850, 10, 1], "semantic": {"name": "self.latest", "arg_names": [], "import_names": [], "rhs_call_name": "Storage", "annotation": ""}, "snippet": " self.latest = Storage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1960_C8", "label": "self.accepted =", "type": "assigned_variable", "loc": [1960, 1960], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1955_C4", "vector": [14, 2, 0.7238, 0.0004, 2, 0.16, 1.0, 285, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.accepted", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.accepted = None # none for not submitted"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1962_C4", "label": "assert_status", "type": "function", "loc": [1962, 1963], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "vector": [2, 1, 0.7247, 0.0007, 1, 0.68, 0.1875, 930, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "assert_status", "arg_names": ["self", "status", "request_vars"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def assert_status(self, status, request_vars):\n return status"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1963_C8", "label": "return", "type": "return", "loc": [1963, 1963], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1962_C4", "vector": [13, 2, 0.7249, 0.0004, 2, 0.03, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return status"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "label": "accepts", "type": "function", "loc": [1965, 2037], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "vector": [2, 1, 0.7389, 0.027, 1, 0.68, 0.25, 319, 0, 8, 1, 0, 0, 0, 20], "semantic": {"name": "accepts", "arg_names": ["self", "request_vars", "session", "formname", "keepvalues", "onvalidation", "hideerror", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def accepts(\n self,\n request_vars,\n session=None,\n formname='default',\n keepvalues=False,\n onvalidation=None,\n hideerror=False,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1975_C8", "label": "expression", "type": "expression", "loc": [1975, 1977], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "vector": [8, 2, 0.7297, 0.0011, 2, 0.11, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n kwargs is not used but allows to specify the same interface for FORM and SQLFORM\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1978_C8", "label": "if", "type": "if", "loc": [1978, 1979], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "vector": [4, 2, 0.7306, 0.0007, 2, 0.11, 0.0476, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request_vars.__class__.__name__ == 'Request':\n request_vars = request_vars.post_vars"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1979_C12", "label": "request_vars =", "type": "assigned_variable", "loc": [1979, 1979], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1978_C8", "vector": [14, 3, 0.7308, 0.0004, 3, 0.74, 0.0, 951, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "request_vars", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request_vars = request_vars.post_vars"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1980_C8", "label": "clear()", "type": "expression", "loc": [1980, 1980], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "vector": [8, 2, 0.7312, 0.0004, 2, 0.11, 0.0952, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " self.errors.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1981_C8", "label": "self.request_vars = Storage()", "type": "assigned_variable", "loc": [1981, 1981], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "vector": [14, 2, 0.7315, 0.0004, 2, 0.11, 0.1429, 215, 3, 0, 0, 0, 850, 10, 1], "semantic": {"name": "self.request_vars", "arg_names": [], "import_names": [], "rhs_call_name": "Storage", "annotation": ""}, "snippet": " self.request_vars = Storage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1982_C8", "label": "update()", "type": "expression", "loc": [1982, 1982], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "vector": [8, 2, 0.7319, 0.0004, 2, 0.11, 0.1905, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.request_vars.update(request_vars)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1983_C8", "label": "self.session =", "type": "assigned_variable", "loc": [1983, 1983], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "vector": [14, 2, 0.7323, 0.0004, 2, 0.11, 0.2381, 77, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.session", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session = session"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1984_C8", "label": "self.formname =", "type": "assigned_variable", "loc": [1984, 1984], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "vector": [14, 2, 0.7326, 0.0004, 2, 0.11, 0.2857, 966, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.formname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.formname = formname"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1985_C8", "label": "self.keepvalues =", "type": "assigned_variable", "loc": [1985, 1985], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "vector": [14, 2, 0.733, 0.0004, 2, 0.11, 0.3333, 95, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.keepvalues", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.keepvalues = keepvalues"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1990_C8", "label": "status =", "type": "assigned_variable", "loc": [1990, 1990], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "vector": [14, 2, 0.7349, 0.0004, 2, 0.11, 0.381, 699, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " status = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1991_C8", "label": "changed =", "type": "assigned_variable", "loc": [1991, 1991], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "vector": [14, 2, 0.7352, 0.0004, 2, 0.11, 0.4286, 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_475:Assign_L1992_C8", "label": "request_vars =", "type": "assigned_variable", "loc": [1992, 1992], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "vector": [14, 2, 0.7356, 0.0004, 2, 0.11, 0.4762, 951, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "request_vars", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request_vars = self.request_vars"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1993_C8", "label": "if", "type": "if", "loc": [1993, 1997], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "vector": [4, 2, 0.7367, 0.0018, 2, 0.11, 0.5238, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if session is not None:\n formkey = session.get('_formkey[%s]' % formname, None)\n # check if user tampering with form and void CSRF\n if not formkey or formkey != request_vars._formkey:\n status = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1994_C12", "label": "formkey = get()", "type": "assigned_variable", "loc": [1994, 1994], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1993_C8", "vector": [14, 3, 0.7363, 0.0004, 3, 0.43, 0.0, 478, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "formkey", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " formkey = session.get('_formkey[%s]' % formname, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1996_C12", "label": "if", "type": "if", "loc": [1996, 1997], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1993_C8", "vector": [4, 3, 0.7373, 0.0007, 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 not formkey or formkey != request_vars._formkey:\n status = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1997_C16", "label": "status =", "type": "assigned_variable", "loc": [1997, 1997], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1996_C12", "vector": [14, 4, 0.7374, 0.0004, 4, 0.08, 0.0, 699, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " status = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1998_C8", "label": "if", "type": "if", "loc": [1998, 1999], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "vector": [4, 2, 0.738, 0.0007, 2, 0.11, 0.5714, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if formname != request_vars._formname:\n status = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1999_C12", "label": "status =", "type": "assigned_variable", "loc": [1999, 1999], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1998_C8", "vector": [14, 3, 0.7382, 0.0004, 3, 0.63, 0.0, 699, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " status = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2000_C8", "label": "if", "type": "if", "loc": [2000, 2004], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "vector": [4, 2, 0.7393, 0.0018, 2, 0.11, 0.619, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if status and session:\n # check if editing a record that has been modified by the server\n if hasattr(self, 'record_hash') and self.record_hash != formkey:\n status = False\n self.record_changed = changed = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2002_C12", "label": "if", "type": "if", "loc": [2002, 2004], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2000_C8", "vector": [4, 3, 0.7397, 0.0011, 3, 0.08, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(self, 'record_hash') and self.record_hash != formkey:\n status = False\n self.record_changed = changed = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2003_C16", "label": "status =", "type": "assigned_variable", "loc": [2003, 2003], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2002_C12", "vector": [14, 4, 0.7397, 0.0004, 4, 0.43, 0.0, 699, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " status = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2004_C16", "label": "self.record_changed =", "type": "assigned_variable", "loc": [2004, 2004], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2002_C12", "vector": [14, 4, 0.74, 0.0004, 4, 0.43, 1.0, 715, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.record_changed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.record_changed = changed = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2005_C8", "label": "status = _traverse()", "type": "assigned_variable", "loc": [2005, 2005], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "vector": [14, 2, 0.7404, 0.0004, 2, 0.11, 0.6667, 699, 3, 2, 0, 0, 319, 10, 1], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "_traverse", "annotation": ""}, "snippet": " status = self._traverse(status, hideerror)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2006_C8", "label": "status = assert_status()", "type": "assigned_variable", "loc": [2006, 2006], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "vector": [14, 2, 0.7408, 0.0004, 2, 0.11, 0.7143, 699, 3, 2, 0, 0, 930, 10, 1], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "assert_status", "annotation": ""}, "snippet": " status = self.assert_status(status, request_vars)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2007_C8", "label": "if", "type": "if", "loc": [2007, 2025], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "vector": [4, 2, 0.7445, 0.007, 2, 0.11, 0.7619, 0, 2, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if onvalidation:\n if isinstance(onvalidation, dict):\n onsuccess = onvalidation.get('onsuccess', None)\n onfailure = onvalidation.get('onfailure', None)\n onchange = onvalidation.get('onchange', None)\n if [k for k in onvalidation if not k in (\n 'onsuccess','onfailure','onchange')]:\n raise RuntimeError('Invalid key in onvalidate dict')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2008_C12", "label": "if", "type": "if", "loc": [2008, 2025], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2007_C8", "vector": [4, 3, 0.7446, 0.0066, 3, 0.59, 0.0, 0, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(onvalidation, dict):\n onsuccess = onvalidation.get('onsuccess', None)\n onfailure = onvalidation.get('onfailure', None)\n onchange = onvalidation.get('onchange', None)\n if [k for k in onvalidation if not k in (\n 'onsuccess','onfailure','onchange')]:\n raise RuntimeError('Invalid key in onvalidate dict')\n if onsuccess and status:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2009_C16", "label": "onsuccess = get()", "type": "assigned_variable", "loc": [2009, 2009], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2008_C12", "vector": [14, 4, 0.7419, 0.0004, 4, 0.33, 0.0, 745, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "onsuccess", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " onsuccess = onvalidation.get('onsuccess', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2010_C16", "label": "onfailure = get()", "type": "assigned_variable", "loc": [2010, 2010], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2008_C12", "vector": [14, 4, 0.7422, 0.0004, 4, 0.33, 0.1429, 344, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "onfailure", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " onfailure = onvalidation.get('onfailure', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2011_C16", "label": "onchange = get()", "type": "assigned_variable", "loc": [2011, 2011], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2008_C12", "vector": [14, 4, 0.7426, 0.0004, 4, 0.33, 0.2857, 89, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "onchange", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " onchange = onvalidation.get('onchange', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2012_C16", "label": "if", "type": "if", "loc": [2012, 2014], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2008_C12", "vector": [4, 4, 0.7434, 0.0011, 4, 0.33, 0.4286, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if [k for k in onvalidation if not k in (\n 'onsuccess','onfailure','onchange')]:\n raise RuntimeError('Invalid key in onvalidate dict')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2015_C16", "label": "if", "type": "if", "loc": [2015, 2016], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2008_C12", "vector": [4, 4, 0.7443, 0.0007, 4, 0.33, 0.5714, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if onsuccess and status:\n call_as_list(onsuccess,self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2016_C20", "label": "call_as_list()", "type": "expression", "loc": [2016, 2016], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2015_C16", "vector": [8, 5, 0.7445, 0.0004, 5, 0.3, 0.0, 656, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "call_as_list", "arg_names": [], "import_names": [], "rhs_call_name": "call_as_list", "annotation": ""}, "snippet": " call_as_list(onsuccess,self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2017_C16", "label": "if", "type": "if", "loc": [2017, 2019], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2008_C12", "vector": [4, 4, 0.7452, 0.0011, 4, 0.33, 0.7143, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if onfailure and request_vars and not status:\n call_as_list(onfailure,self)\n status = len(self.errors) == 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2018_C20", "label": "call_as_list()", "type": "expression", "loc": [2018, 2018], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2017_C16", "vector": [8, 5, 0.7452, 0.0004, 5, 0.36, 0.0, 656, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "call_as_list", "arg_names": [], "import_names": [], "rhs_call_name": "call_as_list", "annotation": ""}, "snippet": " call_as_list(onfailure,self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2019_C20", "label": "status =", "type": "assigned_variable", "loc": [2019, 2019], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2017_C16", "vector": [14, 5, 0.7456, 0.0004, 5, 0.36, 1.0, 699, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " status = len(self.errors) == 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2020_C16", "label": "if", "type": "if", "loc": [2020, 2023], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2008_C12", "vector": [4, 4, 0.7465, 0.0015, 4, 0.33, 0.8571, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if changed:\n if onchange and self.record_changed and \\\n self.detect_record_change:\n call_as_list(onchange,self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2021_C20", "label": "if", "type": "if", "loc": [2021, 2023], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2020_C16", "vector": [4, 5, 0.7467, 0.0011, 5, 0.19, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if onchange and self.record_changed and \\\n self.detect_record_change:\n call_as_list(onchange,self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2023_C24", "label": "call_as_list()", "type": "expression", "loc": [2023, 2023], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2021_C20", "vector": [8, 6, 0.747, 0.0004, 6, 0.17, 0.0, 656, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "call_as_list", "arg_names": [], "import_names": [], "rhs_call_name": "call_as_list", "annotation": ""}, "snippet": " call_as_list(onchange,self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2024_C12", "label": "if", "type": "if", "loc": [2024, 2025], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2008_C12", "vector": [4, 4, 0.7476, 0.0007, 4, 0.33, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif status:\n call_as_list(onvalidation, self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2025_C16", "label": "call_as_list()", "type": "expression", "loc": [2025, 2025], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2024_C12", "vector": [8, 5, 0.7478, 0.0004, 5, 0.94, 0.0, 656, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "call_as_list", "arg_names": [], "import_names": [], "rhs_call_name": "call_as_list", "annotation": ""}, "snippet": " call_as_list(onvalidation, self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2026_C8", "label": "if", "type": "if", "loc": [2026, 2027], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "vector": [4, 2, 0.7483, 0.0007, 2, 0.11, 0.8095, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.errors:\n status = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2027_C12", "label": "status =", "type": "assigned_variable", "loc": [2027, 2027], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2026_C8", "vector": [14, 3, 0.7485, 0.0004, 3, 0.24, 0.0, 699, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " status = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2028_C8", "label": "if", "type": "if", "loc": [2028, 2033], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "vector": [4, 2, 0.7498, 0.0022, 2, 0.11, 0.8571, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not session is None:\n if hasattr(self, 'record_hash'):\n formkey = self.record_hash\n else:\n formkey = web2py_uuid()\n self.formkey = session['_formkey[%s]' % formname] = formkey"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2029_C12", "label": "if", "type": "if", "loc": [2029, 2032], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2028_C8", "vector": [4, 3, 0.7498, 0.0015, 3, 0.93, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(self, 'record_hash'):\n formkey = self.record_hash\n else:\n formkey = web2py_uuid()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2030_C16", "label": "formkey =", "type": "assigned_variable", "loc": [2030, 2030], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2029_C12", "vector": [14, 4, 0.7496, 0.0004, 4, 0.13, 0.0, 478, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "formkey", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " formkey = self.record_hash"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2032_C16", "label": "formkey = web2py_uuid()", "type": "assigned_variable", "loc": [2032, 2032], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2029_C12", "vector": [14, 4, 0.7504, 0.0004, 4, 0.13, 1.0, 478, 3, 0, 0, 0, 583, 10, 1], "semantic": {"name": "formkey", "arg_names": [], "import_names": [], "rhs_call_name": "web2py_uuid", "annotation": ""}, "snippet": " formkey = web2py_uuid()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2033_C12", "label": "self.formkey =", "type": "assigned_variable", "loc": [2033, 2033], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2028_C8", "vector": [14, 3, 0.7507, 0.0004, 3, 0.93, 1.0, 751, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.formkey", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.formkey = session['_formkey[%s]' % formname] = formkey"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2034_C8", "label": "if", "type": "if", "loc": [2034, 2035], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "vector": [4, 2, 0.7513, 0.0007, 2, 0.11, 0.9048, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if status and not keepvalues:\n self._traverse(False, hideerror)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2035_C12", "label": "_traverse()", "type": "expression", "loc": [2035, 2035], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2034_C8", "vector": [8, 3, 0.7515, 0.0004, 3, 0.68, 0.0, 319, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_traverse", "arg_names": [], "import_names": [], "rhs_call_name": "_traverse", "annotation": ""}, "snippet": " self._traverse(False, hideerror)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2036_C8", "label": "self.accepted =", "type": "assigned_variable", "loc": [2036, 2036], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "vector": [14, 2, 0.7518, 0.0004, 2, 0.11, 0.9524, 285, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.accepted", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.accepted = status"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2037_C8", "label": "return", "type": "return", "loc": [2037, 2037], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "vector": [13, 2, 0.7522, 0.0004, 2, 0.11, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return status"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2039_C4", "label": "_postprocessing", "type": "function", "loc": [2039, 2045], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "vector": [2, 1, 0.7541, 0.0026, 1, 0.68, 0.3125, 455, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "_postprocessing", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _postprocessing(self):\n if not '_action' in self.attributes:\n self['_action'] = '#'\n if not '_method' in self.attributes:\n self['_method'] = 'post'\n if not '_enctype' in self.attributes:\n self['_enctype'] = 'multipart/form-data'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2040_C8", "label": "if", "type": "if", "loc": [2040, 2041], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2039_C4", "vector": [4, 2, 0.7535, 0.0007, 2, 0.48, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not '_action' in self.attributes:\n self['_action'] = '#'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2041_C12", "label": "assign", "type": "assigned_variable", "loc": [2041, 2041], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2040_C8", "vector": [14, 3, 0.7537, 0.0004, 3, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_action'] = '#'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2042_C8", "label": "if", "type": "if", "loc": [2042, 2043], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2039_C4", "vector": [4, 2, 0.7542, 0.0007, 2, 0.48, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not '_method' in self.attributes:\n self['_method'] = 'post'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2043_C12", "label": "assign", "type": "assigned_variable", "loc": [2043, 2043], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2042_C8", "vector": [14, 3, 0.7544, 0.0004, 3, 0.61, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_method'] = 'post'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2044_C8", "label": "if", "type": "if", "loc": [2044, 2045], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2039_C4", "vector": [4, 2, 0.755, 0.0007, 2, 0.48, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not '_enctype' in self.attributes:\n self['_enctype'] = 'multipart/form-data'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2045_C12", "label": "assign", "type": "assigned_variable", "loc": [2045, 2045], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2044_C8", "vector": [14, 3, 0.7552, 0.0004, 3, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_enctype'] = 'multipart/form-data'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2047_C4", "label": "hidden_fields", "type": "function", "loc": [2047, 2059], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "vector": [2, 1, 0.7581, 0.0048, 1, 0.68, 0.375, 463, 0, 1, 1, 0, 0, 0, 10], "semantic": {"name": "hidden_fields", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def hidden_fields(self):\n c = []\n attr = self.attributes.get('hidden', {})\n if 'hidden' in self.attributes:\n c = [INPUT(_type='hidden', _name=key, _value=value)\n for (key, value) in attr.iteritems()]\n if hasattr(self, 'formkey') and self.formkey:\n c.append(INPUT(_type='hidden', _name='_formkey',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2048_C8", "label": "c =", "type": "assigned_variable", "loc": [2048, 2048], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2047_C4", "vector": [14, 2, 0.7563, 0.0004, 2, 0.28, 0.0, 411, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2049_C8", "label": "attr = get()", "type": "assigned_variable", "loc": [2049, 2049], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2047_C4", "vector": [14, 2, 0.7566, 0.0004, 2, 0.28, 0.2, 400, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "attr", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " attr = self.attributes.get('hidden', {})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2050_C8", "label": "if", "type": "if", "loc": [2050, 2052], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2047_C4", "vector": [4, 2, 0.7574, 0.0011, 2, 0.28, 0.4, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'hidden' in self.attributes:\n c = [INPUT(_type='hidden', _name=key, _value=value)\n for (key, value) in attr.iteritems()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2051_C12", "label": "c =", "type": "assigned_variable", "loc": [2051, 2052], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2050_C8", "vector": [14, 3, 0.7576, 0.0007, 3, 0.73, 0.0, 411, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c = [INPUT(_type='hidden', _name=key, _value=value)\n for (key, value) in attr.iteritems()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2053_C8", "label": "if", "type": "if", "loc": [2053, 2055], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2047_C4", "vector": [4, 2, 0.7585, 0.0011, 2, 0.28, 0.6, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(self, 'formkey') and self.formkey:\n c.append(INPUT(_type='hidden', _name='_formkey',\n _value=self.formkey))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2054_C12", "label": "append()", "type": "expression", "loc": [2054, 2055], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2053_C8", "vector": [8, 3, 0.7587, 0.0007, 3, 0.7, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " c.append(INPUT(_type='hidden', _name='_formkey',\n _value=self.formkey))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2056_C8", "label": "if", "type": "if", "loc": [2056, 2058], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2047_C4", "vector": [4, 2, 0.7596, 0.0011, 2, 0.28, 0.8, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(self, 'formname') and self.formname:\n c.append(INPUT(_type='hidden', _name='_formname',\n _value=self.formname))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2057_C12", "label": "append()", "type": "expression", "loc": [2057, 2058], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2056_C8", "vector": [8, 3, 0.7598, 0.0007, 3, 0.33, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " c.append(INPUT(_type='hidden', _name='_formname',\n _value=self.formname))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2059_C8", "label": "return", "type": "return", "loc": [2059, 2059], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2047_C4", "vector": [13, 2, 0.7603, 0.0004, 2, 0.28, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return DIV(c, _style=\"display:none;\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2061_C4", "label": "xml", "type": "function", "loc": [2061, 2066], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "vector": [2, 1, 0.762, 0.0022, 1, 0.68, 0.4375, 324, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "xml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def xml(self):\n newform = FORM(*self.components, **self.attributes)\n hidden_fields = self.hidden_fields()\n if hidden_fields.components:\n newform.append(hidden_fields)\n return DIV.xml(newform)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2062_C8", "label": "newform = FORM()", "type": "assigned_variable", "loc": [2062, 2062], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2061_C4", "vector": [14, 2, 0.7614, 0.0004, 2, 0.54, 0.0, 180, 3, 2, 0, 0, 690, 10, 1], "semantic": {"name": "newform", "arg_names": [], "import_names": [], "rhs_call_name": "FORM", "annotation": ""}, "snippet": " newform = FORM(*self.components, **self.attributes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2063_C8", "label": "hidden_fields = hidden_fields()", "type": "assigned_variable", "loc": [2063, 2063], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2061_C4", "vector": [14, 2, 0.7618, 0.0004, 2, 0.54, 0.3333, 463, 3, 0, 0, 0, 463, 10, 1], "semantic": {"name": "hidden_fields", "arg_names": [], "import_names": [], "rhs_call_name": "hidden_fields", "annotation": ""}, "snippet": " hidden_fields = self.hidden_fields()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2064_C8", "label": "if", "type": "if", "loc": [2064, 2065], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2061_C4", "vector": [4, 2, 0.7624, 0.0007, 2, 0.54, 0.6667, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hidden_fields.components:\n newform.append(hidden_fields)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2065_C12", "label": "append()", "type": "expression", "loc": [2065, 2065], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2064_C8", "vector": [8, 3, 0.7626, 0.0004, 3, 0.09, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " newform.append(hidden_fields)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2066_C8", "label": "return", "type": "return", "loc": [2066, 2066], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2061_C4", "vector": [13, 2, 0.7629, 0.0004, 2, 0.54, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return DIV.xml(newform)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "label": "validate", "type": "function", "loc": [2068, 2151], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "vector": [2, 1, 0.779, 0.031, 1, 0.68, 0.5, 628, 0, 2, 1, 0, 0, 0, 28], "semantic": {"name": "validate", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def validate(self, **kwargs):\n \"\"\"\n This function validates the form,\n you can use it instead of directly form.accepts.\n\n Usage:\n In controller\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2069_C8", "label": "expression", "type": "expression", "loc": [2069, 2098], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "vector": [8, 2, 0.7694, 0.0111, 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 This function validates the form,\n you can use it instead of directly form.accepts.\n\n Usage:\n In controller\n\n def action():"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L2099_C8", "label": "from gluon import current, redirect", "type": "import", "loc": [2099, 2099], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "vector": [1, 2, 0.7751, 0.0004, 2, 0.84, 0.0769, 826, 0, 2, 0, 0, 826, 0, 0], "semantic": {"name": "gluon", "arg_names": [], "import_names": ["current", "redirect"], "rhs_call_name": "", "annotation": ""}, "snippet": " from gluon import current, redirect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2100_C8", "label": " = get()", "type": "assigned_variable", "loc": [2100, 2101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "vector": [14, 2, 0.7757, 0.0007, 2, 0.84, 0.1538, 0, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " kwargs['request_vars'] = kwargs.get(\n 'request_vars', current.request.post_vars)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2102_C8", "label": " = get()", "type": "assigned_variable", "loc": [2102, 2102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "vector": [14, 2, 0.7762, 0.0004, 2, 0.84, 0.2308, 0, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " kwargs['session'] = kwargs.get('session', current.session)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2103_C8", "label": " = get()", "type": "assigned_variable", "loc": [2103, 2103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "vector": [14, 2, 0.7766, 0.0004, 2, 0.84, 0.3077, 0, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " kwargs['dbio'] = kwargs.get('dbio', False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2106_C8", "label": "onsuccess = get()", "type": "assigned_variable", "loc": [2106, 2106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "vector": [14, 2, 0.7777, 0.0004, 2, 0.84, 0.3846, 745, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "onsuccess", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " onsuccess = kwargs.get('onsuccess', 'flash')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2107_C8", "label": "onfailure = get()", "type": "assigned_variable", "loc": [2107, 2107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "vector": [14, 2, 0.7781, 0.0004, 2, 0.84, 0.4615, 344, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "onfailure", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " onfailure = kwargs.get('onfailure', 'flash')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2108_C8", "label": "onchange = get()", "type": "assigned_variable", "loc": [2108, 2108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "vector": [14, 2, 0.7784, 0.0004, 2, 0.84, 0.5385, 89, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "onchange", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " onchange = kwargs.get('onchange', 'flash')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2109_C8", "label": "message_onsuccess = get()", "type": "assigned_variable", "loc": [2109, 2110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "vector": [14, 2, 0.779, 0.0007, 2, 0.84, 0.6154, 232, 3, 2, 0, 0, 607, 10, 2], "semantic": {"name": "message_onsuccess", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " message_onsuccess = kwargs.get('message_onsuccess',\n current.T(\"Success!\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2111_C8", "label": "message_onfailure = get()", "type": "assigned_variable", "loc": [2111, 2112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "vector": [14, 2, 0.7797, 0.0007, 2, 0.84, 0.6923, 566, 3, 2, 0, 0, 607, 10, 2], "semantic": {"name": "message_onfailure", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " message_onfailure = kwargs.get('message_onfailure',\n current.T(\"Errors in form, please check it out.\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2113_C8", "label": "message_onchange = get()", "type": "assigned_variable", "loc": [2113, 2115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "vector": [14, 2, 0.7806, 0.0011, 2, 0.84, 0.7692, 995, 3, 2, 0, 0, 607, 10, 2], "semantic": {"name": "message_onchange", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " message_onchange = kwargs.get('message_onchange',\n current.T(\"Form consecutive submissions not allowed. \" +\n \"Try re-submitting or refreshing the form page.\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2116_C8", "label": "next = get()", "type": "assigned_variable", "loc": [2116, 2116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "vector": [14, 2, 0.7814, 0.0004, 2, 0.84, 0.8462, 11, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "next", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " next = kwargs.get('next', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2117_C8", "label": "for key", "type": "for", "loc": [2117, 2120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "vector": [6, 2, 0.7823, 0.0015, 2, 0.84, 0.9231, 230, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key in ('message_onsuccess', 'message_onfailure', 'onsuccess',\n 'onfailure', 'next', 'message_onchange', 'onchange'):\n if key in kwargs:\n del kwargs[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2119_C12", "label": "if", "type": "if", "loc": [2119, 2120], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2117_C8", "vector": [4, 3, 0.7827, 0.0007, 3, 0.93, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if key in kwargs:\n del kwargs[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2122_C8", "label": "if", "type": "if", "loc": [2122, 2151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "vector": [4, 2, 0.789, 0.0111, 2, 0.84, 1.0, 0, 3, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.accepts(**kwargs):\n if onsuccess == 'flash':\n if next:\n current.session.flash = message_onsuccess\n else:\n current.response.flash = message_onsuccess\n elif callable(onsuccess):\n onsuccess(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2123_C12", "label": "if", "type": "if", "loc": [2123, 2129], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2122_C8", "vector": [4, 3, 0.7851, 0.0026, 3, 0.2, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if onsuccess == 'flash':\n if next:\n current.session.flash = message_onsuccess\n else:\n current.response.flash = message_onsuccess\n elif callable(onsuccess):\n onsuccess(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2124_C16", "label": "if", "type": "if", "loc": [2124, 2127], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2123_C12", "vector": [4, 4, 0.7849, 0.0015, 4, 0.87, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if next:\n current.session.flash = message_onsuccess\n else:\n current.response.flash = message_onsuccess"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2125_C20", "label": "current.session.flash =", "type": "assigned_variable", "loc": [2125, 2125], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2124_C16", "vector": [14, 5, 0.7847, 0.0004, 5, 0.25, 0.0, 706, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "current.session.flash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " current.session.flash = message_onsuccess"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2127_C20", "label": "current.response.flash =", "type": "assigned_variable", "loc": [2127, 2127], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2124_C16", "vector": [14, 5, 0.7855, 0.0004, 5, 0.25, 1.0, 958, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "current.response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " current.response.flash = message_onsuccess"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2128_C12", "label": "if", "type": "if", "loc": [2128, 2129], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2123_C12", "vector": [4, 4, 0.786, 0.0007, 4, 0.87, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif callable(onsuccess):\n onsuccess(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2129_C16", "label": "onsuccess()", "type": "expression", "loc": [2129, 2129], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2128_C12", "vector": [8, 5, 0.7862, 0.0004, 5, 0.59, 0.0, 745, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "onsuccess", "arg_names": [], "import_names": [], "rhs_call_name": "onsuccess", "annotation": ""}, "snippet": " onsuccess(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2130_C12", "label": "if", "type": "if", "loc": [2130, 2137], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2122_C8", "vector": [4, 3, 0.7879, 0.003, 3, 0.2, 0.3333, 0, 2, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if next:\n if self.vars:\n for key, value in self.vars.iteritems():\n next = next.replace('[%s]' % key,\n urllib.quote(str(value)))\n if not next.startswith('/'):\n next = URL(next)\n redirect(next)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2131_C16", "label": "if", "type": "if", "loc": [2131, 2136], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2130_C12", "vector": [4, 4, 0.7879, 0.0022, 4, 0.06, 0.0, 0, 7, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.vars:\n for key, value in self.vars.iteritems():\n next = next.replace('[%s]' % key,\n urllib.quote(str(value)))\n if not next.startswith('/'):\n next = URL(next)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2132_C20", "label": "for key, value", "type": "for", "loc": [2132, 2134], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2131_C16", "vector": [6, 5, 0.7877, 0.0011, 5, 0.85, 0.0, 839, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, value in self.vars.iteritems():\n next = next.replace('[%s]' % key,\n urllib.quote(str(value)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2133_C24", "label": "next = replace()", "type": "assigned_variable", "loc": [2133, 2134], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2132_C20", "vector": [14, 6, 0.7879, 0.0007, 6, 0.76, 0.0, 11, 3, 2, 0, 0, 293, 10, 3], "semantic": {"name": "next", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " next = next.replace('[%s]' % key,\n urllib.quote(str(value)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2135_C20", "label": "if", "type": "if", "loc": [2135, 2136], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2131_C16", "vector": [4, 5, 0.7886, 0.0007, 5, 0.85, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not next.startswith('/'):\n next = URL(next)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2136_C24", "label": "next = URL()", "type": "assigned_variable", "loc": [2136, 2136], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2135_C20", "vector": [14, 6, 0.7888, 0.0004, 6, 0.41, 0.0, 11, 3, 1, 0, 0, 759, 10, 1], "semantic": {"name": "next", "arg_names": [], "import_names": [], "rhs_call_name": "URL", "annotation": ""}, "snippet": " next = URL(next)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2137_C16", "label": "redirect()", "type": "expression", "loc": [2137, 2137], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2130_C12", "vector": [8, 4, 0.7891, 0.0004, 4, 0.06, 1.0, 206, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(next)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2138_C12", "label": "return", "type": "return", "loc": [2138, 2138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2122_C8", "vector": [13, 3, 0.7895, 0.0004, 3, 0.2, 0.6667, 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_475:If_L2139_C8", "label": "if", "type": "if", "loc": [2139, 2151], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2122_C8", "vector": [4, 3, 0.7921, 0.0048, 3, 0.2, 1.0, 0, 7, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.errors:\n if onfailure == 'flash':\n current.response.flash = message_onfailure\n elif callable(onfailure):\n onfailure(self)\n return False\n elif hasattr(self, \"record_changed\"):\n if self.record_changed and self.detect_record_change:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2140_C12", "label": "if", "type": "if", "loc": [2140, 2143], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2139_C8", "vector": [4, 4, 0.7908, 0.0015, 4, 0.48, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if onfailure == 'flash':\n current.response.flash = message_onfailure\n elif callable(onfailure):\n onfailure(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2141_C16", "label": "current.response.flash =", "type": "assigned_variable", "loc": [2141, 2141], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2140_C12", "vector": [14, 5, 0.7906, 0.0004, 5, 0.09, 0.0, 958, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "current.response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " current.response.flash = message_onfailure"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2142_C12", "label": "if", "type": "if", "loc": [2142, 2143], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2140_C12", "vector": [4, 5, 0.7912, 0.0007, 5, 0.09, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif callable(onfailure):\n onfailure(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2143_C16", "label": "onfailure()", "type": "expression", "loc": [2143, 2143], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2142_C12", "vector": [8, 6, 0.7914, 0.0004, 6, 0.72, 0.0, 344, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "onfailure", "arg_names": [], "import_names": [], "rhs_call_name": "onfailure", "annotation": ""}, "snippet": " onfailure(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2144_C12", "label": "return", "type": "return", "loc": [2144, 2144], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2139_C8", "vector": [13, 4, 0.7917, 0.0004, 4, 0.48, 0.5, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2145_C8", "label": "if", "type": "if", "loc": [2145, 2151], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2139_C8", "vector": [4, 4, 0.7932, 0.0026, 4, 0.48, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif hasattr(self, \"record_changed\"):\n if self.record_changed and self.detect_record_change:\n if onchange == 'flash':\n current.response.flash = message_onchange\n elif callable(onchange):\n onchange(self)\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2146_C12", "label": "if", "type": "if", "loc": [2146, 2150], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2145_C8", "vector": [4, 5, 0.7932, 0.0018, 5, 0.94, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.record_changed and self.detect_record_change:\n if onchange == 'flash':\n current.response.flash = message_onchange\n elif callable(onchange):\n onchange(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2147_C16", "label": "if", "type": "if", "loc": [2147, 2150], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2146_C12", "vector": [4, 6, 0.7934, 0.0015, 6, 0.31, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if onchange == 'flash':\n current.response.flash = message_onchange\n elif callable(onchange):\n onchange(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2148_C20", "label": "current.response.flash =", "type": "assigned_variable", "loc": [2148, 2148], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2147_C16", "vector": [14, 7, 0.7932, 0.0004, 7, 0.84, 0.0, 958, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "current.response.flash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " current.response.flash = message_onchange"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2149_C16", "label": "if", "type": "if", "loc": [2149, 2150], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2147_C16", "vector": [4, 7, 0.7938, 0.0007, 7, 0.84, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif callable(onchange):\n onchange(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2150_C20", "label": "onchange()", "type": "expression", "loc": [2150, 2150], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2149_C16", "vector": [8, 8, 0.7939, 0.0004, 8, 0.17, 0.0, 89, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "onchange", "arg_names": [], "import_names": [], "rhs_call_name": "onchange", "annotation": ""}, "snippet": " onchange(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2151_C12", "label": "return", "type": "return", "loc": [2151, 2151], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2145_C8", "vector": [13, 5, 0.7943, 0.0004, 5, 0.94, 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_475:FunctionDef_L2153_C4", "label": "process", "type": "function", "loc": [2153, 2184], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "vector": [2, 1, 0.8008, 0.0118, 1, 0.68, 0.5625, 712, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "process", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def process(self, **kwargs):\n \"\"\"\n Perform the .validate() method but returns the form\n\n Usage in controllers:\n # directly on return\n def action():\n #some code here"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2154_C8", "label": "expression", "type": "expression", "loc": [2154, 2180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2153_C4", "vector": [8, 2, 0.8002, 0.01, 2, 0.27, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Perform the .validate() method but returns the form\n\n Usage in controllers:\n # directly on return\n def action():\n #some code here\n return dict(form=FORM(...).process(...))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2181_C8", "label": " = get()", "type": "assigned_variable", "loc": [2181, 2181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2153_C4", "vector": [14, 2, 0.8054, 0.0004, 2, 0.27, 0.3333, 0, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " kwargs['dbio'] = kwargs.get('dbio', True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2183_C8", "label": "validate()", "type": "expression", "loc": [2183, 2183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2153_C4", "vector": [8, 2, 0.8061, 0.0004, 2, 0.27, 0.6667, 628, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "validate", "arg_names": [], "import_names": [], "rhs_call_name": "validate", "annotation": ""}, "snippet": " self.validate(**kwargs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2184_C8", "label": "return", "type": "return", "loc": [2184, 2184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2153_C4", "vector": [13, 2, 0.8065, 0.0004, 2, 0.27, 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_475:Assign_L2186_C4", "label": "REDIRECT_JS =", "type": "assigned_variable", "loc": [2186, 2186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "vector": [14, 1, 0.8072, 0.0004, 1, 0.68, 0.625, 961, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "REDIRECT_JS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " REDIRECT_JS = \"window.location='%s';return false\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2188_C4", "label": "add_button", "type": "function", "loc": [2188, 2192], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "vector": [2, 1, 0.8087, 0.0018, 1, 0.68, 0.6875, 435, 0, 4, 0, 0, 0, 0, 3], "semantic": {"name": "add_button", "arg_names": ["self", "value", "url", "_class"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_button(self, value, url, _class=None):\n submit = self.element('input[type=submit]')\n submit.parent.append(\n INPUT(_type=\"button\", _value=value, _class=_class,\n _onclick=self.REDIRECT_JS % url))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2189_C8", "label": "submit = element()", "type": "assigned_variable", "loc": [2189, 2189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2188_C4", "vector": [14, 2, 0.8083, 0.0004, 2, 0.3, 0.0, 487, 3, 1, 0, 0, 736, 10, 1], "semantic": {"name": "submit", "arg_names": [], "import_names": [], "rhs_call_name": "element", "annotation": ""}, "snippet": " submit = self.element('input[type=submit]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2190_C8", "label": "append()", "type": "expression", "loc": [2190, 2192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2188_C4", "vector": [8, 2, 0.8091, 0.0011, 2, 0.3, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " submit.parent.append(\n INPUT(_type=\"button\", _value=value, _class=_class,\n _onclick=self.REDIRECT_JS % url))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2195_C4", "label": "confirm", "type": "function", "loc": [2195, 2210], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "vector": [2, 1, 0.8133, 0.0059, 1, 0.68, 0.75, 488, 0, 3, 1, 0, 0, 0, 7], "semantic": {"name": "confirm", "arg_names": ["text", "buttons", "hidden"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def confirm(text='OK', buttons=None, hidden=None):\n if not buttons:\n buttons = {}\n if not hidden:\n hidden = {}\n inputs = [INPUT(_type='button',\n _value=name,\n _onclick=FORM.REDIRECT_JS % link)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2196_C8", "label": "if", "type": "if", "loc": [2196, 2197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2195_C4", "vector": [4, 2, 0.8111, 0.0007, 2, 0.1, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not buttons:\n buttons = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2197_C12", "label": "buttons =", "type": "assigned_variable", "loc": [2197, 2197], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2196_C8", "vector": [14, 3, 0.8113, 0.0004, 3, 0.51, 0.0, 587, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "buttons", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " buttons = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2198_C8", "label": "if", "type": "if", "loc": [2198, 2199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2195_C4", "vector": [4, 2, 0.8119, 0.0007, 2, 0.1, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hidden:\n hidden = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2199_C12", "label": "hidden =", "type": "assigned_variable", "loc": [2199, 2199], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2198_C8", "vector": [14, 3, 0.812, 0.0004, 3, 0.15, 0.0, 524, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "hidden", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hidden = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2200_C8", "label": "inputs =", "type": "assigned_variable", "loc": [2200, 2203], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2195_C4", "vector": [14, 2, 0.813, 0.0015, 2, 0.1, 0.4, 226, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "inputs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " inputs = [INPUT(_type='button',\n _value=name,\n _onclick=FORM.REDIRECT_JS % link)\n for name, link in buttons.iteritems()]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2208_C8", "label": "form = FORM()", "type": "assigned_variable", "loc": [2208, 2208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2195_C4", "vector": [14, 2, 0.8154, 0.0004, 2, 0.1, 0.6, 761, 3, 2, 0, 0, 690, 10, 2], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "FORM", "annotation": ""}, "snippet": " form = FORM(INPUT(_type='submit', _value=text), *inputs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2209_C8", "label": "process()", "type": "expression", "loc": [2209, 2209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2195_C4", "vector": [8, 2, 0.8157, 0.0004, 2, 0.1, 0.8, 712, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "process", "arg_names": [], "import_names": [], "rhs_call_name": "process", "annotation": ""}, "snippet": " form.process()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2210_C8", "label": "return", "type": "return", "loc": [2210, 2210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2195_C4", "vector": [13, 2, 0.8161, 0.0004, 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 form"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2212_C4", "label": "as_dict", "type": "function", "loc": [2212, 2257], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "vector": [2, 1, 0.8251, 0.017, 1, 0.68, 0.8125, 664, 0, 3, 1, 0, 0, 0, 19], "semantic": {"name": "as_dict", "arg_names": ["self", "flat", "sanitize"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def as_dict(self, flat=False, sanitize=True):\n \"\"\"EXPERIMENTAL\n\n Sanitize is naive. It should catch any unsafe value\n for client retrieval.\n \"\"\"\n SERIALIZABLE = (int, float, bool, basestring, long,\n set, list, dict, tuple, Storage, type(None))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2213_C8", "label": "expression", "type": "expression", "loc": [2213, 2217], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2212_C4", "vector": [8, 2, 0.8179, 0.0018, 2, 0.78, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"EXPERIMENTAL\n\n Sanitize is naive. It should catch any unsafe value\n for client retrieval.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2218_C8", "label": "SERIALIZABLE =", "type": "assigned_variable", "loc": [2218, 2219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2212_C4", "vector": [14, 2, 0.8192, 0.0007, 2, 0.78, 0.1667, 85, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "SERIALIZABLE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " SERIALIZABLE = (int, float, bool, basestring, long,\n set, list, dict, tuple, Storage, type(None))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2220_C8", "label": "UNSAFE =", "type": "assigned_variable", "loc": [2220, 2220], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2212_C4", "vector": [14, 2, 0.8198, 0.0004, 2, 0.78, 0.3333, 541, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "UNSAFE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " UNSAFE = (\"PASSWORD\", \"CRYPT\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2221_C8", "label": "d =", "type": "assigned_variable", "loc": [2221, 2221], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2212_C4", "vector": [14, 2, 0.8202, 0.0004, 2, 0.78, 0.5, 355, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d = self.__dict__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2223_C8", "label": "sanitizer", "type": "function", "loc": [2223, 2233], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2212_C4", "vector": [2, 2, 0.8227, 0.0041, 2, 0.78, 0.6667, 308, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "sanitizer", "arg_names": ["obj"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def sanitizer(obj):\n if isinstance(obj, dict):\n for k in obj.keys():\n if any([unsafe in str(k).upper() for\n unsafe in UNSAFE]):\n # erease unsafe pair\n obj.pop(k)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2224_C12", "label": "if", "type": "if", "loc": [2224, 2232], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2223_C8", "vector": [4, 3, 0.8227, 0.0033, 3, 0.63, 0.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(obj, dict):\n for k in obj.keys():\n if any([unsafe in str(k).upper() for\n unsafe in UNSAFE]):\n # erease unsafe pair\n obj.pop(k)\n else:\n # not implemented"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2225_C16", "label": "for k", "type": "for", "loc": [2225, 2229], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2224_C12", "vector": [6, 4, 0.8224, 0.0018, 4, 0.2, 0.0, 954, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k in obj.keys():\n if any([unsafe in str(k).upper() for\n unsafe in UNSAFE]):\n # erease unsafe pair\n obj.pop(k)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2226_C20", "label": "if", "type": "if", "loc": [2226, 2229], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2225_C16", "vector": [4, 5, 0.8226, 0.0015, 5, 0.19, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if any([unsafe in str(k).upper() for\n unsafe in UNSAFE]):\n # erease unsafe pair\n obj.pop(k)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2229_C23", "label": "pop()", "type": "expression", "loc": [2229, 2229], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2226_C20", "vector": [8, 6, 0.8231, 0.0004, 6, 0.52, 0.0, 969, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pop", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " obj.pop(k)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2233_C12", "label": "return", "type": "return", "loc": [2233, 2233], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2223_C8", "vector": [13, 3, 0.8246, 0.0004, 3, 0.63, 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_475:FunctionDef_L2235_C8", "label": "flatten", "type": "function", "loc": [2235, 2256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2212_C4", "vector": [2, 2, 0.8292, 0.0081, 2, 0.78, 0.8333, 893, 0, 1, 1, 0, 0, 0, 11], "semantic": {"name": "flatten", "arg_names": ["obj"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def flatten(obj):\n if isinstance(obj, (dict, Storage)):\n newobj = obj.copy()\n else:\n newobj = obj\n if sanitize:\n newobj = sanitizer(newobj)\n if flat:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2236_C12", "label": "if", "type": "if", "loc": [2236, 2239], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2235_C8", "vector": [4, 3, 0.8263, 0.0015, 3, 0.16, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(obj, (dict, Storage)):\n newobj = obj.copy()\n else:\n newobj = obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2237_C16", "label": "newobj = copy()", "type": "assigned_variable", "loc": [2237, 2237], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2236_C12", "vector": [14, 4, 0.8261, 0.0004, 4, 0.08, 0.0, 716, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "newobj", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " newobj = obj.copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2239_C16", "label": "newobj =", "type": "assigned_variable", "loc": [2239, 2239], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2236_C12", "vector": [14, 4, 0.8268, 0.0004, 4, 0.08, 1.0, 716, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "newobj", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newobj = obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2240_C12", "label": "if", "type": "if", "loc": [2240, 2241], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2235_C8", "vector": [4, 3, 0.8274, 0.0007, 3, 0.16, 0.5, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if sanitize:\n newobj = sanitizer(newobj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2241_C16", "label": "newobj = sanitizer()", "type": "assigned_variable", "loc": [2241, 2241], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2240_C12", "vector": [14, 4, 0.8275, 0.0004, 4, 0.89, 0.0, 716, 3, 1, 0, 0, 308, 10, 1], "semantic": {"name": "newobj", "arg_names": [], "import_names": [], "rhs_call_name": "sanitizer", "annotation": ""}, "snippet": " newobj = sanitizer(newobj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2242_C12", "label": "if", "type": "if", "loc": [2242, 2256], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2235_C8", "vector": [4, 3, 0.8305, 0.0055, 3, 0.16, 1.0, 0, 2, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if flat:\n if type(obj) in SERIALIZABLE:\n if isinstance(newobj, (dict, Storage)):\n for k in newobj:\n newk = flatten(k)\n newobj[newk] = flatten(newobj[k])\n if k != newk:\n newobj.pop(k)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2243_C16", "label": "if", "type": "if", "loc": [2243, 2255], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2242_C12", "vector": [4, 4, 0.8305, 0.0048, 4, 0.49, 0.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if type(obj) in SERIALIZABLE:\n if isinstance(newobj, (dict, Storage)):\n for k in newobj:\n newk = flatten(k)\n newobj[newk] = flatten(newobj[k])\n if k != newk:\n newobj.pop(k)\n return newobj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2244_C20", "label": "if", "type": "if", "loc": [2244, 2254], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2243_C16", "vector": [4, 5, 0.8305, 0.0041, 5, 0.27, 0.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(newobj, (dict, Storage)):\n for k in newobj:\n newk = flatten(k)\n newobj[newk] = flatten(newobj[k])\n if k != newk:\n newobj.pop(k)\n return newobj\n elif isinstance(newobj, (list, tuple, set)):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2245_C24", "label": "for k", "type": "for", "loc": [2245, 2249], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2244_C20", "vector": [6, 6, 0.8298, 0.0018, 6, 0.51, 0.0, 954, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k in newobj:\n newk = flatten(k)\n newobj[newk] = flatten(newobj[k])\n if k != newk:\n newobj.pop(k)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2246_C28", "label": "newk = flatten()", "type": "assigned_variable", "loc": [2246, 2246], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2245_C24", "vector": [14, 7, 0.8294, 0.0004, 7, 0.92, 0.0, 833, 3, 1, 0, 0, 893, 10, 1], "semantic": {"name": "newk", "arg_names": [], "import_names": [], "rhs_call_name": "flatten", "annotation": ""}, "snippet": " newk = flatten(k)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2247_C28", "label": " = flatten()", "type": "assigned_variable", "loc": [2247, 2247], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2245_C24", "vector": [14, 7, 0.8298, 0.0004, 7, 0.92, 0.5, 0, 3, 1, 0, 0, 893, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "flatten", "annotation": ""}, "snippet": " newobj[newk] = flatten(newobj[k])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2248_C28", "label": "if", "type": "if", "loc": [2248, 2249], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2245_C24", "vector": [4, 7, 0.8303, 0.0007, 7, 0.92, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k != newk:\n newobj.pop(k)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2249_C32", "label": "pop()", "type": "expression", "loc": [2249, 2249], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2248_C28", "vector": [8, 8, 0.8305, 0.0004, 8, 0.19, 0.0, 969, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "pop", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " newobj.pop(k)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2250_C24", "label": "return", "type": "return", "loc": [2250, 2250], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2244_C20", "vector": [13, 6, 0.8309, 0.0004, 6, 0.51, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return newobj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2251_C20", "label": "if", "type": "if", "loc": [2251, 2254], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2244_C20", "vector": [4, 6, 0.8318, 0.0015, 6, 0.51, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(newobj, (list, tuple, set)):\n return [flatten(item) for item in newobj]\n else:\n return newobj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2252_C24", "label": "return", "type": "return", "loc": [2252, 2252], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2251_C20", "vector": [13, 7, 0.8316, 0.0004, 7, 0.97, 0.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [flatten(item) for item in newobj]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2254_C24", "label": "return", "type": "return", "loc": [2254, 2254], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2251_C20", "vector": [13, 7, 0.8323, 0.0004, 7, 0.97, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return newobj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2255_C22", "label": "return", "type": "return", "loc": [2255, 2255], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2243_C16", "vector": [13, 5, 0.8327, 0.0004, 5, 0.27, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " else: return str(newobj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2256_C18", "label": "return", "type": "return", "loc": [2256, 2256], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2242_C12", "vector": [13, 4, 0.8331, 0.0004, 4, 0.49, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " else: return newobj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2257_C8", "label": "return", "type": "return", "loc": [2257, 2257], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2212_C4", "vector": [13, 2, 0.8335, 0.0004, 2, 0.78, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return flatten(d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2259_C4", "label": "as_json", "type": "function", "loc": [2259, 2262], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "vector": [2, 1, 0.8347, 0.0015, 1, 0.68, 0.875, 443, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "as_json", "arg_names": ["self", "sanitize"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def as_json(self, sanitize=True):\n d = self.as_dict(flat=True, sanitize=sanitize)\n from serializers import json\n return json(d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2260_C8", "label": "d = as_dict()", "type": "assigned_variable", "loc": [2260, 2260], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2259_C4", "vector": [14, 2, 0.8346, 0.0004, 2, 0.83, 0.0, 355, 3, 2, 0, 0, 664, 10, 1], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "as_dict", "annotation": ""}, "snippet": " d = self.as_dict(flat=True, sanitize=sanitize)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L2261_C8", "label": "from serializers import json", "type": "import", "loc": [2261, 2261], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2259_C4", "vector": [1, 2, 0.8349, 0.0004, 2, 0.83, 0.5, 370, 0, 1, 0, 0, 370, 0, 0], "semantic": {"name": "serializers", "arg_names": [], "import_names": ["json"], "rhs_call_name": "", "annotation": ""}, "snippet": " from serializers import json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2262_C8", "label": "return", "type": "return", "loc": [2262, 2262], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2259_C4", "vector": [13, 2, 0.8353, 0.0004, 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 json(d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2264_C4", "label": "as_yaml", "type": "function", "loc": [2264, 2267], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "vector": [2, 1, 0.8366, 0.0015, 1, 0.68, 0.9375, 49, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "as_yaml", "arg_names": ["self", "sanitize"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def as_yaml(self, sanitize=True):\n d = self.as_dict(flat=True, sanitize=sanitize)\n from serializers import yaml\n return yaml(d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2265_C8", "label": "d = as_dict()", "type": "assigned_variable", "loc": [2265, 2265], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2264_C4", "vector": [14, 2, 0.8364, 0.0004, 2, 0.94, 0.0, 355, 3, 2, 0, 0, 664, 10, 1], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "as_dict", "annotation": ""}, "snippet": " d = self.as_dict(flat=True, sanitize=sanitize)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L2266_C8", "label": "from serializers import yaml", "type": "import", "loc": [2266, 2266], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2264_C4", "vector": [1, 2, 0.8368, 0.0004, 2, 0.94, 0.5, 370, 0, 1, 0, 0, 370, 0, 0], "semantic": {"name": "serializers", "arg_names": [], "import_names": ["yaml"], "rhs_call_name": "", "annotation": ""}, "snippet": " from serializers import yaml"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2267_C8", "label": "return", "type": "return", "loc": [2267, 2267], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2264_C4", "vector": [13, 2, 0.8371, 0.0004, 2, 0.94, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return yaml(d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2269_C4", "label": "as_xml", "type": "function", "loc": [2269, 2272], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "vector": [2, 1, 0.8384, 0.0015, 1, 0.68, 1.0, 823, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "as_xml", "arg_names": ["self", "sanitize"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def as_xml(self, sanitize=True):\n d = self.as_dict(flat=True, sanitize=sanitize)\n from serializers import xml\n return xml(d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2270_C8", "label": "d = as_dict()", "type": "assigned_variable", "loc": [2270, 2270], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2269_C4", "vector": [14, 2, 0.8383, 0.0004, 2, 0.36, 0.0, 355, 3, 2, 0, 0, 664, 10, 1], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "as_dict", "annotation": ""}, "snippet": " d = self.as_dict(flat=True, sanitize=sanitize)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L2271_C8", "label": "from serializers import xml", "type": "import", "loc": [2271, 2271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2269_C4", "vector": [1, 2, 0.8386, 0.0004, 2, 0.36, 0.5, 370, 0, 1, 0, 0, 370, 0, 0], "semantic": {"name": "serializers", "arg_names": [], "import_names": ["xml"], "rhs_call_name": "", "annotation": ""}, "snippet": " from serializers import xml"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2272_C8", "label": "return", "type": "return", "loc": [2272, 2272], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2269_C4", "vector": [13, 2, 0.839, 0.0004, 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 xml(d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2275_C0", "label": "BEAUTIFY", "type": "class", "loc": [2275, 2352], "level": 0, "parent": null, "vector": [3, 0, 0.8543, 0.0288, 0, 0.66, 0.9223, 580, 0, 2, 0, 0, 697, 0, 41], "semantic": {"name": "BEAUTIFY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BEAUTIFY(DIV):\n\n \"\"\"\n example::\n\n >>> BEAUTIFY(['a', 'b', {'hello': 'world'}]).xml()\n '<div><table><tr><td><div>a</div></td></tr><tr><td><div>b</div></td></tr><tr><td><div><table><tr><td style=\"font-weight:bold;vertical-align:top\">hello</td><td valign=\"top\">:</td><td><div>world</div></td></tr></table></div></td></tr></table></div>'\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2277_C4", "label": "expression", "type": "expression", "loc": [2277, 2288], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2275_C0", "vector": [8, 1, 0.8429, 0.0044, 1, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n example::\n\n >>> BEAUTIFY(['a', 'b', {'hello': 'world'}]).xml()\n '<div><table><tr><td><div>a</div></td></tr><tr><td><div>b</div></td></tr><tr><td><div><table><tr><td style=\"font-weight:bold;vertical-align:top\">hello</td><td valign=\"top\">:</td><td><div>world</div></td></tr></table></div></td></tr></table></div>'\n\n turns any list, dictionary, etc into decent looking html.\n Two special attributes are"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2290_C4", "label": "tag =", "type": "assigned_variable", "loc": [2290, 2290], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2275_C0", "vector": [14, 1, 0.8456, 0.0004, 1, 0.28, 0.3333, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'div'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2293_C4", "label": "no_underscore", "type": "function", "loc": [2293, 2296], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2275_C0", "vector": [2, 1, 0.8473, 0.0015, 1, 0.28, 0.6667, 944, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "no_underscore", "arg_names": ["key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def no_underscore(key):\n if key[:1] == '_':\n return None\n return key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2294_C8", "label": "if", "type": "if", "loc": [2294, 2295], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2293_C4", "vector": [4, 2, 0.8473, 0.0007, 2, 0.12, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if key[:1] == '_':\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2295_C12", "label": "return", "type": "return", "loc": [2295, 2295], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2294_C8", "vector": [13, 3, 0.8475, 0.0004, 3, 0.06, 0.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2296_C8", "label": "return", "type": "return", "loc": [2296, 2296], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2293_C4", "vector": [13, 2, 0.8479, 0.0004, 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 key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "label": "__init__", "type": "function", "loc": [2298, 2352], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2275_C0", "vector": [2, 1, 0.8586, 0.0203, 1, 0.28, 1.0, 555, 0, 3, 0, 0, 0, 0, 41], "semantic": {"name": "__init__", "arg_names": ["self", "component", "attributes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, component, **attributes):\n self.components = [component]\n self.attributes = attributes\n sorter = attributes.get('sorted', sorted)\n keyfilter = attributes.get('keyfilter', BEAUTIFY.no_underscore)\n components = []\n attributes = copy.copy(self.attributes)\n level = attributes['level'] = attributes.get('level', 6) - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2299_C8", "label": "self.components =", "type": "assigned_variable", "loc": [2299, 2299], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "vector": [14, 2, 0.849, 0.0004, 2, 0.23, 0.0, 687, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.components", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.components = [component]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2300_C8", "label": "self.attributes =", "type": "assigned_variable", "loc": [2300, 2300], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "vector": [14, 2, 0.8493, 0.0004, 2, 0.23, 0.1, 21, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.attributes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.attributes = attributes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2301_C8", "label": "sorter = get()", "type": "assigned_variable", "loc": [2301, 2301], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "vector": [14, 2, 0.8497, 0.0004, 2, 0.23, 0.2, 158, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "sorter", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " sorter = attributes.get('sorted', sorted)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2302_C8", "label": "keyfilter = get()", "type": "assigned_variable", "loc": [2302, 2302], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "vector": [14, 2, 0.8501, 0.0004, 2, 0.23, 0.3, 565, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "keyfilter", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " keyfilter = attributes.get('keyfilter', BEAUTIFY.no_underscore)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2303_C8", "label": "components =", "type": "assigned_variable", "loc": [2303, 2303], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "vector": [14, 2, 0.8504, 0.0004, 2, 0.23, 0.4, 11, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "components", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " components = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2304_C8", "label": "attributes = copy()", "type": "assigned_variable", "loc": [2304, 2304], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "vector": [14, 2, 0.8508, 0.0004, 2, 0.23, 0.5, 344, 3, 1, 0, 0, 739, 10, 1], "semantic": {"name": "attributes", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " attributes = copy.copy(self.attributes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2305_C8", "label": "level =", "type": "assigned_variable", "loc": [2305, 2305], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "vector": [14, 2, 0.8512, 0.0004, 2, 0.23, 0.6, 479, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "level", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " level = attributes['level'] = attributes.get('level', 6) - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2306_C8", "label": "if", "type": "if", "loc": [2306, 2307], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "vector": [4, 2, 0.8517, 0.0007, 2, 0.23, 0.7, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if '_class' in attributes:\n attributes['_class'] += 'i'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2308_C8", "label": "if", "type": "if", "loc": [2308, 2309], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "vector": [4, 2, 0.8525, 0.0007, 2, 0.23, 0.8, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if level == 0:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2309_C12", "label": "return", "type": "return", "loc": [2309, 2309], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2308_C8", "vector": [13, 3, 0.8527, 0.0004, 3, 0.26, 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_475:For_L2310_C8", "label": "for c", "type": "for", "loc": [2310, 2351], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "vector": [6, 2, 0.8606, 0.0155, 2, 0.23, 0.9, 411, 7, 0, 0, 0, 0, 0, 37], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in self.components:\n if hasattr(c, 'value') and not callable(c.value):\n if c.value:\n components.append(c.value)\n if hasattr(c, 'xml') and callable(c.xml):\n components.append(c)\n continue\n elif hasattr(c, 'keys') and callable(c.keys):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2311_C12", "label": "if", "type": "if", "loc": [2311, 2313], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2310_C8", "vector": [4, 3, 0.8538, 0.0011, 3, 0.02, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(c, 'value') and not callable(c.value):\n if c.value:\n components.append(c.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2312_C16", "label": "if", "type": "if", "loc": [2312, 2313], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2311_C12", "vector": [4, 4, 0.854, 0.0007, 4, 0.68, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if c.value:\n components.append(c.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2313_C20", "label": "append()", "type": "expression", "loc": [2313, 2313], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2312_C16", "vector": [8, 5, 0.8541, 0.0004, 5, 0.32, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " components.append(c.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2314_C12", "label": "if", "type": "if", "loc": [2314, 2339], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2310_C8", "vector": [4, 3, 0.8591, 0.0096, 3, 0.02, 0.5, 0, 0, 0, 0, 0, 0, 0, 18], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(c, 'xml') and callable(c.xml):\n components.append(c)\n continue\n elif hasattr(c, 'keys') and callable(c.keys):\n rows = []\n try:\n keys = (sorter and sorter(c)) or c\n for key in keys:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2315_C16", "label": "append()", "type": "expression", "loc": [2315, 2315], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2314_C12", "vector": [8, 4, 0.8549, 0.0004, 4, 0.58, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " components.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2317_C12", "label": "if", "type": "if", "loc": [2317, 2339], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2314_C12", "vector": [4, 4, 0.8597, 0.0085, 4, 0.58, 1.0, 0, 0, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif hasattr(c, 'keys') and callable(c.keys):\n rows = []\n try:\n keys = (sorter and sorter(c)) or c\n for key in keys:\n if isinstance(key, (str, unicode)) and keyfilter:\n filtered_key = keyfilter(key)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2318_C16", "label": "rows =", "type": "assigned_variable", "loc": [2318, 2318], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2317_C12", "vector": [14, 5, 0.856, 0.0004, 5, 0.18, 0.0, 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_475:Try_L2319_C16", "label": "try", "type": "try", "loc": [2319, 2339], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2317_C12", "vector": [7, 5, 0.86, 0.0078, 5, 0.18, 1.0, 0, 0, 1, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n keys = (sorter and sorter(c)) or c\n for key in keys:\n if isinstance(key, (str, unicode)) and keyfilter:\n filtered_key = keyfilter(key)\n else:\n filtered_key = str(key)\n if filtered_key is None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2320_C20", "label": "keys =", "type": "assigned_variable", "loc": [2320, 2320], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L2319_C16", "vector": [14, 6, 0.8567, 0.0004, 6, 0.29, 0.0, 204, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "keys", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " keys = (sorter and sorter(c)) or c"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2321_C20", "label": "for key", "type": "for", "loc": [2321, 2335], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L2319_C16", "vector": [6, 6, 0.8597, 0.0055, 6, 0.29, 0.5, 230, 2, 0, 0, 0, 0, 0, 10], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key in keys:\n if isinstance(key, (str, unicode)) and keyfilter:\n filtered_key = keyfilter(key)\n else:\n filtered_key = str(key)\n if filtered_key is None:\n continue\n value = c[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2322_C24", "label": "if", "type": "if", "loc": [2322, 2325], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2321_C20", "vector": [4, 7, 0.858, 0.0015, 7, 0.53, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(key, (str, unicode)) and keyfilter:\n filtered_key = keyfilter(key)\n else:\n filtered_key = str(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2323_C28", "label": "filtered_key = keyfilter()", "type": "assigned_variable", "loc": [2323, 2323], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2322_C24", "vector": [14, 8, 0.8578, 0.0004, 8, 0.77, 0.0, 441, 3, 1, 0, 0, 565, 10, 1], "semantic": {"name": "filtered_key", "arg_names": [], "import_names": [], "rhs_call_name": "keyfilter", "annotation": ""}, "snippet": " filtered_key = keyfilter(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2325_C28", "label": "filtered_key = str()", "type": "assigned_variable", "loc": [2325, 2325], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2322_C24", "vector": [14, 8, 0.8586, 0.0004, 8, 0.77, 1.0, 441, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "filtered_key", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " filtered_key = str(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2326_C24", "label": "if", "type": "if", "loc": [2326, 2327], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2321_C20", "vector": [4, 7, 0.8591, 0.0007, 7, 0.53, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if filtered_key is None:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2328_C24", "label": "value =", "type": "assigned_variable", "loc": [2328, 2328], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2321_C20", "vector": [14, 7, 0.8597, 0.0004, 7, 0.53, 0.5, 441, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = c[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2329_C24", "label": "if", "type": "if", "loc": [2329, 2330], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2321_C20", "vector": [4, 7, 0.8602, 0.0007, 7, 0.53, 0.75, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, types.LambdaType):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2331_C24", "label": "append()", "type": "expression", "loc": [2331, 2335], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2321_C20", "vector": [8, 7, 0.8615, 0.0018, 7, 0.53, 1.0, 243, 3, 1, 0, 0, 0, 0, 6], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " rows.append(\n TR(\n TD(filtered_key, _style='font-weight:bold;vertical-align:top'),\n TD(':', _valign='top'),\n TD(BEAUTIFY(value, **attributes))))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2336_C20", "label": "append()", "type": "expression", "loc": [2336, 2336], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L2319_C16", "vector": [8, 6, 0.8626, 0.0004, 6, 0.29, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " components.append(TABLE(*rows, **attributes))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2340_C12", "label": "if", "type": "if", "loc": [2340, 2351], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2310_C8", "vector": [4, 3, 0.8661, 0.0044, 3, 0.02, 1.0, 0, 3, 0, 0, 0, 0, 0, 16], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(c, str):\n components.append(str(c))\n elif isinstance(c, unicode):\n components.append(c.encode('utf8'))\n elif isinstance(c, (list, tuple)):\n items = [TR(TD(BEAUTIFY(item, **attributes)))\n for item in c]\n components.append(TABLE(*items, **attributes))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2341_C16", "label": "append()", "type": "expression", "loc": [2341, 2341], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2340_C12", "vector": [8, 4, 0.8645, 0.0004, 4, 0.9, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " components.append(str(c))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2342_C12", "label": "if", "type": "if", "loc": [2342, 2351], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2340_C12", "vector": [4, 4, 0.8665, 0.0037, 4, 0.9, 1.0, 0, 3, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(c, unicode):\n components.append(c.encode('utf8'))\n elif isinstance(c, (list, tuple)):\n items = [TR(TD(BEAUTIFY(item, **attributes)))\n for item in c]\n components.append(TABLE(*items, **attributes))\n elif isinstance(c, cgi.FieldStorage):\n components.append('FieldStorage object')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2343_C16", "label": "append()", "type": "expression", "loc": [2343, 2343], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2342_C12", "vector": [8, 5, 0.8652, 0.0004, 5, 0.72, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " components.append(c.encode('utf8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2344_C12", "label": "if", "type": "if", "loc": [2344, 2351], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2342_C12", "vector": [4, 5, 0.8669, 0.003, 5, 0.72, 1.0, 0, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(c, (list, tuple)):\n items = [TR(TD(BEAUTIFY(item, **attributes)))\n for item in c]\n components.append(TABLE(*items, **attributes))\n elif isinstance(c, cgi.FieldStorage):\n components.append('FieldStorage object')\n else:\n components.append(repr(c))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2345_C16", "label": "items =", "type": "assigned_variable", "loc": [2345, 2346], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2344_C12", "vector": [14, 6, 0.8661, 0.0007, 6, 0.34, 0.0, 339, 5, 0, 0, 0, 0, 0, 3], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = [TR(TD(BEAUTIFY(item, **attributes)))\n for item in c]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2347_C16", "label": "append()", "type": "expression", "loc": [2347, 2347], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2344_C12", "vector": [8, 6, 0.8667, 0.0004, 6, 0.34, 0.5, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " components.append(TABLE(*items, **attributes))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2348_C12", "label": "if", "type": "if", "loc": [2348, 2351], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2344_C12", "vector": [4, 6, 0.8676, 0.0015, 6, 0.34, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(c, cgi.FieldStorage):\n components.append('FieldStorage object')\n else:\n components.append(repr(c))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2349_C16", "label": "append()", "type": "expression", "loc": [2349, 2349], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2348_C12", "vector": [8, 7, 0.8674, 0.0004, 7, 0.24, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " components.append('FieldStorage object')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2351_C16", "label": "append()", "type": "expression", "loc": [2351, 2351], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2348_C12", "vector": [8, 7, 0.8682, 0.0004, 7, 0.24, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " components.append(repr(c))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2352_C8", "label": "self.components =", "type": "assigned_variable", "loc": [2352, 2352], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "vector": [14, 2, 0.8685, 0.0004, 2, 0.23, 1.0, 687, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.components", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.components = components"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2355_C0", "label": "MENU", "type": "class", "loc": [2355, 2448], "level": 0, "parent": null, "vector": [3, 0, 0.8868, 0.0347, 0, 0.66, 0.932, 474, 0, 4, 0, 0, 697, 0, 35], "semantic": {"name": "MENU", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MENU(DIV):\n \"\"\"\n Used to build menus\n\n Optional arguments\n _class: defaults to 'web2py-menu web2py-menu-vertical'\n ul_class: defaults to 'web2py-menu-vertical'\n li_class: defaults to 'web2py-menu-expand'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2356_C4", "label": "expression", "type": "expression", "loc": [2356, 2369], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2355_C0", "vector": [8, 1, 0.8724, 0.0052, 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 Used to build menus\n\n Optional arguments\n _class: defaults to 'web2py-menu web2py-menu-vertical'\n ul_class: defaults to 'web2py-menu-vertical'\n li_class: defaults to 'web2py-menu-expand'\n li_first: defaults to 'web2py-menu-first'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2371_C4", "label": "tag =", "type": "assigned_variable", "loc": [2371, 2371], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2355_C0", "vector": [14, 1, 0.8756, 0.0004, 1, 0.07, 0.2, 732, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = 'ul'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2373_C4", "label": "__init__", "type": "function", "loc": [2373, 2390], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2355_C0", "vector": [2, 1, 0.8794, 0.0066, 1, 0.07, 0.4, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "data", "args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, data, **args):\n self.data = data\n self.attributes = args\n self.components = []\n if not '_class' in self.attributes:\n self['_class'] = 'web2py-menu web2py-menu-vertical'\n if not 'ul_class' in self.attributes:\n self['ul_class'] = 'web2py-menu-vertical'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2374_C8", "label": "self.data =", "type": "assigned_variable", "loc": [2374, 2374], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2373_C4", "vector": [14, 2, 0.8767, 0.0004, 2, 0.87, 0.0, 838, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.data = data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2375_C8", "label": "self.attributes =", "type": "assigned_variable", "loc": [2375, 2375], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2373_C4", "vector": [14, 2, 0.877, 0.0004, 2, 0.87, 0.1111, 21, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.attributes", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.attributes = args"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2376_C8", "label": "self.components =", "type": "assigned_variable", "loc": [2376, 2376], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2373_C4", "vector": [14, 2, 0.8774, 0.0004, 2, 0.87, 0.2222, 687, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.components", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.components = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2377_C8", "label": "if", "type": "if", "loc": [2377, 2378], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2373_C4", "vector": [4, 2, 0.878, 0.0007, 2, 0.87, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not '_class' in self.attributes:\n self['_class'] = 'web2py-menu web2py-menu-vertical'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2378_C12", "label": "assign", "type": "assigned_variable", "loc": [2378, 2378], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2377_C8", "vector": [14, 3, 0.8781, 0.0004, 3, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_class'] = 'web2py-menu web2py-menu-vertical'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2379_C8", "label": "if", "type": "if", "loc": [2379, 2380], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2373_C4", "vector": [4, 2, 0.8787, 0.0007, 2, 0.87, 0.4444, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not 'ul_class' in self.attributes:\n self['ul_class'] = 'web2py-menu-vertical'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2380_C12", "label": "assign", "type": "assigned_variable", "loc": [2380, 2380], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2379_C8", "vector": [14, 3, 0.8789, 0.0004, 3, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['ul_class'] = 'web2py-menu-vertical'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2381_C8", "label": "if", "type": "if", "loc": [2381, 2382], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2373_C4", "vector": [4, 2, 0.8794, 0.0007, 2, 0.87, 0.5556, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not 'li_class' in self.attributes:\n self['li_class'] = 'web2py-menu-expand'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2382_C12", "label": "assign", "type": "assigned_variable", "loc": [2382, 2382], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2381_C8", "vector": [14, 3, 0.8796, 0.0004, 3, 0.0, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['li_class'] = 'web2py-menu-expand'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2383_C8", "label": "if", "type": "if", "loc": [2383, 2384], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2373_C4", "vector": [4, 2, 0.8802, 0.0007, 2, 0.87, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not 'li_first' in self.attributes:\n self['li_first'] = 'web2py-menu-first'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2384_C12", "label": "assign", "type": "assigned_variable", "loc": [2384, 2384], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2383_C8", "vector": [14, 3, 0.8804, 0.0004, 3, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['li_first'] = 'web2py-menu-first'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2385_C8", "label": "if", "type": "if", "loc": [2385, 2386], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2373_C4", "vector": [4, 2, 0.8809, 0.0007, 2, 0.87, 0.7778, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not 'li_last' in self.attributes:\n self['li_last'] = 'web2py-menu-last'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2386_C12", "label": "assign", "type": "assigned_variable", "loc": [2386, 2386], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2385_C8", "vector": [14, 3, 0.8811, 0.0004, 3, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['li_last'] = 'web2py-menu-last'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2387_C8", "label": "if", "type": "if", "loc": [2387, 2388], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2373_C4", "vector": [4, 2, 0.8816, 0.0007, 2, 0.87, 0.8889, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not 'li_active' in self.attributes:\n self['li_active'] = 'web2py-menu-active'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2388_C12", "label": "assign", "type": "assigned_variable", "loc": [2388, 2388], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2387_C8", "vector": [14, 3, 0.8818, 0.0004, 3, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['li_active'] = 'web2py-menu-active'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2389_C8", "label": "if", "type": "if", "loc": [2389, 2390], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2373_C4", "vector": [4, 2, 0.8824, 0.0007, 2, 0.87, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not 'mobile' in self.attributes:\n self['mobile'] = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2390_C12", "label": "assign", "type": "assigned_variable", "loc": [2390, 2390], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2389_C8", "vector": [14, 3, 0.8826, 0.0004, 3, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['mobile'] = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2392_C4", "label": "serialize", "type": "function", "loc": [2392, 2429], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2355_C0", "vector": [2, 1, 0.8901, 0.014, 1, 0.07, 0.6, 50, 0, 3, 1, 0, 0, 0, 22], "semantic": {"name": "serialize", "arg_names": ["self", "data", "level"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self, data, level=0):\n if level == 0:\n ul = UL(**self.attributes)\n else:\n ul = UL(_class=self['ul_class'])\n for item in data:\n if isinstance(item,LI):\n ul.append(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2393_C8", "label": "if", "type": "if", "loc": [2393, 2396], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2392_C4", "vector": [4, 2, 0.8842, 0.0015, 2, 0.37, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if level == 0:\n ul = UL(**self.attributes)\n else:\n ul = UL(_class=self['ul_class'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2394_C12", "label": "ul = UL()", "type": "assigned_variable", "loc": [2394, 2394], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2393_C8", "vector": [14, 3, 0.884, 0.0004, 3, 0.65, 0.0, 608, 3, 1, 0, 0, 64, 10, 1], "semantic": {"name": "ul", "arg_names": [], "import_names": [], "rhs_call_name": "UL", "annotation": ""}, "snippet": " ul = UL(**self.attributes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2396_C12", "label": "ul = UL()", "type": "assigned_variable", "loc": [2396, 2396], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2393_C8", "vector": [14, 3, 0.8848, 0.0004, 3, 0.65, 1.0, 608, 3, 1, 0, 0, 64, 10, 1], "semantic": {"name": "ul", "arg_names": [], "import_names": [], "rhs_call_name": "UL", "annotation": ""}, "snippet": " ul = UL(_class=self['ul_class'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2397_C8", "label": "for item", "type": "for", "loc": [2397, 2428], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2392_C4", "vector": [6, 2, 0.8909, 0.0118, 2, 0.37, 0.5, 434, 2, 0, 0, 0, 0, 0, 20], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in data:\n if isinstance(item,LI):\n ul.append(item)\n else:\n (name, active, link) = item[:3]\n if isinstance(link, DIV):\n li = LI(link)\n elif 'no_link_url' in self.attributes and self['no_link_url'] == link:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2398_C12", "label": "if", "type": "if", "loc": [2398, 2428], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2397_C8", "vector": [4, 3, 0.8911, 0.0114, 3, 0.67, 0.0, 0, 3, 0, 0, 0, 0, 0, 20], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(item,LI):\n ul.append(item)\n else:\n (name, active, link) = item[:3]\n if isinstance(link, DIV):\n li = LI(link)\n elif 'no_link_url' in self.attributes and self['no_link_url'] == link:\n li = LI(DIV(name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2399_C16", "label": "append()", "type": "expression", "loc": [2399, 2399], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2398_C12", "vector": [8, 4, 0.8859, 0.0004, 4, 0.7, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " ul.append(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2401_C16", "label": "name, active, link =", "type": "assigned_variable", "loc": [2401, 2401], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2398_C12", "vector": [14, 4, 0.8866, 0.0004, 4, 0.7, 0.1667, 438, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "name, active, link", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (name, active, link) = item[:3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2402_C16", "label": "if", "type": "if", "loc": [2402, 2414], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2398_C12", "vector": [4, 4, 0.8892, 0.0048, 4, 0.7, 0.3333, 0, 3, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(link, DIV):\n li = LI(link)\n elif 'no_link_url' in self.attributes and self['no_link_url'] == link:\n li = LI(DIV(name))\n elif isinstance(link,dict):\n li = LI(A(name, **link))\n elif link:\n li = LI(A(name, _href=link))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2403_C20", "label": "li = LI()", "type": "assigned_variable", "loc": [2403, 2403], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2402_C16", "vector": [14, 5, 0.8874, 0.0004, 5, 0.2, 0.0, 603, 3, 1, 0, 0, 814, 10, 1], "semantic": {"name": "li", "arg_names": [], "import_names": [], "rhs_call_name": "LI", "annotation": ""}, "snippet": " li = LI(link)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2404_C16", "label": "if", "type": "if", "loc": [2404, 2414], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2402_C16", "vector": [4, 5, 0.8896, 0.0041, 5, 0.2, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif 'no_link_url' in self.attributes and self['no_link_url'] == link:\n li = LI(DIV(name))\n elif isinstance(link,dict):\n li = LI(A(name, **link))\n elif link:\n li = LI(A(name, _href=link))\n elif not link and isinstance(name, A):\n li = LI(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2405_C20", "label": "li = LI()", "type": "assigned_variable", "loc": [2405, 2405], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2404_C16", "vector": [14, 6, 0.8881, 0.0004, 6, 0.72, 0.0, 603, 3, 1, 0, 0, 814, 10, 2], "semantic": {"name": "li", "arg_names": [], "import_names": [], "rhs_call_name": "LI", "annotation": ""}, "snippet": " li = LI(DIV(name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2406_C16", "label": "if", "type": "if", "loc": [2406, 2414], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2404_C16", "vector": [4, 6, 0.89, 0.0033, 6, 0.72, 1.0, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(link,dict):\n li = LI(A(name, **link))\n elif link:\n li = LI(A(name, _href=link))\n elif not link and isinstance(name, A):\n li = LI(name)\n else:\n li = LI(A(name, _href='#',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2407_C20", "label": "li = LI()", "type": "assigned_variable", "loc": [2407, 2407], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2406_C16", "vector": [14, 7, 0.8888, 0.0004, 7, 0.18, 0.0, 603, 3, 1, 0, 0, 814, 10, 2], "semantic": {"name": "li", "arg_names": [], "import_names": [], "rhs_call_name": "LI", "annotation": ""}, "snippet": " li = LI(A(name, **link))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2408_C16", "label": "if", "type": "if", "loc": [2408, 2414], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2406_C16", "vector": [4, 7, 0.8903, 0.0026, 7, 0.18, 1.0, 0, 2, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif link:\n li = LI(A(name, _href=link))\n elif not link and isinstance(name, A):\n li = LI(name)\n else:\n li = LI(A(name, _href='#',\n _onclick='javascript:void(0);return false;'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2409_C20", "label": "li = LI()", "type": "assigned_variable", "loc": [2409, 2409], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2408_C16", "vector": [14, 8, 0.8896, 0.0004, 8, 0.44, 0.0, 603, 3, 1, 0, 0, 814, 10, 2], "semantic": {"name": "li", "arg_names": [], "import_names": [], "rhs_call_name": "LI", "annotation": ""}, "snippet": " li = LI(A(name, _href=link))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2410_C16", "label": "if", "type": "if", "loc": [2410, 2414], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2408_C16", "vector": [4, 8, 0.8907, 0.0018, 8, 0.44, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not link and isinstance(name, A):\n li = LI(name)\n else:\n li = LI(A(name, _href='#',\n _onclick='javascript:void(0);return false;'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2411_C20", "label": "li = LI()", "type": "assigned_variable", "loc": [2411, 2411], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2410_C16", "vector": [14, 9, 0.8903, 0.0004, 9, 0.84, 0.0, 603, 3, 1, 0, 0, 814, 10, 1], "semantic": {"name": "li", "arg_names": [], "import_names": [], "rhs_call_name": "LI", "annotation": ""}, "snippet": " li = LI(name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2413_C20", "label": "li = LI()", "type": "assigned_variable", "loc": [2413, 2414], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2410_C16", "vector": [14, 9, 0.8912, 0.0007, 9, 0.84, 1.0, 603, 3, 1, 0, 0, 814, 10, 2], "semantic": {"name": "li", "arg_names": [], "import_names": [], "rhs_call_name": "LI", "annotation": ""}, "snippet": " li = LI(A(name, _href='#',\n _onclick='javascript:void(0);return false;'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2415_C16", "label": "if", "type": "if", "loc": [2415, 2418], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2398_C12", "vector": [4, 4, 0.8924, 0.0015, 4, 0.7, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if level == 0 and item == data[0]:\n li['_class'] = self['li_first']\n elif level == 0 and item == data[-1]:\n li['_class'] = self['li_last']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2416_C20", "label": "assign", "type": "assigned_variable", "loc": [2416, 2416], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2415_C16", "vector": [14, 5, 0.8922, 0.0004, 5, 0.44, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " li['_class'] = self['li_first']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2417_C16", "label": "if", "type": "if", "loc": [2417, 2418], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2415_C16", "vector": [4, 5, 0.8927, 0.0007, 5, 0.44, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif level == 0 and item == data[-1]:\n li['_class'] = self['li_last']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2418_C20", "label": "assign", "type": "assigned_variable", "loc": [2418, 2418], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2417_C16", "vector": [14, 6, 0.8929, 0.0004, 6, 0.85, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " li['_class'] = self['li_last']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2419_C16", "label": "if", "type": "if", "loc": [2419, 2421], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2398_C12", "vector": [4, 4, 0.8936, 0.0011, 4, 0.7, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(item) > 3 and item[3]:\n li['_class'] = self['li_class']\n li.append(self.serialize(item[3], level + 1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2420_C20", "label": "assign", "type": "assigned_variable", "loc": [2420, 2420], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2419_C16", "vector": [14, 5, 0.8936, 0.0004, 5, 0.33, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " li['_class'] = self['li_class']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2421_C20", "label": "append()", "type": "expression", "loc": [2421, 2421], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2419_C16", "vector": [8, 5, 0.894, 0.0004, 5, 0.33, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " li.append(self.serialize(item[3], level + 1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2422_C16", "label": "if", "type": "if", "loc": [2422, 2426], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2398_C12", "vector": [4, 4, 0.8951, 0.0018, 4, 0.7, 0.8333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if active or ('active_url' in self.attributes and self['active_url'] == link):\n if li['_class']:\n li['_class'] = li['_class'] + ' ' + self['li_active']\n else:\n li['_class'] = self['li_active']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2423_C20", "label": "if", "type": "if", "loc": [2423, 2426], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2422_C16", "vector": [4, 5, 0.8953, 0.0015, 5, 0.86, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if li['_class']:\n li['_class'] = li['_class'] + ' ' + self['li_active']\n else:\n li['_class'] = self['li_active']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2424_C24", "label": "assign", "type": "assigned_variable", "loc": [2424, 2424], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2423_C20", "vector": [14, 6, 0.8951, 0.0004, 6, 0.96, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " li['_class'] = li['_class'] + ' ' + self['li_active']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2426_C24", "label": "assign", "type": "assigned_variable", "loc": [2426, 2426], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2423_C20", "vector": [14, 6, 0.8959, 0.0004, 6, 0.96, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " li['_class'] = self['li_active']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2427_C16", "label": "if", "type": "if", "loc": [2427, 2428], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2398_C12", "vector": [4, 4, 0.8964, 0.0007, 4, 0.7, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(item) <= 4 or item[4] == True:\n ul.append(li)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2428_C20", "label": "append()", "type": "expression", "loc": [2428, 2428], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2427_C16", "vector": [8, 5, 0.8966, 0.0004, 5, 0.16, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " ul.append(li)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2429_C8", "label": "return", "type": "return", "loc": [2429, 2429], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2392_C4", "vector": [13, 2, 0.897, 0.0004, 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 ul"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2431_C4", "label": "serialize_mobile", "type": "function", "loc": [2431, 2442], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2355_C0", "vector": [2, 1, 0.8997, 0.0044, 1, 0.07, 0.8, 196, 0, 4, 1, 0, 0, 0, 9], "semantic": {"name": "serialize_mobile", "arg_names": ["self", "data", "select", "prefix"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize_mobile(self, data, select=None, prefix=''):\n if not select:\n select = SELECT(**self.attributes)\n for item in data:\n if len(item) <= 4 or item[4] == True:\n select.append(OPTION(CAT(prefix, item[0]),\n _value=item[2], _selected=item[1]))\n if len(item) > 3 and len(item[3]):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2432_C8", "label": "if", "type": "if", "loc": [2432, 2433], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2431_C4", "vector": [4, 2, 0.8983, 0.0007, 2, 0.87, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not select:\n select = SELECT(**self.attributes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2433_C12", "label": "select = SELECT()", "type": "assigned_variable", "loc": [2433, 2433], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2432_C8", "vector": [14, 3, 0.8984, 0.0004, 3, 0.53, 0.0, 438, 3, 1, 0, 0, 736, 10, 1], "semantic": {"name": "select", "arg_names": [], "import_names": [], "rhs_call_name": "SELECT", "annotation": ""}, "snippet": " select = SELECT(**self.attributes)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2434_C8", "label": "for item", "type": "for", "loc": [2434, 2440], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2431_C4", "vector": [6, 2, 0.8999, 0.0026, 2, 0.87, 0.3333, 434, 2, 0, 0, 0, 0, 0, 8], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in data:\n if len(item) <= 4 or item[4] == True:\n select.append(OPTION(CAT(prefix, item[0]),\n _value=item[2], _selected=item[1]))\n if len(item) > 3 and len(item[3]):\n self.serialize_mobile(\n item[3], select, prefix=CAT(prefix, item[0], '/'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2435_C12", "label": "if", "type": "if", "loc": [2435, 2440], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2434_C8", "vector": [4, 3, 0.9001, 0.0022, 3, 0.15, 0.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(item) <= 4 or item[4] == True:\n select.append(OPTION(CAT(prefix, item[0]),\n _value=item[2], _selected=item[1]))\n if len(item) > 3 and len(item[3]):\n self.serialize_mobile(\n item[3], select, prefix=CAT(prefix, item[0], '/'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2436_C16", "label": "append()", "type": "expression", "loc": [2436, 2437], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2435_C12", "vector": [8, 4, 0.8997, 0.0007, 4, 0.81, 0.0, 243, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " select.append(OPTION(CAT(prefix, item[0]),\n _value=item[2], _selected=item[1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2438_C16", "label": "if", "type": "if", "loc": [2438, 2440], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2435_C12", "vector": [4, 4, 0.9007, 0.0011, 4, 0.81, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(item) > 3 and len(item[3]):\n self.serialize_mobile(\n item[3], select, prefix=CAT(prefix, item[0], '/'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2439_C20", "label": "serialize_mobile()", "type": "expression", "loc": [2439, 2440], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2438_C16", "vector": [8, 5, 0.9008, 0.0007, 5, 0.51, 0.0, 196, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "serialize_mobile", "arg_names": [], "import_names": [], "rhs_call_name": "serialize_mobile", "annotation": ""}, "snippet": " self.serialize_mobile(\n item[3], select, prefix=CAT(prefix, item[0], '/'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2441_C8", "label": "assign", "type": "assigned_variable", "loc": [2441, 2441], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2431_C4", "vector": [14, 2, 0.9014, 0.0004, 2, 0.87, 0.6667, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " select['_onchange'] = 'window.location=this.value'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2442_C8", "label": "return", "type": "return", "loc": [2442, 2442], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2431_C4", "vector": [13, 2, 0.9018, 0.0004, 2, 0.87, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return select"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2444_C4", "label": "xml", "type": "function", "loc": [2444, 2448], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2355_C0", "vector": [2, 1, 0.9032, 0.0018, 1, 0.07, 1.0, 324, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "xml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def xml(self):\n if self['mobile']:\n return self.serialize_mobile(self.data, 0).xml()\n else:\n return self.serialize(self.data, 0).xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2445_C8", "label": "if", "type": "if", "loc": [2445, 2448], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2444_C4", "vector": [4, 2, 0.9034, 0.0015, 2, 0.75, 0.0, 0, 6, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self['mobile']:\n return self.serialize_mobile(self.data, 0).xml()\n else:\n return self.serialize(self.data, 0).xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2446_C12", "label": "return", "type": "return", "loc": [2446, 2446], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2445_C8", "vector": [13, 3, 0.9032, 0.0004, 3, 0.12, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.serialize_mobile(self.data, 0).xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2448_C12", "label": "return", "type": "return", "loc": [2448, 2448], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2445_C8", "vector": [13, 3, 0.904, 0.0004, 3, 0.12, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.serialize(self.data, 0).xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2451_C0", "label": "embed64", "type": "function", "loc": [2451, 2470], "level": 0, "parent": null, "vector": [2, 0, 0.9086, 0.0074, 0, 0.66, 0.9417, 720, 0, 4, 1, 0, 0, 0, 5], "semantic": {"name": "embed64", "arg_names": ["filename", "file", "data", "extension"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def embed64(\n filename=None,\n file=None,\n data=None,\n extension='image/gif',\n):\n \"\"\"\n helper to encode the provided (binary) data into base64."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2457_C4", "label": "expression", "type": "expression", "loc": [2457, 2463], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2451_C0", "vector": [8, 1, 0.9084, 0.0026, 1, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n helper to encode the provided (binary) data into base64.\n\n :param filename: if provided, opens and reads this file in 'rb' mode\n :param file: if provided, reads this file\n :param data: if provided, uses the provided data\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2465_C4", "label": "if", "type": "if", "loc": [2465, 2468], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2451_C0", "vector": [4, 1, 0.9108, 0.0015, 1, 0.14, 0.3333, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if filename and os.path.exists(file):\n fp = open(filename, 'rb')\n data = fp.read()\n fp.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2466_C8", "label": "fp = open()", "type": "assigned_variable", "loc": [2466, 2466], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2465_C4", "vector": [14, 2, 0.9106, 0.0004, 2, 0.17, 0.0, 392, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fp", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " fp = open(filename, 'rb')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2467_C8", "label": "data = read()", "type": "assigned_variable", "loc": [2467, 2467], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2465_C4", "vector": [14, 2, 0.911, 0.0004, 2, 0.17, 0.5, 929, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " data = fp.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2468_C8", "label": "close()", "type": "expression", "loc": [2468, 2468], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2465_C4", "vector": [8, 2, 0.9114, 0.0004, 2, 0.17, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fp.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2469_C4", "label": "data = b64encode()", "type": "assigned_variable", "loc": [2469, 2469], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2451_C0", "vector": [14, 1, 0.9117, 0.0004, 1, 0.14, 0.6667, 929, 3, 1, 0, 0, 11, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "b64encode", "annotation": ""}, "snippet": " data = base64.b64encode(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2470_C4", "label": "return", "type": "return", "loc": [2470, 2470], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2451_C0", "vector": [13, 1, 0.9121, 0.0004, 1, 0.14, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'data:%s;base64,%s' % (extension, data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2473_C0", "label": "test", "type": "function", "loc": [2473, 2518], "level": 0, "parent": null, "vector": [2, 0, 0.9215, 0.017, 0, 0.66, 0.9515, 224, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def test():\n \"\"\"\n Example:\n\n >>> from validators import *\n >>> print DIV(A('click me', _href=URL(a='a', c='b', f='c')), BR(), HR(), DIV(SPAN(\\\"World\\\"), _class='unknown')).xml()\n <div><a href=\\\"/a/b/c\\\">click me</a><br /><hr /><div class=\\\"unknown\\\"><span>World</span></div></div>\n >>> print DIV(UL(\\\"doc\\\",\\\"cat\\\",\\\"mouse\\\")).xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2474_C4", "label": "expression", "type": "expression", "loc": [2474, 2517], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2473_C0", "vector": [8, 1, 0.9215, 0.0162, 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 Example:\n\n >>> from validators import *\n >>> print DIV(A('click me', _href=URL(a='a', c='b', f='c')), BR(), HR(), DIV(SPAN(\\\"World\\\"), _class='unknown')).xml()\n <div><a href=\\\"/a/b/c\\\">click me</a><br /><hr /><div class=\\\"unknown\\\"><span>World</span></div></div>\n >>> print DIV(UL(\\\"doc\\\",\\\"cat\\\",\\\"mouse\\\")).xml()\n <div><ul><li>doc</li><li>cat</li><li>mouse</li></ul></div>"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2521_C0", "label": "web2pyHTMLParser", "type": "class", "loc": [2521, 2586], "level": 0, "parent": null, "vector": [3, 0, 0.9429, 0.0244, 0, 0.66, 0.9612, 113, 0, 6, 0, 0, 217, 0, 28], "semantic": {"name": "web2pyHTMLParser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class web2pyHTMLParser(HTMLParser):\n \"\"\"\n obj = web2pyHTMLParser(text) parses and html/xml text into web2py helpers.\n obj.tree contains the root of the tree, and tree can be manipulated\n\n >>> str(web2pyHTMLParser('hello<div a=\"b\" c=3>wor<ld<span>xxx</span>y<script/>yy</div>zzz').tree)\n 'hello<div a=\"b\" c=\"3\">wor<ld<span>xxx</span>y<script></script>yy</div>zzz'\n >>> str(web2pyHTMLParser('<div>a<span>b</div>c').tree)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2522_C4", "label": "expression", "type": "expression", "loc": [2522, 2534], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2521_C0", "vector": [8, 1, 0.9335, 0.0048, 1, 0.99, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n obj = web2pyHTMLParser(text) parses and html/xml text into web2py helpers.\n obj.tree contains the root of the tree, and tree can be manipulated\n\n >>> str(web2pyHTMLParser('hello<div a=\"b\" c=3>wor<ld<span>xxx</span>y<script/>yy</div>zzz').tree)\n 'hello<div a=\"b\" c=\"3\">wor<ld<span>xxx</span>y<script></script>yy</div>zzz'\n >>> str(web2pyHTMLParser('<div>a<span>b</div>c').tree)\n '<div>a<span>b</span></div>c'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2535_C4", "label": "__init__", "type": "function", "loc": [2535, 2541], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2521_C0", "vector": [2, 1, 0.9372, 0.0026, 1, 0.99, 0.1667, 555, 0, 3, 0, 0, 0, 0, 5], "semantic": {"name": "__init__", "arg_names": ["self", "text", "closed"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, text, closed=('input', 'link')):\n HTMLParser.__init__(self)\n self.tree = self.parent = TAG['']()\n self.closed = closed\n self.tags = [x for x in __all__ if isinstance(eval(x), DIV)]\n self.last = None\n self.feed(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2536_C8", "label": "__init__()", "type": "expression", "loc": [2536, 2536], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2535_C4", "vector": [8, 2, 0.9365, 0.0004, 2, 0.38, 0.0, 555, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " HTMLParser.__init__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2537_C8", "label": "self.tree =", "type": "assigned_variable", "loc": [2537, 2537], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2535_C4", "vector": [14, 2, 0.9369, 0.0004, 2, 0.38, 0.2, 180, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "self.tree", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.tree = self.parent = TAG['']()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2538_C8", "label": "self.closed =", "type": "assigned_variable", "loc": [2538, 2538], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2535_C4", "vector": [14, 2, 0.9372, 0.0004, 2, 0.38, 0.4, 494, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.closed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.closed = closed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2539_C8", "label": "self.tags =", "type": "assigned_variable", "loc": [2539, 2539], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2535_C4", "vector": [14, 2, 0.9376, 0.0004, 2, 0.38, 0.6, 664, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "self.tags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.tags = [x for x in __all__ if isinstance(eval(x), DIV)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2540_C8", "label": "self.last =", "type": "assigned_variable", "loc": [2540, 2540], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2535_C4", "vector": [14, 2, 0.938, 0.0004, 2, 0.38, 0.8, 379, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.last", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.last = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2541_C8", "label": "feed()", "type": "expression", "loc": [2541, 2541], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2535_C4", "vector": [8, 2, 0.9383, 0.0004, 2, 0.38, 1.0, 87, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "feed", "arg_names": [], "import_names": [], "rhs_call_name": "feed", "annotation": ""}, "snippet": " self.feed(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2543_C4", "label": "handle_starttag", "type": "function", "loc": [2543, 2557], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2521_C0", "vector": [2, 1, 0.9417, 0.0055, 1, 0.99, 0.3333, 761, 0, 3, 0, 0, 0, 0, 6], "semantic": {"name": "handle_starttag", "arg_names": ["self", "tagname", "attrs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_starttag(self, tagname, attrs):\n if tagname.upper() in self.tags:\n tag = eval(tagname.upper())\n else:\n if tagname in self.closed:\n tagname += '/'\n tag = TAG[tagname]()\n for key, value in attrs:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2544_C8", "label": "if", "type": "if", "loc": [2544, 2549], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2543_C4", "vector": [4, 2, 0.9404, 0.0022, 2, 0.46, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tagname.upper() in self.tags:\n tag = eval(tagname.upper())\n else:\n if tagname in self.closed:\n tagname += '/'\n tag = TAG[tagname]()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2545_C12", "label": "tag = eval()", "type": "assigned_variable", "loc": [2545, 2545], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2544_C8", "vector": [14, 3, 0.9398, 0.0004, 3, 0.83, 0.0, 732, 3, 1, 0, 0, 776, 10, 2], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "eval", "annotation": ""}, "snippet": " tag = eval(tagname.upper())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2547_C12", "label": "if", "type": "if", "loc": [2547, 2548], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2544_C8", "vector": [4, 3, 0.9407, 0.0007, 3, 0.83, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tagname in self.closed:\n tagname += '/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2549_C12", "label": "tag =", "type": "assigned_variable", "loc": [2549, 2549], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2544_C8", "vector": [14, 3, 0.9413, 0.0004, 3, 0.83, 1.0, 732, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = TAG[tagname]()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2550_C8", "label": "for key, value", "type": "for", "loc": [2550, 2551], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2543_C4", "vector": [6, 2, 0.9418, 0.0007, 2, 0.46, 0.25, 839, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, value in attrs:\n tag['_' + key] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2551_C12", "label": "assign", "type": "assigned_variable", "loc": [2551, 2551], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2550_C8", "vector": [14, 3, 0.942, 0.0004, 3, 0.08, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag['_' + key] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2552_C8", "label": "tag.parent =", "type": "assigned_variable", "loc": [2552, 2552], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2543_C4", "vector": [14, 2, 0.9424, 0.0004, 2, 0.46, 0.5, 136, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tag.parent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag.parent = self.parent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2553_C8", "label": "append()", "type": "expression", "loc": [2553, 2553], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2543_C4", "vector": [8, 2, 0.9428, 0.0004, 2, 0.46, 0.75, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.parent.append(tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2554_C8", "label": "if", "type": "if", "loc": [2554, 2557], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2543_C4", "vector": [4, 2, 0.9437, 0.0015, 2, 0.46, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not tag.tag.endswith('/'):\n self.parent = tag\n else:\n self.last = tag.tag[:-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2555_C12", "label": "self.parent =", "type": "assigned_variable", "loc": [2555, 2555], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2554_C8", "vector": [14, 3, 0.9435, 0.0004, 3, 0.35, 0.0, 428, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.parent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.parent = tag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2557_C12", "label": "self.last =", "type": "assigned_variable", "loc": [2557, 2557], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2554_C8", "vector": [14, 3, 0.9442, 0.0004, 3, 0.35, 1.0, 379, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.last", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.last = tag.tag[:-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2559_C4", "label": "handle_data", "type": "function", "loc": [2559, 2565], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2521_C0", "vector": [2, 1, 0.9461, 0.0026, 1, 0.99, 0.5, 645, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "handle_data", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_data(self, data):\n if not isinstance(data, unicode):\n try:\n data = data.decode('utf8')\n except:\n data = data.decode('latin1')\n self.parent.append(data.encode('utf8', 'xmlcharref'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2560_C8", "label": "if", "type": "if", "loc": [2560, 2564], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2559_C4", "vector": [4, 2, 0.9461, 0.0018, 2, 0.26, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(data, unicode):\n try:\n data = data.decode('utf8')\n except:\n data = data.decode('latin1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L2561_C12", "label": "try", "type": "try", "loc": [2561, 2564], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2560_C8", "vector": [7, 3, 0.9463, 0.0015, 3, 0.56, 0.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n data = data.decode('utf8')\n except:\n data = data.decode('latin1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2562_C16", "label": "data = decode()", "type": "assigned_variable", "loc": [2562, 2562], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L2561_C12", "vector": [14, 4, 0.9461, 0.0004, 4, 0.73, 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('utf8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2564_C16", "label": "data = decode()", "type": "assigned_variable", "loc": [2564, 2564], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L2561_C12", "vector": [14, 4, 0.9468, 0.0004, 4, 0.73, 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('latin1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2565_C8", "label": "append()", "type": "expression", "loc": [2565, 2565], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2559_C4", "vector": [8, 2, 0.9472, 0.0004, 2, 0.26, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.parent.append(data.encode('utf8', 'xmlcharref'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2567_C4", "label": "handle_charref", "type": "function", "loc": [2567, 2571], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2521_C0", "vector": [2, 1, 0.9487, 0.0018, 1, 0.99, 0.6667, 26, 0, 2, 0, 0, 0, 0, 9], "semantic": {"name": "handle_charref", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_charref(self, name):\n if name.startswith('x'):\n self.parent.append(unichr(int(name[1:], 16)).encode('utf8'))\n else:\n self.parent.append(unichr(int(name)).encode('utf8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2568_C8", "label": "if", "type": "if", "loc": [2568, 2571], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2567_C4", "vector": [4, 2, 0.9489, 0.0015, 2, 0.79, 0.0, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name.startswith('x'):\n self.parent.append(unichr(int(name[1:], 16)).encode('utf8'))\n else:\n self.parent.append(unichr(int(name)).encode('utf8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2569_C12", "label": "append()", "type": "expression", "loc": [2569, 2569], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2568_C8", "vector": [8, 3, 0.9487, 0.0004, 3, 0.91, 0.0, 243, 3, 1, 0, 0, 0, 0, 4], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.parent.append(unichr(int(name[1:], 16)).encode('utf8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2571_C12", "label": "append()", "type": "expression", "loc": [2571, 2571], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2568_C8", "vector": [8, 3, 0.9494, 0.0004, 3, 0.91, 1.0, 243, 3, 1, 0, 0, 0, 0, 4], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.parent.append(unichr(int(name)).encode('utf8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2573_C4", "label": "handle_entityref", "type": "function", "loc": [2573, 2574], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2521_C0", "vector": [2, 1, 0.9503, 0.0007, 1, 0.99, 0.8333, 733, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "handle_entityref", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_entityref(self, name):\n self.parent.append(entitydefs[name])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2574_C8", "label": "append()", "type": "expression", "loc": [2574, 2574], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2573_C4", "vector": [8, 2, 0.9505, 0.0004, 2, 0.78, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.parent.append(entitydefs[name])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2576_C4", "label": "handle_endtag", "type": "function", "loc": [2576, 2586], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2521_C0", "vector": [2, 1, 0.9531, 0.0041, 1, 0.99, 1.0, 63, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "handle_endtag", "arg_names": ["self", "tagname"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handle_endtag(self, tagname):\n # this deals with unbalanced tags\n if tagname == self.last:\n return\n while True:\n try:\n parent_tagname = self.parent.tag\n self.parent = self.parent.parent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2578_C8", "label": "if", "type": "if", "loc": [2578, 2579], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2576_C4", "vector": [4, 2, 0.9522, 0.0007, 2, 0.72, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tagname == self.last:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2579_C12", "label": "return", "type": "return", "loc": [2579, 2579], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2578_C8", "vector": [13, 3, 0.9524, 0.0004, 3, 0.66, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:While_L2580_C8", "label": "while", "type": "while", "loc": [2580, 2586], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2576_C4", "vector": [5, 2, 0.9538, 0.0026, 2, 0.72, 1.0, 0, 1, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n try:\n parent_tagname = self.parent.tag\n self.parent = self.parent.parent\n except:\n raise RuntimeError(\"unable to balance tag %s\" % tagname)\n if parent_tagname[:len(tagname)] == tagname: break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L2581_C12", "label": "try", "type": "try", "loc": [2581, 2585], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:While_L2580_C8", "vector": [7, 3, 0.9538, 0.0018, 3, 0.57, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n parent_tagname = self.parent.tag\n self.parent = self.parent.parent\n except:\n raise RuntimeError(\"unable to balance tag %s\" % tagname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2582_C16", "label": "parent_tagname =", "type": "assigned_variable", "loc": [2582, 2582], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L2581_C12", "vector": [14, 4, 0.9535, 0.0004, 4, 0.53, 0.0, 581, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parent_tagname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parent_tagname = self.parent.tag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2583_C16", "label": "self.parent =", "type": "assigned_variable", "loc": [2583, 2583], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L2581_C12", "vector": [14, 4, 0.9538, 0.0004, 4, 0.53, 1.0, 428, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.parent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.parent = self.parent.parent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2586_C12", "label": "if", "type": "if", "loc": [2586, 2586], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:While_L2580_C8", "vector": [4, 3, 0.9549, 0.0004, 3, 0.57, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parent_tagname[:len(tagname)] == tagname: break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "label": "markdown_serializer", "type": "function", "loc": [2589, 2615], "level": 0, "parent": null, "vector": [2, 0, 0.9609, 0.01, 0, 0.66, 0.9709, 790, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "markdown_serializer", "arg_names": ["text", "tag", "attr"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def markdown_serializer(text, tag=None, attr=None):\n attr = attr or {}\n if tag is None:\n return re.sub('\\s+', ' ', text)\n if tag == 'br':\n return '\\n\\n'\n if tag == 'h1':\n return '#' + text + '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2590_C4", "label": "attr =", "type": "assigned_variable", "loc": [2590, 2590], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "vector": [14, 1, 0.9564, 0.0004, 1, 0.2, 0.0, 400, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "attr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " attr = attr or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2591_C4", "label": "if", "type": "if", "loc": [2591, 2592], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "vector": [4, 1, 0.957, 0.0007, 1, 0.2, 0.0769, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag is None:\n return re.sub('\\s+', ' ', text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2592_C8", "label": "return", "type": "return", "loc": [2592, 2592], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2591_C4", "vector": [13, 2, 0.9572, 0.0004, 2, 0.28, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return re.sub('\\s+', ' ', text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2593_C4", "label": "if", "type": "if", "loc": [2593, 2594], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "vector": [4, 1, 0.9577, 0.0007, 1, 0.2, 0.1538, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'br':\n return '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2594_C8", "label": "return", "type": "return", "loc": [2594, 2594], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2593_C4", "vector": [13, 2, 0.9579, 0.0004, 2, 0.09, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2595_C4", "label": "if", "type": "if", "loc": [2595, 2596], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "vector": [4, 1, 0.9585, 0.0007, 1, 0.2, 0.2308, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'h1':\n return '#' + text + '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2596_C8", "label": "return", "type": "return", "loc": [2596, 2596], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2595_C4", "vector": [13, 2, 0.9586, 0.0004, 2, 0.23, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '#' + text + '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2597_C4", "label": "if", "type": "if", "loc": [2597, 2598], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "vector": [4, 1, 0.9592, 0.0007, 1, 0.2, 0.3077, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'h2':\n return '#' * 2 + text + '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2598_C8", "label": "return", "type": "return", "loc": [2598, 2598], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2597_C4", "vector": [13, 2, 0.9594, 0.0004, 2, 0.62, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '#' * 2 + text + '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2599_C4", "label": "if", "type": "if", "loc": [2599, 2600], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "vector": [4, 1, 0.9599, 0.0007, 1, 0.2, 0.3846, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'h3':\n return '#' * 3 + text + '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2600_C8", "label": "return", "type": "return", "loc": [2600, 2600], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2599_C4", "vector": [13, 2, 0.9601, 0.0004, 2, 0.26, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '#' * 3 + text + '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2601_C4", "label": "if", "type": "if", "loc": [2601, 2602], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "vector": [4, 1, 0.9607, 0.0007, 1, 0.2, 0.4615, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'h4':\n return '#' * 4 + text + '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2602_C8", "label": "return", "type": "return", "loc": [2602, 2602], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2601_C4", "vector": [13, 2, 0.9609, 0.0004, 2, 0.12, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '#' * 4 + text + '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2603_C4", "label": "if", "type": "if", "loc": [2603, 2604], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "vector": [4, 1, 0.9614, 0.0007, 1, 0.2, 0.5385, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'p':\n return text + '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2604_C8", "label": "return", "type": "return", "loc": [2604, 2604], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2603_C4", "vector": [13, 2, 0.9616, 0.0004, 2, 0.69, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return text + '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2605_C4", "label": "if", "type": "if", "loc": [2605, 2606], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "vector": [4, 1, 0.9621, 0.0007, 1, 0.2, 0.6154, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'b' or tag == 'strong':\n return '**%s**' % text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2606_C8", "label": "return", "type": "return", "loc": [2606, 2606], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2605_C4", "vector": [13, 2, 0.9623, 0.0004, 2, 0.06, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '**%s**' % text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2607_C4", "label": "if", "type": "if", "loc": [2607, 2608], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "vector": [4, 1, 0.9629, 0.0007, 1, 0.2, 0.6923, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'em' or tag == 'i':\n return '*%s*' % text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2608_C8", "label": "return", "type": "return", "loc": [2608, 2608], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2607_C4", "vector": [13, 2, 0.9631, 0.0004, 2, 0.15, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '*%s*' % text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2609_C4", "label": "if", "type": "if", "loc": [2609, 2610], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "vector": [4, 1, 0.9636, 0.0007, 1, 0.2, 0.7692, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'tt' or tag == 'code':\n return '`%s`' % text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2610_C8", "label": "return", "type": "return", "loc": [2610, 2610], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2609_C4", "vector": [13, 2, 0.9638, 0.0004, 2, 0.49, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '`%s`' % text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2611_C4", "label": "if", "type": "if", "loc": [2611, 2612], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "vector": [4, 1, 0.9644, 0.0007, 1, 0.2, 0.8462, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'a':\n return '[%s](%s)' % (text, attr.get('_href', ''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2612_C8", "label": "return", "type": "return", "loc": [2612, 2612], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2611_C4", "vector": [13, 2, 0.9645, 0.0004, 2, 0.86, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '[%s](%s)' % (text, attr.get('_href', ''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2613_C4", "label": "if", "type": "if", "loc": [2613, 2614], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "vector": [4, 1, 0.9651, 0.0007, 1, 0.2, 0.9231, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'img':\n return '' % (attr.get('_alt', ''), attr.get('_src', ''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2614_C8", "label": "return", "type": "return", "loc": [2614, 2614], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2613_C4", "vector": [13, 2, 0.9653, 0.0004, 2, 0.32, 0.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '' % (attr.get('_alt', ''), attr.get('_src', ''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2615_C4", "label": "return", "type": "return", "loc": [2615, 2615], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "vector": [13, 1, 0.9657, 0.0004, 1, 0.2, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "label": "markmin_serializer", "type": "function", "loc": [2618, 2653], "level": 0, "parent": null, "vector": [2, 0, 0.9732, 0.0133, 0, 0.66, 0.9806, 488, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "markmin_serializer", "arg_names": ["text", "tag", "attr"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def markmin_serializer(text, tag=None, attr=None):\n attr = attr or {}\n # if tag is None: return re.sub('\\s+',' ',text)\n if tag == 'br':\n return '\\n\\n'\n if tag == 'h1':\n return '# ' + text + '\\n\\n'\n if tag == 'h2':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2619_C4", "label": "attr =", "type": "assigned_variable", "loc": [2619, 2619], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "vector": [14, 1, 0.9671, 0.0004, 1, 0.23, 0.0, 400, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "attr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " attr = attr or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2621_C4", "label": "if", "type": "if", "loc": [2621, 2622], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "vector": [4, 1, 0.9681, 0.0007, 1, 0.23, 0.0588, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'br':\n return '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2622_C8", "label": "return", "type": "return", "loc": [2622, 2622], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2621_C4", "vector": [13, 2, 0.9682, 0.0004, 2, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2623_C4", "label": "if", "type": "if", "loc": [2623, 2624], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "vector": [4, 1, 0.9688, 0.0007, 1, 0.23, 0.1176, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'h1':\n return '# ' + text + '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2624_C8", "label": "return", "type": "return", "loc": [2624, 2624], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2623_C4", "vector": [13, 2, 0.969, 0.0004, 2, 0.48, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '# ' + text + '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2625_C4", "label": "if", "type": "if", "loc": [2625, 2626], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "vector": [4, 1, 0.9695, 0.0007, 1, 0.23, 0.1765, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'h2':\n return '#' * 2 + ' ' + text + '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2626_C8", "label": "return", "type": "return", "loc": [2626, 2626], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2625_C4", "vector": [13, 2, 0.9697, 0.0004, 2, 0.83, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '#' * 2 + ' ' + text + '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2627_C4", "label": "if", "type": "if", "loc": [2627, 2628], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "vector": [4, 1, 0.9703, 0.0007, 1, 0.23, 0.2353, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'h3':\n return '#' * 3 + ' ' + text + '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2628_C8", "label": "return", "type": "return", "loc": [2628, 2628], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2627_C4", "vector": [13, 2, 0.9705, 0.0004, 2, 0.98, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '#' * 3 + ' ' + text + '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2629_C4", "label": "if", "type": "if", "loc": [2629, 2630], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "vector": [4, 1, 0.971, 0.0007, 1, 0.23, 0.2941, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'h4':\n return '#' * 4 + ' ' + text + '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2630_C8", "label": "return", "type": "return", "loc": [2630, 2630], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2629_C4", "vector": [13, 2, 0.9712, 0.0004, 2, 0.28, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '#' * 4 + ' ' + text + '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2631_C4", "label": "if", "type": "if", "loc": [2631, 2632], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "vector": [4, 1, 0.9718, 0.0007, 1, 0.23, 0.3529, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'p':\n return text + '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2632_C8", "label": "return", "type": "return", "loc": [2632, 2632], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2631_C4", "vector": [13, 2, 0.9719, 0.0004, 2, 0.38, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return text + '\\n\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2633_C4", "label": "if", "type": "if", "loc": [2633, 2634], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "vector": [4, 1, 0.9725, 0.0007, 1, 0.23, 0.4118, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'li':\n return '\\n- ' + text.replace('\\n', ' ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2634_C8", "label": "return", "type": "return", "loc": [2634, 2634], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2633_C4", "vector": [13, 2, 0.9727, 0.0004, 2, 0.39, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\\n- ' + text.replace('\\n', ' ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2635_C4", "label": "if", "type": "if", "loc": [2635, 2636], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "vector": [4, 1, 0.9732, 0.0007, 1, 0.23, 0.4706, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'tr':\n return text[3:].replace('\\n', ' ') + '\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2636_C8", "label": "return", "type": "return", "loc": [2636, 2636], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2635_C4", "vector": [13, 2, 0.9734, 0.0004, 2, 0.8, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return text[3:].replace('\\n', ' ') + '\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2637_C4", "label": "if", "type": "if", "loc": [2637, 2638], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "vector": [4, 1, 0.974, 0.0007, 1, 0.23, 0.5294, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag in ['table', 'blockquote']:\n return '\\n-----\\n' + text + '\\n------\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2638_C8", "label": "return", "type": "return", "loc": [2638, 2638], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2637_C4", "vector": [13, 2, 0.9742, 0.0004, 2, 0.04, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\\n-----\\n' + text + '\\n------\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2639_C4", "label": "if", "type": "if", "loc": [2639, 2640], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "vector": [4, 1, 0.9747, 0.0007, 1, 0.23, 0.5882, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag in ['td', 'th']:\n return ' | ' + text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2640_C8", "label": "return", "type": "return", "loc": [2640, 2640], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2639_C4", "vector": [13, 2, 0.9749, 0.0004, 2, 0.55, 0.0, 0, 4, 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_475:If_L2641_C4", "label": "if", "type": "if", "loc": [2641, 2642], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "vector": [4, 1, 0.9754, 0.0007, 1, 0.23, 0.6471, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag in ['b', 'strong', 'label']:\n return '**%s**' % text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2642_C8", "label": "return", "type": "return", "loc": [2642, 2642], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2641_C4", "vector": [13, 2, 0.9756, 0.0004, 2, 0.0, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '**%s**' % text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2643_C4", "label": "if", "type": "if", "loc": [2643, 2644], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "vector": [4, 1, 0.9762, 0.0007, 1, 0.23, 0.7059, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag in ['em', 'i']:\n return \"''%s''\" % text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2644_C8", "label": "return", "type": "return", "loc": [2644, 2644], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2643_C4", "vector": [13, 2, 0.9764, 0.0004, 2, 0.59, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"''%s''\" % text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2645_C4", "label": "if", "type": "if", "loc": [2645, 2646], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "vector": [4, 1, 0.9769, 0.0007, 1, 0.23, 0.7647, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag in ['tt']:\n return '``%s``' % text.strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2646_C8", "label": "return", "type": "return", "loc": [2646, 2646], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2645_C4", "vector": [13, 2, 0.9771, 0.0004, 2, 0.99, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '``%s``' % text.strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2647_C4", "label": "if", "type": "if", "loc": [2647, 2648], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "vector": [4, 1, 0.9777, 0.0007, 1, 0.23, 0.8235, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag in ['code']:\n return '``\\n%s``' % text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2648_C8", "label": "return", "type": "return", "loc": [2648, 2648], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2647_C4", "vector": [13, 2, 0.9778, 0.0004, 2, 0.71, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '``\\n%s``' % text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2649_C4", "label": "if", "type": "if", "loc": [2649, 2650], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "vector": [4, 1, 0.9784, 0.0007, 1, 0.23, 0.8824, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'a':\n return '[[%s %s]]' % (text, attr.get('_href', ''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2650_C8", "label": "return", "type": "return", "loc": [2650, 2650], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2649_C4", "vector": [13, 2, 0.9786, 0.0004, 2, 0.69, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '[[%s %s]]' % (text, attr.get('_href', ''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2651_C4", "label": "if", "type": "if", "loc": [2651, 2652], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "vector": [4, 1, 0.9791, 0.0007, 1, 0.23, 0.9412, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'img':\n return '[[%s %s left]]' % (attr.get('_alt', 'no title'), attr.get('_src', ''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2652_C8", "label": "return", "type": "return", "loc": [2652, 2652], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2651_C4", "vector": [13, 2, 0.9793, 0.0004, 2, 0.48, 0.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '[[%s %s left]]' % (attr.get('_alt', 'no title'), attr.get('_src', ''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2653_C4", "label": "return", "type": "return", "loc": [2653, 2653], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "vector": [13, 1, 0.9797, 0.0004, 1, 0.23, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2656_C0", "label": "MARKMIN", "type": "class", "loc": [2656, 2703], "level": 0, "parent": null, "vector": [3, 0, 0.9895, 0.0177, 0, 0.66, 0.9903, 209, 0, 5, 0, 0, 963, 0, 2], "semantic": {"name": "MARKMIN", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MARKMIN(XmlComponent):\n \"\"\"\n For documentation: http://web2py.com/examples/static/markmin.html\n \"\"\"\n def __init__(self, text, extra=None, allowed=None, sep='p',\n url=None, environment=None, latex='google',\n autolinks='default',\n protolinks='default',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2657_C4", "label": "expression", "type": "expression", "loc": [2657, 2659], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2656_C0", "vector": [8, 1, 0.9815, 0.0011, 1, 0.51, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n For documentation: http://web2py.com/examples/static/markmin.html\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "label": "__init__", "type": "function", "loc": [2660, 2676], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2656_C0", "vector": [2, 1, 0.9852, 0.0063, 1, 0.51, 0.2, 555, 0, 12, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "text", "extra", "allowed", "sep", "url", "environment", "latex", "autolinks", "protolinks", "class_prefix", "id_prefix"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, text, extra=None, allowed=None, sep='p',\n url=None, environment=None, latex='google',\n autolinks='default',\n protolinks='default',\n class_prefix='',\n id_prefix='markmin_'):\n self.text = text\n self.extra = extra or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2666_C8", "label": "self.text =", "type": "assigned_variable", "loc": [2666, 2666], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "vector": [14, 2, 0.9845, 0.0004, 2, 0.34, 0.0, 320, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.text = text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2667_C8", "label": "self.extra =", "type": "assigned_variable", "loc": [2667, 2667], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "vector": [14, 2, 0.9849, 0.0004, 2, 0.34, 0.1, 921, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.extra", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.extra = extra or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2668_C8", "label": "self.allowed =", "type": "assigned_variable", "loc": [2668, 2668], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "vector": [14, 2, 0.9852, 0.0004, 2, 0.34, 0.2, 747, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.allowed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.allowed = allowed or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2669_C8", "label": "self.sep =", "type": "assigned_variable", "loc": [2669, 2669], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "vector": [14, 2, 0.9856, 0.0004, 2, 0.34, 0.3, 1, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.sep", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.sep = sep"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2670_C8", "label": "self.url =", "type": "assigned_variable", "loc": [2670, 2670], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "vector": [14, 2, 0.986, 0.0004, 2, 0.34, 0.4, 720, 8, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.url = URL if url == True else url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2671_C8", "label": "self.environment =", "type": "assigned_variable", "loc": [2671, 2671], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "vector": [14, 2, 0.9863, 0.0004, 2, 0.34, 0.5, 443, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.environment", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.environment = environment"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2672_C8", "label": "self.latex =", "type": "assigned_variable", "loc": [2672, 2672], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "vector": [14, 2, 0.9867, 0.0004, 2, 0.34, 0.6, 615, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.latex", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.latex = latex"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2673_C8", "label": "self.autolinks =", "type": "assigned_variable", "loc": [2673, 2673], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "vector": [14, 2, 0.9871, 0.0004, 2, 0.34, 0.7, 845, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.autolinks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.autolinks = autolinks"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2674_C8", "label": "self.protolinks =", "type": "assigned_variable", "loc": [2674, 2674], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "vector": [14, 2, 0.9874, 0.0004, 2, 0.34, 0.8, 425, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.protolinks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.protolinks = protolinks"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2675_C8", "label": "self.class_prefix =", "type": "assigned_variable", "loc": [2675, 2675], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "vector": [14, 2, 0.9878, 0.0004, 2, 0.34, 0.9, 384, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.class_prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.class_prefix = class_prefix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2676_C8", "label": "self.id_prefix =", "type": "assigned_variable", "loc": [2676, 2676], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "vector": [14, 2, 0.9882, 0.0004, 2, 0.34, 1.0, 159, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.id_prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.id_prefix = id_prefix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2678_C4", "label": "xml", "type": "function", "loc": [2678, 2687], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2656_C0", "vector": [2, 1, 0.9906, 0.0037, 1, 0.51, 0.4, 324, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "xml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def xml(self):\n \"\"\"\n calls the gluon.contrib.markmin render function to convert the wiki syntax\n \"\"\"\n from contrib.markmin.markmin2html import render\n return render(self.text, extra=self.extra,\n allowed=self.allowed, sep=self.sep, latex=self.latex,\n URL=self.url, environment=self.environment,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2679_C8", "label": "expression", "type": "expression", "loc": [2679, 2681], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2678_C4", "vector": [8, 2, 0.9897, 0.0011, 2, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n calls the gluon.contrib.markmin render function to convert the wiki syntax\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L2682_C8", "label": "from contrib.markmin.markmin2html import render", "type": "import", "loc": [2682, 2682], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2678_C4", "vector": [1, 2, 0.9904, 0.0004, 2, 0.67, 0.5, 140, 0, 1, 0, 0, 140, 0, 0], "semantic": {"name": "contrib.markmin.markmin2html", "arg_names": [], "import_names": ["render"], "rhs_call_name": "", "annotation": ""}, "snippet": " from contrib.markmin.markmin2html import render"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2683_C8", "label": "return", "type": "return", "loc": [2683, 2687], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2678_C4", "vector": [13, 2, 0.9915, 0.0018, 2, 0.67, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return render(self.text, extra=self.extra,\n allowed=self.allowed, sep=self.sep, latex=self.latex,\n URL=self.url, environment=self.environment,\n autolinks=self.autolinks, protolinks=self.protolinks,\n class_prefix=self.class_prefix, id_prefix=self.id_prefix)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2689_C4", "label": "__str__", "type": "function", "loc": [2689, 2690], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2656_C0", "vector": [2, 1, 0.9932, 0.0007, 1, 0.51, 0.6, 527, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n return self.xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2690_C8", "label": "return", "type": "return", "loc": [2690, 2690], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2689_C4", "vector": [13, 2, 0.9934, 0.0004, 2, 0.64, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2692_C4", "label": "flatten", "type": "function", "loc": [2692, 2696], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2656_C0", "vector": [2, 1, 0.9948, 0.0018, 1, 0.51, 0.8, 893, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "flatten", "arg_names": ["self", "render"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def flatten(self, render=None):\n \"\"\"\n return the text stored by the MARKMIN object rendered by the render function\n \"\"\"\n return self.text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2693_C8", "label": "expression", "type": "expression", "loc": [2693, 2695], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2692_C4", "vector": [8, 2, 0.9948, 0.0011, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n return the text stored by the MARKMIN object rendered by the render function\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2696_C8", "label": "return", "type": "return", "loc": [2696, 2696], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2692_C4", "vector": [13, 2, 0.9956, 0.0004, 2, 0.88, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2698_C4", "label": "elements", "type": "function", "loc": [2698, 2703], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2656_C0", "vector": [2, 1, 0.9972, 0.0022, 1, 0.51, 1.0, 915, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "elements", "arg_names": ["self", "args", "kargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def elements(self, *args, **kargs):\n \"\"\"\n to be considered experimental since the behavior of this method is questionable\n another options could be TAG(self.text).elements(*args,**kargs)\n \"\"\"\n return [self.text]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2699_C8", "label": "expression", "type": "expression", "loc": [2699, 2702], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2698_C4", "vector": [8, 2, 0.9972, 0.0015, 2, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n to be considered experimental since the behavior of this method is questionable\n another options could be TAG(self.text).elements(*args,**kargs)\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2703_C8", "label": "return", "type": "return", "loc": [2703, 2703], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2698_C4", "vector": [13, 2, 0.9982, 0.0004, 2, 0.13, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [self.text]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2706_C0", "label": "if", "type": "if", "loc": [2706, 2708], "level": 0, "parent": null, "vector": [4, 0, 0.9996, 0.0011, 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 import doctest\n doctest.testmod()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Import_L2707_C4", "label": "doctest import doctest", "type": "import", "loc": [2707, 2707], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2706_C0", "vector": [1, 1, 0.9996, 0.0004, 1, 0.93, 0.0, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "doctest", "arg_names": [], "import_names": ["doctest"], "rhs_call_name": "", "annotation": ""}, "snippet": " import doctest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2708_C4", "label": "testmod()", "type": "expression", "loc": [2708, 2708], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2706_C0", "vector": [8, 1, 1.0, 0.0004, 1, 0.93, 1.0, 116, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "testmod", "arg_names": [], "import_names": [], "rhs_call_name": "testmod", "annotation": ""}, "snippet": " doctest.testmod()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L123_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L130_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L130_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L134_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L136_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L240_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L242_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L242_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L243_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L244_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L245_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L246_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L247_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L249_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L249_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L250_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L252_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L252_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L253_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L253_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L254_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L253_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L255_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L255_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L256_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L252_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L257_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L252_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L258_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L258_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L259_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L261_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L261_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L262_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L261_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L263_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L261_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L264_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L261_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L265_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L261_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L266_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L266_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L267_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L268_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L268_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L269_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L270_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L271_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L272_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L272_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L273_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L273_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L274_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L274_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L275_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L273_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L279_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L279_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L280_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L280_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L281_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L279_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L282_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L279_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L283_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L279_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L284_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L279_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L286_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L272_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L289_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L289_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L290_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L272_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L292_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L292_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L293_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L295_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L297_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L300_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L300_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L301_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L301_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L302_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L302_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L303_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L302_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L306_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L301_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L309_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L300_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L311_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L313_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L316_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L317_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L317_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L318_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L317_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L320_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L320_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L321_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L317_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L322_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L322_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L323_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L325_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L326_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L325_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L327_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L327_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L328_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L330_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L330_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L334_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L330_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L337_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L337_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L338_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L337_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L339_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L339_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L340_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L339_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L342_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L342_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L343_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L339_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L344_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L330_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L347_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L330_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L348_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L330_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L351_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L353_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L353_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L354_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L358_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L358_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L359_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L363_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L366_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L369_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L371_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L375_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L410_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L410_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L411_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L414_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L414_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L415_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L414_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L416_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L416_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L417_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L414_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L418_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L419_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L419_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L420_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L423_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L426_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L429_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L434_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L435_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L444_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L445_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L445_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L446_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L446_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L447_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L445_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L448_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L448_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L449_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L452_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L452_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L453_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L452_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L454_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L454_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L455_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L454_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L458_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L458_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L459_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L459_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L460_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L458_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L461_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L458_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L464_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L466_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L469_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L473_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L374_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L478_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L485_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L486_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L485_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L492_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L485_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L495_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L495_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L496_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L485_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L498_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L498_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L499_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L499_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L500_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L499_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L502_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L498_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L503_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L498_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L507_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L485_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L509_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L509_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L510_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L509_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L511_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L509_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L512_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L509_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L513_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L509_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L514_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L485_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L516_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L516_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L517_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L516_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L518_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L516_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L519_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L516_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L520_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L516_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L521_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L524_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L534_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L534_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L563_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L534_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L574_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L574_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L575_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L534_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L577_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L577_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L578_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L577_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L579_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L579_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L580_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L534_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L581_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L583_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L583_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L584_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L586_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L586_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L587_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L589_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L589_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L590_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L592_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L592_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L593_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L595_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L595_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L596_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L598_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L598_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L599_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L605_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L605_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L606_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L608_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L608_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L609_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L611_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L611_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L612_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L612_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L613_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L615_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L615_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L616_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L618_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L618_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L619_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L618_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L622_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L622_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L623_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L618_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L624_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L523_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L626_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L626_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L627_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L626_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L631_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L636_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L637_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L640_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L641_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L646_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L667_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L669_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L669_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L670_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L669_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L677_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L669_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L680_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L680_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L681_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L680_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L683_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L669_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L684_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L669_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L685_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L669_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L687_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L669_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L688_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L688_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L689_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L669_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L690_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L692_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L692_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L693_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L692_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L697_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L697_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L698_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L692_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L699_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L701_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L701_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L702_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L701_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L710_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L701_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L711_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L701_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L712_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L701_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L713_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L715_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L715_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L716_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L715_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L724_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L715_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L725_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L715_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L726_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L715_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L727_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L729_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L729_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L730_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L729_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L739_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L739_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L740_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L740_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L741_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L740_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L743_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L739_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L745_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L747_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L747_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L748_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L747_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L756_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L747_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L757_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L757_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L758_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L757_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L760_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L762_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L762_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L763_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L762_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L771_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L776_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L776_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L777_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L776_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L780_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L782_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L782_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L783_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L782_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L786_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L788_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L788_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L789_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L788_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L795_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L797_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L797_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L800_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L797_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L810_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L797_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L811_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L811_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L812_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L812_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L814_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L814_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L815_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L814_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L817_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L811_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L818_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L818_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L819_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L811_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L820_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L797_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L821_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L823_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L823_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L824_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L823_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L829_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L831_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L831_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L833_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L831_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L834_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L834_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L835_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L835_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L836_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L835_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L837_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L835_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L838_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L835_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L839_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L835_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L840_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L835_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L841_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L835_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L842_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L835_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L844_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L831_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L849_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L831_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L850_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L850_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L851_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L850_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L852_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L850_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L853_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L853_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L854_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L853_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L855_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L853_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L856_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L856_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L857_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L856_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L858_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L831_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L859_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L859_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L860_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L831_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L861_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L863_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L863_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L864_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L863_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L867_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L869_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L869_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L870_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L870_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L871_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L873_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L873_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L874_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L873_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L888_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L873_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L889_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L889_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L890_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L889_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L892_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L889_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L893_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L893_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L894_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L893_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L895_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L889_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L897_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L873_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L898_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L873_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L899_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L899_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L900_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L899_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L901_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L899_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L902_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L873_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L903_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L873_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L904_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L873_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L905_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L873_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L908_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L873_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L911_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L913_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L913_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L914_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L913_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L918_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L913_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L920_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L920_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L921_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L913_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L923_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L923_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L925_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L913_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L928_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L930_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L930_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L931_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L930_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L935_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L937_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L937_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L938_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L937_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L952_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L937_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L953_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L953_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L954_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L954_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L955_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L954_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L956_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L956_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L957_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L956_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L959_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L937_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L961_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L961_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L962_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L937_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L963_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L965_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L966_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L967_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L968_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L971_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1043_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1043_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1044_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1045_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1045_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1046_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1045_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1047_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1045_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1048_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1048_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1049_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1048_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1050_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1050_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1051_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1050_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1053_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1050_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1055_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1050_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1056_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1056_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1057_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1056_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1058_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1056_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1059_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1056_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1060_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1056_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1061_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1056_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1062_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1062_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1063_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1056_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1064_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1064_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1065_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1056_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1066_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1066_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1067_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1056_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1069_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1069_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1070_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1056_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1071_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1073_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1076_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1077_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1078_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1078_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1079_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1080_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1080_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1081_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1081_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1082_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1082_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1083_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1083_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1084_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1082_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1085_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1085_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1086_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1086_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1087_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1085_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1089_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1090_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1090_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1091_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1090_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1092_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1090_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1093_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1093_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1094_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1094_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1096_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1098_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1098_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1099_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1108_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1108_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1110_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1110_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1111_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1110_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1113_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1115_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1116_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1116_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1117_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1117_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1119_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1116_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1120_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1120_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1121_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1120_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1122_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1122_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1123_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1123_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1124_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1122_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1125_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1125_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1126_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1122_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1127_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L970_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1139_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1141_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1149_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1152_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1153_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1154_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L1155_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L1155_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1156_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L1155_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1157_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L1155_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1158_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1158_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1159_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L1155_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1160_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1160_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1161_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1161_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1162_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L1155_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1163_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1163_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1164_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1163_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1165_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L645_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1171_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1171_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1172_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1171_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1171_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1177_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1171_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1178_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1179_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1171_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1183_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1188_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1192_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1193_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1192_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1194_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1192_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1192_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1196_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1199_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1201_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1199_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1209_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1209_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1210_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1199_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1212_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1213_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1213_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1214_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1215_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1215_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1216_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1218_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1219_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1220_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1221_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1199_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1223_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1223_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1224_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1229_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1230_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1229_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1246_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1229_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1248_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1229_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1249_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1229_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1250_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1229_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1251_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1229_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1253_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1254_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1255_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1255_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1256_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1257_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1258_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1259_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1259_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1260_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1259_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1261_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1261_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1262_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1261_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1263_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1263_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1264_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1263_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1265_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1265_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1266_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1265_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1267_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1267_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1268_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1267_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1269_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1269_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1270_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1269_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1272_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1273_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1253_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1274_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1277_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1278_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1277_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1298_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1277_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1300_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1277_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1301_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1277_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1277_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1303_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1277_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1305_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1305_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1306_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1305_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1307_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1307_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1308_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1307_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1310_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1305_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1311_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1305_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1312_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1312_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1313_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1305_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1314_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1305_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1315_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1305_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1316_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1305_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1317_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1317_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1318_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1318_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1319_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1318_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1320_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1320_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1321_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1320_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1322_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1322_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1323_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1322_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1325_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1317_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1327_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1305_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1328_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1305_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1329_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1332_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1334_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1337_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1339_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1342_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1344_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1347_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1349_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1352_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1354_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1352_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1356_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1356_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1357_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1356_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1359_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1356_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1361_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1361_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1366_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1361_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1368_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1371_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1373_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1371_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1375_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1375_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1376_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1375_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1378_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1375_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1380_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1380_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1384_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1380_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1386_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1389_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1391_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1394_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1396_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1399_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1401_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1404_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1406_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1409_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1411_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1414_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1416_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1419_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1421_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1424_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1426_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1429_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1431_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1434_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1435_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1434_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1441_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1434_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1443_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1444_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1445_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1445_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1446_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1443_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1447_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1450_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1452_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1455_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1457_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1460_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1462_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1465_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1467_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1470_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1472_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1470_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1474_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1474_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1475_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1475_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1476_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1474_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1477_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1477_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1478_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1477_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1480_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1474_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1481_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1481_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1482_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1481_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1484_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1481_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1485_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1485_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1486_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1485_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1487_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1487_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1488_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1487_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1491_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1485_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1493_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1485_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1494_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1494_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1495_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1494_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1496_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1474_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1498_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1501_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1503_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1506_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1508_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1511_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1513_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1516_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1518_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1521_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1523_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1526_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1528_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1531_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1533_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1531_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1560_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1560_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1561_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1560_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1562_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1560_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1563_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1560_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1564_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1560_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1565_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1560_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1566_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1560_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1567_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1579_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1581_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1584_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1586_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1589_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1590_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1589_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1598_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1589_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1600_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1600_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1601_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1604_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1606_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1609_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1611_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1614_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1616_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1620_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1628_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1619_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1630_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1630_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1631_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1634_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1636_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1634_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1638_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1638_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1639_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1642_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1644_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1642_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1646_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1646_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1647_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1650_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1652_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1650_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1654_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1654_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1655_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1658_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1660_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1663_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1665_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1668_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1669_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1668_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1678_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1668_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1680_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1680_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1681_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1684_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1686_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1689_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1691_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1694_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1696_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1694_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1727_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1694_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1729_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1729_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1733_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1729_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1734_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1734_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1735_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1729_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1736_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1729_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1737_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1729_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1738_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1738_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1739_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1738_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1740_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1738_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1741_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1738_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1743_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1738_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1744_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1738_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1745_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1745_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1746_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1745_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1748_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1729_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1749_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1729_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1750_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1750_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1751_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1751_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1752_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1750_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1753_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1753_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1754_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1753_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1755_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1755_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1756_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1755_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1757_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1729_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1759_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1759_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1760_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1759_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1761_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1729_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1762_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1694_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1764_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1764_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1765_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1764_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1766_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1766_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1767_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1764_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1768_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1764_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1769_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1764_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1770_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1770_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1771_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1770_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1773_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1764_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1774_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1774_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1776_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1776_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1777_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1777_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1778_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1776_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1779_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1779_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1780_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1779_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1781_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1781_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1782_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1781_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1783_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1783_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1784_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1776_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1785_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1776_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1786_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1786_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1787_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1787_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1788_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1787_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1790_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1786_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1791_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1791_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1792_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1792_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1793_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1792_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1794_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1794_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1795_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1694_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1797_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1797_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1798_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1797_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1799_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1799_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1802_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1799_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1804_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1799_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1810_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1810_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1811_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1810_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1812_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1812_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1813_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1799_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1814_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1817_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1819_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1817_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1827_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1817_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1829_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1829_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1830_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1830_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1831_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1829_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1832_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1832_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1833_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1829_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1834_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1834_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1835_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1834_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1836_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1836_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1837_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1840_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1842_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1840_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1844_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1844_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1845_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1845_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1846_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1849_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1851_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1854_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1856_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1854_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1858_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1858_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1859_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1858_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1860_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1860_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1861_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1861_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1862_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1861_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1864_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1858_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1865_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1868_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1870_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1868_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1880_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1868_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1882_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1882_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1883_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1882_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1884_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1884_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1885_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1885_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1886_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1885_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1888_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1882_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1889_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1868_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1891_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1891_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1892_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1891_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1893_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1893_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1894_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1894_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1895_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1894_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1897_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1891_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1898_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1891_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1900_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1891_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1901_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1901_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1902_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1902_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1903_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1903_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1904_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1904_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1906_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1904_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1908_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1902_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1910_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1910_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1911_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1910_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1913_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1902_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1914_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L1914_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1915_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1915_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1917_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1915_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1919_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1922_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1924_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1927_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1929_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1934_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1953_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1955_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1955_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1956_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1955_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1957_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1955_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1958_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1955_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1959_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1955_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1960_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1962_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1962_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L1963_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1975_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1978_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1978_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1979_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1980_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1981_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L1982_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1983_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1984_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1985_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1990_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1991_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1992_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1993_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1993_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1994_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1993_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1996_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1996_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1997_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1998_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L1998_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L1999_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2000_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2000_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2002_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2002_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2003_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2002_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2004_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2005_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2006_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2007_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2007_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2008_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2008_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2009_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2008_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2010_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2008_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2011_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2008_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2012_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2008_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2015_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2015_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2016_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2008_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2017_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2017_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2018_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2017_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2019_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2008_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2020_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2020_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2021_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2021_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2023_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2008_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2024_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2024_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2025_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2026_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2026_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2027_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2028_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2028_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2029_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2029_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2030_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2029_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2032_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2028_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2033_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2034_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2034_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2035_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2036_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L1965_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2037_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2039_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2039_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2040_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2040_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2041_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2039_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2042_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2042_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2043_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2039_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2044_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2044_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2045_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2047_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2047_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2048_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2047_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2049_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2047_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2050_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2050_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2051_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2047_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2053_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2053_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2054_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2047_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2056_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2056_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2057_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2047_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2059_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2061_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2061_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2062_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2061_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2063_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2061_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2064_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2064_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2065_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2061_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2066_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2069_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L2099_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2117_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2119_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2068_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2123_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2123_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2124_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2124_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2125_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2124_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2127_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2123_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2128_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2128_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2129_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2130_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2130_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2131_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2131_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2132_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2132_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2133_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2131_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2135_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2135_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2136_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2130_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2137_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2138_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2122_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2139_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2140_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2140_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2141_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2140_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2142_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2142_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2143_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2139_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2144_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2139_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2145_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2146_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2146_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2147_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2147_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2148_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2147_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2149_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2149_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2150_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2145_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2151_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2181_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2183_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2196_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2196_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2197_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2198_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2199_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2208_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2209_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2195_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2210_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2212_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2213_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2220_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2221_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2223_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2223_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2224_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2224_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2225_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2225_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2226_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2226_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2229_C23"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2223_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2233_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2235_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2235_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2236_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2236_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2237_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2236_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2239_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2235_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2240_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2240_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2241_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2235_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2242_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2242_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2243_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2243_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2244_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2244_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2245_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2245_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2246_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2245_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2247_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2245_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2248_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2248_C28", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2249_C32"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2244_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2250_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2244_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2251_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2251_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2252_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2251_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2254_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2243_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2255_C22"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2242_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2256_C18"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2212_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2257_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2259_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2259_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2260_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2259_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L2261_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2259_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2262_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2264_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2265_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L2266_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2264_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2267_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L1932_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2269_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2269_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2270_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2269_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L2271_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2269_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2272_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2277_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2290_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2293_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2293_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2294_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2294_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2295_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2293_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2296_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2275_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2299_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2300_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2301_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2302_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2303_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2304_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2305_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2306_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2308_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2308_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2309_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2310_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2310_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2311_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2311_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2312_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2312_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2313_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2310_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2314_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2314_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2315_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2314_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2317_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2317_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2318_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2317_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L2319_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L2319_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2320_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L2319_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2321_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2321_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2322_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2322_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2323_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2322_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2325_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2321_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2326_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2321_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2328_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2321_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2329_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2321_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2331_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L2319_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2336_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2310_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2340_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2340_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2341_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2340_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2342_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2342_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2343_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2342_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2344_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2344_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2345_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2344_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2347_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2344_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2348_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2348_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2349_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2348_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2351_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2298_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2352_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2355_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2356_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2355_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2371_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2355_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2373_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2373_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2374_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2373_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2375_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2373_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2376_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2373_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2377_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2377_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2378_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2373_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2379_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2379_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2380_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2373_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2381_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2381_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2382_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2373_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2383_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2383_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2384_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2373_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2385_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2385_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2386_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2373_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2387_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2387_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2388_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2373_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2389_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2389_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2390_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2355_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2392_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2392_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2393_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2393_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2394_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2393_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2396_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2392_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2397_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2397_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2398_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2398_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2399_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2398_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2401_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2398_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2402_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2402_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2403_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2402_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2404_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2404_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2405_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2404_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2406_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2406_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2407_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2406_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2408_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2408_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2409_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2408_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2410_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2410_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2411_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2410_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2413_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2398_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2415_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2415_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2416_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2415_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2417_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2417_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2418_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2398_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2419_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2419_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2420_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2419_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2421_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2398_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2422_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2422_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2423_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2423_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2424_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2423_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2426_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2398_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2427_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2427_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2428_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2392_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2429_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2355_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2431_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2431_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2432_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2432_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2433_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2431_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2434_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2434_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2435_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2435_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2436_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2435_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2438_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2438_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2439_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2431_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2441_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2431_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2442_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2355_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2444_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2444_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2445_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2445_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2446_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2445_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2448_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2451_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2457_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2451_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2465_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2465_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2466_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2465_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2467_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2465_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2468_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2451_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2469_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2451_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2470_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2473_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2474_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2521_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2522_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2521_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2535_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2535_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2536_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2535_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2537_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2535_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2538_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2535_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2539_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2535_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2540_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2535_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2541_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2521_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2543_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2543_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2544_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2544_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2545_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2544_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2547_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2544_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2549_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2543_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2550_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:For_L2550_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2551_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2543_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2552_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2543_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2553_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2543_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2554_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2554_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2555_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2554_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2557_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2521_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2559_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2559_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2560_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2560_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L2561_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L2561_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2562_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L2561_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2564_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2559_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2565_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2521_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2567_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2567_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2568_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2568_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2569_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2568_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2571_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2521_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2573_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2573_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2574_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2521_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2576_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2576_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2578_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2578_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2579_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2576_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:While_L2580_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:While_L2580_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L2581_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L2581_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2582_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:Try_L2581_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2583_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:While_L2580_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2586_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2590_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2591_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2591_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2592_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2593_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2593_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2594_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2595_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2595_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2596_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2597_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2597_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2598_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2599_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2599_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2600_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2601_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2601_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2602_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2603_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2603_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2604_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2605_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2605_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2606_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2607_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2607_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2608_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2609_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2609_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2610_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2611_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2611_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2612_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2613_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2613_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2614_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2589_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2615_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2619_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2621_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2621_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2622_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2623_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2623_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2624_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2625_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2625_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2626_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2627_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2627_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2628_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2629_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2629_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2630_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2631_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2631_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2632_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2633_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2633_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2634_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2635_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2635_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2636_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2637_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2637_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2638_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2639_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2639_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2640_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2641_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2641_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2642_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2643_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2643_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2644_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2645_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2645_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2646_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2647_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2648_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2649_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2649_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2650_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2651_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2651_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2652_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2618_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2653_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2656_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2657_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2656_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2666_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2667_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2668_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2669_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2670_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2671_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2672_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2673_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2674_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2675_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2660_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Assign_L2676_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2656_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2678_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2678_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2679_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2678_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:ImportFrom_L2682_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2678_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2683_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2656_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2689_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2689_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2690_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2656_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2692_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2692_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2693_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2692_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2696_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:ClassDef_L2656_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2698_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2698_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2699_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:FunctionDef_L2698_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Return_L2703_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2706_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Import_L2707_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_475:If_L2706_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_475:Expr_L2708_C4"}] |
# -*- coding: utf-8 -*-
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either version 3, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
"Pythonic simple JSON RPC Client implementation"
__author__ = "Mariano Reingart (reingart@gmail.com)"
__copyright__ = "Copyright (C) 2011 Mariano Reingart"
__license__ = "LGPL 3.0"
__version__ = "0.05"
import urllib
from xmlrpclib import Transport, SafeTransport
from cStringIO import StringIO
import random
import sys
try:
import gluon.contrib.simplejson as json # try web2py json serializer
except ImportError:
try:
import json # try stdlib (py2.6)
except:
import simplejson as json # try external module
class JSONRPCError(RuntimeError):
"Error object for remote procedure call fail"
def __init__(self, code, message, data=None):
value = "%s: %s\n%s" % (code, message, '\n'.join(data))
RuntimeError.__init__(self, value)
self.code = code
self.message = message
self.data = data
class JSONDummyParser:
"json wrapper for xmlrpclib parser interfase"
def __init__(self):
self.buf = StringIO()
def feed(self, data):
self.buf.write(data)
def close(self):
return self.buf.getvalue()
class JSONTransportMixin:
"json wrapper for xmlrpclib transport interfase"
def send_content(self, connection, request_body):
connection.putheader("Content-Type", "application/json")
connection.putheader("Content-Length", str(len(request_body)))
connection.endheaders()
if request_body:
connection.send(request_body)
# todo: add gzip compression
def getparser(self):
# get parser and unmarshaller
parser = JSONDummyParser()
return parser, parser
class JSONTransport(JSONTransportMixin, Transport):
pass
class JSONSafeTransport(JSONTransportMixin, SafeTransport):
pass
class ServerProxy(object):
"JSON RPC Simple Client Service Proxy"
def __init__(self, uri, transport=None, encoding=None, verbose=0):
self.location = uri # server location (url)
self.trace = verbose # show debug messages
self.exceptions = True # raise errors? (JSONRPCError)
self.timeout = None
self.json_request = self.json_response = ''
type, uri = urllib.splittype(uri)
if type not in ("http", "https"):
raise IOError("unsupported JSON-RPC protocol")
self.__host, self.__handler = urllib.splithost(uri)
if transport is None:
if type == "https":
transport = JSONSafeTransport()
else:
transport = JSONTransport()
self.__transport = transport
self.__encoding = encoding
self.__verbose = verbose
def __getattr__(self, attr):
"pseudo method that can be called"
return lambda *args: self.call(attr, *args)
def call(self, method, *args):
"JSON RPC communication (method invocation)"
# build data sent to the service
request_id = random.randint(0, sys.maxint)
data = {'id': request_id, 'method': method, 'params': args, }
request = json.dumps(data)
# make HTTP request (retry if connection is lost)
response = self.__transport.request(
self.__host,
self.__handler,
request,
verbose=self.__verbose
)
# store plain request and response for further debugging
self.json_request = request
self.json_response = response
# parse json data coming from service
# {'version': '1.1', 'id': id, 'result': result, 'error': None}
response = json.loads(response)
if response['id'] != request_id:
raise JSONRPCError(0, "JSON Request ID != Response ID")
self.error = response.get('error', {})
if self.error and self.exceptions:
raise JSONRPCError(self.error.get('code', 0),
self.error.get('message', ''),
self.error.get('data', None))
return response.get('result')
ServiceProxy = ServerProxy
if __name__ == "__main__":
# basic tests:
location = "http://www.web2py.com.ar/webservices/sample/call/jsonrpc"
client = ServerProxy(location, verbose='--verbose' in sys.argv,)
print client.add(1, 2)
| ajibawa-2023/Python-Code-Large/train/row_477 | 83 | 152 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L12_C0", "label": "expression", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0789, 0.0066, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"Pythonic simple JSON RPC Client implementation\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L14_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.0921, 0.0066, 0, 0.66, 0.0556, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = \"Mariano Reingart (reingart@gmail.com)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L15_C0", "label": "__copyright__ =", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.0987, 0.0066, 0, 0.66, 0.1111, 200, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__copyright__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__copyright__ = \"Copyright (C) 2011 Mariano Reingart\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L16_C0", "label": "__license__ =", "type": "assigned_variable", "loc": [16, 16], "level": 0, "parent": null, "vector": [14, 0, 0.1053, 0.0066, 0, 0.66, 0.1667, 11, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__license__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__license__ = \"LGPL 3.0\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L17_C0", "label": "__version__ =", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.1118, 0.0066, 0, 0.66, 0.2222, 162, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__version__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__version__ = \"0.05\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Import_L20_C0", "label": "urllib import urllib", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.1316, 0.0066, 0, 0.66, 0.2778, 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_477:ImportFrom_L21_C0", "label": "from xmlrpclib import Transport, SafeTransport", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.1382, 0.0066, 0, 0.66, 0.3333, 251, 0, 2, 0, 0, 251, 0, 0], "semantic": {"name": "xmlrpclib", "arg_names": [], "import_names": ["Transport", "SafeTransport"], "rhs_call_name": "", "annotation": ""}, "snippet": "from xmlrpclib import Transport, SafeTransport"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:ImportFrom_L22_C0", "label": "from cStringIO import StringIO", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.1447, 0.0066, 0, 0.66, 0.3889, 764, 0, 1, 0, 0, 764, 0, 0], "semantic": {"name": "cStringIO", "arg_names": [], "import_names": ["StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": "from cStringIO import StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Import_L23_C0", "label": "random import random", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.1513, 0.0066, 0, 0.66, 0.4444, 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_477:Import_L24_C0", "label": "sys import sys", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.1579, 0.0066, 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_477:Try_L25_C0", "label": "try", "type": "try", "loc": [25, 31], "level": 0, "parent": null, "vector": [7, 0, 0.1842, 0.0461, 0, 0.66, 0.5556, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n import gluon.contrib.simplejson as json # try web2py json serializer\nexcept ImportError:\n try:\n import json # try stdlib (py2.6)\n except:\n import simplejson as json # try external module"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Import_L26_C4", "label": "gluon.contrib.simplejson import json", "type": "import", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:Try_L25_C0", "vector": [1, 1, 0.1711, 0.0066, 1, 0.25, 0.0, 611, 0, 1, 0, 0, 611, 0, 0], "semantic": {"name": "gluon.contrib.simplejson", "arg_names": [], "import_names": ["json"], "rhs_call_name": "", "annotation": ""}, "snippet": " import gluon.contrib.simplejson as json # try web2py json serializer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Try_L28_C4", "label": "try", "type": "try", "loc": [28, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:Try_L25_C0", "vector": [7, 1, 0.1941, 0.0263, 1, 0.25, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n import json # try stdlib (py2.6)\n except:\n import simplejson as json # try external module"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Import_L29_C8", "label": "json import json", "type": "import", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:Try_L28_C4", "vector": [1, 2, 0.1908, 0.0066, 2, 0.09, 0.0, 463, 0, 1, 0, 0, 463, 0, 0], "semantic": {"name": "json", "arg_names": [], "import_names": ["json"], "rhs_call_name": "", "annotation": ""}, "snippet": " import json # try stdlib (py2.6)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Import_L31_C8", "label": "simplejson import json", "type": "import", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:Try_L28_C4", "vector": [1, 2, 0.2039, 0.0066, 2, 0.09, 0.0, 386, 0, 1, 0, 0, 386, 0, 0], "semantic": {"name": "simplejson", "arg_names": [], "import_names": ["json"], "rhs_call_name": "", "annotation": ""}, "snippet": " import simplejson as json # try external module"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L34_C0", "label": "JSONRPCError", "type": "class", "loc": [34, 41], "level": 0, "parent": null, "vector": [3, 0, 0.2467, 0.0526, 0, 0.66, 0.6111, 9, 0, 1, 0, 0, 178, 0, 2], "semantic": {"name": "JSONRPCError", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class JSONRPCError(RuntimeError):\n \"Error object for remote procedure call fail\"\n def __init__(self, code, message, data=None):\n value = \"%s: %s\\n%s\" % (code, message, '\\n'.join(data))\n RuntimeError.__init__(self, value)\n self.code = code\n self.message = message\n self.data = data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L35_C4", "label": "expression", "type": "expression", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L34_C0", "vector": [8, 1, 0.2303, 0.0066, 1, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"Error object for remote procedure call fail\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L36_C4", "label": "__init__", "type": "function", "loc": [36, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L34_C0", "vector": [2, 1, 0.2533, 0.0395, 1, 0.79, 1.0, 555, 0, 4, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "code", "message", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, code, message, data=None):\n value = \"%s: %s\\n%s\" % (code, message, '\\n'.join(data))\n RuntimeError.__init__(self, value)\n self.code = code\n self.message = message\n self.data = data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L37_C8", "label": "value =", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L36_C4", "vector": [14, 2, 0.2434, 0.0066, 2, 0.89, 0.0, 441, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = \"%s: %s\\n%s\" % (code, message, '\\n'.join(data))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L38_C8", "label": "__init__()", "type": "expression", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L36_C4", "vector": [8, 2, 0.25, 0.0066, 2, 0.89, 0.25, 555, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " RuntimeError.__init__(self, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L39_C8", "label": "self.code =", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L36_C4", "vector": [14, 2, 0.2566, 0.0066, 2, 0.89, 0.5, 296, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.code = code"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L40_C8", "label": "self.message =", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L36_C4", "vector": [14, 2, 0.2632, 0.0066, 2, 0.89, 0.75, 709, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.message = message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L41_C8", "label": "self.data =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L36_C4", "vector": [14, 2, 0.2697, 0.0066, 2, 0.89, 1.0, 838, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.data = data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L44_C0", "label": "JSONDummyParser", "type": "class", "loc": [44, 53], "level": 0, "parent": null, "vector": [3, 0, 0.3191, 0.0658, 0, 0.66, 0.6667, 8, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "JSONDummyParser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class JSONDummyParser:\n \"json wrapper for xmlrpclib parser interfase\"\n def __init__(self):\n self.buf = StringIO()\n\n def feed(self, data):\n self.buf.write(data)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L45_C4", "label": "expression", "type": "expression", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L44_C0", "vector": [8, 1, 0.2961, 0.0066, 1, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"json wrapper for xmlrpclib parser interfase\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L46_C4", "label": "__init__", "type": "function", "loc": [46, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L44_C0", "vector": [2, 1, 0.3059, 0.0132, 1, 0.98, 0.3333, 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.buf = StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L47_C8", "label": "self.buf = StringIO()", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L46_C4", "vector": [14, 2, 0.3092, 0.0066, 2, 0.73, 0.0, 108, 3, 0, 0, 0, 609, 10, 1], "semantic": {"name": "self.buf", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": " self.buf = StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L49_C4", "label": "feed", "type": "function", "loc": [49, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L44_C0", "vector": [2, 1, 0.3257, 0.0132, 1, 0.98, 0.6667, 87, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "feed", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def feed(self, data):\n self.buf.write(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L50_C8", "label": "write()", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L49_C4", "vector": [8, 2, 0.3289, 0.0066, 2, 0.68, 0.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.buf.write(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L52_C4", "label": "close", "type": "function", "loc": [52, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L44_C0", "vector": [2, 1, 0.3454, 0.0132, 1, 0.98, 1.0, 77, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def close(self):\n return self.buf.getvalue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Return_L53_C8", "label": "return", "type": "return", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L52_C4", "vector": [13, 2, 0.3487, 0.0066, 2, 0.19, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.buf.getvalue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L56_C0", "label": "JSONTransportMixin", "type": "class", "loc": [56, 70], "level": 0, "parent": null, "vector": [3, 0, 0.4145, 0.0987, 0, 0.66, 0.7222, 426, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "JSONTransportMixin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class JSONTransportMixin:\n \"json wrapper for xmlrpclib transport interfase\"\n\n def send_content(self, connection, request_body):\n connection.putheader(\"Content-Type\", \"application/json\")\n connection.putheader(\"Content-Length\", str(len(request_body)))\n connection.endheaders()\n if request_body:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L57_C4", "label": "expression", "type": "expression", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L56_C0", "vector": [8, 1, 0.375, 0.0066, 1, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"json wrapper for xmlrpclib transport interfase\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L59_C4", "label": "send_content", "type": "function", "loc": [59, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L56_C0", "vector": [2, 1, 0.4046, 0.0395, 1, 0.37, 0.5, 499, 0, 3, 0, 0, 0, 0, 6], "semantic": {"name": "send_content", "arg_names": ["self", "connection", "request_body"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def send_content(self, connection, request_body):\n connection.putheader(\"Content-Type\", \"application/json\")\n connection.putheader(\"Content-Length\", str(len(request_body)))\n connection.endheaders()\n if request_body:\n connection.send(request_body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L60_C8", "label": "putheader()", "type": "expression", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L59_C4", "vector": [8, 2, 0.3947, 0.0066, 2, 0.37, 0.0, 327, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "putheader", "arg_names": [], "import_names": [], "rhs_call_name": "putheader", "annotation": ""}, "snippet": " connection.putheader(\"Content-Type\", \"application/json\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L61_C8", "label": "putheader()", "type": "expression", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L59_C4", "vector": [8, 2, 0.4013, 0.0066, 2, 0.37, 0.3333, 327, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "putheader", "arg_names": [], "import_names": [], "rhs_call_name": "putheader", "annotation": ""}, "snippet": " connection.putheader(\"Content-Length\", str(len(request_body)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L62_C8", "label": "endheaders()", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L59_C4", "vector": [8, 2, 0.4079, 0.0066, 2, 0.37, 0.6667, 242, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "endheaders", "arg_names": [], "import_names": [], "rhs_call_name": "endheaders", "annotation": ""}, "snippet": " connection.endheaders()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:If_L63_C8", "label": "if", "type": "if", "loc": [63, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L59_C4", "vector": [4, 2, 0.4178, 0.0132, 2, 0.37, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request_body:\n connection.send(request_body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L64_C12", "label": "send()", "type": "expression", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:If_L63_C8", "vector": [8, 3, 0.4211, 0.0066, 3, 0.98, 0.0, 826, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "send", "arg_names": [], "import_names": [], "rhs_call_name": "send", "annotation": ""}, "snippet": " connection.send(request_body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L67_C4", "label": "getparser", "type": "function", "loc": [67, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L56_C0", "vector": [2, 1, 0.4507, 0.0263, 1, 0.37, 1.0, 119, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "getparser", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def getparser(self):\n # get parser and unmarshaller\n parser = JSONDummyParser()\n return parser, parser"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L69_C8", "label": "parser = JSONDummyParser()", "type": "assigned_variable", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L67_C4", "vector": [14, 2, 0.4539, 0.0066, 2, 0.59, 0.0, 968, 3, 0, 0, 0, 8, 10, 1], "semantic": {"name": "parser", "arg_names": [], "import_names": [], "rhs_call_name": "JSONDummyParser", "annotation": ""}, "snippet": " parser = JSONDummyParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Return_L70_C8", "label": "return", "type": "return", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L67_C4", "vector": [13, 2, 0.4605, 0.0066, 2, 0.59, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parser, parser"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L73_C0", "label": "JSONTransport", "type": "class", "loc": [73, 74], "level": 0, "parent": null, "vector": [3, 0, 0.4836, 0.0132, 0, 0.66, 0.7778, 81, 0, 0, 0, 0, 426, 0, 0], "semantic": {"name": "JSONTransport", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class JSONTransport(JSONTransportMixin, Transport):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L77_C0", "label": "JSONSafeTransport", "type": "class", "loc": [77, 78], "level": 0, "parent": null, "vector": [3, 0, 0.5099, 0.0132, 0, 0.66, 0.8333, 832, 0, 0, 0, 0, 426, 0, 0], "semantic": {"name": "JSONSafeTransport", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class JSONSafeTransport(JSONTransportMixin, SafeTransport):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L81_C0", "label": "ServerProxy", "type": "class", "loc": [81, 142], "level": 0, "parent": null, "vector": [3, 0, 0.7336, 0.4079, 0, 0.66, 0.8889, 164, 0, 3, 0, 0, 186, 0, 17], "semantic": {"name": "ServerProxy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ServerProxy(object):\n \"JSON RPC Simple Client Service Proxy\"\n\n def __init__(self, uri, transport=None, encoding=None, verbose=0):\n self.location = uri # server location (url)\n self.trace = verbose # show debug messages\n self.exceptions = True # raise errors? (JSONRPCError)\n self.timeout = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L82_C4", "label": "expression", "type": "expression", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L81_C0", "vector": [8, 1, 0.5395, 0.0066, 1, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"JSON RPC Simple Client Service Proxy\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "label": "__init__", "type": "function", "loc": [84, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L81_C0", "vector": [2, 1, 0.6151, 0.1316, 1, 0.43, 0.3333, 555, 0, 5, 0, 0, 0, 0, 5], "semantic": {"name": "__init__", "arg_names": ["self", "uri", "transport", "encoding", "verbose"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, uri, transport=None, encoding=None, verbose=0):\n self.location = uri # server location (url)\n self.trace = verbose # show debug messages\n self.exceptions = True # raise errors? (JSONRPCError)\n self.timeout = None\n self.json_request = self.json_response = ''\n\n type, uri = urllib.splittype(uri)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L85_C8", "label": "self.location =", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "vector": [14, 2, 0.5592, 0.0066, 2, 0.4, 0.0, 840, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.location", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.location = uri # server location (url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L86_C8", "label": "self.trace =", "type": "assigned_variable", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "vector": [14, 2, 0.5658, 0.0066, 2, 0.4, 0.0909, 312, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.trace", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.trace = verbose # show debug messages"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L87_C8", "label": "self.exceptions =", "type": "assigned_variable", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "vector": [14, 2, 0.5724, 0.0066, 2, 0.4, 0.1818, 346, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.exceptions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.exceptions = True # raise errors? (JSONRPCError)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L88_C8", "label": "self.timeout =", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "vector": [14, 2, 0.5789, 0.0066, 2, 0.4, 0.2727, 621, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.timeout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.timeout = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L89_C8", "label": "self.json_request =", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "vector": [14, 2, 0.5855, 0.0066, 2, 0.4, 0.3636, 447, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.json_request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.json_request = self.json_response = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L91_C8", "label": "type, uri = splittype()", "type": "assigned_variable", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "vector": [14, 2, 0.5987, 0.0066, 2, 0.4, 0.4545, 380, 3, 1, 0, 0, 77, 10, 1], "semantic": {"name": "type, uri", "arg_names": [], "import_names": [], "rhs_call_name": "splittype", "annotation": ""}, "snippet": " type, uri = urllib.splittype(uri)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:If_L92_C8", "label": "if", "type": "if", "loc": [92, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "vector": [4, 2, 0.6086, 0.0132, 2, 0.4, 0.5455, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if type not in (\"http\", \"https\"):\n raise IOError(\"unsupported JSON-RPC protocol\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L94_C8", "label": " = splithost()", "type": "assigned_variable", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "vector": [14, 2, 0.6184, 0.0066, 2, 0.4, 0.6364, 0, 3, 1, 0, 0, 79, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "splithost", "annotation": ""}, "snippet": " self.__host, self.__handler = urllib.splithost(uri)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:If_L96_C8", "label": "if", "type": "if", "loc": [96, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "vector": [4, 2, 0.6447, 0.0329, 2, 0.4, 0.7273, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if transport is None:\n if type == \"https\":\n transport = JSONSafeTransport()\n else:\n transport = JSONTransport()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:If_L97_C12", "label": "if", "type": "if", "loc": [97, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:If_L96_C8", "vector": [4, 3, 0.648, 0.0263, 3, 0.42, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if type == \"https\":\n transport = JSONSafeTransport()\n else:\n transport = JSONTransport()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L98_C16", "label": "transport = JSONSafeTransport()", "type": "assigned_variable", "loc": [98, 98], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:If_L97_C12", "vector": [14, 4, 0.6447, 0.0066, 4, 0.71, 0.0, 124, 3, 0, 0, 0, 832, 10, 1], "semantic": {"name": "transport", "arg_names": [], "import_names": [], "rhs_call_name": "JSONSafeTransport", "annotation": ""}, "snippet": " transport = JSONSafeTransport()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L100_C16", "label": "transport = JSONTransport()", "type": "assigned_variable", "loc": [100, 100], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:If_L97_C12", "vector": [14, 4, 0.6579, 0.0066, 4, 0.71, 1.0, 124, 3, 0, 0, 0, 81, 10, 1], "semantic": {"name": "transport", "arg_names": [], "import_names": [], "rhs_call_name": "JSONTransport", "annotation": ""}, "snippet": " transport = JSONTransport()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L101_C8", "label": "self.__transport =", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "vector": [14, 2, 0.6645, 0.0066, 2, 0.4, 0.8182, 709, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.__transport", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__transport = transport"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L102_C8", "label": "self.__encoding =", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "vector": [14, 2, 0.6711, 0.0066, 2, 0.4, 0.9091, 616, 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_477:Assign_L103_C8", "label": "self.__verbose =", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "vector": [14, 2, 0.6776, 0.0066, 2, 0.4, 1.0, 206, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.__verbose", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__verbose = verbose"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L105_C4", "label": "__getattr__", "type": "function", "loc": [105, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L81_C0", "vector": [2, 1, 0.6974, 0.0197, 1, 0.43, 0.6667, 210, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__getattr__", "arg_names": ["self", "attr"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getattr__(self, attr):\n \"pseudo method that can be called\"\n return lambda *args: self.call(attr, *args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L106_C8", "label": "expression", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L105_C4", "vector": [8, 2, 0.6974, 0.0066, 2, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"pseudo method that can be called\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Return_L107_C8", "label": "return", "type": "return", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L105_C4", "vector": [13, 2, 0.7039, 0.0066, 2, 0.95, 1.0, 0, 9, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return lambda *args: self.call(attr, *args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "label": "call", "type": "function", "loc": [109, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L81_C0", "vector": [2, 1, 0.8257, 0.2237, 1, 0.43, 1.0, 832, 0, 3, 1, 0, 0, 0, 11], "semantic": {"name": "call", "arg_names": ["self", "method", "args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def call(self, method, *args):\n \"JSON RPC communication (method invocation)\"\n\n # build data sent to the service\n request_id = random.randint(0, sys.maxint)\n data = {'id': request_id, 'method': method, 'params': args, }\n request = json.dumps(data)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L110_C8", "label": "expression", "type": "expression", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "vector": [8, 2, 0.7237, 0.0066, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"JSON RPC communication (method invocation)\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L113_C8", "label": "request_id = randint()", "type": "assigned_variable", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "vector": [14, 2, 0.7434, 0.0066, 2, 0.88, 0.0909, 303, 3, 2, 0, 0, 449, 10, 1], "semantic": {"name": "request_id", "arg_names": [], "import_names": [], "rhs_call_name": "randint", "annotation": ""}, "snippet": " request_id = random.randint(0, sys.maxint)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L114_C8", "label": "data =", "type": "assigned_variable", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "vector": [14, 2, 0.75, 0.0066, 2, 0.88, 0.1818, 929, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = {'id': request_id, 'method': method, 'params': args, }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L115_C8", "label": "request = dumps()", "type": "assigned_variable", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "vector": [14, 2, 0.7566, 0.0066, 2, 0.88, 0.2727, 50, 3, 1, 0, 0, 160, 10, 1], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "dumps", "annotation": ""}, "snippet": " request = json.dumps(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L118_C8", "label": "response = request()", "type": "assigned_variable", "loc": [118, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "vector": [14, 2, 0.7928, 0.0395, 2, 0.88, 0.3636, 511, 3, 4, 0, 0, 50, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "request", "annotation": ""}, "snippet": " response = self.__transport.request(\n self.__host,\n self.__handler,\n request,\n verbose=self.__verbose\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L126_C8", "label": "self.json_request =", "type": "assigned_variable", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "vector": [14, 2, 0.8289, 0.0066, 2, 0.88, 0.4545, 447, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.json_request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.json_request = request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L127_C8", "label": "self.json_response =", "type": "assigned_variable", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "vector": [14, 2, 0.8355, 0.0066, 2, 0.88, 0.5455, 322, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.json_response", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.json_response = response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L131_C8", "label": "response = loads()", "type": "assigned_variable", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "vector": [14, 2, 0.8618, 0.0066, 2, 0.88, 0.6364, 511, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": " response = json.loads(response)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:If_L133_C8", "label": "if", "type": "if", "loc": [133, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "vector": [4, 2, 0.8783, 0.0132, 2, 0.88, 0.7273, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if response['id'] != request_id:\n raise JSONRPCError(0, \"JSON Request ID != Response ID\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L136_C8", "label": "self.error = get()", "type": "assigned_variable", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "vector": [14, 2, 0.8947, 0.0066, 2, 0.88, 0.8182, 784, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "self.error", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.error = response.get('error', {})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:If_L137_C8", "label": "if", "type": "if", "loc": [137, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "vector": [4, 2, 0.9112, 0.0263, 2, 0.88, 0.9091, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.error and self.exceptions:\n raise JSONRPCError(self.error.get('code', 0),\n self.error.get('message', ''),\n self.error.get('data', None))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Return_L142_C8", "label": "return", "type": "return", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "vector": [13, 2, 0.9342, 0.0066, 2, 0.88, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return response.get('result')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L145_C0", "label": "ServiceProxy =", "type": "assigned_variable", "loc": [145, 145], "level": 0, "parent": null, "vector": [14, 0, 0.9539, 0.0066, 0, 0.66, 0.9444, 915, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ServiceProxy", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ServiceProxy = ServerProxy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:If_L148_C0", "label": "if", "type": "if", "loc": [148, 152], "level": 0, "parent": null, "vector": [4, 0, 0.9868, 0.0329, 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 # basic tests:\n location = \"http://www.web2py.com.ar/webservices/sample/call/jsonrpc\"\n client = ServerProxy(location, verbose='--verbose' in sys.argv,)\n print(client.add(1, 2))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L150_C4", "label": "location =", "type": "assigned_variable", "loc": [150, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:If_L148_C0", "vector": [14, 1, 0.9868, 0.0066, 1, 0.26, 0.0, 771, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "location", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " location = \"http://www.web2py.com.ar/webservices/sample/call/jsonrpc\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L151_C4", "label": "client = ServerProxy()", "type": "assigned_variable", "loc": [151, 151], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:If_L148_C0", "vector": [14, 1, 0.9934, 0.0066, 1, 0.26, 0.5, 608, 3, 2, 0, 0, 164, 10, 1], "semantic": {"name": "client", "arg_names": [], "import_names": [], "rhs_call_name": "ServerProxy", "annotation": ""}, "snippet": " client = ServerProxy(location, verbose='--verbose' in sys.argv,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L152_C4", "label": "print()", "type": "expression", "loc": [152, 152], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_477:If_L148_C0", "vector": [8, 1, 1.0, 0.0066, 1, 0.26, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(client.add(1, 2))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_477:Try_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Import_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:Try_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Try_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:Try_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Import_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:Try_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Import_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Return_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:If_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:If_L63_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L64_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Return_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:If_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:If_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:If_L96_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_477:If_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:If_L97_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L98_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:If_L97_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L100_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Return_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:ClassDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:If_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:If_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Return_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:If_L148_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:If_L148_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Assign_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_477:If_L148_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_477:Expr_L152_C4"}] |
#!/usr/bin/env python
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
Attention: Requires Chrome or Safari. For IE of Firefox you need https://github.com/gimite/web-socket-js
1) install tornado (requires Tornado 2.1)
easy_install tornado
2) start this app:
python gluon/contrib/websocket_messaging.py -k mykey -p 8888
3) from any web2py app you can post messages with
from gluon.contrib.websocket_messaging import websocket_send
websocket_send('http://127.0.0.1:8888','Hello World','mykey','mygroup')
4) from any template you can receive them with
<script>
$(document).ready(function(){
if(!web2py_websocket('ws://127.0.0.1:8888/realtime/mygroup',function(e){alert(e.data)}))
alert("html5 websocket not supported by your browser, try Google Chrome");
});
</script>
When the server posts a message, all clients connected to the page will popup an alert message
Or if you want to send json messages and store evaluated json in a var called data:
<script>
$(document).ready(function(){
var data;
web2py_websocket('ws://127.0.0.1:8888/realtime/mygroup',function(e){data=eval('('+e.data+')')});
});
</script>
- All communications between web2py and websocket_messaging will be digitally signed with hmac.
- All validation is handled on the web2py side and there is no need to modify websocket_messaging.py
- Multiple web2py instances can talk with one or more websocket_messaging servers.
- "ws://127.0.0.1:8888/realtime/" must be contain the IP of the websocket_messaging server.
- Via group='mygroup' name you can support multiple groups of clients (think of many chat-rooms)
Here is a complete sample web2py action:
def index():
form=LOAD('default','ajax_form',ajax=True)
script=SCRIPT('''
jQuery(document).ready(function(){
var callback=function(e){alert(e.data)};
if(!web2py_websocket('ws://127.0.0.1:8888/realtime/mygroup',callback))
alert("html5 websocket not supported by your browser, try Google Chrome");
});
''')
return dict(form=form, script=script)
def ajax_form():
form=SQLFORM.factory(Field('message'))
if form.accepts(request,session):
from gluon.contrib.websocket_messaging import websocket_send
websocket_send(
'http://127.0.0.1:8888',form.vars.message,'mykey','mygroup')
return form
Acknowledgements:
Tornado code inspired by http://thomas.pelletier.im/2010/08/websocket-tornado-redis/
"""
import tornado.httpserver
import tornado.websocket
import tornado.ioloop
import tornado.web
import hmac
import sys
import optparse
import urllib
import time
listeners = {}
names = {}
tokens = {}
def websocket_send(url, message, hmac_key=None, group='default'):
sig = hmac_key and hmac.new(hmac_key, message).hexdigest() or ''
params = urllib.urlencode(
{'message': message, 'signature': sig, 'group': group})
f = urllib.urlopen(url, params)
data = f.read()
f.close()
return data
class PostHandler(tornado.web.RequestHandler):
"""
only authorized parties can post messages
"""
def post(self):
if hmac_key and not 'signature' in self.request.arguments:
return 'false'
if 'message' in self.request.arguments:
message = self.request.arguments['message'][0]
group = self.request.arguments.get('group', ['default'])[0]
print '%s:MESSAGE to %s:%s' % (time.time(), group, message)
if hmac_key:
signature = self.request.arguments['signature'][0]
if not hmac.new(hmac_key, message).hexdigest() == signature:
return 'false'
for client in listeners.get(group, []):
client.write_message(message)
return 'true'
return 'false'
class TokenHandler(tornado.web.RequestHandler):
"""
if running with -t post a token to allow a client to join using the token
the message here is the token (any uuid)
allows only authorized parties to joins, for example, a chat
"""
def post(self):
if hmac_key and not 'message' in self.request.arguments:
return 'false'
if 'message' in self.request.arguments:
message = self.request.arguments['message'][0]
if hmac_key:
signature = self.request.arguments['signature'][0]
if not hmac.new(hmac_key, message).hexdigest() == signature:
return 'false'
tokens[message] = None
return 'true'
return 'false'
class DistributeHandler(tornado.websocket.WebSocketHandler):
def open(self, params):
group, token, name = params.split('/') + [None, None]
self.group = group or 'default'
self.token = token or 'none'
self.name = name or 'anonymous'
# only authorized parties can join
if DistributeHandler.tokens:
if not self.token in tokens or not token[self.token] is None:
self.close()
else:
tokens[self.token] = self
if not self.group in listeners:
listeners[self.group] = []
# notify clients that a member has joined the groups
for client in listeners.get(self.group, []):
client.write_message('+' + self.name)
listeners[self.group].append(self)
names[self] = self.name
print '%s:CONNECT to %s' % (time.time(), self.group)
def on_message(self, message):
pass
def on_close(self):
if self.group in listeners:
listeners[self.group].remove(self)
del names[self]
# notify clients that a member has left the groups
for client in listeners.get(self.group, []):
client.write_message('-' + self.name)
print '%s:DISCONNECT from %s' % (time.time(), self.group)
if __name__ == "__main__":
usage = __doc__
version = ""
parser = optparse.OptionParser(usage, None, optparse.Option, version)
parser.add_option('-p',
'--port',
default='8888',
dest='port',
help='socket')
parser.add_option('-l',
'--listen',
default='0.0.0.0',
dest='address',
help='listener address')
parser.add_option('-k',
'--hmac_key',
default='',
dest='hmac_key',
help='hmac_key')
parser.add_option('-t',
'--tokens',
action='store_true',
default=False,
dest='tokens',
help='require tockens to join')
(options, args) = parser.parse_args()
hmac_key = options.hmac_key
DistributeHandler.tokens = options.tokens
urls = [
(r'/', PostHandler),
(r'/token', TokenHandler),
(r'/realtime/(.*)', DistributeHandler)]
application = tornado.web.Application(urls, auto_reload=True)
http_server = tornado.httpserver.HTTPServer(application)
http_server.listen(int(options.port), address=options.address)
tornado.ioloop.IOLoop.instance().start()
| ajibawa-2023/Python-Code-Large/train/row_478 | 91 | 207 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 71], "level": 0, "parent": null, "vector": [8, 0, 0.1763, 0.3382, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis file is part of the web2py Web Framework\nCopyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>\nLicense: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)\n\nAttention: Requires Chrome or Safari. For IE of Firefox you need https://github.com/gimite/web-socket-js\n\n1) install tornado (requires Tornado 2.1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Import_L73_C0", "label": "tornado.httpserver import tornado.httpserver", "type": "import", "loc": [73, 73], "level": 0, "parent": null, "vector": [1, 0, 0.3527, 0.0048, 0, 0.66, 0.0588, 17, 0, 1, 0, 0, 17, 0, 0], "semantic": {"name": "tornado.httpserver", "arg_names": [], "import_names": ["tornado.httpserver"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tornado.httpserver"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Import_L74_C0", "label": "tornado.websocket import tornado.websocket", "type": "import", "loc": [74, 74], "level": 0, "parent": null, "vector": [1, 0, 0.3575, 0.0048, 0, 0.66, 0.1176, 364, 0, 1, 0, 0, 364, 0, 0], "semantic": {"name": "tornado.websocket", "arg_names": [], "import_names": ["tornado.websocket"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tornado.websocket"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Import_L75_C0", "label": "tornado.ioloop import tornado.ioloop", "type": "import", "loc": [75, 75], "level": 0, "parent": null, "vector": [1, 0, 0.3623, 0.0048, 0, 0.66, 0.1765, 730, 0, 1, 0, 0, 730, 0, 0], "semantic": {"name": "tornado.ioloop", "arg_names": [], "import_names": ["tornado.ioloop"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tornado.ioloop"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Import_L76_C0", "label": "tornado.web import tornado.web", "type": "import", "loc": [76, 76], "level": 0, "parent": null, "vector": [1, 0, 0.3671, 0.0048, 0, 0.66, 0.2353, 248, 0, 1, 0, 0, 248, 0, 0], "semantic": {"name": "tornado.web", "arg_names": [], "import_names": ["tornado.web"], "rhs_call_name": "", "annotation": ""}, "snippet": "import tornado.web"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Import_L77_C0", "label": "hmac import hmac", "type": "import", "loc": [77, 77], "level": 0, "parent": null, "vector": [1, 0, 0.372, 0.0048, 0, 0.66, 0.2941, 993, 0, 1, 0, 0, 993, 0, 0], "semantic": {"name": "hmac", "arg_names": [], "import_names": ["hmac"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hmac"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Import_L78_C0", "label": "sys import sys", "type": "import", "loc": [78, 78], "level": 0, "parent": null, "vector": [1, 0, 0.3768, 0.0048, 0, 0.66, 0.3529, 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_478:Import_L79_C0", "label": "optparse import optparse", "type": "import", "loc": [79, 79], "level": 0, "parent": null, "vector": [1, 0, 0.3816, 0.0048, 0, 0.66, 0.4118, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Import_L80_C0", "label": "urllib import urllib", "type": "import", "loc": [80, 80], "level": 0, "parent": null, "vector": [1, 0, 0.3865, 0.0048, 0, 0.66, 0.4706, 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_478:Import_L81_C0", "label": "time import time", "type": "import", "loc": [81, 81], "level": 0, "parent": null, "vector": [1, 0, 0.3913, 0.0048, 0, 0.66, 0.5294, 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_478:Assign_L83_C0", "label": "listeners =", "type": "assigned_variable", "loc": [83, 83], "level": 0, "parent": null, "vector": [14, 0, 0.401, 0.0048, 0, 0.66, 0.5882, 272, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "listeners", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "listeners = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L84_C0", "label": "names =", "type": "assigned_variable", "loc": [84, 84], "level": 0, "parent": null, "vector": [14, 0, 0.4058, 0.0048, 0, 0.66, 0.6471, 382, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "names", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "names = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L85_C0", "label": "tokens =", "type": "assigned_variable", "loc": [85, 85], "level": 0, "parent": null, "vector": [14, 0, 0.4106, 0.0048, 0, 0.66, 0.7059, 700, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "tokens", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "tokens = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L88_C0", "label": "websocket_send", "type": "function", "loc": [88, 95], "level": 0, "parent": null, "vector": [2, 0, 0.442, 0.0386, 0, 0.66, 0.7647, 381, 0, 4, 1, 0, 0, 0, 6], "semantic": {"name": "websocket_send", "arg_names": ["url", "message", "hmac_key", "group"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def websocket_send(url, message, hmac_key=None, group='default'):\n sig = hmac_key and hmac.new(hmac_key, message).hexdigest() or ''\n params = urllib.urlencode(\n {'message': message, 'signature': sig, 'group': group})\n f = urllib.urlopen(url, params)\n data = f.read()\n f.close()\n return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L89_C4", "label": "sig =", "type": "assigned_variable", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L88_C0", "vector": [14, 1, 0.43, 0.0048, 1, 0.32, 0.0, 899, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "sig", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sig = hmac_key and hmac.new(hmac_key, message).hexdigest() or ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L90_C4", "label": "params = urlencode()", "type": "assigned_variable", "loc": [90, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L88_C0", "vector": [14, 1, 0.4372, 0.0097, 1, 0.32, 0.2, 206, 3, 1, 0, 0, 414, 10, 1], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "urlencode", "annotation": ""}, "snippet": " params = urllib.urlencode(\n {'message': message, 'signature': sig, 'group': group})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L92_C4", "label": "f = urlopen()", "type": "assigned_variable", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L88_C0", "vector": [14, 1, 0.4444, 0.0048, 1, 0.32, 0.4, 899, 3, 2, 0, 0, 687, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "urlopen", "annotation": ""}, "snippet": " f = urllib.urlopen(url, params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L93_C4", "label": "data = read()", "type": "assigned_variable", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L88_C0", "vector": [14, 1, 0.4493, 0.0048, 1, 0.32, 0.6, 929, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " data = f.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L94_C4", "label": "close()", "type": "expression", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L88_C0", "vector": [8, 1, 0.4541, 0.0048, 1, 0.32, 0.8, 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_478:Return_L95_C4", "label": "return", "type": "return", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L88_C0", "vector": [13, 1, 0.4589, 0.0048, 1, 0.32, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:ClassDef_L98_C0", "label": "PostHandler", "type": "class", "loc": [98, 116], "level": 0, "parent": null, "vector": [3, 0, 0.5169, 0.0918, 0, 0.66, 0.8235, 546, 0, 1, 0, 0, 623, 0, 7], "semantic": {"name": "PostHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PostHandler(tornado.web.RequestHandler):\n \"\"\"\n only authorized parties can post messages\n \"\"\"\n def post(self):\n if hmac_key and not 'signature' in self.request.arguments:\n return 'false'\n if 'message' in self.request.arguments:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L99_C4", "label": "expression", "type": "expression", "loc": [99, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:ClassDef_L98_C0", "vector": [8, 1, 0.4831, 0.0145, 1, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n only authorized parties can post messages\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L102_C4", "label": "post", "type": "function", "loc": [102, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:ClassDef_L98_C0", "vector": [2, 1, 0.5266, 0.0725, 1, 0.59, 1.0, 304, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "post", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def post(self):\n if hmac_key and not 'signature' in self.request.arguments:\n return 'false'\n if 'message' in self.request.arguments:\n message = self.request.arguments['message'][0]\n group = self.request.arguments.get('group', ['default'])[0]\n print('%s:MESSAGE to %s:%s' % (time.time(), group, message))\n if hmac_key:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:If_L103_C8", "label": "if", "type": "if", "loc": [103, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L102_C4", "vector": [4, 2, 0.5, 0.0097, 2, 0.07, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hmac_key and not 'signature' in self.request.arguments:\n return 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Return_L104_C12", "label": "return", "type": "return", "loc": [104, 104], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L103_C8", "vector": [13, 3, 0.5024, 0.0048, 3, 0.3, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:If_L105_C8", "label": "if", "type": "if", "loc": [105, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L102_C4", "vector": [4, 2, 0.5314, 0.0531, 2, 0.07, 0.5, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'message' in self.request.arguments:\n message = self.request.arguments['message'][0]\n group = self.request.arguments.get('group', ['default'])[0]\n print('%s:MESSAGE to %s:%s' % (time.time(), group, message))\n if hmac_key:\n signature = self.request.arguments['signature'][0]\n if not hmac.new(hmac_key, message).hexdigest() == signature:\n return 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L106_C12", "label": "message =", "type": "assigned_variable", "loc": [106, 106], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L105_C8", "vector": [14, 3, 0.5121, 0.0048, 3, 0.74, 0.0, 635, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " message = self.request.arguments['message'][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L107_C12", "label": "group =", "type": "assigned_variable", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L105_C8", "vector": [14, 3, 0.5169, 0.0048, 3, 0.74, 0.2, 43, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " group = self.request.arguments.get('group', ['default'])[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L108_C12", "label": "print()", "type": "expression", "loc": [108, 108], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L105_C8", "vector": [8, 3, 0.5217, 0.0048, 3, 0.74, 0.4, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%s:MESSAGE to %s:%s' % (time.time(), group, message))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:If_L109_C12", "label": "if", "type": "if", "loc": [109, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L105_C8", "vector": [4, 3, 0.5338, 0.0193, 3, 0.74, 0.6, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hmac_key:\n signature = self.request.arguments['signature'][0]\n if not hmac.new(hmac_key, message).hexdigest() == signature:\n return 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L110_C16", "label": "signature =", "type": "assigned_variable", "loc": [110, 110], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L109_C12", "vector": [14, 4, 0.5314, 0.0048, 4, 0.47, 0.0, 932, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "signature", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " signature = self.request.arguments['signature'][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:If_L111_C16", "label": "if", "type": "if", "loc": [111, 112], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L109_C12", "vector": [4, 4, 0.5386, 0.0097, 4, 0.47, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hmac.new(hmac_key, message).hexdigest() == signature:\n return 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Return_L112_C20", "label": "return", "type": "return", "loc": [112, 112], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L111_C16", "vector": [13, 5, 0.5411, 0.0048, 5, 0.35, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:For_L113_C12", "label": "for client", "type": "for", "loc": [113, 114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L105_C8", "vector": [6, 3, 0.5483, 0.0097, 3, 0.74, 0.8, 608, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "client", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for client in listeners.get(group, []):\n client.write_message(message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L114_C16", "label": "write_message()", "type": "expression", "loc": [114, 114], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:For_L113_C12", "vector": [8, 4, 0.5507, 0.0048, 4, 0.88, 0.0, 177, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write_message", "arg_names": [], "import_names": [], "rhs_call_name": "write_message", "annotation": ""}, "snippet": " client.write_message(message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Return_L115_C12", "label": "return", "type": "return", "loc": [115, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L105_C8", "vector": [13, 3, 0.5556, 0.0048, 3, 0.74, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Return_L116_C8", "label": "return", "type": "return", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L102_C4", "vector": [13, 2, 0.5604, 0.0048, 2, 0.07, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:ClassDef_L119_C0", "label": "TokenHandler", "type": "class", "loc": [119, 136], "level": 0, "parent": null, "vector": [3, 0, 0.6159, 0.087, 0, 0.66, 0.8824, 761, 0, 1, 0, 0, 623, 0, 2], "semantic": {"name": "TokenHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TokenHandler(tornado.web.RequestHandler):\n \"\"\"\n if running with -t post a token to allow a client to join using the token\n the message here is the token (any uuid)\n allows only authorized parties to joins, for example, a chat\n \"\"\"\n def post(self):\n if hmac_key and not 'message' in self.request.arguments:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L120_C4", "label": "expression", "type": "expression", "loc": [120, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:ClassDef_L119_C0", "vector": [8, 1, 0.5894, 0.0242, 1, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n if running with -t post a token to allow a client to join using the token\n the message here is the token (any uuid)\n allows only authorized parties to joins, for example, a chat\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L125_C4", "label": "post", "type": "function", "loc": [125, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:ClassDef_L119_C0", "vector": [2, 1, 0.6304, 0.058, 1, 0.76, 1.0, 304, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "post", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def post(self):\n if hmac_key and not 'message' in self.request.arguments:\n return 'false'\n if 'message' in self.request.arguments:\n message = self.request.arguments['message'][0]\n if hmac_key:\n signature = self.request.arguments['signature'][0]\n if not hmac.new(hmac_key, message).hexdigest() == signature:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:If_L126_C8", "label": "if", "type": "if", "loc": [126, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L125_C4", "vector": [4, 2, 0.6111, 0.0097, 2, 0.45, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hmac_key and not 'message' in self.request.arguments:\n return 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Return_L127_C12", "label": "return", "type": "return", "loc": [127, 127], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L126_C8", "vector": [13, 3, 0.6135, 0.0048, 3, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:If_L128_C8", "label": "if", "type": "if", "loc": [128, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L125_C4", "vector": [4, 2, 0.6353, 0.0386, 2, 0.45, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'message' in self.request.arguments:\n message = self.request.arguments['message'][0]\n if hmac_key:\n signature = self.request.arguments['signature'][0]\n if not hmac.new(hmac_key, message).hexdigest() == signature:\n return 'false'\n tokens[message] = None\n return 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L129_C12", "label": "message =", "type": "assigned_variable", "loc": [129, 129], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L128_C8", "vector": [14, 3, 0.6232, 0.0048, 3, 0.1, 0.0, 635, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " message = self.request.arguments['message'][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:If_L130_C12", "label": "if", "type": "if", "loc": [130, 133], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L128_C8", "vector": [4, 3, 0.6353, 0.0193, 3, 0.1, 0.3333, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hmac_key:\n signature = self.request.arguments['signature'][0]\n if not hmac.new(hmac_key, message).hexdigest() == signature:\n return 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L131_C16", "label": "signature =", "type": "assigned_variable", "loc": [131, 131], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L130_C12", "vector": [14, 4, 0.6329, 0.0048, 4, 0.39, 0.0, 932, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "signature", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " signature = self.request.arguments['signature'][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:If_L132_C16", "label": "if", "type": "if", "loc": [132, 133], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L130_C12", "vector": [4, 4, 0.6401, 0.0097, 4, 0.39, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hmac.new(hmac_key, message).hexdigest() == signature:\n return 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Return_L133_C20", "label": "return", "type": "return", "loc": [133, 133], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L132_C16", "vector": [13, 5, 0.6425, 0.0048, 5, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L134_C12", "label": "assign", "type": "assigned_variable", "loc": [134, 134], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L128_C8", "vector": [14, 3, 0.6473, 0.0048, 3, 0.1, 0.6667, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tokens[message] = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Return_L135_C12", "label": "return", "type": "return", "loc": [135, 135], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L128_C8", "vector": [13, 3, 0.6522, 0.0048, 3, 0.1, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Return_L136_C8", "label": "return", "type": "return", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L125_C4", "vector": [13, 2, 0.657, 0.0048, 2, 0.45, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:ClassDef_L139_C0", "label": "DistributeHandler", "type": "class", "loc": [139, 170], "level": 0, "parent": null, "vector": [3, 0, 0.7464, 0.1546, 0, 0.66, 0.9412, 496, 0, 3, 0, 0, 202, 0, 12], "semantic": {"name": "DistributeHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DistributeHandler(tornado.websocket.WebSocketHandler):\n def open(self, params):\n group, token, name = params.split('/') + [None, None]\n self.group = group or 'default'\n self.token = token or 'none'\n self.name = name or 'anonymous'\n # only authorized parties can join\n if DistributeHandler.tokens:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L140_C4", "label": "open", "type": "function", "loc": [140, 158], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:ClassDef_L139_C0", "vector": [2, 1, 0.7198, 0.0918, 1, 0.64, 0.0, 693, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "open", "arg_names": ["self", "params"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def open(self, params):\n group, token, name = params.split('/') + [None, None]\n self.group = group or 'default'\n self.token = token or 'none'\n self.name = name or 'anonymous'\n # only authorized parties can join\n if DistributeHandler.tokens:\n if not self.token in tokens or not token[self.token] is None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L141_C8", "label": "group, token, name =", "type": "assigned_variable", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L140_C4", "vector": [14, 2, 0.6812, 0.0048, 2, 0.95, 0.0, 58, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "group, token, name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " group, token, name = params.split('/') + [None, None]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L142_C8", "label": "self.group =", "type": "assigned_variable", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L140_C4", "vector": [14, 2, 0.686, 0.0048, 2, 0.95, 0.1111, 561, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.group", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.group = group or 'default'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L143_C8", "label": "self.token =", "type": "assigned_variable", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L140_C4", "vector": [14, 2, 0.6908, 0.0048, 2, 0.95, 0.2222, 150, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.token = token or 'none'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L144_C8", "label": "self.name =", "type": "assigned_variable", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L140_C4", "vector": [14, 2, 0.6957, 0.0048, 2, 0.95, 0.3333, 689, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.name = name or 'anonymous'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:If_L146_C8", "label": "if", "type": "if", "loc": [146, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L140_C4", "vector": [4, 2, 0.715, 0.0242, 2, 0.95, 0.4444, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if DistributeHandler.tokens:\n if not self.token in tokens or not token[self.token] is None:\n self.close()\n else:\n tokens[self.token] = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:If_L147_C12", "label": "if", "type": "if", "loc": [147, 150], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L146_C8", "vector": [4, 3, 0.7174, 0.0193, 3, 0.57, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.token in tokens or not token[self.token] is None:\n self.close()\n else:\n tokens[self.token] = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L148_C16", "label": "close()", "type": "expression", "loc": [148, 148], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L147_C12", "vector": [8, 4, 0.715, 0.0048, 4, 0.86, 0.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_478:Assign_L150_C16", "label": "assign", "type": "assigned_variable", "loc": [150, 150], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L147_C12", "vector": [14, 4, 0.7246, 0.0048, 4, 0.86, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tokens[self.token] = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:If_L151_C8", "label": "if", "type": "if", "loc": [151, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L140_C4", "vector": [4, 2, 0.7319, 0.0097, 2, 0.95, 0.5556, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.group in listeners:\n listeners[self.group] = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L152_C12", "label": "assign", "type": "assigned_variable", "loc": [152, 152], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L151_C8", "vector": [14, 3, 0.7343, 0.0048, 3, 0.8, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " listeners[self.group] = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:For_L154_C8", "label": "for client", "type": "for", "loc": [154, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L140_C4", "vector": [6, 2, 0.7464, 0.0097, 2, 0.95, 0.6667, 608, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "client", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for client in listeners.get(self.group, []):\n client.write_message('+' + self.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L155_C12", "label": "write_message()", "type": "expression", "loc": [155, 155], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:For_L154_C8", "vector": [8, 3, 0.7488, 0.0048, 3, 0.9, 0.0, 177, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write_message", "arg_names": [], "import_names": [], "rhs_call_name": "write_message", "annotation": ""}, "snippet": " client.write_message('+' + self.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L156_C8", "label": "append()", "type": "expression", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L140_C4", "vector": [8, 2, 0.7536, 0.0048, 2, 0.95, 0.7778, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " listeners[self.group].append(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L157_C8", "label": "assign", "type": "assigned_variable", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L140_C4", "vector": [14, 2, 0.7585, 0.0048, 2, 0.95, 0.8889, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " names[self] = self.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L158_C8", "label": "print()", "type": "expression", "loc": [158, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L140_C4", "vector": [8, 2, 0.7633, 0.0048, 2, 0.95, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%s:CONNECT to %s' % (time.time(), self.group))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L160_C4", "label": "on_message", "type": "function", "loc": [160, 161], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:ClassDef_L139_C0", "vector": [2, 1, 0.7754, 0.0097, 1, 0.64, 0.5, 365, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "on_message", "arg_names": ["self", "message"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_message(self, message):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L163_C4", "label": "on_close", "type": "function", "loc": [163, 170], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:ClassDef_L139_C0", "vector": [2, 1, 0.8043, 0.0386, 1, 0.64, 1.0, 805, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "on_close", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def on_close(self):\n if self.group in listeners:\n listeners[self.group].remove(self)\n del names[self]\n # notify clients that a member has left the groups\n for client in listeners.get(self.group, []):\n client.write_message('-' + self.name)\n print('%s:DISCONNECT from %s' % (time.time(), self.group))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:If_L164_C8", "label": "if", "type": "if", "loc": [164, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L163_C4", "vector": [4, 2, 0.7947, 0.0097, 2, 0.79, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.group in listeners:\n listeners[self.group].remove(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L165_C12", "label": "remove()", "type": "expression", "loc": [165, 165], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L164_C8", "vector": [8, 3, 0.7971, 0.0048, 3, 0.25, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " listeners[self.group].remove(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:For_L168_C8", "label": "for client", "type": "for", "loc": [168, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L163_C4", "vector": [6, 2, 0.814, 0.0097, 2, 0.79, 0.5, 608, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "client", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for client in listeners.get(self.group, []):\n client.write_message('-' + self.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L169_C12", "label": "write_message()", "type": "expression", "loc": [169, 169], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:For_L168_C8", "vector": [8, 3, 0.8164, 0.0048, 3, 0.95, 0.0, 177, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write_message", "arg_names": [], "import_names": [], "rhs_call_name": "write_message", "annotation": ""}, "snippet": " client.write_message('-' + self.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L170_C8", "label": "print()", "type": "expression", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L163_C4", "vector": [8, 2, 0.8213, 0.0048, 2, 0.79, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%s:DISCONNECT from %s' % (time.time(), self.group))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "label": "if", "type": "if", "loc": [172, 207], "level": 0, "parent": null, "vector": [4, 0, 0.9155, 0.1739, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n usage = __doc__\n version = \"\"\n parser = optparse.OptionParser(usage, None, optparse.Option, version)\n parser.add_option('-p',\n '--port',\n default='8888',\n dest='port',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L173_C4", "label": "usage =", "type": "assigned_variable", "loc": [173, 173], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "vector": [14, 1, 0.8357, 0.0048, 1, 0.81, 0.0, 129, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "usage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " usage = __doc__"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L174_C4", "label": "version =", "type": "assigned_variable", "loc": [174, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "vector": [14, 1, 0.8406, 0.0048, 1, 0.81, 0.0714, 623, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L175_C4", "label": "parser = OptionParser()", "type": "assigned_variable", "loc": [175, 175], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "vector": [14, 1, 0.8454, 0.0048, 1, 0.81, 0.1429, 968, 3, 4, 0, 0, 894, 10, 1], "semantic": {"name": "parser", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " parser = optparse.OptionParser(usage, None, optparse.Option, version)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L176_C4", "label": "add_option()", "type": "expression", "loc": [176, 180], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "vector": [8, 1, 0.8599, 0.0242, 1, 0.81, 0.2143, 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('-p',\n '--port',\n default='8888',\n dest='port',\n help='socket')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L181_C4", "label": "add_option()", "type": "expression", "loc": [181, 185], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "vector": [8, 1, 0.8841, 0.0242, 1, 0.81, 0.2857, 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('-l',\n '--listen',\n default='0.0.0.0',\n dest='address',\n help='listener address')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L186_C4", "label": "add_option()", "type": "expression", "loc": [186, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "vector": [8, 1, 0.9082, 0.0242, 1, 0.81, 0.3571, 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',\n '--hmac_key',\n default='',\n dest='hmac_key',\n help='hmac_key')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L191_C4", "label": "add_option()", "type": "expression", "loc": [191, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "vector": [8, 1, 0.9348, 0.029, 1, 0.81, 0.4286, 176, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-t',\n '--tokens',\n action='store_true',\n default=False,\n dest='tokens',\n help='require tockens to join')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L197_C4", "label": "options, args = parse_args()", "type": "assigned_variable", "loc": [197, 197], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "vector": [14, 1, 0.9517, 0.0048, 1, 0.81, 0.5, 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_478:Assign_L198_C4", "label": "hmac_key =", "type": "assigned_variable", "loc": [198, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "vector": [14, 1, 0.9565, 0.0048, 1, 0.81, 0.5714, 3, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "hmac_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hmac_key = options.hmac_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L199_C4", "label": "DistributeHandler.tokens =", "type": "assigned_variable", "loc": [199, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "vector": [14, 1, 0.9614, 0.0048, 1, 0.81, 0.6429, 677, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "DistributeHandler.tokens", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " DistributeHandler.tokens = options.tokens"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L200_C4", "label": "urls =", "type": "assigned_variable", "loc": [200, 203], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "vector": [14, 1, 0.9734, 0.0193, 1, 0.81, 0.7143, 260, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "urls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " urls = [\n (r'/', PostHandler),\n (r'/token', TokenHandler),\n (r'/realtime/(.*)', DistributeHandler)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L204_C4", "label": "application = Application()", "type": "assigned_variable", "loc": [204, 204], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "vector": [14, 1, 0.9855, 0.0048, 1, 0.81, 0.7857, 244, 3, 2, 0, 0, 979, 10, 1], "semantic": {"name": "application", "arg_names": [], "import_names": [], "rhs_call_name": "Application", "annotation": ""}, "snippet": " application = tornado.web.Application(urls, auto_reload=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L205_C4", "label": "http_server = HTTPServer()", "type": "assigned_variable", "loc": [205, 205], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "vector": [14, 1, 0.9903, 0.0048, 1, 0.81, 0.8571, 337, 3, 1, 0, 0, 258, 10, 1], "semantic": {"name": "http_server", "arg_names": [], "import_names": [], "rhs_call_name": "HTTPServer", "annotation": ""}, "snippet": " http_server = tornado.httpserver.HTTPServer(application)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L206_C4", "label": "listen()", "type": "expression", "loc": [206, 206], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "vector": [8, 1, 0.9952, 0.0048, 1, 0.81, 0.9286, 265, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "listen", "arg_names": [], "import_names": [], "rhs_call_name": "listen", "annotation": ""}, "snippet": " http_server.listen(int(options.port), address=options.address)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L207_C4", "label": "start()", "type": "expression", "loc": [207, 207], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "vector": [8, 1, 1.0, 0.0048, 1, 0.81, 1.0, 511, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "start", "annotation": ""}, "snippet": " tornado.ioloop.IOLoop.instance().start()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Return_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:ClassDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:ClassDef_L98_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_478:If_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L103_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Return_L104_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_478:If_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L106_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L108_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_478:If_L109_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L109_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L110_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L109_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_478:If_L111_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L111_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Return_L112_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_478:For_L113_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:For_L113_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L114_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Return_L115_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Return_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L125_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_478:If_L126_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L126_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Return_L127_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L125_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_478:If_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L128_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L129_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L128_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_478:If_L130_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L130_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L131_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L130_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_478:If_L132_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L132_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Return_L133_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L128_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L134_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L128_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Return_L135_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L125_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Return_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:ClassDef_L139_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L140_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L140_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L140_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L140_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L140_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_478:If_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_478:If_L147_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L147_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L148_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L147_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L150_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L140_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_478:If_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L151_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L152_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L140_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_478:For_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:For_L154_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L155_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L140_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L140_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L140_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:ClassDef_L139_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:ClassDef_L139_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_478:If_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L164_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L165_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_478:For_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:For_L168_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L169_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L191_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L200_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L204_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Assign_L205_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_478:If_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_478:Expr_L207_C4"}] |
#!/usr/bin/env python
# coding: utf8
"""
RPX Authentication for web2py
Developed by Nathan Freeze (Copyright © 2009)
Email <nathan@freezable.com>
Modified by Massimo Di Pierro
This file contains code to allow using RPXNow.com (now Jainrain.com)
services with web2py
"""
import os
import re
import urllib
from gluon import *
from gluon.tools import fetch
from gluon.storage import Storage
import gluon.contrib.simplejson as json
class RPXAccount(object):
"""
from gluon.contrib.login_methods.rpx_account import RPXAccount
auth.settings.actions_disabled=['register','change_password',
'request_reset_password']
auth.settings.login_form = RPXAccount(request,
api_key="...",
domain="...",
url = "http://localhost:8000/%s/default/user/login" % request.application)
"""
def __init__(self,
request,
api_key="",
domain="",
url="",
embed=True,
auth_url="https://rpxnow.com/api/v2/auth_info",
language="en",
prompt='rpx',
on_login_failure=None,
):
self.request = request
self.api_key = api_key
self.embed = embed
self.auth_url = auth_url
self.domain = domain
self.token_url = url
self.language = language
self.profile = None
self.prompt = prompt
self.on_login_failure = on_login_failure
self.mappings = Storage()
dn = {'givenName': '', 'familyName': ''}
self.mappings.Facebook = lambda profile, dn=dn:\
dict(registration_id=profile.get("identifier", ""),
username=profile.get("preferredUsername", ""),
email=profile.get("email", ""),
first_name=profile.get("name", dn).get("givenName", ""),
last_name=profile.get("name", dn).get("familyName", ""))
self.mappings.Google = lambda profile, dn=dn:\
dict(registration_id=profile.get("identifier", ""),
username=profile.get("preferredUsername", ""),
email=profile.get("email", ""),
first_name=profile.get("name", dn).get("givenName", ""),
last_name=profile.get("name", dn).get("familyName", ""))
self.mappings.default = lambda profile:\
dict(registration_id=profile.get("identifier", ""),
username=profile.get("preferredUsername", ""),
email=profile.get("email", ""),
first_name=profile.get("preferredUsername", ""),
last_name='')
def get_user(self):
request = self.request
if request.vars.token:
user = Storage()
data = urllib.urlencode(
dict(apiKey=self.api_key, token=request.vars.token))
auth_info_json = fetch(self.auth_url + '?' + data)
auth_info = json.loads(auth_info_json)
if auth_info['stat'] == 'ok':
self.profile = auth_info['profile']
provider = re.sub('[^\w\-]', '', self.profile['providerName'])
user = self.mappings.get(
provider, self.mappings.default)(self.profile)
return user
elif self.on_login_failure:
redirect(self.on_login_failure)
return None
def login_form(self):
request = self.request
args = request.args
if self.embed:
JANRAIN_URL = \
"https://%s.rpxnow.com/openid/embed?token_url=%s&language_preference=%s"
rpxform = IFRAME(
_src=JANRAIN_URL % (
self.domain, self.token_url, self.language),
_scrolling="no",
_frameborder="no",
_style="width:400px;height:240px;")
else:
JANRAIN_URL = \
"https://%s.rpxnow.com/openid/v2/signin?token_url=%s"
rpxform = DIV(SCRIPT(_src="https://rpxnow.com/openid/v2/widget",
_type="text/javascript"),
SCRIPT("RPXNOW.overlay = true;",
"RPXNOW.language_preference = '%s';" % self.language,
"RPXNOW.realm = '%s';" % self.domain,
"RPXNOW.token_url = '%s';" % self.token_url,
"RPXNOW.show();",
_type="text/javascript"))
return rpxform
def use_janrain(auth, filename='private/janrain.key', **kwargs):
path = os.path.join(current.request.folder, filename)
if os.path.exists(path):
request = current.request
domain, key = open(path, 'r').read().strip().split(':')
host = current.request.env.http_host
url = URL('default', 'user', args='login', scheme=True)
auth.settings.actions_disabled = \
['register', 'change_password', 'request_reset_password']
auth.settings.login_form = RPXAccount(
request, api_key=key, domain=domain, url=url, **kwargs)
| ajibawa-2023/Python-Code-Large/train/row_481 | 59 | 134 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_481:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 12], "level": 0, "parent": null, "vector": [8, 0, 0.0597, 0.0672, 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 RPX Authentication for web2py\n Developed by Nathan Freeze (Copyright \u00a9 2009)\n Email <nathan@freezable.com>\n Modified by Massimo Di Pierro\n\n This file contains code to allow using RPXNow.com (now Jainrain.com)\n services with web2py"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Import_L14_C0", "label": "os import os", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1045, 0.0075, 0, 0.66, 0.1111, 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_481:Import_L15_C0", "label": "re import re", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.1119, 0.0075, 0, 0.66, 0.2222, 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_481:Import_L16_C0", "label": "urllib import urllib", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.1194, 0.0075, 0, 0.66, 0.3333, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "urllib", "arg_names": [], "import_names": ["urllib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urllib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:ImportFrom_L17_C0", "label": "from gluon import *", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.1269, 0.0075, 0, 0.66, 0.4444, 826, 0, 1, 0, 0, 826, 0, 0], "semantic": {"name": "gluon", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:ImportFrom_L18_C0", "label": "from gluon.tools import fetch", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1343, 0.0075, 0, 0.66, 0.5556, 322, 0, 1, 0, 0, 322, 0, 0], "semantic": {"name": "gluon.tools", "arg_names": [], "import_names": ["fetch"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.tools import fetch"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:ImportFrom_L19_C0", "label": "from gluon.storage import Storage", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.1418, 0.0075, 0, 0.66, 0.6667, 696, 0, 1, 0, 0, 696, 0, 0], "semantic": {"name": "gluon.storage", "arg_names": [], "import_names": ["Storage"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.storage import Storage"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Import_L20_C0", "label": "gluon.contrib.simplejson import json", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.1493, 0.0075, 0, 0.66, 0.7778, 611, 0, 1, 0, 0, 611, 0, 0], "semantic": {"name": "gluon.contrib.simplejson", "arg_names": [], "import_names": ["json"], "rhs_call_name": "", "annotation": ""}, "snippet": "import gluon.contrib.simplejson as json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:ClassDef_L23_C0", "label": "RPXAccount", "type": "class", "loc": [23, 121], "level": 0, "parent": null, "vector": [3, 0, 0.5373, 0.7388, 0, 0.66, 0.8889, 149, 0, 3, 0, 0, 186, 0, 35], "semantic": {"name": "RPXAccount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RPXAccount(object):\n\n \"\"\"\n from gluon.contrib.login_methods.rpx_account import RPXAccount\n auth.settings.actions_disabled=['register','change_password',\n 'request_reset_password']\n auth.settings.login_form = RPXAccount(request,\n api_key=\"...\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Expr_L25_C4", "label": "expression", "type": "expression", "loc": [25, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:ClassDef_L23_C0", "vector": [8, 1, 0.2164, 0.0672, 1, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n from gluon.contrib.login_methods.rpx_account import RPXAccount\n auth.settings.actions_disabled=['register','change_password',\n 'request_reset_password']\n auth.settings.login_form = RPXAccount(request,\n api_key=\"...\",\n domain=\"...\",\n url = \"http://localhost:8000/%s/default/user/login\" % request.application)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "label": "__init__", "type": "function", "loc": [35, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:ClassDef_L23_C0", "vector": [2, 1, 0.4179, 0.3209, 1, 0.45, 0.3333, 555, 0, 10, 0, 0, 0, 0, 22], "semantic": {"name": "__init__", "arg_names": ["self", "request", "api_key", "domain", "url", "embed", "auth_url", "language", "prompt", "on_login_failure"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self,\n request,\n api_key=\"\",\n domain=\"\",\n url=\"\",\n embed=True,\n auth_url=\"https://rpxnow.com/api/v2/auth_info\",\n language=\"en\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L47_C8", "label": "self.request =", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "vector": [14, 2, 0.3507, 0.0075, 2, 0.24, 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_481:Assign_L48_C8", "label": "self.api_key =", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "vector": [14, 2, 0.3582, 0.0075, 2, 0.24, 0.0714, 355, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.api_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.api_key = api_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L49_C8", "label": "self.embed =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "vector": [14, 2, 0.3657, 0.0075, 2, 0.24, 0.1429, 945, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.embed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.embed = embed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L50_C8", "label": "self.auth_url =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "vector": [14, 2, 0.3731, 0.0075, 2, 0.24, 0.2143, 649, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.auth_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.auth_url = auth_url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L51_C8", "label": "self.domain =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "vector": [14, 2, 0.3806, 0.0075, 2, 0.24, 0.2857, 208, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.domain", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.domain = domain"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L52_C8", "label": "self.token_url =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "vector": [14, 2, 0.3881, 0.0075, 2, 0.24, 0.3571, 81, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.token_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.token_url = url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L53_C8", "label": "self.language =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "vector": [14, 2, 0.3955, 0.0075, 2, 0.24, 0.4286, 164, 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_481:Assign_L54_C8", "label": "self.profile =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "vector": [14, 2, 0.403, 0.0075, 2, 0.24, 0.5, 43, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.profile", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.profile = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L55_C8", "label": "self.prompt =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "vector": [14, 2, 0.4104, 0.0075, 2, 0.24, 0.5714, 198, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.prompt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.prompt = prompt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L56_C8", "label": "self.on_login_failure =", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "vector": [14, 2, 0.4179, 0.0075, 2, 0.24, 0.6429, 75, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.on_login_failure", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.on_login_failure = on_login_failure"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L57_C8", "label": "self.mappings = Storage()", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "vector": [14, 2, 0.4254, 0.0075, 2, 0.24, 0.7143, 708, 3, 0, 0, 0, 850, 10, 1], "semantic": {"name": "self.mappings", "arg_names": [], "import_names": [], "rhs_call_name": "Storage", "annotation": ""}, "snippet": " self.mappings = Storage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L59_C8", "label": "dn =", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "vector": [14, 2, 0.4403, 0.0075, 2, 0.24, 0.7857, 105, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "dn", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dn = {'givenName': '', 'familyName': ''}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L60_C8", "label": "self.mappings.Facebook =", "type": "assigned_variable", "loc": [60, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "vector": [14, 2, 0.4664, 0.0448, 2, 0.24, 0.8571, 859, 9, 0, 0, 0, 0, 0, 8], "semantic": {"name": "self.mappings.Facebook", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mappings.Facebook = lambda profile, dn=dn:\\\n dict(registration_id=profile.get(\"identifier\", \"\"),\n username=profile.get(\"preferredUsername\", \"\"),\n email=profile.get(\"email\", \"\"),\n first_name=profile.get(\"name\", dn).get(\"givenName\", \"\"),\n last_name=profile.get(\"name\", dn).get(\"familyName\", \"\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L66_C8", "label": "self.mappings.Google =", "type": "assigned_variable", "loc": [66, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "vector": [14, 2, 0.5112, 0.0448, 2, 0.24, 0.9286, 595, 9, 0, 0, 0, 0, 0, 8], "semantic": {"name": "self.mappings.Google", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mappings.Google = lambda profile, dn=dn:\\\n dict(registration_id=profile.get(\"identifier\", \"\"),\n username=profile.get(\"preferredUsername\", \"\"),\n email=profile.get(\"email\", \"\"),\n first_name=profile.get(\"name\", dn).get(\"givenName\", \"\"),\n last_name=profile.get(\"name\", dn).get(\"familyName\", \"\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L72_C8", "label": "self.mappings.default =", "type": "assigned_variable", "loc": [72, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "vector": [14, 2, 0.556, 0.0448, 2, 0.24, 1.0, 515, 9, 0, 0, 0, 0, 0, 5], "semantic": {"name": "self.mappings.default", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mappings.default = lambda profile:\\\n dict(registration_id=profile.get(\"identifier\", \"\"),\n username=profile.get(\"preferredUsername\", \"\"),\n email=profile.get(\"email\", \"\"),\n first_name=profile.get(\"preferredUsername\", \"\"),\n last_name='')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L79_C4", "label": "get_user", "type": "function", "loc": [79, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:ClassDef_L23_C0", "vector": [2, 1, 0.653, 0.1343, 1, 0.45, 0.6667, 174, 0, 1, 1, 0, 0, 0, 9], "semantic": {"name": "get_user", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_user(self):\n request = self.request\n if request.vars.token:\n user = Storage()\n data = urllib.urlencode(\n dict(apiKey=self.api_key, token=request.vars.token))\n auth_info_json = fetch(self.auth_url + '?' + data)\n auth_info = json.loads(auth_info_json)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L80_C8", "label": "request =", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L79_C4", "vector": [14, 2, 0.597, 0.0075, 2, 0.03, 0.0, 50, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request = self.request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:If_L81_C8", "label": "if", "type": "if", "loc": [81, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L79_C4", "vector": [4, 2, 0.6567, 0.1119, 2, 0.03, 0.5, 0, 7, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.vars.token:\n user = Storage()\n data = urllib.urlencode(\n dict(apiKey=self.api_key, token=request.vars.token))\n auth_info_json = fetch(self.auth_url + '?' + data)\n auth_info = json.loads(auth_info_json)\n\n if auth_info['stat'] == 'ok':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L82_C12", "label": "user = Storage()", "type": "assigned_variable", "loc": [82, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:If_L81_C8", "vector": [14, 3, 0.6119, 0.0075, 3, 0.58, 0.0, 503, 3, 0, 0, 0, 850, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "Storage", "annotation": ""}, "snippet": " user = Storage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L83_C12", "label": "data = urlencode()", "type": "assigned_variable", "loc": [83, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:If_L81_C8", "vector": [14, 3, 0.6231, 0.0149, 3, 0.58, 0.25, 929, 3, 1, 0, 0, 414, 10, 2], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "urlencode", "annotation": ""}, "snippet": " data = urllib.urlencode(\n dict(apiKey=self.api_key, token=request.vars.token))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L85_C12", "label": "auth_info_json = fetch()", "type": "assigned_variable", "loc": [85, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:If_L81_C8", "vector": [14, 3, 0.6343, 0.0075, 3, 0.58, 0.5, 790, 3, 1, 0, 0, 587, 10, 1], "semantic": {"name": "auth_info_json", "arg_names": [], "import_names": [], "rhs_call_name": "fetch", "annotation": ""}, "snippet": " auth_info_json = fetch(self.auth_url + '?' + data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L86_C12", "label": "auth_info = loads()", "type": "assigned_variable", "loc": [86, 86], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:If_L81_C8", "vector": [14, 3, 0.6418, 0.0075, 3, 0.58, 0.75, 78, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "auth_info", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": " auth_info = json.loads(auth_info_json)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:If_L88_C12", "label": "if", "type": "if", "loc": [88, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:If_L81_C8", "vector": [4, 3, 0.6828, 0.0597, 3, 0.58, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if auth_info['stat'] == 'ok':\n self.profile = auth_info['profile']\n provider = re.sub('[^\\w\\-]', '', self.profile['providerName'])\n user = self.mappings.get(\n provider, self.mappings.default)(self.profile)\n return user\n elif self.on_login_failure:\n redirect(self.on_login_failure)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L89_C16", "label": "self.profile =", "type": "assigned_variable", "loc": [89, 89], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:If_L88_C12", "vector": [14, 4, 0.6642, 0.0075, 4, 0.98, 0.0, 43, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.profile", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.profile = auth_info['profile']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L90_C16", "label": "provider = sub()", "type": "assigned_variable", "loc": [90, 90], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:If_L88_C12", "vector": [14, 4, 0.6716, 0.0075, 4, 0.98, 0.25, 736, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "provider", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " provider = re.sub('[^\\w\\-]', '', self.profile['providerName'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L91_C16", "label": "user =", "type": "assigned_variable", "loc": [91, 92], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:If_L88_C12", "vector": [14, 4, 0.6828, 0.0149, 4, 0.98, 0.5, 503, 3, 1, 0, 0, 0, 10, 2], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user = self.mappings.get(\n provider, self.mappings.default)(self.profile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Return_L93_C16", "label": "return", "type": "return", "loc": [93, 93], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:If_L88_C12", "vector": [13, 4, 0.694, 0.0075, 4, 0.98, 0.75, 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_481:If_L94_C12", "label": "if", "type": "if", "loc": [94, 95], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:If_L88_C12", "vector": [4, 4, 0.7052, 0.0149, 4, 0.98, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.on_login_failure:\n redirect(self.on_login_failure)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Expr_L95_C16", "label": "redirect()", "type": "expression", "loc": [95, 95], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:If_L94_C12", "vector": [8, 5, 0.709, 0.0075, 5, 0.61, 0.0, 206, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(self.on_login_failure)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Return_L96_C8", "label": "return", "type": "return", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L79_C4", "vector": [13, 2, 0.7164, 0.0075, 2, 0.03, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L98_C4", "label": "login_form", "type": "function", "loc": [98, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:ClassDef_L23_C0", "vector": [2, 1, 0.8172, 0.1791, 1, 0.45, 1.0, 289, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "login_form", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def login_form(self):\n request = self.request\n args = request.args\n if self.embed:\n JANRAIN_URL = \\\n \"https://%s.rpxnow.com/openid/embed?token_url=%s&language_preference=%s\"\n rpxform = IFRAME(\n _src=JANRAIN_URL % ("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L99_C8", "label": "request =", "type": "assigned_variable", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L98_C4", "vector": [14, 2, 0.7388, 0.0075, 2, 0.3, 0.0, 50, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request = self.request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L100_C8", "label": "args =", "type": "assigned_variable", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L98_C4", "vector": [14, 2, 0.7463, 0.0075, 2, 0.3, 0.3333, 805, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = request.args"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:If_L101_C8", "label": "if", "type": "if", "loc": [101, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L98_C4", "vector": [4, 2, 0.8246, 0.1493, 2, 0.3, 0.6667, 0, 7, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.embed:\n JANRAIN_URL = \\\n \"https://%s.rpxnow.com/openid/embed?token_url=%s&language_preference=%s\"\n rpxform = IFRAME(\n _src=JANRAIN_URL % (\n self.domain, self.token_url, self.language),\n _scrolling=\"no\",\n _frameborder=\"no\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L102_C12", "label": "JANRAIN_URL =", "type": "assigned_variable", "loc": [102, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:If_L101_C8", "vector": [14, 3, 0.7649, 0.0149, 3, 0.21, 0.0, 22, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "JANRAIN_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " JANRAIN_URL = \\\n \"https://%s.rpxnow.com/openid/embed?token_url=%s&language_preference=%s\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L104_C12", "label": "rpxform = IFRAME()", "type": "assigned_variable", "loc": [104, 109], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:If_L101_C8", "vector": [14, 3, 0.7948, 0.0448, 3, 0.21, 0.3333, 905, 3, 4, 0, 0, 37, 10, 1], "semantic": {"name": "rpxform", "arg_names": [], "import_names": [], "rhs_call_name": "IFRAME", "annotation": ""}, "snippet": " rpxform = IFRAME(\n _src=JANRAIN_URL % (\n self.domain, self.token_url, self.language),\n _scrolling=\"no\",\n _frameborder=\"no\",\n _style=\"width:400px;height:240px;\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L111_C12", "label": "JANRAIN_URL =", "type": "assigned_variable", "loc": [111, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:If_L101_C8", "vector": [14, 3, 0.8321, 0.0149, 3, 0.21, 0.6667, 22, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "JANRAIN_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " JANRAIN_URL = \\\n \"https://%s.rpxnow.com/openid/v2/signin?token_url=%s\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L113_C12", "label": "rpxform = DIV()", "type": "assigned_variable", "loc": [113, 120], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:If_L101_C8", "vector": [14, 3, 0.8694, 0.0597, 3, 0.21, 1.0, 905, 3, 2, 0, 0, 697, 10, 3], "semantic": {"name": "rpxform", "arg_names": [], "import_names": [], "rhs_call_name": "DIV", "annotation": ""}, "snippet": " rpxform = DIV(SCRIPT(_src=\"https://rpxnow.com/openid/v2/widget\",\n _type=\"text/javascript\"),\n SCRIPT(\"RPXNOW.overlay = true;\",\n \"RPXNOW.language_preference = '%s';\" % self.language,\n \"RPXNOW.realm = '%s';\" % self.domain,\n \"RPXNOW.token_url = '%s';\" % self.token_url,\n \"RPXNOW.show();\",\n _type=\"text/javascript\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Return_L121_C8", "label": "return", "type": "return", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L98_C4", "vector": [13, 2, 0.903, 0.0075, 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 rpxform"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L124_C0", "label": "use_janrain", "type": "function", "loc": [124, 134], "level": 0, "parent": null, "vector": [2, 0, 0.9627, 0.0821, 0, 0.66, 1.0, 118, 0, 3, 0, 0, 0, 0, 8], "semantic": {"name": "use_janrain", "arg_names": ["auth", "filename", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def use_janrain(auth, filename='private/janrain.key', **kwargs):\n path = os.path.join(current.request.folder, filename)\n if os.path.exists(path):\n request = current.request\n domain, key = open(path, 'r').read().strip().split(':')\n host = current.request.env.http_host\n url = URL('default', 'user', args='login', scheme=True)\n auth.settings.actions_disabled = \\"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L125_C4", "label": "path = join()", "type": "assigned_variable", "loc": [125, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L124_C0", "vector": [14, 1, 0.9328, 0.0075, 1, 0.52, 0.0, 358, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " path = os.path.join(current.request.folder, filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:If_L126_C4", "label": "if", "type": "if", "loc": [126, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L124_C0", "vector": [4, 1, 0.9701, 0.0672, 1, 0.52, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.exists(path):\n request = current.request\n domain, key = open(path, 'r').read().strip().split(':')\n host = current.request.env.http_host\n url = URL('default', 'user', args='login', scheme=True)\n auth.settings.actions_disabled = \\\n ['register', 'change_password', 'request_reset_password']\n auth.settings.login_form = RPXAccount("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L127_C8", "label": "request =", "type": "assigned_variable", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:If_L126_C4", "vector": [14, 2, 0.9478, 0.0075, 2, 0.93, 0.0, 50, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request = current.request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L128_C8", "label": "domain, key = split()", "type": "assigned_variable", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:If_L126_C4", "vector": [14, 2, 0.9552, 0.0075, 2, 0.93, 0.2, 884, 3, 1, 0, 0, 908, 10, 4], "semantic": {"name": "domain, key", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " domain, key = open(path, 'r').read().strip().split(':')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L129_C8", "label": "host =", "type": "assigned_variable", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:If_L126_C4", "vector": [14, 2, 0.9627, 0.0075, 2, 0.93, 0.4, 867, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "host", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " host = current.request.env.http_host"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L130_C8", "label": "url = URL()", "type": "assigned_variable", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:If_L126_C4", "vector": [14, 2, 0.9701, 0.0075, 2, 0.93, 0.6, 789, 3, 4, 0, 0, 759, 10, 1], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "URL", "annotation": ""}, "snippet": " url = URL('default', 'user', args='login', scheme=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L131_C8", "label": "auth.settings.actions_disabled =", "type": "assigned_variable", "loc": [131, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:If_L126_C4", "vector": [14, 2, 0.9813, 0.0149, 2, 0.93, 0.8, 973, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "auth.settings.actions_disabled", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " auth.settings.actions_disabled = \\\n ['register', 'change_password', 'request_reset_password']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L133_C8", "label": "auth.settings.login_form = RPXAccount()", "type": "assigned_variable", "loc": [133, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_481:If_L126_C4", "vector": [14, 2, 0.9963, 0.0149, 2, 0.93, 1.0, 374, 3, 5, 0, 0, 149, 10, 1], "semantic": {"name": "auth.settings.login_form", "arg_names": [], "import_names": [], "rhs_call_name": "RPXAccount", "annotation": ""}, "snippet": " auth.settings.login_form = RPXAccount(\n request, api_key=key, domain=domain, url=url, **kwargs)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_481:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Expr_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L35_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:If_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:If_L81_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L82_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:If_L81_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L83_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:If_L81_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L85_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:If_L81_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L86_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:If_L81_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_481:If_L88_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:If_L88_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L89_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:If_L88_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L90_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:If_L88_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L91_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:If_L88_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Return_L93_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:If_L88_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_481:If_L94_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:If_L94_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Expr_L95_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Return_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:If_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L102_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L104_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:If_L101_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L113_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Return_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:FunctionDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_481:If_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:If_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:If_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:If_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:If_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:If_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_481:If_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_481:Assign_L133_C8"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu>.
License: GPL v2
Thanks to Hans Donner <hans.donner@pobox.com> for GaeGoogleAccount.
"""
from google.appengine.api import users
class GaeGoogleAccount(object):
"""
Login will be done via Google's Appengine login object, instead of web2py's
login form.
Include in your model (eg db.py)::
from gluon.contrib.login_methods.gae_google_account import \
GaeGoogleAccount
auth.settings.login_form=GaeGoogleAccount()
"""
def login_url(self, next="/"):
return users.create_login_url(next)
def logout_url(self, next="/"):
return users.create_logout_url(next)
def get_user(self):
user = users.get_current_user()
if user:
return dict(nickname=user.nickname(), email=user.email(),
user_id=user.user_id(), source="google account")
| ajibawa-2023/Python-Code-Large/train/row_482 | 12 | 38 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_482:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 10], "level": 0, "parent": null, "vector": [8, 0, 0.1842, 0.1842, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis file is part of web2py Web Framework (Copyrighted, 2007-2009).\nDeveloped by Massimo Di Pierro <mdipierro@cs.depaul.edu>.\nLicense: GPL v2\n\nThanks to Hans Donner <hans.donner@pobox.com> for GaeGoogleAccount.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_482:ImportFrom_L12_C0", "label": "from google.appengine.api import users", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.3158, 0.0263, 0, 0.66, 0.5, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "google.appengine.api", "arg_names": [], "import_names": ["users"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.api import users"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_482:ClassDef_L15_C0", "label": "GaeGoogleAccount", "type": "class", "loc": [15, 38], "level": 0, "parent": null, "vector": [3, 0, 0.6974, 0.6316, 0, 0.66, 1.0, 2, 0, 3, 0, 0, 186, 0, 7], "semantic": {"name": "GaeGoogleAccount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GaeGoogleAccount(object):\n \"\"\"\n Login will be done via Google's Appengine login object, instead of web2py's\n login form.\n\n Include in your model (eg db.py)::\n\n from gluon.contrib.login_methods.gae_google_account import \\"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_482:Expr_L16_C4", "label": "expression", "type": "expression", "loc": [16, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_482:ClassDef_L15_C0", "vector": [8, 1, 0.5526, 0.2895, 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 Login will be done via Google's Appengine login object, instead of web2py's\n login form.\n\n Include in your model (eg db.py)::\n\n from gluon.contrib.login_methods.gae_google_account import \\\n GaeGoogleAccount"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_482:FunctionDef_L28_C4", "label": "login_url", "type": "function", "loc": [28, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_482:ClassDef_L15_C0", "vector": [2, 1, 0.75, 0.0526, 1, 0.0, 0.3333, 704, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "login_url", "arg_names": ["self", "next"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def login_url(self, next=\"/\"):\n return users.create_login_url(next)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_482:Return_L29_C8", "label": "return", "type": "return", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_482:FunctionDef_L28_C4", "vector": [13, 2, 0.7632, 0.0263, 2, 0.4, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return users.create_login_url(next)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_482:FunctionDef_L31_C4", "label": "logout_url", "type": "function", "loc": [31, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_482:ClassDef_L15_C0", "vector": [2, 1, 0.8289, 0.0526, 1, 0.0, 0.6667, 181, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "logout_url", "arg_names": ["self", "next"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def logout_url(self, next=\"/\"):\n return users.create_logout_url(next)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_482:Return_L32_C8", "label": "return", "type": "return", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_482:FunctionDef_L31_C4", "vector": [13, 2, 0.8421, 0.0263, 2, 0.05, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return users.create_logout_url(next)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_482:FunctionDef_L34_C4", "label": "get_user", "type": "function", "loc": [34, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_482:ClassDef_L15_C0", "vector": [2, 1, 0.9474, 0.1316, 1, 0.0, 1.0, 174, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "get_user", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_user(self):\n user = users.get_current_user()\n if user:\n return dict(nickname=user.nickname(), email=user.email(),\n user_id=user.user_id(), source=\"google account\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_482:Assign_L35_C8", "label": "user = get_current_user()", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_482:FunctionDef_L34_C4", "vector": [14, 2, 0.9211, 0.0263, 2, 0.48, 0.0, 503, 3, 0, 0, 0, 722, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "get_current_user", "annotation": ""}, "snippet": " user = users.get_current_user()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_482:If_L36_C8", "label": "if", "type": "if", "loc": [36, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_482:FunctionDef_L34_C4", "vector": [4, 2, 0.9737, 0.0789, 2, 0.48, 1.0, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user:\n return dict(nickname=user.nickname(), email=user.email(),\n user_id=user.user_id(), source=\"google account\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_482:Return_L37_C12", "label": "return", "type": "return", "loc": [37, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_482:If_L36_C8", "vector": [13, 3, 0.9868, 0.0526, 3, 0.0, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict(nickname=user.nickname(), email=user.email(),\n user_id=user.user_id(), source=\"google account\")"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_482:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_482:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_482:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_482:FunctionDef_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_482:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_482:Return_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_482:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_482:FunctionDef_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_482:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_482:Return_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_482:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_482:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_482:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_482:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_482:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_482:If_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_482:If_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_482:Return_L37_C12"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu>.
License: GPL v2
Thanks to Hans Donner <hans.donner@pobox.com> for GaeGoogleAccount.
"""
from gluon.http import HTTP
try:
import linkedin
except ImportError:
raise HTTP(400, "linkedin module not found")
class LinkedInAccount(object):
"""
Login will be done via Google's Appengine login object, instead of web2py's
login form.
Include in your model (eg db.py)::
from gluon.contrib.login_methods.linkedin_account import LinkedInAccount
auth.settings.login_form=LinkedInAccount(request,KEY,SECRET,RETURN_URL)
"""
def __init__(self, request, key, secret, return_url):
self.request = request
self.api = linkedin.LinkedIn(key, secret, return_url)
self.token = result = self.api.requestToken()
def login_url(self, next="/"):
return self.api.getAuthorizeURL(self.token)
def logout_url(self, next="/"):
return ''
def get_user(self):
result = self.request.vars.verifier and self.api.accessToken(
verifier=self.request.vars.verifier)
if result:
profile = self.api.GetProfile()
profile = self.api.GetProfile(
profile).public_url = "http://www.linkedin.com/in/ozgurv"
return dict(first_name=profile.first_name,
last_name=profile.last_name,
username=profile.id)
| ajibawa-2023/Python-Code-Large/train/row_483 | 20 | 51 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_483:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 10], "level": 0, "parent": null, "vector": [8, 0, 0.1373, 0.1373, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis file is part of web2py Web Framework (Copyrighted, 2007-2009).\nDeveloped by Massimo Di Pierro <mdipierro@cs.depaul.edu>.\nLicense: GPL v2\n\nThanks to Hans Donner <hans.donner@pobox.com> for GaeGoogleAccount.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_483:ImportFrom_L12_C0", "label": "from gluon.http import HTTP", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.2353, 0.0196, 0, 0.66, 0.3333, 453, 0, 1, 0, 0, 453, 0, 0], "semantic": {"name": "gluon.http", "arg_names": [], "import_names": ["HTTP"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.http import HTTP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_483:Try_L13_C0", "label": "try", "type": "try", "loc": [13, 16], "level": 0, "parent": null, "vector": [7, 0, 0.2843, 0.0784, 0, 0.66, 0.6667, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n import linkedin\nexcept ImportError:\n raise HTTP(400, \"linkedin module not found\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_483:Import_L14_C4", "label": "linkedin import linkedin", "type": "import", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_483:Try_L13_C0", "vector": [1, 1, 0.2745, 0.0196, 1, 0.66, 0.0, 524, 0, 1, 0, 0, 524, 0, 0], "semantic": {"name": "linkedin", "arg_names": [], "import_names": ["linkedin"], "rhs_call_name": "", "annotation": ""}, "snippet": " import linkedin"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_483:ClassDef_L19_C0", "label": "LinkedInAccount", "type": "class", "loc": [19, 51], "level": 0, "parent": null, "vector": [3, 0, 0.6863, 0.6471, 0, 0.66, 1.0, 43, 0, 4, 0, 0, 186, 0, 7], "semantic": {"name": "LinkedInAccount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class LinkedInAccount(object):\n \"\"\"\n Login will be done via Google's Appengine login object, instead of web2py's\n login form.\n\n Include in your model (eg db.py)::\n\n from gluon.contrib.login_methods.linkedin_account import LinkedInAccount"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_483:Expr_L20_C4", "label": "expression", "type": "expression", "loc": [20, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_483:ClassDef_L19_C0", "vector": [8, 1, 0.4804, 0.1961, 1, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Login will be done via Google's Appengine login object, instead of web2py's\n login form.\n\n Include in your model (eg db.py)::\n\n from gluon.contrib.login_methods.linkedin_account import LinkedInAccount\n auth.settings.login_form=LinkedInAccount(request,KEY,SECRET,RETURN_URL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_483:FunctionDef_L31_C4", "label": "__init__", "type": "function", "loc": [31, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_483:ClassDef_L19_C0", "vector": [2, 1, 0.6373, 0.0784, 1, 0.73, 0.25, 555, 0, 5, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "request", "key", "secret", "return_url"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, request, key, secret, return_url):\n self.request = request\n self.api = linkedin.LinkedIn(key, secret, return_url)\n self.token = result = self.api.requestToken()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_483:Assign_L32_C8", "label": "self.request =", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_483:FunctionDef_L31_C4", "vector": [14, 2, 0.6275, 0.0196, 2, 0.8, 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_483:Assign_L33_C8", "label": "self.api = LinkedIn()", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_483:FunctionDef_L31_C4", "vector": [14, 2, 0.6471, 0.0196, 2, 0.8, 0.5, 310, 3, 3, 0, 0, 333, 10, 1], "semantic": {"name": "self.api", "arg_names": [], "import_names": [], "rhs_call_name": "LinkedIn", "annotation": ""}, "snippet": " self.api = linkedin.LinkedIn(key, secret, return_url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_483:Assign_L34_C8", "label": "self.token = requestToken()", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_483:FunctionDef_L31_C4", "vector": [14, 2, 0.6667, 0.0196, 2, 0.8, 1.0, 150, 3, 0, 0, 0, 62, 10, 1], "semantic": {"name": "self.token", "arg_names": [], "import_names": [], "rhs_call_name": "requestToken", "annotation": ""}, "snippet": " self.token = result = self.api.requestToken()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_483:FunctionDef_L36_C4", "label": "login_url", "type": "function", "loc": [36, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_483:ClassDef_L19_C0", "vector": [2, 1, 0.7157, 0.0392, 1, 0.73, 0.5, 704, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "login_url", "arg_names": ["self", "next"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def login_url(self, next=\"/\"):\n return self.api.getAuthorizeURL(self.token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_483:Return_L37_C8", "label": "return", "type": "return", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_483:FunctionDef_L36_C4", "vector": [13, 2, 0.7255, 0.0196, 2, 0.62, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.api.getAuthorizeURL(self.token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_483:FunctionDef_L39_C4", "label": "logout_url", "type": "function", "loc": [39, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_483:ClassDef_L19_C0", "vector": [2, 1, 0.7745, 0.0392, 1, 0.73, 0.75, 181, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "logout_url", "arg_names": ["self", "next"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def logout_url(self, next=\"/\"):\n return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_483:Return_L40_C8", "label": "return", "type": "return", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_483:FunctionDef_L39_C4", "vector": [13, 2, 0.7843, 0.0196, 2, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_483:FunctionDef_L42_C4", "label": "get_user", "type": "function", "loc": [42, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_483:ClassDef_L19_C0", "vector": [2, 1, 0.9118, 0.1961, 1, 0.73, 1.0, 174, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "get_user", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_user(self):\n result = self.request.vars.verifier and self.api.accessToken(\n verifier=self.request.vars.verifier)\n if result:\n profile = self.api.GetProfile()\n profile = self.api.GetProfile(\n profile).public_url = \"http://www.linkedin.com/in/ozgurv\"\n return dict(first_name=profile.first_name,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_483:Assign_L43_C8", "label": "result =", "type": "assigned_variable", "loc": [43, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_483:FunctionDef_L42_C4", "vector": [14, 2, 0.8529, 0.0392, 2, 0.78, 0.0, 51, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result = self.request.vars.verifier and self.api.accessToken(\n verifier=self.request.vars.verifier)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_483:If_L45_C8", "label": "if", "type": "if", "loc": [45, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_483:FunctionDef_L42_C4", "vector": [4, 2, 0.9412, 0.1373, 2, 0.78, 1.0, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if result:\n profile = self.api.GetProfile()\n profile = self.api.GetProfile(\n profile).public_url = \"http://www.linkedin.com/in/ozgurv\"\n return dict(first_name=profile.first_name,\n last_name=profile.last_name,\n username=profile.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_483:Assign_L46_C12", "label": "profile = GetProfile()", "type": "assigned_variable", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_483:If_L45_C8", "vector": [14, 3, 0.902, 0.0196, 3, 0.65, 0.0, 924, 3, 0, 0, 0, 629, 10, 1], "semantic": {"name": "profile", "arg_names": [], "import_names": [], "rhs_call_name": "GetProfile", "annotation": ""}, "snippet": " profile = self.api.GetProfile()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_483:Assign_L47_C12", "label": "profile =", "type": "assigned_variable", "loc": [47, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_483:If_L45_C8", "vector": [14, 3, 0.9314, 0.0392, 3, 0.65, 0.5, 924, 1, 0, 0, 0, 0, 3, 1], "semantic": {"name": "profile", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " profile = self.api.GetProfile(\n profile).public_url = \"http://www.linkedin.com/in/ozgurv\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_483:Return_L49_C12", "label": "return", "type": "return", "loc": [49, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_483:If_L45_C8", "vector": [13, 3, 0.9804, 0.0588, 3, 0.65, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict(first_name=profile.first_name,\n last_name=profile.last_name,\n username=profile.id)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_483:Try_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_483:Import_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_483:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_483:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_483:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_483:FunctionDef_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_483:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_483:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_483:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_483:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_483:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_483:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_483:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_483:FunctionDef_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_483:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_483:Return_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_483:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_483:FunctionDef_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_483:FunctionDef_L39_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_483:Return_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_483:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_483:FunctionDef_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_483:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_483:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_483:FunctionDef_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_483:If_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_483:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_483:Assign_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_483:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_483:Assign_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_483:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_483:Return_L49_C12"}] |
#!/usr/bin/env python
# coding: utf8
"""
Dropbox Authentication for web2py
Developed by Massimo Di Pierro (2012)
Same License as Web2py License
"""
# mind here session is dropbox session, not current.session
import os
import re
import urllib
from dropbox import client, rest, session
from gluon import *
from gluon.tools import fetch
from gluon.storage import Storage
import gluon.contrib.simplejson as json
class DropboxAccount(object):
"""
from gluon.contrib.login_methods.dropbox_account import DropboxAccount
auth.settings.actions_disabled=['register','change_password',
'request_reset_password']
auth.settings.login_form = DropboxAccount(request,
key="...",
secret="...",
access_type="...",
login_url = "http://localhost:8000/%s/default/user/login" % request.application)
when logged in
client = auth.settings.login_form.client
"""
def __init__(self,
request,
key="",
secret="",
access_type="app_folder",
login_url="",
on_login_failure=None,
):
self.request = request
self.key = key
self.secret = secret
self.access_type = access_type
self.login_url = login_url
self.on_login_failure = on_login_failure
self.sess = session.DropboxSession(
self.key, self.secret, self.access_type)
def get_user(self):
request = self.request
if not current.session.dropbox_request_token:
return None
elif not current.session.dropbox_access_token:
request_token = current.session.dropbox_request_token
self.sess.set_request_token(request_token[0], request_token[1])
access_token = self.sess.obtain_access_token(self.sess.token)
current.session.dropbox_access_token = \
(access_token.key, access_token.secret)
else:
access_token = current.session.dropbox_access_token
self.sess.set_token(access_token[0], access_token[1])
user = Storage()
self.client = client.DropboxClient(self.sess)
data = self.client.account_info()
display_name = data.get('display_name', '').split(' ', 1)
user = dict(email=data.get('email', None),
first_name=display_name[0],
last_name=display_name[-1],
registration_id=data.get('uid', None))
if not user['registration_id'] and self.on_login_failure:
redirect(self.on_login_failure)
return user
def login_form(self):
request_token = self.sess.obtain_request_token()
current.session.dropbox_request_token = \
(request_token.key, request_token.secret)
dropbox_url = self.sess.build_authorize_url(request_token,
self.login_url)
redirect(dropbox_url)
form = IFRAME(_src=dropbox_url,
_scrolling="no",
_frameborder="no",
_style="width:400px;height:240px;")
return form
def logout_url(self, next="/"):
self.sess.unlink()
current.session.auth = None
return next
def get_client(self):
access_token = current.session.dropbox_access_token
self.sess.set_token(access_token[0], access_token[1])
self.client = client.DropboxClient(self.sess)
def put(self, filename, file):
if not hasattr(self,'client'): self.get_client()
return self.client.put_file(filename, file)['bytes']
def get(self, filename):
if not hasattr(self,'client'): self.get_client()
return self.client.get_file(filename)
def dir(self, path):
if not hasattr(self,'client'): self.get_client()
return self.client.metadata(path)
def use_dropbox(auth, filename='private/dropbox.key', **kwargs):
path = os.path.join(current.request.folder, filename)
if os.path.exists(path):
request = current.request
key, secret, access_type = open(path, 'r').read().strip().split(':')
host = current.request.env.http_host
login_url = "http://%s/%s/default/user/login" % \
(host, request.application)
auth.settings.actions_disabled = \
['register', 'change_password', 'request_reset_password']
auth.settings.login_form = DropboxAccount(
request, key=key, secret=secret, access_type=access_type,
login_url=login_url, **kwargs)
| ajibawa-2023/Python-Code-Large/train/row_484 | 74 | 131 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_484:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0458, 0.0382, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nDropbox Authentication for web2py\nDeveloped by Massimo Di Pierro (2012)\nSame License as Web2py License\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Import_L12_C0", "label": "os import os", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0916, 0.0076, 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_484:Import_L13_C0", "label": "re import re", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0992, 0.0076, 0, 0.66, 0.2, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": "", "annotation": ""}, "snippet": "import re"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Import_L14_C0", "label": "urllib import urllib", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1069, 0.0076, 0, 0.66, 0.3, 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_484:ImportFrom_L15_C0", "label": "from dropbox import client, rest, session", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.1145, 0.0076, 0, 0.66, 0.4, 397, 0, 3, 0, 0, 397, 0, 0], "semantic": {"name": "dropbox", "arg_names": [], "import_names": ["client", "rest", "session"], "rhs_call_name": "", "annotation": ""}, "snippet": "from dropbox import client, rest, session"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:ImportFrom_L16_C0", "label": "from gluon import *", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.1221, 0.0076, 0, 0.66, 0.5, 826, 0, 1, 0, 0, 826, 0, 0], "semantic": {"name": "gluon", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:ImportFrom_L17_C0", "label": "from gluon.tools import fetch", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.1298, 0.0076, 0, 0.66, 0.6, 322, 0, 1, 0, 0, 322, 0, 0], "semantic": {"name": "gluon.tools", "arg_names": [], "import_names": ["fetch"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.tools import fetch"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:ImportFrom_L18_C0", "label": "from gluon.storage import Storage", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1374, 0.0076, 0, 0.66, 0.7, 696, 0, 1, 0, 0, 696, 0, 0], "semantic": {"name": "gluon.storage", "arg_names": [], "import_names": ["Storage"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.storage import Storage"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Import_L19_C0", "label": "gluon.contrib.simplejson import json", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.145, 0.0076, 0, 0.66, 0.8, 611, 0, 1, 0, 0, 611, 0, 0], "semantic": {"name": "gluon.contrib.simplejson", "arg_names": [], "import_names": ["json"], "rhs_call_name": "", "annotation": ""}, "snippet": "import gluon.contrib.simplejson as json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:ClassDef_L22_C0", "label": "DropboxAccount", "type": "class", "loc": [22, 116], "level": 0, "parent": null, "vector": [3, 0, 0.5267, 0.7252, 0, 0.66, 0.9, 640, 0, 8, 0, 0, 186, 0, 29], "semantic": {"name": "DropboxAccount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DropboxAccount(object):\n\n \"\"\"\n from gluon.contrib.login_methods.dropbox_account import DropboxAccount\n auth.settings.actions_disabled=['register','change_password',\n 'request_reset_password']\n auth.settings.login_form = DropboxAccount(request,\n key=\"...\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Expr_L24_C4", "label": "expression", "type": "expression", "loc": [24, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:ClassDef_L22_C0", "vector": [8, 1, 0.2252, 0.0916, 1, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n from gluon.contrib.login_methods.dropbox_account import DropboxAccount\n auth.settings.actions_disabled=['register','change_password',\n 'request_reset_password']\n auth.settings.login_form = DropboxAccount(request,\n key=\"...\",\n secret=\"...\",\n access_type=\"...\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L37_C4", "label": "__init__", "type": "function", "loc": [37, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:ClassDef_L22_C0", "vector": [2, 1, 0.3435, 0.1298, 1, 0.86, 0.125, 555, 0, 7, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "request", "key", "secret", "access_type", "login_url", "on_login_failure"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self,\n request,\n key=\"\",\n secret=\"\",\n access_type=\"app_folder\",\n login_url=\"\",\n on_login_failure=None,\n ):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L46_C8", "label": "self.request =", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L37_C4", "vector": [14, 2, 0.3511, 0.0076, 2, 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_484:Assign_L47_C8", "label": "self.key =", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L37_C4", "vector": [14, 2, 0.3588, 0.0076, 2, 0.79, 0.1667, 605, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.key = key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L48_C8", "label": "self.secret =", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L37_C4", "vector": [14, 2, 0.3664, 0.0076, 2, 0.79, 0.3333, 208, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.secret = secret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L49_C8", "label": "self.access_type =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L37_C4", "vector": [14, 2, 0.374, 0.0076, 2, 0.79, 0.5, 672, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.access_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.access_type = access_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L50_C8", "label": "self.login_url =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L37_C4", "vector": [14, 2, 0.3817, 0.0076, 2, 0.79, 0.6667, 332, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.login_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.login_url = login_url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L51_C8", "label": "self.on_login_failure =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L37_C4", "vector": [14, 2, 0.3893, 0.0076, 2, 0.79, 0.8333, 75, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.on_login_failure", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.on_login_failure = on_login_failure"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L52_C8", "label": "self.sess = DropboxSession()", "type": "assigned_variable", "loc": [52, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L37_C4", "vector": [14, 2, 0.4008, 0.0153, 2, 0.79, 1.0, 947, 3, 3, 0, 0, 850, 10, 1], "semantic": {"name": "self.sess", "arg_names": [], "import_names": [], "rhs_call_name": "DropboxSession", "annotation": ""}, "snippet": " self.sess = session.DropboxSession(\n self.key, self.secret, self.access_type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L55_C4", "label": "get_user", "type": "function", "loc": [55, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:ClassDef_L22_C0", "vector": [2, 1, 0.5153, 0.1985, 1, 0.86, 0.25, 174, 0, 1, 1, 0, 0, 0, 12], "semantic": {"name": "get_user", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_user(self):\n request = self.request\n if not current.session.dropbox_request_token:\n return None\n elif not current.session.dropbox_access_token:\n\n request_token = current.session.dropbox_request_token\n self.sess.set_request_token(request_token[0], request_token[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L56_C8", "label": "request =", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L55_C4", "vector": [14, 2, 0.4275, 0.0076, 2, 0.91, 0.0, 50, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request = self.request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:If_L57_C8", "label": "if", "type": "if", "loc": [57, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L55_C4", "vector": [4, 2, 0.4771, 0.0916, 2, 0.91, 0.125, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not current.session.dropbox_request_token:\n return None\n elif not current.session.dropbox_access_token:\n\n request_token = current.session.dropbox_request_token\n self.sess.set_request_token(request_token[0], request_token[1])\n access_token = self.sess.obtain_access_token(self.sess.token)\n current.session.dropbox_access_token = \\"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Return_L58_C12", "label": "return", "type": "return", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:If_L57_C8", "vector": [13, 3, 0.4427, 0.0076, 3, 0.19, 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_484:If_L59_C8", "label": "if", "type": "if", "loc": [59, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:If_L57_C8", "vector": [4, 3, 0.4847, 0.0763, 3, 0.19, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not current.session.dropbox_access_token:\n\n request_token = current.session.dropbox_request_token\n self.sess.set_request_token(request_token[0], request_token[1])\n access_token = self.sess.obtain_access_token(self.sess.token)\n current.session.dropbox_access_token = \\\n (access_token.key, access_token.secret)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L61_C12", "label": "request_token =", "type": "assigned_variable", "loc": [61, 61], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:If_L59_C8", "vector": [14, 4, 0.4656, 0.0076, 4, 0.09, 0.0, 279, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "request_token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request_token = current.session.dropbox_request_token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Expr_L62_C12", "label": "set_request_token()", "type": "expression", "loc": [62, 62], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:If_L59_C8", "vector": [8, 4, 0.4733, 0.0076, 4, 0.09, 0.2, 764, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_request_token", "arg_names": [], "import_names": [], "rhs_call_name": "set_request_token", "annotation": ""}, "snippet": " self.sess.set_request_token(request_token[0], request_token[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L63_C12", "label": "access_token = obtain_access_token()", "type": "assigned_variable", "loc": [63, 63], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:If_L59_C8", "vector": [14, 4, 0.4809, 0.0076, 4, 0.09, 0.4, 797, 3, 1, 0, 0, 123, 10, 1], "semantic": {"name": "access_token", "arg_names": [], "import_names": [], "rhs_call_name": "obtain_access_token", "annotation": ""}, "snippet": " access_token = self.sess.obtain_access_token(self.sess.token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L64_C12", "label": "current.session.dropbox_access_token =", "type": "assigned_variable", "loc": [64, 65], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:If_L59_C8", "vector": [14, 4, 0.4924, 0.0153, 4, 0.09, 0.6, 63, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "current.session.dropbox_access_token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " current.session.dropbox_access_token = \\\n (access_token.key, access_token.secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L67_C12", "label": "access_token =", "type": "assigned_variable", "loc": [67, 67], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:If_L59_C8", "vector": [14, 4, 0.5115, 0.0076, 4, 0.09, 0.8, 797, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "access_token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " access_token = current.session.dropbox_access_token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Expr_L68_C12", "label": "set_token()", "type": "expression", "loc": [68, 68], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:If_L59_C8", "vector": [8, 4, 0.5191, 0.0076, 4, 0.09, 1.0, 377, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_token", "arg_names": [], "import_names": [], "rhs_call_name": "set_token", "annotation": ""}, "snippet": " self.sess.set_token(access_token[0], access_token[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L70_C8", "label": "user = Storage()", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L55_C4", "vector": [14, 2, 0.5344, 0.0076, 2, 0.91, 0.25, 503, 3, 0, 0, 0, 850, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "Storage", "annotation": ""}, "snippet": " user = Storage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L71_C8", "label": "self.client = DropboxClient()", "type": "assigned_variable", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L55_C4", "vector": [14, 2, 0.542, 0.0076, 2, 0.91, 0.375, 349, 3, 1, 0, 0, 123, 10, 1], "semantic": {"name": "self.client", "arg_names": [], "import_names": [], "rhs_call_name": "DropboxClient", "annotation": ""}, "snippet": " self.client = client.DropboxClient(self.sess)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L72_C8", "label": "data = account_info()", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L55_C4", "vector": [14, 2, 0.5496, 0.0076, 2, 0.91, 0.5, 929, 3, 0, 0, 0, 467, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "account_info", "annotation": ""}, "snippet": " data = self.client.account_info()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L73_C8", "label": "display_name = split()", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L55_C4", "vector": [14, 2, 0.5573, 0.0076, 2, 0.91, 0.625, 145, 3, 2, 0, 0, 908, 10, 2], "semantic": {"name": "display_name", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " display_name = data.get('display_name', '').split(' ', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L74_C8", "label": "user = dict()", "type": "assigned_variable", "loc": [74, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L55_C4", "vector": [14, 2, 0.5763, 0.0305, 2, 0.91, 0.75, 503, 3, 4, 0, 0, 827, 10, 3], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " user = dict(email=data.get('email', None),\n first_name=display_name[0],\n last_name=display_name[-1],\n registration_id=data.get('uid', None))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:If_L78_C8", "label": "if", "type": "if", "loc": [78, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L55_C4", "vector": [4, 2, 0.5992, 0.0153, 2, 0.91, 0.875, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not user['registration_id'] and self.on_login_failure:\n redirect(self.on_login_failure)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Expr_L79_C12", "label": "redirect()", "type": "expression", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:If_L78_C8", "vector": [8, 3, 0.6031, 0.0076, 3, 0.57, 0.0, 206, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(self.on_login_failure)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Return_L80_C8", "label": "return", "type": "return", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L55_C4", "vector": [13, 2, 0.6107, 0.0076, 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 user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L82_C4", "label": "login_form", "type": "function", "loc": [82, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:ClassDef_L22_C0", "vector": [2, 1, 0.6718, 0.0992, 1, 0.86, 0.375, 289, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "login_form", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def login_form(self):\n\n request_token = self.sess.obtain_request_token()\n current.session.dropbox_request_token = \\\n (request_token.key, request_token.secret)\n dropbox_url = self.sess.build_authorize_url(request_token,\n self.login_url)\n redirect(dropbox_url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L84_C8", "label": "request_token = obtain_request_token()", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L82_C4", "vector": [14, 2, 0.6412, 0.0076, 2, 0.29, 0.0, 279, 3, 0, 0, 0, 398, 10, 1], "semantic": {"name": "request_token", "arg_names": [], "import_names": [], "rhs_call_name": "obtain_request_token", "annotation": ""}, "snippet": " request_token = self.sess.obtain_request_token()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L85_C8", "label": "current.session.dropbox_request_token =", "type": "assigned_variable", "loc": [85, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L82_C4", "vector": [14, 2, 0.6527, 0.0153, 2, 0.29, 0.2, 398, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "current.session.dropbox_request_token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " current.session.dropbox_request_token = \\\n (request_token.key, request_token.secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L87_C8", "label": "dropbox_url = build_authorize_url()", "type": "assigned_variable", "loc": [87, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L82_C4", "vector": [14, 2, 0.6679, 0.0153, 2, 0.29, 0.4, 341, 3, 2, 0, 0, 628, 10, 1], "semantic": {"name": "dropbox_url", "arg_names": [], "import_names": [], "rhs_call_name": "build_authorize_url", "annotation": ""}, "snippet": " dropbox_url = self.sess.build_authorize_url(request_token,\n self.login_url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Expr_L89_C8", "label": "redirect()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L82_C4", "vector": [8, 2, 0.6794, 0.0076, 2, 0.29, 0.6, 206, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(dropbox_url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L90_C8", "label": "form = IFRAME()", "type": "assigned_variable", "loc": [90, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L82_C4", "vector": [14, 2, 0.6985, 0.0305, 2, 0.29, 0.8, 761, 3, 4, 0, 0, 37, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "IFRAME", "annotation": ""}, "snippet": " form = IFRAME(_src=dropbox_url,\n _scrolling=\"no\",\n _frameborder=\"no\",\n _style=\"width:400px;height:240px;\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Return_L94_C8", "label": "return", "type": "return", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L82_C4", "vector": [13, 2, 0.7176, 0.0076, 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 form"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L96_C4", "label": "logout_url", "type": "function", "loc": [96, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:ClassDef_L22_C0", "vector": [2, 1, 0.7443, 0.0305, 1, 0.86, 0.5, 181, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "logout_url", "arg_names": ["self", "next"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def logout_url(self, next=\"/\"):\n self.sess.unlink()\n current.session.auth = None\n return next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Expr_L97_C8", "label": "unlink()", "type": "expression", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L96_C4", "vector": [8, 2, 0.7405, 0.0076, 2, 0.09, 0.0, 701, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "unlink", "arg_names": [], "import_names": [], "rhs_call_name": "unlink", "annotation": ""}, "snippet": " self.sess.unlink()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L98_C8", "label": "current.session.auth =", "type": "assigned_variable", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L96_C4", "vector": [14, 2, 0.7481, 0.0076, 2, 0.09, 0.5, 262, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "current.session.auth", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " current.session.auth = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Return_L99_C8", "label": "return", "type": "return", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L96_C4", "vector": [13, 2, 0.7557, 0.0076, 2, 0.09, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L101_C4", "label": "get_client", "type": "function", "loc": [101, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:ClassDef_L22_C0", "vector": [2, 1, 0.7824, 0.0305, 1, 0.86, 0.625, 768, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "get_client", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_client(self):\n access_token = current.session.dropbox_access_token\n self.sess.set_token(access_token[0], access_token[1])\n self.client = client.DropboxClient(self.sess)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L102_C8", "label": "access_token =", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L101_C4", "vector": [14, 2, 0.7786, 0.0076, 2, 0.48, 0.0, 797, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "access_token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " access_token = current.session.dropbox_access_token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Expr_L103_C8", "label": "set_token()", "type": "expression", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L101_C4", "vector": [8, 2, 0.7863, 0.0076, 2, 0.48, 0.5, 377, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_token", "arg_names": [], "import_names": [], "rhs_call_name": "set_token", "annotation": ""}, "snippet": " self.sess.set_token(access_token[0], access_token[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L104_C8", "label": "self.client = DropboxClient()", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L101_C4", "vector": [14, 2, 0.7939, 0.0076, 2, 0.48, 1.0, 349, 3, 1, 0, 0, 123, 10, 1], "semantic": {"name": "self.client", "arg_names": [], "import_names": [], "rhs_call_name": "DropboxClient", "annotation": ""}, "snippet": " self.client = client.DropboxClient(self.sess)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L106_C4", "label": "put", "type": "function", "loc": [106, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:ClassDef_L22_C0", "vector": [2, 1, 0.8168, 0.0229, 1, 0.86, 0.75, 636, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "put", "arg_names": ["self", "filename", "file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def put(self, filename, file):\n if not hasattr(self,'client'): self.get_client()\n return self.client.put_file(filename, file)['bytes']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:If_L107_C8", "label": "if", "type": "if", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L106_C4", "vector": [4, 2, 0.8168, 0.0076, 2, 0.6, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hasattr(self,'client'): self.get_client()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Expr_L107_C39", "label": "get_client()", "type": "expression", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:If_L107_C8", "vector": [8, 3, 0.8168, 0.0076, 3, 0.33, 0.0, 768, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "get_client", "arg_names": [], "import_names": [], "rhs_call_name": "get_client", "annotation": ""}, "snippet": " if not hasattr(self,'client'): self.get_client()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Return_L108_C8", "label": "return", "type": "return", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L106_C4", "vector": [13, 2, 0.8244, 0.0076, 2, 0.6, 1.0, 0, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.client.put_file(filename, file)['bytes']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L110_C4", "label": "get", "type": "function", "loc": [110, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:ClassDef_L22_C0", "vector": [2, 1, 0.8473, 0.0229, 1, 0.86, 0.875, 607, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "get", "arg_names": ["self", "filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self, filename):\n if not hasattr(self,'client'): self.get_client()\n return self.client.get_file(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:If_L111_C8", "label": "if", "type": "if", "loc": [111, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L110_C4", "vector": [4, 2, 0.8473, 0.0076, 2, 0.2, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hasattr(self,'client'): self.get_client()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Expr_L111_C39", "label": "get_client()", "type": "expression", "loc": [111, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:If_L111_C8", "vector": [8, 3, 0.8473, 0.0076, 3, 0.12, 0.0, 768, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "get_client", "arg_names": [], "import_names": [], "rhs_call_name": "get_client", "annotation": ""}, "snippet": " if not hasattr(self,'client'): self.get_client()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Return_L112_C8", "label": "return", "type": "return", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L110_C4", "vector": [13, 2, 0.855, 0.0076, 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.client.get_file(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L114_C4", "label": "dir", "type": "function", "loc": [114, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:ClassDef_L22_C0", "vector": [2, 1, 0.8779, 0.0229, 1, 0.86, 1.0, 152, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "dir", "arg_names": ["self", "path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def dir(self, path):\n if not hasattr(self,'client'): self.get_client()\n return self.client.metadata(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:If_L115_C8", "label": "if", "type": "if", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L114_C4", "vector": [4, 2, 0.8779, 0.0076, 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 hasattr(self,'client'): self.get_client()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Expr_L115_C39", "label": "get_client()", "type": "expression", "loc": [115, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:If_L115_C8", "vector": [8, 3, 0.8779, 0.0076, 3, 0.88, 0.0, 768, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "get_client", "arg_names": [], "import_names": [], "rhs_call_name": "get_client", "annotation": ""}, "snippet": " if not hasattr(self,'client'): self.get_client()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Return_L116_C8", "label": "return", "type": "return", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L114_C4", "vector": [13, 2, 0.8855, 0.0076, 2, 0.8, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.client.metadata(path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L119_C0", "label": "use_dropbox", "type": "function", "loc": [119, 131], "level": 0, "parent": null, "vector": [2, 0, 0.9542, 0.0992, 0, 0.66, 1.0, 902, 0, 3, 0, 0, 0, 0, 7], "semantic": {"name": "use_dropbox", "arg_names": ["auth", "filename", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def use_dropbox(auth, filename='private/dropbox.key', **kwargs):\n path = os.path.join(current.request.folder, filename)\n if os.path.exists(path):\n request = current.request\n key, secret, access_type = open(path, 'r').read().strip().split(':')\n host = current.request.env.http_host\n login_url = \"http://%s/%s/default/user/login\" % \\\n (host, request.application)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L120_C4", "label": "path = join()", "type": "assigned_variable", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L119_C0", "vector": [14, 1, 0.916, 0.0076, 1, 0.44, 0.0, 358, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " path = os.path.join(current.request.folder, filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:If_L121_C4", "label": "if", "type": "if", "loc": [121, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L119_C0", "vector": [4, 1, 0.9618, 0.084, 1, 0.44, 1.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.exists(path):\n request = current.request\n key, secret, access_type = open(path, 'r').read().strip().split(':')\n host = current.request.env.http_host\n login_url = \"http://%s/%s/default/user/login\" % \\\n (host, request.application)\n auth.settings.actions_disabled = \\\n ['register', 'change_password', 'request_reset_password']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L122_C8", "label": "request =", "type": "assigned_variable", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:If_L121_C4", "vector": [14, 2, 0.9313, 0.0076, 2, 0.93, 0.0, 50, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request = current.request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L123_C8", "label": "key, secret, access_type = split()", "type": "assigned_variable", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:If_L121_C4", "vector": [14, 2, 0.9389, 0.0076, 2, 0.93, 0.2, 507, 3, 1, 0, 0, 908, 10, 4], "semantic": {"name": "key, secret, access_type", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " key, secret, access_type = open(path, 'r').read().strip().split(':')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L124_C8", "label": "host =", "type": "assigned_variable", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:If_L121_C4", "vector": [14, 2, 0.9466, 0.0076, 2, 0.93, 0.4, 867, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "host", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " host = current.request.env.http_host"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L125_C8", "label": "login_url =", "type": "assigned_variable", "loc": [125, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:If_L121_C4", "vector": [14, 2, 0.958, 0.0153, 2, 0.93, 0.6, 704, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "login_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " login_url = \"http://%s/%s/default/user/login\" % \\\n (host, request.application)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L127_C8", "label": "auth.settings.actions_disabled =", "type": "assigned_variable", "loc": [127, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:If_L121_C4", "vector": [14, 2, 0.9733, 0.0153, 2, 0.93, 0.8, 973, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "auth.settings.actions_disabled", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " auth.settings.actions_disabled = \\\n ['register', 'change_password', 'request_reset_password']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L129_C8", "label": "auth.settings.login_form = DropboxAccount()", "type": "assigned_variable", "loc": [129, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_484:If_L121_C4", "vector": [14, 2, 0.9924, 0.0229, 2, 0.93, 1.0, 374, 3, 6, 0, 0, 640, 10, 1], "semantic": {"name": "auth.settings.login_form", "arg_names": [], "import_names": [], "rhs_call_name": "DropboxAccount", "annotation": ""}, "snippet": " auth.settings.login_form = DropboxAccount(\n request, key=key, secret=secret, access_type=access_type,\n login_url=login_url, **kwargs)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_484:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:If_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Return_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:If_L57_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_484:If_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Expr_L62_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L63_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L64_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Expr_L68_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:If_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:If_L78_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Expr_L79_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Return_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Expr_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Return_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Expr_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Return_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Expr_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:If_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:If_L107_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Expr_L107_C39"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Return_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:If_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:If_L111_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Expr_L111_C39"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L110_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Return_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:If_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:If_L115_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Expr_L115_C39"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Return_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:FunctionDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_484:If_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:If_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L122_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:If_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:If_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:If_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:If_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_484:If_L121_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_484:Assign_L129_C8"}] |
#!/usr/bin/env python
# coding: utf8
"""
Oneall Authentication for web2py
Developed by Nathan Freeze (Copyright © 2013)
Email <nathan@freezable.com>
This file contains code to allow using onall.com
authentication services with web2py
"""
import os
import base64
from gluon import *
from gluon.storage import Storage
from gluon.contrib.simplejson import JSONDecodeError
from gluon.tools import fetch
import gluon.contrib.simplejson as json
class OneallAccount(object):
"""
from gluon.contrib.login_methods.oneall_account import OneallAccount
auth.settings.actions_disabled=['register','change_password',
'request_reset_password']
auth.settings.login_form = OneallAccount(request,
public_key="...",
private_key="...",
domain="...",
url = "http://localhost:8000/%s/default/user/login" % request.application)
"""
def __init__(self, request, public_key="", private_key="", domain="",
url=None, providers=None, on_login_failure=None):
self.request = request
self.public_key = public_key
self.private_key = private_key
self.url = url
self.domain = domain
self.profile = None
self.on_login_failure = on_login_failure
self.providers = providers or ["facebook", "google", "yahoo", "openid"]
self.mappings = Storage()
def defaultmapping(profile):
name = profile.get('name',{})
dname = name.get('formatted',profile.get('displayName'))
email=profile.get('emails', [{}])[0].get('value')
reg_id=profile.get('identity_token','')
username=profile.get('preferredUsername',email)
first_name=name.get('givenName', dname.split(' ')[0])
last_name=profile.get('familyName',dname.split(' ')[1])
return dict(registration_id=reg_id,username=username,email=email,
first_name=first_name,last_name=last_name)
self.mappings.default = defaultmapping
def get_user(self):
request = self.request
user = None
if request.vars.connection_token:
auth_url = "https://%s.api.oneall.com/connections/%s.json" % \
(self.domain, request.vars.connection_token)
auth_pw = "%s:%s" % (self.public_key,self.private_key)
auth_pw = base64.b64encode(auth_pw)
headers = dict(Authorization="Basic %s" % auth_pw)
try:
auth_info_json = fetch(auth_url,headers=headers)
auth_info = json.loads(auth_info_json)
data = auth_info['response']['result']['data']
if data['plugin']['key'] == 'social_login':
if data['plugin']['data']['status'] == 'success':
userdata = data['user']
self.profile = userdata['identity']
source = self.profile['source']['key']
mapping = self.mappings.get(source,self.mappings['default'])
user = mapping(self.profile)
except (JSONDecodeError, KeyError):
pass
if user is None and self.on_login_failure:
redirect(self.on_login_failure)
return user
def login_form(self):
scheme = self.request.env.wsgi_url_scheme
oneall_url = scheme + "://%s.api.oneall.com/socialize/library.js" % self.domain
oneall_lib = SCRIPT(_src=oneall_url,_type='text/javascript')
container = DIV(_id="oa_social_login_container")
widget = SCRIPT('oneall.api.plugins.social_login.build("oa_social_login_container",',
'{providers : %s,' % self.providers,
'callback_uri: "%s"});' % self.url,
_type="text/javascript")
form = DIV(oneall_lib,container,widget)
return form
def use_oneall(auth, filename='private/oneall.key', **kwargs):
path = os.path.join(current.request.folder, filename)
if os.path.exists(path):
request = current.request
domain, public_key, private_key = open(path, 'r').read().strip().split(':')
url = URL('default', 'user', args='login', scheme=True)
auth.settings.actions_disabled =\
['register', 'change_password', 'request_reset_password']
auth.settings.login_form = OneallAccount(
request, public_key=public_key,private_key=private_key,
domain=domain, url=url, **kwargs)
| ajibawa-2023/Python-Code-Large/train/row_485 | 68 | 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_485:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 11], "level": 0, "parent": null, "vector": [8, 0, 0.0701, 0.0748, 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 Oneall Authentication for web2py\n Developed by Nathan Freeze (Copyright \u00a9 2013)\n Email <nathan@freezable.com>\n\n This file contains code to allow using onall.com\n authentication services with web2py\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Import_L13_C0", "label": "os import os", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.1215, 0.0093, 0, 0.66, 0.1111, 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_485:Import_L14_C0", "label": "base64 import base64", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1308, 0.0093, 0, 0.66, 0.2222, 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_485:ImportFrom_L15_C0", "label": "from gluon import *", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.1402, 0.0093, 0, 0.66, 0.3333, 826, 0, 1, 0, 0, 826, 0, 0], "semantic": {"name": "gluon", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:ImportFrom_L16_C0", "label": "from gluon.storage import Storage", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.1495, 0.0093, 0, 0.66, 0.4444, 696, 0, 1, 0, 0, 696, 0, 0], "semantic": {"name": "gluon.storage", "arg_names": [], "import_names": ["Storage"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.storage import Storage"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:ImportFrom_L17_C0", "label": "from gluon.contrib.simplejson import JSONDecodeError", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.1589, 0.0093, 0, 0.66, 0.5556, 611, 0, 1, 0, 0, 611, 0, 0], "semantic": {"name": "gluon.contrib.simplejson", "arg_names": [], "import_names": ["JSONDecodeError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.contrib.simplejson import JSONDecodeError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:ImportFrom_L18_C0", "label": "from gluon.tools import fetch", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1682, 0.0093, 0, 0.66, 0.6667, 322, 0, 1, 0, 0, 322, 0, 0], "semantic": {"name": "gluon.tools", "arg_names": [], "import_names": ["fetch"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.tools import fetch"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Import_L19_C0", "label": "gluon.contrib.simplejson import json", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.1776, 0.0093, 0, 0.66, 0.7778, 611, 0, 1, 0, 0, 611, 0, 0], "semantic": {"name": "gluon.contrib.simplejson", "arg_names": [], "import_names": ["json"], "rhs_call_name": "", "annotation": ""}, "snippet": "import gluon.contrib.simplejson as json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:ClassDef_L21_C0", "label": "OneallAccount", "type": "class", "loc": [21, 95], "level": 0, "parent": null, "vector": [3, 0, 0.5421, 0.7009, 0, 0.66, 0.8889, 684, 0, 4, 0, 0, 186, 0, 24], "semantic": {"name": "OneallAccount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OneallAccount(object):\n\n \"\"\"\n from gluon.contrib.login_methods.oneall_account import OneallAccount\n auth.settings.actions_disabled=['register','change_password',\n 'request_reset_password']\n auth.settings.login_form = OneallAccount(request,\n public_key=\"...\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Expr_L23_C4", "label": "expression", "type": "expression", "loc": [23, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:ClassDef_L21_C0", "vector": [8, 1, 0.257, 0.0935, 1, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n from gluon.contrib.login_methods.oneall_account import OneallAccount\n auth.settings.actions_disabled=['register','change_password',\n 'request_reset_password']\n auth.settings.login_form = OneallAccount(request,\n public_key=\"...\",\n private_key=\"...\",\n domain=\"...\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "label": "__init__", "type": "function", "loc": [34, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:ClassDef_L21_C0", "vector": [2, 1, 0.4252, 0.2243, 1, 0.31, 0.3333, 555, 0, 8, 1, 0, 0, 0, 13], "semantic": {"name": "__init__", "arg_names": ["self", "request", "public_key", "private_key", "domain", "url", "providers", "on_login_failure"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, request, public_key=\"\", private_key=\"\", domain=\"\",\n url=None, providers=None, on_login_failure=None):\n\n self.request = request\n self.public_key = public_key\n self.private_key = private_key\n self.url = url\n self.domain = domain"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L37_C8", "label": "self.request =", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "vector": [14, 2, 0.3458, 0.0093, 2, 0.27, 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_485:Assign_L38_C8", "label": "self.public_key =", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "vector": [14, 2, 0.3551, 0.0093, 2, 0.27, 0.1, 660, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.public_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.public_key = public_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L39_C8", "label": "self.private_key =", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "vector": [14, 2, 0.3645, 0.0093, 2, 0.27, 0.2, 91, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.private_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.private_key = private_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L40_C8", "label": "self.url =", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "vector": [14, 2, 0.3738, 0.0093, 2, 0.27, 0.3, 720, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.url = url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L41_C8", "label": "self.domain =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "vector": [14, 2, 0.3832, 0.0093, 2, 0.27, 0.4, 208, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.domain", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.domain = domain"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L42_C8", "label": "self.profile =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "vector": [14, 2, 0.3925, 0.0093, 2, 0.27, 0.5, 43, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.profile", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.profile = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L43_C8", "label": "self.on_login_failure =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "vector": [14, 2, 0.4019, 0.0093, 2, 0.27, 0.6, 75, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.on_login_failure", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.on_login_failure = on_login_failure"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L44_C8", "label": "self.providers =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "vector": [14, 2, 0.4112, 0.0093, 2, 0.27, 0.7, 586, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.providers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.providers = providers or [\"facebook\", \"google\", \"yahoo\", \"openid\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L46_C8", "label": "self.mappings = Storage()", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "vector": [14, 2, 0.4299, 0.0093, 2, 0.27, 0.8, 708, 3, 0, 0, 0, 850, 10, 1], "semantic": {"name": "self.mappings", "arg_names": [], "import_names": [], "rhs_call_name": "Storage", "annotation": ""}, "snippet": " self.mappings = Storage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L47_C8", "label": "defaultmapping", "type": "function", "loc": [47, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "vector": [2, 2, 0.4813, 0.0935, 2, 0.27, 0.9, 265, 0, 1, 1, 0, 0, 0, 12], "semantic": {"name": "defaultmapping", "arg_names": ["profile"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def defaultmapping(profile):\n name = profile.get('name',{})\n dname = name.get('formatted',profile.get('displayName'))\n email=profile.get('emails', [{}])[0].get('value')\n reg_id=profile.get('identity_token','')\n username=profile.get('preferredUsername',email)\n first_name=name.get('givenName', dname.split(' ')[0])\n last_name=profile.get('familyName',dname.split(' ')[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L48_C12", "label": "name = get()", "type": "assigned_variable", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L47_C8", "vector": [14, 3, 0.4486, 0.0093, 3, 0.17, 0.0, 57, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " name = profile.get('name',{})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L49_C12", "label": "dname = get()", "type": "assigned_variable", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L47_C8", "vector": [14, 3, 0.4579, 0.0093, 3, 0.17, 0.1429, 408, 3, 2, 0, 0, 607, 10, 2], "semantic": {"name": "dname", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " dname = name.get('formatted',profile.get('displayName'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L50_C12", "label": "email = get()", "type": "assigned_variable", "loc": [50, 50], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L47_C8", "vector": [14, 3, 0.4673, 0.0093, 3, 0.17, 0.2857, 413, 3, 1, 0, 0, 607, 10, 2], "semantic": {"name": "email", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " email=profile.get('emails', [{}])[0].get('value')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L51_C12", "label": "reg_id = get()", "type": "assigned_variable", "loc": [51, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L47_C8", "vector": [14, 3, 0.4766, 0.0093, 3, 0.17, 0.4286, 812, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "reg_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " reg_id=profile.get('identity_token','')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L52_C12", "label": "username = get()", "type": "assigned_variable", "loc": [52, 52], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L47_C8", "vector": [14, 3, 0.486, 0.0093, 3, 0.17, 0.5714, 718, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "username", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " username=profile.get('preferredUsername',email)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L53_C12", "label": "first_name = get()", "type": "assigned_variable", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L47_C8", "vector": [14, 3, 0.4953, 0.0093, 3, 0.17, 0.7143, 185, 3, 2, 0, 0, 607, 10, 2], "semantic": {"name": "first_name", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " first_name=name.get('givenName', dname.split(' ')[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L54_C12", "label": "last_name = get()", "type": "assigned_variable", "loc": [54, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L47_C8", "vector": [14, 3, 0.5047, 0.0093, 3, 0.17, 0.8571, 578, 3, 2, 0, 0, 607, 10, 2], "semantic": {"name": "last_name", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " last_name=profile.get('familyName',dname.split(' ')[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Return_L55_C12", "label": "return", "type": "return", "loc": [55, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L47_C8", "vector": [13, 3, 0.5187, 0.0187, 3, 0.17, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict(registration_id=reg_id,username=username,email=email,\n first_name=first_name,last_name=last_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L57_C8", "label": "self.mappings.default =", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "vector": [14, 2, 0.5327, 0.0093, 2, 0.27, 1.0, 515, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.mappings.default", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mappings.default = defaultmapping"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L59_C4", "label": "get_user", "type": "function", "loc": [59, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:ClassDef_L21_C0", "vector": [2, 1, 0.6636, 0.2336, 1, 0.31, 0.6667, 174, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "get_user", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_user(self):\n request = self.request\n user = None\n if request.vars.connection_token:\n auth_url = \"https://%s.api.oneall.com/connections/%s.json\" % \\\n (self.domain, request.vars.connection_token)\n auth_pw = \"%s:%s\" % (self.public_key,self.private_key)\n auth_pw = base64.b64encode(auth_pw)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L60_C8", "label": "request =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L59_C4", "vector": [14, 2, 0.5607, 0.0093, 2, 0.16, 0.0, 50, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request = self.request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L61_C8", "label": "user =", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L59_C4", "vector": [14, 2, 0.5701, 0.0093, 2, 0.16, 0.3333, 503, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:If_L62_C8", "label": "if", "type": "if", "loc": [62, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L59_C4", "vector": [4, 2, 0.6729, 0.1963, 2, 0.16, 0.6667, 0, 7, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.vars.connection_token:\n auth_url = \"https://%s.api.oneall.com/connections/%s.json\" % \\\n (self.domain, request.vars.connection_token)\n auth_pw = \"%s:%s\" % (self.public_key,self.private_key)\n auth_pw = base64.b64encode(auth_pw)\n headers = dict(Authorization=\"Basic %s\" % auth_pw)\n try:\n auth_info_json = fetch(auth_url,headers=headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L63_C12", "label": "auth_url =", "type": "assigned_variable", "loc": [63, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:If_L62_C8", "vector": [14, 3, 0.5935, 0.0187, 3, 0.37, 0.0, 911, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "auth_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " auth_url = \"https://%s.api.oneall.com/connections/%s.json\" % \\\n (self.domain, request.vars.connection_token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L65_C12", "label": "auth_pw =", "type": "assigned_variable", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:If_L62_C8", "vector": [14, 3, 0.6075, 0.0093, 3, 0.37, 0.2, 384, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "auth_pw", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " auth_pw = \"%s:%s\" % (self.public_key,self.private_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L66_C12", "label": "auth_pw = b64encode()", "type": "assigned_variable", "loc": [66, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:If_L62_C8", "vector": [14, 3, 0.6168, 0.0093, 3, 0.37, 0.4, 384, 3, 1, 0, 0, 11, 10, 1], "semantic": {"name": "auth_pw", "arg_names": [], "import_names": [], "rhs_call_name": "b64encode", "annotation": ""}, "snippet": " auth_pw = base64.b64encode(auth_pw)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L67_C12", "label": "headers = dict()", "type": "assigned_variable", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:If_L62_C8", "vector": [14, 3, 0.6262, 0.0093, 3, 0.37, 0.6, 950, 3, 1, 0, 0, 827, 10, 1], "semantic": {"name": "headers", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " headers = dict(Authorization=\"Basic %s\" % auth_pw)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Try_L68_C12", "label": "try", "type": "try", "loc": [68, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:If_L62_C8", "vector": [7, 3, 0.6916, 0.1215, 3, 0.37, 0.8, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n auth_info_json = fetch(auth_url,headers=headers)\n auth_info = json.loads(auth_info_json)\n data = auth_info['response']['result']['data']\n if data['plugin']['key'] == 'social_login':\n if data['plugin']['data']['status'] == 'success':\n userdata = data['user']\n self.profile = userdata['identity']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L69_C16", "label": "auth_info_json = fetch()", "type": "assigned_variable", "loc": [69, 69], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:Try_L68_C12", "vector": [14, 4, 0.6449, 0.0093, 4, 0.25, 0.0, 790, 3, 2, 0, 0, 587, 10, 1], "semantic": {"name": "auth_info_json", "arg_names": [], "import_names": [], "rhs_call_name": "fetch", "annotation": ""}, "snippet": " auth_info_json = fetch(auth_url,headers=headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L70_C16", "label": "auth_info = loads()", "type": "assigned_variable", "loc": [70, 70], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:Try_L68_C12", "vector": [14, 4, 0.6542, 0.0093, 4, 0.25, 0.3333, 78, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "auth_info", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": " auth_info = json.loads(auth_info_json)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L71_C16", "label": "data =", "type": "assigned_variable", "loc": [71, 71], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:Try_L68_C12", "vector": [14, 4, 0.6636, 0.0093, 4, 0.25, 0.6667, 929, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = auth_info['response']['result']['data']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:If_L72_C16", "label": "if", "type": "if", "loc": [72, 78], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:Try_L68_C12", "vector": [4, 4, 0.7009, 0.0654, 4, 0.25, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if data['plugin']['key'] == 'social_login':\n if data['plugin']['data']['status'] == 'success':\n userdata = data['user']\n self.profile = userdata['identity']\n source = self.profile['source']['key']\n mapping = self.mappings.get(source,self.mappings['default'])\n user = mapping(self.profile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:If_L73_C20", "label": "if", "type": "if", "loc": [73, 78], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:If_L72_C16", "vector": [4, 5, 0.7056, 0.0561, 5, 0.55, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if data['plugin']['data']['status'] == 'success':\n userdata = data['user']\n self.profile = userdata['identity']\n source = self.profile['source']['key']\n mapping = self.mappings.get(source,self.mappings['default'])\n user = mapping(self.profile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L74_C24", "label": "userdata =", "type": "assigned_variable", "loc": [74, 74], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:If_L73_C20", "vector": [14, 6, 0.6916, 0.0093, 6, 0.3, 0.0, 7, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "userdata", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " userdata = data['user']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L75_C24", "label": "self.profile =", "type": "assigned_variable", "loc": [75, 75], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:If_L73_C20", "vector": [14, 6, 0.7009, 0.0093, 6, 0.3, 0.25, 43, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.profile", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.profile = userdata['identity']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L76_C24", "label": "source =", "type": "assigned_variable", "loc": [76, 76], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:If_L73_C20", "vector": [14, 6, 0.7103, 0.0093, 6, 0.3, 0.5, 703, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "source", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " source = self.profile['source']['key']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L77_C24", "label": "mapping = get()", "type": "assigned_variable", "loc": [77, 77], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:If_L73_C20", "vector": [14, 6, 0.7196, 0.0093, 6, 0.3, 0.75, 351, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "mapping", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " mapping = self.mappings.get(source,self.mappings['default'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L78_C24", "label": "user = mapping()", "type": "assigned_variable", "loc": [78, 78], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:If_L73_C20", "vector": [14, 6, 0.729, 0.0093, 6, 0.3, 1.0, 503, 3, 1, 0, 0, 351, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "mapping", "annotation": ""}, "snippet": " user = mapping(self.profile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:If_L81_C12", "label": "if", "type": "if", "loc": [81, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:If_L62_C8", "vector": [4, 3, 0.7617, 0.0187, 3, 0.37, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user is None and self.on_login_failure:\n redirect(self.on_login_failure)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Expr_L82_C20", "label": "redirect()", "type": "expression", "loc": [82, 82], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:If_L81_C12", "vector": [8, 4, 0.7664, 0.0093, 4, 0.64, 0.0, 206, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(self.on_login_failure)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Return_L83_C8", "label": "return", "type": "return", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L59_C4", "vector": [13, 2, 0.7757, 0.0093, 2, 0.16, 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_485:FunctionDef_L85_C4", "label": "login_form", "type": "function", "loc": [85, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:ClassDef_L21_C0", "vector": [2, 1, 0.8411, 0.1028, 1, 0.31, 1.0, 289, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "login_form", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def login_form(self):\n scheme = self.request.env.wsgi_url_scheme\n oneall_url = scheme + \"://%s.api.oneall.com/socialize/library.js\" % self.domain\n oneall_lib = SCRIPT(_src=oneall_url,_type='text/javascript')\n container = DIV(_id=\"oa_social_login_container\")\n widget = SCRIPT('oneall.api.plugins.social_login.build(\"oa_social_login_container\",',\n '{providers : %s,' % self.providers,\n 'callback_uri: \"%s\"});' % self.url,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L86_C8", "label": "scheme =", "type": "assigned_variable", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L85_C4", "vector": [14, 2, 0.8037, 0.0093, 2, 0.97, 0.0, 207, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "scheme", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scheme = self.request.env.wsgi_url_scheme"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L87_C8", "label": "oneall_url =", "type": "assigned_variable", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L85_C4", "vector": [14, 2, 0.8131, 0.0093, 2, 0.97, 0.1667, 990, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "oneall_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " oneall_url = scheme + \"://%s.api.oneall.com/socialize/library.js\" % self.domain"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L88_C8", "label": "oneall_lib = SCRIPT()", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L85_C4", "vector": [14, 2, 0.8224, 0.0093, 2, 0.97, 0.3333, 784, 3, 2, 0, 0, 8, 10, 1], "semantic": {"name": "oneall_lib", "arg_names": [], "import_names": [], "rhs_call_name": "SCRIPT", "annotation": ""}, "snippet": " oneall_lib = SCRIPT(_src=oneall_url,_type='text/javascript')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L89_C8", "label": "container = DIV()", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L85_C4", "vector": [14, 2, 0.8318, 0.0093, 2, 0.97, 0.5, 516, 3, 1, 0, 0, 697, 10, 1], "semantic": {"name": "container", "arg_names": [], "import_names": [], "rhs_call_name": "DIV", "annotation": ""}, "snippet": " container = DIV(_id=\"oa_social_login_container\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L90_C8", "label": "widget = SCRIPT()", "type": "assigned_variable", "loc": [90, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L85_C4", "vector": [14, 2, 0.8551, 0.0374, 2, 0.97, 0.6667, 972, 3, 4, 0, 0, 8, 10, 1], "semantic": {"name": "widget", "arg_names": [], "import_names": [], "rhs_call_name": "SCRIPT", "annotation": ""}, "snippet": " widget = SCRIPT('oneall.api.plugins.social_login.build(\"oa_social_login_container\",',\n '{providers : %s,' % self.providers,\n 'callback_uri: \"%s\"});' % self.url,\n _type=\"text/javascript\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L94_C8", "label": "form = DIV()", "type": "assigned_variable", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L85_C4", "vector": [14, 2, 0.8785, 0.0093, 2, 0.97, 0.8333, 761, 3, 3, 0, 0, 697, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "DIV", "annotation": ""}, "snippet": " form = DIV(oneall_lib,container,widget)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Return_L95_C8", "label": "return", "type": "return", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L85_C4", "vector": [13, 2, 0.8879, 0.0093, 2, 0.97, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return form"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L97_C0", "label": "use_oneall", "type": "function", "loc": [97, 107], "level": 0, "parent": null, "vector": [2, 0, 0.9533, 0.1028, 0, 0.66, 1.0, 918, 0, 3, 0, 0, 0, 0, 8], "semantic": {"name": "use_oneall", "arg_names": ["auth", "filename", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def use_oneall(auth, filename='private/oneall.key', **kwargs):\n path = os.path.join(current.request.folder, filename)\n if os.path.exists(path):\n request = current.request\n domain, public_key, private_key = open(path, 'r').read().strip().split(':')\n url = URL('default', 'user', args='login', scheme=True)\n auth.settings.actions_disabled =\\\n ['register', 'change_password', 'request_reset_password']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L98_C4", "label": "path = join()", "type": "assigned_variable", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L97_C0", "vector": [14, 1, 0.9159, 0.0093, 1, 0.12, 0.0, 358, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " path = os.path.join(current.request.folder, filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:If_L99_C4", "label": "if", "type": "if", "loc": [99, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L97_C0", "vector": [4, 1, 0.9626, 0.0841, 1, 0.12, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.exists(path):\n request = current.request\n domain, public_key, private_key = open(path, 'r').read().strip().split(':')\n url = URL('default', 'user', args='login', scheme=True)\n auth.settings.actions_disabled =\\\n ['register', 'change_password', 'request_reset_password']\n auth.settings.login_form = OneallAccount(\n request, public_key=public_key,private_key=private_key,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L100_C8", "label": "request =", "type": "assigned_variable", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:If_L99_C4", "vector": [14, 2, 0.9346, 0.0093, 2, 0.61, 0.0, 50, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request = current.request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L101_C8", "label": "domain, public_key, private_key = split()", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:If_L99_C4", "vector": [14, 2, 0.9439, 0.0093, 2, 0.61, 0.25, 685, 3, 1, 0, 0, 908, 10, 4], "semantic": {"name": "domain, public_key, private_key", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " domain, public_key, private_key = open(path, 'r').read().strip().split(':')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L102_C8", "label": "url = URL()", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:If_L99_C4", "vector": [14, 2, 0.9533, 0.0093, 2, 0.61, 0.5, 789, 3, 4, 0, 0, 759, 10, 1], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "URL", "annotation": ""}, "snippet": " url = URL('default', 'user', args='login', scheme=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L103_C8", "label": "auth.settings.actions_disabled =", "type": "assigned_variable", "loc": [103, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:If_L99_C4", "vector": [14, 2, 0.9673, 0.0187, 2, 0.61, 0.75, 973, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "auth.settings.actions_disabled", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " auth.settings.actions_disabled =\\\n ['register', 'change_password', 'request_reset_password']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L105_C8", "label": "auth.settings.login_form = OneallAccount()", "type": "assigned_variable", "loc": [105, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_485:If_L99_C4", "vector": [14, 2, 0.9907, 0.028, 2, 0.61, 1.0, 374, 3, 6, 0, 0, 684, 10, 1], "semantic": {"name": "auth.settings.login_form", "arg_names": [], "import_names": [], "rhs_call_name": "OneallAccount", "annotation": ""}, "snippet": " auth.settings.login_form = OneallAccount(\n request, public_key=public_key,private_key=private_key,\n domain=domain, url=url, **kwargs)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_485:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Expr_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L50_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L52_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L47_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Return_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:If_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:If_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L63_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:If_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L65_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:If_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L66_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:If_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:If_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Try_L68_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:Try_L68_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L69_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:Try_L68_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L70_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:Try_L68_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L71_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:Try_L68_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_485:If_L72_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:If_L72_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_485:If_L73_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:If_L73_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L74_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:If_L73_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L75_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:If_L73_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L76_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:If_L73_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L77_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:If_L73_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L78_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:If_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_485:If_L81_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:If_L81_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Expr_L82_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Return_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Return_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:FunctionDef_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_485:If_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:If_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:If_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:If_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:If_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_485:If_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_485:Assign_L105_C8"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
BrowserID Authentication for web2py
developed by Madhukar R Pai (Copyright 2012)
Email <madspai@gmail.com>
License : LGPL
thanks and credits to the web2py community
This custom authenticator allows web2py to authenticate using browserid (https://browserid.org/)
BrowserID is a project by Mozilla Labs (http://mozillalabs.com/)
to Know how browserid works please visit http://identity.mozilla.com/post/7616727542/introducing-browserid-a-better-way-to-sign-in
bottom line BrowserID provides a free, secure, de-centralized, easy to use(for users and developers) login solution.
You can use any email id as your login id. Browserid just verifys the email id and lets you login with that id.
credits for the doPost jquery function - itsadok (http://stackoverflow.com/users/7581/itsadok)
"""
import time
from gluon import *
from gluon.storage import Storage
from gluon.tools import fetch
import gluon.contrib.simplejson as json
class BrowserID(object):
"""
from gluon.contrib.login_methods.browserid_account import BrowserID
auth.settings.login_form = BrowserID(request,
audience = "http://127.0.0.1:8000"
assertion_post_url = "http://127.0.0.1:8000/%s/default/user/login" % request.application)
"""
def __init__(self,
request,
audience="",
assertion_post_url="",
prompt="BrowserID Login",
issuer="browserid.org",
verify_url="https://browserid.org/verify",
browserid_js="https://browserid.org/include.js",
browserid_button="https://browserid.org/i/sign_in_red.png",
crypto_js="https://crypto-js.googlecode.com/files/2.2.0-crypto-md5.js",
on_login_failure=None,
):
self.request = request
self.audience = audience
self.assertion_post_url = assertion_post_url
self.prompt = prompt
self.issuer = issuer
self.verify_url = verify_url
self.browserid_js = browserid_js
self.browserid_button = browserid_button
self.crypto_js = crypto_js
self.on_login_failure = on_login_failure
self.asertion_js = """
(function($){$.extend({doPost:function(url,params){var $form=$("<form method='POST'>").attr("action",url);
$.each(params,function(name,value){$("<input type='hidden'>").attr("name",name).attr("value",value).appendTo($form)});
$form.appendTo("body");$form.submit()}})})(jQuery);
function gotVerifiedEmail(assertion){if(assertion !== null){$.doPost('%s',{'assertion':assertion});}}""" % self.assertion_post_url
def get_user(self):
request = self.request
if request.vars.assertion:
audience = self.audience
issuer = self.issuer
assertion = XML(request.vars.assertion, sanitize=True)
verify_data = {'assertion': assertion, 'audience': audience}
auth_info_json = fetch(self.verify_url, data=verify_data)
j = json.loads(auth_info_json)
epoch_time = int(time.time() * 1000) # we need 13 digit epoch time
if j["status"] == "okay" and j["audience"] == audience and j['issuer'] == issuer and j['expires'] >= epoch_time:
return dict(email=j['email'])
elif self.on_login_failure:
redirect('http://google.com')
else:
redirect('http://google.com')
return None
def login_form(self):
request = self.request
onclick = "javascript:navigator.id.getVerifiedEmail(gotVerifiedEmail) ; return false"
form = DIV(SCRIPT(_src=self.browserid_js, _type="text/javascript"),
SCRIPT(_src=self.crypto_js, _type="text/javascript"),
A(IMG(_src=self.browserid_button, _alt=self.prompt), _href="#", _onclick=onclick, _class="browserid", _title="Login With BrowserID"),
SCRIPT(self.asertion_js))
return form
| ajibawa-2023/Python-Code-Large/train/row_486 | 41 | 91 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_486:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 21], "level": 0, "parent": null, "vector": [8, 0, 0.1374, 0.1978, 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 BrowserID Authentication for web2py\n developed by Madhukar R Pai (Copyright 2012)\n Email <madspai@gmail.com>\n License : LGPL\n\n thanks and credits to the web2py community\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Import_L22_C0", "label": "time import time", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.2418, 0.011, 0, 0.66, 0.1667, 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_486:ImportFrom_L23_C0", "label": "from gluon import *", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.2527, 0.011, 0, 0.66, 0.3333, 826, 0, 1, 0, 0, 826, 0, 0], "semantic": {"name": "gluon", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:ImportFrom_L24_C0", "label": "from gluon.storage import Storage", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.2637, 0.011, 0, 0.66, 0.5, 696, 0, 1, 0, 0, 696, 0, 0], "semantic": {"name": "gluon.storage", "arg_names": [], "import_names": ["Storage"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.storage import Storage"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:ImportFrom_L25_C0", "label": "from gluon.tools import fetch", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.2747, 0.011, 0, 0.66, 0.6667, 322, 0, 1, 0, 0, 322, 0, 0], "semantic": {"name": "gluon.tools", "arg_names": [], "import_names": ["fetch"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.tools import fetch"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Import_L26_C0", "label": "gluon.contrib.simplejson import json", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.2857, 0.011, 0, 0.66, 0.8333, 611, 0, 1, 0, 0, 611, 0, 0], "semantic": {"name": "gluon.contrib.simplejson", "arg_names": [], "import_names": ["json"], "rhs_call_name": "", "annotation": ""}, "snippet": "import gluon.contrib.simplejson as json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:ClassDef_L29_C0", "label": "BrowserID", "type": "class", "loc": [29, 91], "level": 0, "parent": null, "vector": [3, 0, 0.6593, 0.6923, 0, 0.66, 1.0, 222, 0, 3, 0, 0, 186, 0, 14], "semantic": {"name": "BrowserID", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BrowserID(object):\n \"\"\"\n from gluon.contrib.login_methods.browserid_account import BrowserID\n auth.settings.login_form = BrowserID(request,\n audience = \"http://127.0.0.1:8000\"\n assertion_post_url = \"http://127.0.0.1:8000/%s/default/user/login\" % request.application)\n \"\"\"\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Expr_L30_C4", "label": "expression", "type": "expression", "loc": [30, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:ClassDef_L29_C0", "vector": [8, 1, 0.3571, 0.0659, 1, 0.04, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n from gluon.contrib.login_methods.browserid_account import BrowserID\n auth.settings.login_form = BrowserID(request,\n audience = \"http://127.0.0.1:8000\"\n assertion_post_url = \"http://127.0.0.1:8000/%s/default/user/login\" % request.application)\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "label": "__init__", "type": "function", "loc": [37, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:ClassDef_L29_C0", "vector": [2, 1, 0.5549, 0.3077, 1, 0.04, 0.3333, 555, 0, 11, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "request", "audience", "assertion_post_url", "prompt", "issuer", "verify_url", "browserid_js", "browserid_button", "crypto_js", "on_login_failure"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self,\n request,\n audience=\"\",\n assertion_post_url=\"\",\n prompt=\"BrowserID Login\",\n issuer=\"browserid.org\",\n verify_url=\"https://browserid.org/verify\",\n browserid_js=\"https://browserid.org/include.js\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L50_C8", "label": "self.request =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "vector": [14, 2, 0.5495, 0.011, 2, 0.67, 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_486:Assign_L51_C8", "label": "self.audience =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "vector": [14, 2, 0.5604, 0.011, 2, 0.67, 0.1, 266, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.audience", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.audience = audience"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L52_C8", "label": "self.assertion_post_url =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "vector": [14, 2, 0.5714, 0.011, 2, 0.67, 0.2, 76, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.assertion_post_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.assertion_post_url = assertion_post_url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L53_C8", "label": "self.prompt =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "vector": [14, 2, 0.5824, 0.011, 2, 0.67, 0.3, 198, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.prompt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.prompt = prompt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L54_C8", "label": "self.issuer =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "vector": [14, 2, 0.5934, 0.011, 2, 0.67, 0.4, 491, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.issuer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.issuer = issuer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L55_C8", "label": "self.verify_url =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "vector": [14, 2, 0.6044, 0.011, 2, 0.67, 0.5, 625, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.verify_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.verify_url = verify_url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L56_C8", "label": "self.browserid_js =", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "vector": [14, 2, 0.6154, 0.011, 2, 0.67, 0.6, 663, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.browserid_js", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.browserid_js = browserid_js"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L57_C8", "label": "self.browserid_button =", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "vector": [14, 2, 0.6264, 0.011, 2, 0.67, 0.7, 556, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.browserid_button", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.browserid_button = browserid_button"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L58_C8", "label": "self.crypto_js =", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "vector": [14, 2, 0.6374, 0.011, 2, 0.67, 0.8, 584, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.crypto_js", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.crypto_js = crypto_js"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L59_C8", "label": "self.on_login_failure =", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "vector": [14, 2, 0.6484, 0.011, 2, 0.67, 0.9, 75, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.on_login_failure", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.on_login_failure = on_login_failure"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L60_C8", "label": "self.asertion_js =", "type": "assigned_variable", "loc": [60, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "vector": [14, 2, 0.6813, 0.0549, 2, 0.67, 1.0, 677, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.asertion_js", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.asertion_js = \"\"\"\n (function($){$.extend({doPost:function(url,params){var $form=$(\"<form method='POST'>\").attr(\"action\",url);\n $.each(params,function(name,value){$(\"<input type='hidden'>\").attr(\"name\",name).attr(\"value\",value).appendTo($form)});\n $form.appendTo(\"body\");$form.submit()}})})(jQuery);\n function gotVerifiedEmail(assertion){if(assertion !== null){$.doPost('%s',{'assertion':assertion});}}\"\"\" % self.assertion_post_url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L66_C4", "label": "get_user", "type": "function", "loc": [66, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:ClassDef_L29_C0", "vector": [2, 1, 0.8132, 0.1868, 1, 0.04, 0.6667, 174, 0, 1, 1, 0, 0, 0, 8], "semantic": {"name": "get_user", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_user(self):\n request = self.request\n if request.vars.assertion:\n audience = self.audience\n issuer = self.issuer\n assertion = XML(request.vars.assertion, sanitize=True)\n verify_data = {'assertion': assertion, 'audience': audience}\n auth_info_json = fetch(self.verify_url, data=verify_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L67_C8", "label": "request =", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L66_C4", "vector": [14, 2, 0.7363, 0.011, 2, 0.71, 0.0, 50, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request = self.request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:If_L68_C8", "label": "if", "type": "if", "loc": [68, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L66_C4", "vector": [4, 2, 0.8187, 0.1538, 2, 0.71, 0.5, 0, 7, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.vars.assertion:\n audience = self.audience\n issuer = self.issuer\n assertion = XML(request.vars.assertion, sanitize=True)\n verify_data = {'assertion': assertion, 'audience': audience}\n auth_info_json = fetch(self.verify_url, data=verify_data)\n j = json.loads(auth_info_json)\n epoch_time = int(time.time() * 1000) # we need 13 digit epoch time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L69_C12", "label": "audience =", "type": "assigned_variable", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:If_L68_C8", "vector": [14, 3, 0.7582, 0.011, 3, 0.13, 0.0, 498, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "audience", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " audience = self.audience"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L70_C12", "label": "issuer =", "type": "assigned_variable", "loc": [70, 70], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:If_L68_C8", "vector": [14, 3, 0.7692, 0.011, 3, 0.13, 0.1429, 494, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "issuer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " issuer = self.issuer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L71_C12", "label": "assertion = XML()", "type": "assigned_variable", "loc": [71, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:If_L68_C8", "vector": [14, 3, 0.7802, 0.011, 3, 0.13, 0.2857, 238, 3, 2, 0, 0, 52, 10, 1], "semantic": {"name": "assertion", "arg_names": [], "import_names": [], "rhs_call_name": "XML", "annotation": ""}, "snippet": " assertion = XML(request.vars.assertion, sanitize=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L72_C12", "label": "verify_data =", "type": "assigned_variable", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:If_L68_C8", "vector": [14, 3, 0.7912, 0.011, 3, 0.13, 0.4286, 650, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "verify_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " verify_data = {'assertion': assertion, 'audience': audience}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L73_C12", "label": "auth_info_json = fetch()", "type": "assigned_variable", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:If_L68_C8", "vector": [14, 3, 0.8022, 0.011, 3, 0.13, 0.5714, 790, 3, 2, 0, 0, 587, 10, 1], "semantic": {"name": "auth_info_json", "arg_names": [], "import_names": [], "rhs_call_name": "fetch", "annotation": ""}, "snippet": " auth_info_json = fetch(self.verify_url, data=verify_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L74_C12", "label": "j = loads()", "type": "assigned_variable", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:If_L68_C8", "vector": [14, 3, 0.8132, 0.011, 3, 0.13, 0.7143, 100, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": " j = json.loads(auth_info_json)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L75_C12", "label": "epoch_time = int()", "type": "assigned_variable", "loc": [75, 75], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:If_L68_C8", "vector": [14, 3, 0.8242, 0.011, 3, 0.13, 0.8571, 852, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "epoch_time", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " epoch_time = int(time.time() * 1000) # we need 13 digit epoch time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:If_L76_C12", "label": "if", "type": "if", "loc": [76, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:If_L68_C8", "vector": [4, 3, 0.8626, 0.0659, 3, 0.13, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if j[\"status\"] == \"okay\" and j[\"audience\"] == audience and j['issuer'] == issuer and j['expires'] >= epoch_time:\n return dict(email=j['email'])\n elif self.on_login_failure:\n redirect('http://google.com')\n else:\n redirect('http://google.com')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Return_L77_C16", "label": "return", "type": "return", "loc": [77, 77], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:If_L76_C12", "vector": [13, 4, 0.8462, 0.011, 4, 0.44, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict(email=j['email'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:If_L78_C12", "label": "if", "type": "if", "loc": [78, 81], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:If_L76_C12", "vector": [4, 4, 0.8736, 0.044, 4, 0.44, 1.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.on_login_failure:\n redirect('http://google.com')\n else:\n redirect('http://google.com')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Expr_L79_C16", "label": "redirect()", "type": "expression", "loc": [79, 79], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:If_L78_C12", "vector": [8, 5, 0.8681, 0.011, 5, 0.26, 0.0, 206, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect('http://google.com')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Expr_L81_C16", "label": "redirect()", "type": "expression", "loc": [81, 81], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:If_L78_C12", "vector": [8, 5, 0.8901, 0.011, 5, 0.26, 1.0, 206, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect('http://google.com')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Return_L82_C8", "label": "return", "type": "return", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L66_C4", "vector": [13, 2, 0.9011, 0.011, 2, 0.71, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L84_C4", "label": "login_form", "type": "function", "loc": [84, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:ClassDef_L29_C0", "vector": [2, 1, 0.9615, 0.0879, 1, 0.04, 1.0, 289, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "login_form", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def login_form(self):\n request = self.request\n onclick = \"javascript:navigator.id.getVerifiedEmail(gotVerifiedEmail) ; return false\"\n form = DIV(SCRIPT(_src=self.browserid_js, _type=\"text/javascript\"),\n SCRIPT(_src=self.crypto_js, _type=\"text/javascript\"),\n A(IMG(_src=self.browserid_button, _alt=self.prompt), _href=\"#\", _onclick=onclick, _class=\"browserid\", _title=\"Login With BrowserID\"),\n SCRIPT(self.asertion_js))\n return form"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L85_C8", "label": "request =", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L84_C4", "vector": [14, 2, 0.9341, 0.011, 2, 0.9, 0.0, 50, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request = self.request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L86_C8", "label": "onclick =", "type": "assigned_variable", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L84_C4", "vector": [14, 2, 0.9451, 0.011, 2, 0.9, 0.3333, 544, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "onclick", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " onclick = \"javascript:navigator.id.getVerifiedEmail(gotVerifiedEmail) ; return false\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L87_C8", "label": "form = DIV()", "type": "assigned_variable", "loc": [87, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L84_C4", "vector": [14, 2, 0.9725, 0.044, 2, 0.9, 0.6667, 761, 3, 4, 0, 0, 697, 10, 6], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "DIV", "annotation": ""}, "snippet": " form = DIV(SCRIPT(_src=self.browserid_js, _type=\"text/javascript\"),\n SCRIPT(_src=self.crypto_js, _type=\"text/javascript\"),\n A(IMG(_src=self.browserid_button, _alt=self.prompt), _href=\"#\", _onclick=onclick, _class=\"browserid\", _title=\"Login With BrowserID\"),\n SCRIPT(self.asertion_js))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_486:Return_L91_C8", "label": "return", "type": "return", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L84_C4", "vector": [13, 2, 1.0, 0.011, 2, 0.9, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return form"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_486:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Expr_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L37_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_486:If_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:If_L68_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:If_L68_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L70_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:If_L68_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:If_L68_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L72_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:If_L68_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L73_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:If_L68_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:If_L68_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L75_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:If_L68_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_486:If_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:If_L76_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Return_L77_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:If_L76_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_486:If_L78_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:If_L78_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Expr_L79_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:If_L78_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Expr_L81_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Return_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Assign_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_486:FunctionDef_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_486:Return_L91_C8"}] |
#!/usr/bin/env python
# coding: utf8
"""
ExtendedLoginForm is used to extend normal login form in web2py with one more login method.
So user can choose the built-in login or extended login methods.
"""
from gluon import current, DIV
class ExtendedLoginForm(object):
"""
Put extended_login_form under web2py/gluon/contrib/login_methods folder.
Then inside your model where defines the auth:
auth = Auth(globals(),db) # authentication/authorization
...
auth.define_tables() # You might like to put the code after auth.define_tables
... # if the alt_login_form deals with tables of auth.
alt_login_form = RPXAccount(request,
api_key="...",
domain="...",
url = "http://localhost:8000/%s/default/user/login" % request.application)
extended_login_form = ExtendedLoginForm(
auth, alt_login_form, signals=['token'])
auth.settings.login_form = extended_login_form
Note:
Since rpx_account doesn't create the password for the user, you
might need to provide a way for user to create password to do
normal login.
"""
def __init__(self,
auth,
alt_login_form,
signals=[],
login_arg='login'
):
self.auth = auth
self.alt_login_form = alt_login_form
self.signals = signals
self.login_arg = login_arg
def get_user(self):
"""
Delegate the get_user to alt_login_form.get_user.
"""
if hasattr(self.alt_login_form, 'get_user'):
return self.alt_login_form.get_user()
return None # let gluon.tools.Auth.get_or_create_user do the rest
def login_url(self, next):
"""
Optional implement for alt_login_form.
In normal case, this should be replaced by get_user, and never get called.
"""
if hasattr(self.alt_login_form, 'login_url'):
return self.alt_login_form.login_url(next)
return self.auth.settings.login_url
def logout_url(self, next):
"""
Optional implement for alt_login_form.
Called if bool(alt_login_form.get_user) is True.
If alt_login_form implemented logout_url function, it will return that function call.
"""
if hasattr(self.alt_login_form, 'logout_url'):
return self.alt_login_form.logout_url(next)
return next
def login_form(self):
"""
Combine the auth() form with alt_login_form.
If signals are set and a parameter in request matches any signals,
it will return the call of alt_login_form.login_form instead.
So alt_login_form can handle some particular situations, for example,
multiple steps of OpenID login inside alt_login_form.login_form.
Otherwise it will render the normal login form combined with
alt_login_form.login_form.
"""
request = current.request
args = request.args
if (self.signals and
any([True for signal in self.signals if signal in request.vars])
):
return self.alt_login_form.login_form()
self.auth.settings.login_form = self.auth
form = DIV(self.auth())
self.auth.settings.login_form = self
form.components.append(self.alt_login_form.login_form())
return form
| ajibawa-2023/Python-Code-Large/train/row_489 | 35 | 105 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_489:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0524, 0.0381, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nExtendedLoginForm is used to extend normal login form in web2py with one more login method.\nSo user can choose the built-in login or extended login methods.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:ImportFrom_L9_C0", "label": "from gluon import current, DIV", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0857, 0.0095, 0, 0.66, 0.5, 826, 0, 2, 0, 0, 826, 0, 0], "semantic": {"name": "gluon", "arg_names": [], "import_names": ["current", "DIV"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon import current, DIV"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:ClassDef_L12_C0", "label": "ExtendedLoginForm", "type": "class", "loc": [12, 105], "level": 0, "parent": null, "vector": [3, 0, 0.5571, 0.8952, 0, 0.66, 1.0, 614, 0, 5, 0, 0, 186, 0, 12], "semantic": {"name": "ExtendedLoginForm", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ExtendedLoginForm(object):\n \"\"\"\n Put extended_login_form under web2py/gluon/contrib/login_methods folder.\n Then inside your model where defines the auth:\n\n auth = Auth(globals(),db) # authentication/authorization\n ...\n auth.define_tables() # You might like to put the code after auth.define_tables"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Expr_L13_C4", "label": "expression", "type": "expression", "loc": [13, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:ClassDef_L12_C0", "vector": [8, 1, 0.2333, 0.2286, 1, 0.6, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Put extended_login_form under web2py/gluon/contrib/login_methods folder.\n Then inside your model where defines the auth:\n\n auth = Auth(globals(),db) # authentication/authorization\n ...\n auth.define_tables() # You might like to put the code after auth.define_tables\n ... # if the alt_login_form deals with tables of auth."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L38_C4", "label": "__init__", "type": "function", "loc": [38, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:ClassDef_L12_C0", "vector": [2, 1, 0.4048, 0.0952, 1, 0.6, 0.2, 555, 0, 5, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "auth", "alt_login_form", "signals", "login_arg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self,\n auth,\n alt_login_form,\n signals=[],\n login_arg='login'\n ):\n self.auth = auth\n self.alt_login_form = alt_login_form"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Assign_L44_C8", "label": "self.auth =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L38_C4", "vector": [14, 2, 0.419, 0.0095, 2, 0.17, 0.0, 882, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.auth", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.auth = auth"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Assign_L45_C8", "label": "self.alt_login_form =", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L38_C4", "vector": [14, 2, 0.4286, 0.0095, 2, 0.17, 0.3333, 706, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.alt_login_form", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.alt_login_form = alt_login_form"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Assign_L46_C8", "label": "self.signals =", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L38_C4", "vector": [14, 2, 0.4381, 0.0095, 2, 0.17, 0.6667, 487, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.signals", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.signals = signals"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Assign_L47_C8", "label": "self.login_arg =", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L38_C4", "vector": [14, 2, 0.4476, 0.0095, 2, 0.17, 1.0, 134, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.login_arg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.login_arg = login_arg"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L49_C4", "label": "get_user", "type": "function", "loc": [49, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:ClassDef_L12_C0", "vector": [2, 1, 0.4952, 0.0667, 1, 0.6, 0.4, 174, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "get_user", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_user(self):\n \"\"\"\n Delegate the get_user to alt_login_form.get_user.\n \"\"\"\n if hasattr(self.alt_login_form, 'get_user'):\n return self.alt_login_form.get_user()\n return None # let gluon.tools.Auth.get_or_create_user do the rest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Expr_L50_C8", "label": "expression", "type": "expression", "loc": [50, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L49_C4", "vector": [8, 2, 0.4857, 0.0286, 2, 0.99, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Delegate the get_user to alt_login_form.get_user.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:If_L53_C8", "label": "if", "type": "if", "loc": [53, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L49_C4", "vector": [4, 2, 0.5095, 0.019, 2, 0.99, 0.5, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(self.alt_login_form, 'get_user'):\n return self.alt_login_form.get_user()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Return_L54_C12", "label": "return", "type": "return", "loc": [54, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:If_L53_C8", "vector": [13, 3, 0.5143, 0.0095, 3, 0.91, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.alt_login_form.get_user()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Return_L55_C8", "label": "return", "type": "return", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L49_C4", "vector": [13, 2, 0.5238, 0.0095, 2, 0.99, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None # let gluon.tools.Auth.get_or_create_user do the rest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L57_C4", "label": "login_url", "type": "function", "loc": [57, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:ClassDef_L12_C0", "vector": [2, 1, 0.581, 0.0857, 1, 0.6, 0.6, 704, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "login_url", "arg_names": ["self", "next"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def login_url(self, next):\n \"\"\"\n Optional implement for alt_login_form.\n\n In normal case, this should be replaced by get_user, and never get called.\n \"\"\"\n if hasattr(self.alt_login_form, 'login_url'):\n return self.alt_login_form.login_url(next)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Expr_L58_C8", "label": "expression", "type": "expression", "loc": [58, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L57_C4", "vector": [8, 2, 0.5714, 0.0476, 2, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Optional implement for alt_login_form.\n\n In normal case, this should be replaced by get_user, and never get called.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:If_L63_C8", "label": "if", "type": "if", "loc": [63, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L57_C4", "vector": [4, 2, 0.6048, 0.019, 2, 0.66, 0.5, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(self.alt_login_form, 'login_url'):\n return self.alt_login_form.login_url(next)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Return_L64_C12", "label": "return", "type": "return", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:If_L63_C8", "vector": [13, 3, 0.6095, 0.0095, 3, 0.46, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.alt_login_form.login_url(next)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Return_L65_C8", "label": "return", "type": "return", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L57_C4", "vector": [13, 2, 0.619, 0.0095, 2, 0.66, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.auth.settings.login_url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L67_C4", "label": "logout_url", "type": "function", "loc": [67, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:ClassDef_L12_C0", "vector": [2, 1, 0.6857, 0.1048, 1, 0.6, 0.8, 181, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "logout_url", "arg_names": ["self", "next"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def logout_url(self, next):\n \"\"\"\n Optional implement for alt_login_form.\n\n Called if bool(alt_login_form.get_user) is True.\n\n If alt_login_form implemented logout_url function, it will return that function call.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Expr_L68_C8", "label": "expression", "type": "expression", "loc": [68, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L67_C4", "vector": [8, 2, 0.6762, 0.0667, 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 Optional implement for alt_login_form.\n\n Called if bool(alt_login_form.get_user) is True.\n\n If alt_login_form implemented logout_url function, it will return that function call.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:If_L75_C8", "label": "if", "type": "if", "loc": [75, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L67_C4", "vector": [4, 2, 0.719, 0.019, 2, 0.3, 0.5, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(self.alt_login_form, 'logout_url'):\n return self.alt_login_form.logout_url(next)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Return_L76_C12", "label": "return", "type": "return", "loc": [76, 76], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:If_L75_C8", "vector": [13, 3, 0.7238, 0.0095, 3, 0.25, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.alt_login_form.logout_url(next)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Return_L77_C8", "label": "return", "type": "return", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L67_C4", "vector": [13, 2, 0.7333, 0.0095, 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 next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L79_C4", "label": "login_form", "type": "function", "loc": [79, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:ClassDef_L12_C0", "vector": [2, 1, 0.8762, 0.2571, 1, 0.6, 1.0, 289, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "login_form", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def login_form(self):\n \"\"\"\n Combine the auth() form with alt_login_form.\n\n If signals are set and a parameter in request matches any signals,\n it will return the call of alt_login_form.login_form instead.\n So alt_login_form can handle some particular situations, for example,\n multiple steps of OpenID login inside alt_login_form.login_form."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Expr_L80_C8", "label": "expression", "type": "expression", "loc": [80, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L79_C4", "vector": [8, 2, 0.8095, 0.1048, 2, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Combine the auth() form with alt_login_form.\n\n If signals are set and a parameter in request matches any signals,\n it will return the call of alt_login_form.login_form instead.\n So alt_login_form can handle some particular situations, for example,\n multiple steps of OpenID login inside alt_login_form.login_form.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Assign_L92_C8", "label": "request =", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L79_C4", "vector": [14, 2, 0.8762, 0.0095, 2, 0.49, 0.125, 50, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request = current.request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Assign_L93_C8", "label": "args =", "type": "assigned_variable", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L79_C4", "vector": [14, 2, 0.8857, 0.0095, 2, 0.49, 0.25, 805, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = request.args"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:If_L95_C8", "label": "if", "type": "if", "loc": [95, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L79_C4", "vector": [4, 2, 0.919, 0.0381, 2, 0.49, 0.375, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (self.signals and\n any([True for signal in self.signals if signal in request.vars])\n ):\n return self.alt_login_form.login_form()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Return_L98_C12", "label": "return", "type": "return", "loc": [98, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:If_L95_C8", "vector": [13, 3, 0.9333, 0.0095, 3, 0.98, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.alt_login_form.login_form()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Assign_L100_C8", "label": "self.auth.settings.login_form =", "type": "assigned_variable", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L79_C4", "vector": [14, 2, 0.9524, 0.0095, 2, 0.49, 0.5, 55, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.auth.settings.login_form", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.auth.settings.login_form = self.auth"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Assign_L101_C8", "label": "form = DIV()", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L79_C4", "vector": [14, 2, 0.9619, 0.0095, 2, 0.49, 0.625, 761, 3, 1, 0, 0, 697, 10, 2], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "DIV", "annotation": ""}, "snippet": " form = DIV(self.auth())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Assign_L102_C8", "label": "self.auth.settings.login_form =", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L79_C4", "vector": [14, 2, 0.9714, 0.0095, 2, 0.49, 0.75, 55, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.auth.settings.login_form", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.auth.settings.login_form = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Expr_L104_C8", "label": "append()", "type": "expression", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L79_C4", "vector": [8, 2, 0.9905, 0.0095, 2, 0.49, 0.875, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " form.components.append(self.alt_login_form.login_form())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_489:Return_L105_C8", "label": "return", "type": "return", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L79_C4", "vector": [13, 2, 1.0, 0.0095, 2, 0.49, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return form"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_489:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Expr_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_489:If_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:If_L53_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Return_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Return_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Expr_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_489:If_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:If_L63_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Return_L64_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Return_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Expr_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_489:If_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:If_L75_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Return_L76_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Return_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Expr_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_489:If_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:If_L95_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Return_L98_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Assign_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Assign_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Expr_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_489:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_489:Return_L105_C8"}] |
import urllib
import urllib2
import base64
def basic_auth(server="http://127.0.0.1"):
"""
to use basic login with a different server
from gluon.contrib.login_methods.basic_auth import basic_auth
auth.settings.login_methods.append(basic_auth('http://server'))
"""
def basic_login_aux(username,
password,
server=server):
key = base64.b64encode(username + ':' + password)
headers = {'Authorization': 'Basic ' + key}
request = urllib2.Request(server, None, headers)
try:
urllib2.urlopen(request)
return True
except (urllib2.URLError, urllib2.HTTPError):
return False
return basic_login_aux
| ajibawa-2023/Python-Code-Large/train/row_490 | 14 | 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_490:Import_L1_C0", "label": "urllib import urllib", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0417, 0.0417, 0, 0.66, 0.0, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "urllib", "arg_names": [], "import_names": ["urllib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urllib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_490:Import_L2_C0", "label": "urllib2 import urllib2", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0417, 0, 0.66, 0.3333, 345, 0, 1, 0, 0, 345, 0, 0], "semantic": {"name": "urllib2", "arg_names": [], "import_names": ["urllib2"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urllib2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_490:Import_L3_C0", "label": "base64 import base64", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.125, 0.0417, 0, 0.66, 0.6667, 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_490:FunctionDef_L6_C0", "label": "basic_auth", "type": "function", "loc": [6, 24], "level": 0, "parent": null, "vector": [2, 0, 0.625, 0.7917, 0, 0.66, 1.0, 753, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "basic_auth", "arg_names": ["server"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def basic_auth(server=\"http://127.0.0.1\"):\n \"\"\"\n to use basic login with a different server\n from gluon.contrib.login_methods.basic_auth import basic_auth\n auth.settings.login_methods.append(basic_auth('http://server'))\n \"\"\"\n\n def basic_login_aux(username,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_490:Expr_L7_C4", "label": "expression", "type": "expression", "loc": [7, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_490:FunctionDef_L6_C0", "vector": [8, 1, 0.375, 0.2083, 1, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n to use basic login with a different server\n from gluon.contrib.login_methods.basic_auth import basic_auth\n auth.settings.login_methods.append(basic_auth('http://server'))\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_490:FunctionDef_L13_C4", "label": "basic_login_aux", "type": "function", "loc": [13, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_490:FunctionDef_L6_C0", "vector": [2, 1, 0.75, 0.4583, 1, 0.72, 0.5, 542, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "basic_login_aux", "arg_names": ["username", "password", "server"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def basic_login_aux(username,\n password,\n server=server):\n key = base64.b64encode(username + ':' + password)\n headers = {'Authorization': 'Basic ' + key}\n request = urllib2.Request(server, None, headers)\n try:\n urllib2.urlopen(request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_490:Assign_L16_C8", "label": "key = b64encode()", "type": "assigned_variable", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_490:FunctionDef_L13_C4", "vector": [14, 2, 0.6667, 0.0417, 2, 0.74, 0.0, 230, 3, 1, 0, 0, 11, 10, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "b64encode", "annotation": ""}, "snippet": " key = base64.b64encode(username + ':' + password)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_490:Assign_L17_C8", "label": "headers =", "type": "assigned_variable", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_490:FunctionDef_L13_C4", "vector": [14, 2, 0.7083, 0.0417, 2, 0.74, 0.3333, 950, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "headers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headers = {'Authorization': 'Basic ' + key}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_490:Assign_L18_C8", "label": "request = Request()", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_490:FunctionDef_L13_C4", "vector": [14, 2, 0.75, 0.0417, 2, 0.74, 0.6667, 50, 3, 3, 0, 0, 51, 10, 1], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "Request", "annotation": ""}, "snippet": " request = urllib2.Request(server, None, headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_490:Try_L19_C8", "label": "try", "type": "try", "loc": [19, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_490:FunctionDef_L13_C4", "vector": [7, 2, 0.875, 0.2083, 2, 0.74, 1.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n urllib2.urlopen(request)\n return True\n except (urllib2.URLError, urllib2.HTTPError):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_490:Expr_L20_C12", "label": "urlopen()", "type": "expression", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_490:Try_L19_C8", "vector": [8, 3, 0.8333, 0.0417, 3, 0.21, 0.0, 687, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "urlopen", "arg_names": [], "import_names": [], "rhs_call_name": "urlopen", "annotation": ""}, "snippet": " urllib2.urlopen(request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_490:Return_L21_C12", "label": "return", "type": "return", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_490:Try_L19_C8", "vector": [13, 3, 0.875, 0.0417, 3, 0.21, 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_490:Return_L23_C12", "label": "return", "type": "return", "loc": [23, 23], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_490:Try_L19_C8", "vector": [13, 3, 0.9583, 0.0417, 3, 0.21, 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_490:Return_L24_C4", "label": "return", "type": "return", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_490:FunctionDef_L6_C0", "vector": [13, 1, 1.0, 0.0417, 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 basic_login_aux"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_490:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_490:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_490:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_490:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_490:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_490:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_490:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_490:Assign_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_490:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_490:Assign_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_490:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_490:Try_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_490:Try_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_490:Expr_L20_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_490:Try_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_490:Return_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_490:Try_L19_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_490:Return_L23_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_490:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_490:Return_L24_C4"}] |
#!/usr/bin/env python
import time
from hashlib import md5
from gluon.dal import DAL
def motp_auth(db=DAL('sqlite://storage.sqlite'),
time_offset=60):
"""
motp allows you to login with a one time password(OTP) generated on a motp client,
motp clients are available for practically all platforms.
to know more about OTP visit http://en.wikipedia.org/wiki/One-time_password
to know more visit http://motp.sourceforge.net
Written by Madhukar R Pai (madspai@gmail.com)
License : MIT or GPL v2
thanks and credits to the web2py community
to use motp_auth:
motp_auth.py has to be located in gluon/contrib/login_methods/ folder
first auth_user has to have 2 extra fields - motp_secret and motp_pin
for that define auth like shown below:
## after auth = Auth(db)
db.define_table(
auth.settings.table_user_name,
Field('first_name', length=128, default=''),
Field('last_name', length=128, default=''),
Field('email', length=128, default='', unique=True), # required
Field('password', 'password', length=512, # required
readable=False, label='Password'),
Field('motp_secret',length=512,default='',
label='MOTP Seceret'),
Field('motp_pin',length=128,default='',
label='MOTP PIN'),
Field('registration_key', length=512, # required
writable=False, readable=False, default=''),
Field('reset_password_key', length=512, # required
writable=False, readable=False, default=''),
Field('registration_id', length=512, # required
writable=False, readable=False, default=''))
##validators
custom_auth_table = db[auth.settings.table_user_name]
# get the custom_auth_table
custom_auth_table.first_name.requires = \
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
custom_auth_table.last_name.requires = \
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
custom_auth_table.password.requires = CRYPT()
custom_auth_table.email.requires = [
IS_EMAIL(error_message=auth.messages.invalid_email),
IS_NOT_IN_DB(db, custom_auth_table.email)]
auth.settings.table_user = custom_auth_table # tell auth to use custom_auth_table
## before auth.define_tables()
##after that:
from gluon.contrib.login_methods.motp_auth import motp_auth
auth.settings.login_methods.append(motp_auth(db=db))
##Instructions for using MOTP
- after configuring motp for web2py, Install a MOTP client on your phone (android,IOS, java, windows phone, etc)
- initialize the motp client (to reset a motp secret type in #**#),
During user creation enter the secret generated during initialization into the motp_secret field in auth_user and
similarly enter a pre-decided pin into the motp_pin
- done.. to login, just generate a fresh OTP by typing in the pin and use the OTP as password
###To Dos###
- both motp_secret and pin are stored in plain text! need to have some way of encrypting
- web2py stores the password in db on successful login (should not happen)
- maybe some utility or page to check the otp would be useful
- as of now user field is hardcoded to email. Some way of selecting user table and user field.
"""
def verify_otp(otp, pin, secret, offset=60):
epoch_time = int(time.time())
time_start = int(str(epoch_time - offset)[:-1])
time_end = int(str(epoch_time + offset)[:-1])
for t in range(time_start - 1, time_end + 1):
to_hash = str(t) + secret + pin
hash = md5(to_hash).hexdigest()[:6]
if otp == hash:
return True
return False
def motp_auth_aux(email,
password,
db=db,
offset=time_offset):
if db:
user_data = db(db.auth_user.email == email).select().first()
if user_data:
if user_data['motp_secret'] and user_data['motp_pin']:
motp_secret = user_data['motp_secret']
motp_pin = user_data['motp_pin']
otp_check = verify_otp(
password, motp_pin, motp_secret, offset=offset)
if otp_check:
return True
else:
return False
else:
return False
return False
return motp_auth_aux
| ajibawa-2023/Python-Code-Large/train/row_491 | 29 | 111 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_491:Import_L3_C0", "label": "time import time", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.027, 0.009, 0, 0.66, 0.0, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_491:ImportFrom_L4_C0", "label": "from hashlib import md5", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.036, 0.009, 0, 0.66, 0.3333, 154, 0, 1, 0, 0, 154, 0, 0], "semantic": {"name": "hashlib", "arg_names": [], "import_names": ["md5"], "rhs_call_name": "", "annotation": ""}, "snippet": "from hashlib import md5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_491:ImportFrom_L5_C0", "label": "from gluon.dal import DAL", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.045, 0.009, 0, 0.66, 0.6667, 169, 0, 1, 0, 0, 169, 0, 0], "semantic": {"name": "gluon.dal", "arg_names": [], "import_names": ["DAL"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.dal import DAL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L8_C0", "label": "motp_auth", "type": "function", "loc": [8, 111], "level": 0, "parent": null, "vector": [2, 0, 0.536, 0.9369, 0, 0.66, 1.0, 252, 0, 2, 1, 0, 0, 0, 15], "semantic": {"name": "motp_auth", "arg_names": ["db", "time_offset"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def motp_auth(db=DAL('sqlite://storage.sqlite'),\n time_offset=60):\n\n \"\"\"\n motp allows you to login with a one time password(OTP) generated on a motp client,\n motp clients are available for practically all platforms.\n to know more about OTP visit http://en.wikipedia.org/wiki/One-time_password\n to know more visit http://motp.sourceforge.net"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_491:Expr_L11_C4", "label": "expression", "type": "expression", "loc": [11, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L8_C0", "vector": [8, 1, 0.4054, 0.6216, 1, 0.27, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n motp allows you to login with a one time password(OTP) generated on a motp client,\n motp clients are available for practically all platforms.\n to know more about OTP visit http://en.wikipedia.org/wiki/One-time_password\n to know more visit http://motp.sourceforge.net\n\n\n Written by Madhukar R Pai (madspai@gmail.com)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L81_C4", "label": "verify_otp", "type": "function", "loc": [81, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L8_C0", "vector": [2, 1, 0.7703, 0.0901, 1, 0.27, 0.3333, 880, 0, 4, 1, 0, 0, 0, 10], "semantic": {"name": "verify_otp", "arg_names": ["otp", "pin", "secret", "offset"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def verify_otp(otp, pin, secret, offset=60):\n epoch_time = int(time.time())\n time_start = int(str(epoch_time - offset)[:-1])\n time_end = int(str(epoch_time + offset)[:-1])\n for t in range(time_start - 1, time_end + 1):\n to_hash = str(t) + secret + pin\n hash = md5(to_hash).hexdigest()[:6]\n if otp == hash:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_491:Assign_L82_C8", "label": "epoch_time = int()", "type": "assigned_variable", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L81_C4", "vector": [14, 2, 0.7387, 0.009, 2, 0.18, 0.0, 852, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "epoch_time", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " epoch_time = int(time.time())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_491:Assign_L83_C8", "label": "time_start = int()", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L81_C4", "vector": [14, 2, 0.7477, 0.009, 2, 0.18, 0.25, 833, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "time_start", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " time_start = int(str(epoch_time - offset)[:-1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_491:Assign_L84_C8", "label": "time_end = int()", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L81_C4", "vector": [14, 2, 0.7568, 0.009, 2, 0.18, 0.5, 609, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "time_end", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " time_end = int(str(epoch_time + offset)[:-1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_491:For_L85_C8", "label": "for t", "type": "for", "loc": [85, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L81_C4", "vector": [6, 2, 0.7838, 0.045, 2, 0.18, 0.75, 15, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for t in range(time_start - 1, time_end + 1):\n to_hash = str(t) + secret + pin\n hash = md5(to_hash).hexdigest()[:6]\n if otp == hash:\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_491:Assign_L86_C12", "label": "to_hash =", "type": "assigned_variable", "loc": [86, 86], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:For_L85_C8", "vector": [14, 3, 0.7748, 0.009, 3, 0.04, 0.0, 465, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "to_hash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " to_hash = str(t) + secret + pin"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_491:Assign_L87_C12", "label": "hash =", "type": "assigned_variable", "loc": [87, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:For_L85_C8", "vector": [14, 3, 0.7838, 0.009, 3, 0.04, 0.5, 58, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "hash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hash = md5(to_hash).hexdigest()[:6]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_491:If_L88_C12", "label": "if", "type": "if", "loc": [88, 89], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:For_L85_C8", "vector": [4, 3, 0.7973, 0.018, 3, 0.04, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if otp == hash:\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_491:Return_L89_C16", "label": "return", "type": "return", "loc": [89, 89], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:If_L88_C12", "vector": [13, 4, 0.8018, 0.009, 4, 0.02, 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_491:Return_L90_C8", "label": "return", "type": "return", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L81_C4", "vector": [13, 2, 0.8108, 0.009, 2, 0.18, 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_491:FunctionDef_L92_C4", "label": "motp_auth_aux", "type": "function", "loc": [92, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L8_C0", "vector": [2, 1, 0.9099, 0.1712, 1, 0.27, 0.6667, 225, 0, 4, 1, 0, 0, 0, 4], "semantic": {"name": "motp_auth_aux", "arg_names": ["email", "password", "db", "offset"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def motp_auth_aux(email,\n password,\n db=db,\n offset=time_offset):\n if db:\n user_data = db(db.auth_user.email == email).select().first()\n if user_data:\n if user_data['motp_secret'] and user_data['motp_pin']:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_491:If_L96_C8", "label": "if", "type": "if", "loc": [96, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L92_C4", "vector": [4, 2, 0.9234, 0.1261, 2, 0.56, 0.0, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if db:\n user_data = db(db.auth_user.email == email).select().first()\n if user_data:\n if user_data['motp_secret'] and user_data['motp_pin']:\n motp_secret = user_data['motp_secret']\n motp_pin = user_data['motp_pin']\n otp_check = verify_otp(\n password, motp_pin, motp_secret, offset=offset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_491:Assign_L97_C12", "label": "user_data = first()", "type": "assigned_variable", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:If_L96_C8", "vector": [14, 3, 0.8739, 0.009, 3, 0.6, 0.0, 844, 3, 0, 0, 0, 199, 10, 3], "semantic": {"name": "user_data", "arg_names": [], "import_names": [], "rhs_call_name": "first", "annotation": ""}, "snippet": " user_data = db(db.auth_user.email == email).select().first()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_491:If_L98_C12", "label": "if", "type": "if", "loc": [98, 109], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:If_L96_C8", "vector": [4, 3, 0.9324, 0.1081, 3, 0.6, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user_data:\n if user_data['motp_secret'] and user_data['motp_pin']:\n motp_secret = user_data['motp_secret']\n motp_pin = user_data['motp_pin']\n otp_check = verify_otp(\n password, motp_pin, motp_secret, offset=offset)\n if otp_check:\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_491:If_L99_C16", "label": "if", "type": "if", "loc": [99, 109], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:If_L98_C12", "vector": [4, 4, 0.9369, 0.0991, 4, 0.13, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user_data['motp_secret'] and user_data['motp_pin']:\n motp_secret = user_data['motp_secret']\n motp_pin = user_data['motp_pin']\n otp_check = verify_otp(\n password, motp_pin, motp_secret, offset=offset)\n if otp_check:\n return True\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_491:Assign_L100_C20", "label": "motp_secret =", "type": "assigned_variable", "loc": [100, 100], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:If_L99_C16", "vector": [14, 5, 0.9009, 0.009, 5, 0.53, 0.0, 256, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "motp_secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " motp_secret = user_data['motp_secret']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_491:Assign_L101_C20", "label": "motp_pin =", "type": "assigned_variable", "loc": [101, 101], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:If_L99_C16", "vector": [14, 5, 0.9099, 0.009, 5, 0.53, 0.25, 235, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "motp_pin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " motp_pin = user_data['motp_pin']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_491:Assign_L102_C20", "label": "otp_check = verify_otp()", "type": "assigned_variable", "loc": [102, 103], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:If_L99_C16", "vector": [14, 5, 0.9234, 0.018, 5, 0.53, 0.5, 474, 3, 4, 0, 0, 880, 10, 1], "semantic": {"name": "otp_check", "arg_names": [], "import_names": [], "rhs_call_name": "verify_otp", "annotation": ""}, "snippet": " otp_check = verify_otp(\n password, motp_pin, motp_secret, offset=offset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_491:If_L104_C20", "label": "if", "type": "if", "loc": [104, 107], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:If_L99_C16", "vector": [4, 5, 0.9505, 0.036, 5, 0.53, 0.75, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if otp_check:\n return True\n else:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_491:Return_L105_C24", "label": "return", "type": "return", "loc": [105, 105], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:If_L104_C20", "vector": [13, 6, 0.9459, 0.009, 6, 0.1, 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_491:Return_L107_C24", "label": "return", "type": "return", "loc": [107, 107], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:If_L104_C20", "vector": [13, 6, 0.964, 0.009, 6, 0.1, 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_491:Return_L109_C20", "label": "return", "type": "return", "loc": [109, 109], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:If_L99_C16", "vector": [13, 5, 0.982, 0.009, 5, 0.53, 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_491:Return_L110_C8", "label": "return", "type": "return", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L92_C4", "vector": [13, 2, 0.991, 0.009, 2, 0.56, 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_491:Return_L111_C4", "label": "return", "type": "return", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L8_C0", "vector": [13, 1, 1.0, 0.009, 1, 0.27, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return motp_auth_aux"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_491:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_491:Assign_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_491:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_491:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_491:For_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:For_L85_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_491:Assign_L86_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:For_L85_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_491:Assign_L87_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:For_L85_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_491:If_L88_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:If_L88_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_491:Return_L89_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_491:Return_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_491:If_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:If_L96_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_491:Assign_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:If_L96_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_491:If_L98_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:If_L98_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_491:If_L99_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:If_L99_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_491:Assign_L100_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:If_L99_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_491:Assign_L101_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:If_L99_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_491:Assign_L102_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:If_L99_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_491:If_L104_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:If_L104_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_491:Return_L105_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:If_L104_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_491:Return_L107_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:If_L99_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_491:Return_L109_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_491:Return_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_491:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_491:Return_L111_C4"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Written by Michele Comitini <mcm@glisco.it>
License: GPL v3
Adds support for x509 authentication.
"""
from gluon.globals import current
from gluon.storage import Storage
from gluon.http import HTTP, redirect
#requires M2Crypto
from M2Crypto import X509
class X509Auth(object):
"""
Login using x509 cert from client.
from gluon.contrib.login_methods.x509_auth import X509Account
auth.settings.actions_disabled=['register','change_password',
'request_reset_password','profile']
auth.settings.login_form = X509Auth()
"""
def __init__(self):
self.request = current.request
self.ssl_client_raw_cert = self.request.env.ssl_client_raw_cert
# rebuild the certificate passed by the env
# this is double work, but it is the only way
# since we cannot access the web server ssl engine directly
if self.ssl_client_raw_cert:
x509 = X509.load_cert_string(
self.ssl_client_raw_cert, X509.FORMAT_PEM)
# extract it from the cert
self.serial = self.request.env.ssl_client_serial or (
'%x' % x509.get_serial_number()).upper()
subject = x509.get_subject()
# Reordering the subject map to a usable Storage map
# this allows us a cleaner syntax:
# cn = self.subject.cn
self.subject = Storage(filter(None,
map(lambda x:
(x, map(lambda y:
y.get_data(
).as_text(),
subject.get_entries_by_nid(subject.nid[x]))),
subject.nid.keys())))
def login_form(self, **args):
raise HTTP(403, 'Login not allowed. No valid x509 crentials')
def login_url(self, next="/"):
raise HTTP(403, 'Login not allowed. No valid x509 crentials')
def logout_url(self, next="/"):
return next
def get_user(self):
'''Returns the user info contained in the certificate.
'''
# We did not get the client cert?
if not self.ssl_client_raw_cert:
return None
# Try to reconstruct some useful info for web2py auth machinery
p = profile = dict()
username = p['username'] = reduce(lambda a, b: '%s | %s' % (
a, b), self.subject.CN or self.subject.commonName)
p['first_name'] = reduce(lambda a, b: '%s | %s' % (a, b),
self.subject.givenName or username)
p['last_name'] = reduce(
lambda a, b: '%s | %s' % (a, b), self.subject.surname)
p['email'] = reduce(lambda a, b: '%s | %s' % (
a, b), self.subject.Email or self.subject.emailAddress)
# IMPORTANT WE USE THE CERT SERIAL AS UNIQUE KEY FOR THE USER
p['registration_id'] = self.serial
# If the auth table has a field certificate it will be used to
# save a PEM encoded copy of the user certificate.
p['certificate'] = self.ssl_client_raw_cert
return profile
| ajibawa-2023/Python-Code-Large/train/row_492 | 31 | 98 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_492:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0714, 0.0714, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nWritten by Michele Comitini <mcm@glisco.it>\nLicense: GPL v3\n\nAdds support for x509 authentication.\n\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:ImportFrom_L12_C0", "label": "from gluon.globals import current", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.1224, 0.0102, 0, 0.66, 0.2, 703, 0, 1, 0, 0, 703, 0, 0], "semantic": {"name": "gluon.globals", "arg_names": [], "import_names": ["current"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.globals import current"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:ImportFrom_L13_C0", "label": "from gluon.storage import Storage", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.1327, 0.0102, 0, 0.66, 0.4, 696, 0, 1, 0, 0, 696, 0, 0], "semantic": {"name": "gluon.storage", "arg_names": [], "import_names": ["Storage"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.storage import Storage"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:ImportFrom_L14_C0", "label": "from gluon.http import HTTP, redirect", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0102, 0, 0.66, 0.6, 453, 0, 2, 0, 0, 453, 0, 0], "semantic": {"name": "gluon.http", "arg_names": [], "import_names": ["HTTP", "redirect"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.http import HTTP, redirect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:ImportFrom_L17_C0", "label": "from M2Crypto import X509", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.1735, 0.0102, 0, 0.66, 0.8, 34, 0, 1, 0, 0, 34, 0, 0], "semantic": {"name": "M2Crypto", "arg_names": [], "import_names": ["X509"], "rhs_call_name": "", "annotation": ""}, "snippet": "from M2Crypto import X509"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:ClassDef_L20_C0", "label": "X509Auth", "type": "class", "loc": [20, 98], "level": 0, "parent": null, "vector": [3, 0, 0.602, 0.8061, 0, 0.66, 1.0, 138, 0, 5, 0, 0, 186, 0, 19], "semantic": {"name": "X509Auth", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class X509Auth(object):\n \"\"\"\n Login using x509 cert from client.\n\n from gluon.contrib.login_methods.x509_auth import X509Account\n auth.settings.actions_disabled=['register','change_password',\n 'request_reset_password','profile']\n auth.settings.login_form = X509Auth()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:Expr_L21_C4", "label": "expression", "type": "expression", "loc": [21, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:ClassDef_L20_C0", "vector": [8, 1, 0.2551, 0.0918, 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 Login using x509 cert from client.\n\n from gluon.contrib.login_methods.x509_auth import X509Account\n auth.settings.actions_disabled=['register','change_password',\n 'request_reset_password','profile']\n auth.settings.login_form = X509Auth()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L31_C4", "label": "__init__", "type": "function", "loc": [31, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:ClassDef_L20_C0", "vector": [2, 1, 0.4541, 0.2857, 1, 0.12, 0.2, 555, 0, 1, 0, 0, 0, 0, 12], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n self.request = current.request\n self.ssl_client_raw_cert = self.request.env.ssl_client_raw_cert\n\n # rebuild the certificate passed by the env\n # this is double work, but it is the only way\n # since we cannot access the web server ssl engine directly\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L32_C8", "label": "self.request =", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L31_C4", "vector": [14, 2, 0.3265, 0.0102, 2, 0.8, 0.0, 952, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.request = current.request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L33_C8", "label": "self.ssl_client_raw_cert =", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L31_C4", "vector": [14, 2, 0.3367, 0.0102, 2, 0.8, 0.5, 988, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.ssl_client_raw_cert", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ssl_client_raw_cert = self.request.env.ssl_client_raw_cert"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:If_L39_C8", "label": "if", "type": "if", "loc": [39, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L31_C4", "vector": [4, 2, 0.4949, 0.2041, 2, 0.8, 1.0, 0, 7, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.ssl_client_raw_cert:\n\n x509 = X509.load_cert_string(\n self.ssl_client_raw_cert, X509.FORMAT_PEM)\n # extract it from the cert\n self.serial = self.request.env.ssl_client_serial or (\n '%x' % x509.get_serial_number()).upper()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L41_C12", "label": "x509 = load_cert_string()", "type": "assigned_variable", "loc": [41, 42], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:If_L39_C8", "vector": [14, 3, 0.4235, 0.0204, 3, 0.79, 0.0, 445, 3, 2, 0, 0, 899, 10, 1], "semantic": {"name": "x509", "arg_names": [], "import_names": [], "rhs_call_name": "load_cert_string", "annotation": ""}, "snippet": " x509 = X509.load_cert_string(\n self.ssl_client_raw_cert, X509.FORMAT_PEM)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L44_C12", "label": "self.serial =", "type": "assigned_variable", "loc": [44, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:If_L39_C8", "vector": [14, 3, 0.4541, 0.0204, 3, 0.79, 0.3333, 772, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "self.serial", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.serial = self.request.env.ssl_client_serial or (\n '%x' % x509.get_serial_number()).upper()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L47_C12", "label": "subject = get_subject()", "type": "assigned_variable", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:If_L39_C8", "vector": [14, 3, 0.4796, 0.0102, 3, 0.79, 0.6667, 241, 3, 0, 0, 0, 936, 10, 1], "semantic": {"name": "subject", "arg_names": [], "import_names": [], "rhs_call_name": "get_subject", "annotation": ""}, "snippet": " subject = x509.get_subject()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L52_C12", "label": "self.subject = Storage()", "type": "assigned_variable", "loc": [52, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:If_L39_C8", "vector": [14, 3, 0.5612, 0.0714, 3, 0.79, 1.0, 52, 3, 1, 0, 0, 850, 10, 8], "semantic": {"name": "self.subject", "arg_names": [], "import_names": [], "rhs_call_name": "Storage", "annotation": ""}, "snippet": " self.subject = Storage(filter(None,\n map(lambda x:\n (x, map(lambda y:\n y.get_data(\n ).as_text(),\n subject.get_entries_by_nid(subject.nid[x]))),\n subject.nid.keys())))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L60_C4", "label": "login_form", "type": "function", "loc": [60, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:ClassDef_L20_C0", "vector": [2, 1, 0.6173, 0.0204, 1, 0.12, 0.4, 289, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "login_form", "arg_names": ["self", "args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def login_form(self, **args):\n raise HTTP(403, 'Login not allowed. No valid x509 crentials')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L63_C4", "label": "login_url", "type": "function", "loc": [63, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:ClassDef_L20_C0", "vector": [2, 1, 0.648, 0.0204, 1, 0.12, 0.6, 704, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "login_url", "arg_names": ["self", "next"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def login_url(self, next=\"/\"):\n raise HTTP(403, 'Login not allowed. No valid x509 crentials')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L66_C4", "label": "logout_url", "type": "function", "loc": [66, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:ClassDef_L20_C0", "vector": [2, 1, 0.6786, 0.0204, 1, 0.12, 0.8, 181, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "logout_url", "arg_names": ["self", "next"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def logout_url(self, next=\"/\"):\n return next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:Return_L67_C8", "label": "return", "type": "return", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L66_C4", "vector": [13, 2, 0.6837, 0.0102, 2, 0.78, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L69_C4", "label": "get_user", "type": "function", "loc": [69, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:ClassDef_L20_C0", "vector": [2, 1, 0.852, 0.3061, 1, 0.12, 1.0, 174, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "get_user", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_user(self):\n '''Returns the user info contained in the certificate.\n '''\n\n # We did not get the client cert?\n if not self.ssl_client_raw_cert:\n return None\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:Expr_L70_C8", "label": "expression", "type": "expression", "loc": [70, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L69_C4", "vector": [8, 2, 0.7194, 0.0204, 2, 0.23, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Returns the user info contained in the certificate.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:If_L74_C8", "label": "if", "type": "if", "loc": [74, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L69_C4", "vector": [4, 2, 0.7602, 0.0204, 2, 0.23, 0.1111, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.ssl_client_raw_cert:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:Return_L75_C12", "label": "return", "type": "return", "loc": [75, 75], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:If_L74_C8", "vector": [13, 3, 0.7653, 0.0102, 3, 0.83, 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_492:Assign_L79_C8", "label": "p = dict()", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L69_C4", "vector": [14, 2, 0.8061, 0.0102, 2, 0.23, 0.2222, 491, 3, 0, 0, 0, 827, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " p = profile = dict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L81_C8", "label": "username = reduce()", "type": "assigned_variable", "loc": [81, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L69_C4", "vector": [14, 2, 0.8316, 0.0204, 2, 0.23, 0.3333, 718, 3, 2, 0, 0, 622, 10, 1], "semantic": {"name": "username", "arg_names": [], "import_names": [], "rhs_call_name": "reduce", "annotation": ""}, "snippet": " username = p['username'] = reduce(lambda a, b: '%s | %s' % (\n a, b), self.subject.CN or self.subject.commonName)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L83_C8", "label": " = reduce()", "type": "assigned_variable", "loc": [83, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L69_C4", "vector": [14, 2, 0.852, 0.0204, 2, 0.23, 0.4444, 0, 3, 2, 0, 0, 622, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "reduce", "annotation": ""}, "snippet": " p['first_name'] = reduce(lambda a, b: '%s | %s' % (a, b),\n self.subject.givenName or username)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L85_C8", "label": " = reduce()", "type": "assigned_variable", "loc": [85, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L69_C4", "vector": [14, 2, 0.8724, 0.0204, 2, 0.23, 0.5556, 0, 3, 2, 0, 0, 622, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "reduce", "annotation": ""}, "snippet": " p['last_name'] = reduce(\n lambda a, b: '%s | %s' % (a, b), self.subject.surname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L87_C8", "label": " = reduce()", "type": "assigned_variable", "loc": [87, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L69_C4", "vector": [14, 2, 0.8929, 0.0204, 2, 0.23, 0.6667, 0, 3, 2, 0, 0, 622, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "reduce", "annotation": ""}, "snippet": " p['email'] = reduce(lambda a, b: '%s | %s' % (\n a, b), self.subject.Email or self.subject.emailAddress)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L91_C8", "label": "assign", "type": "assigned_variable", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L69_C4", "vector": [14, 2, 0.9286, 0.0102, 2, 0.23, 0.7778, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " p['registration_id'] = self.serial"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L96_C8", "label": "assign", "type": "assigned_variable", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L69_C4", "vector": [14, 2, 0.9796, 0.0102, 2, 0.23, 0.8889, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " p['certificate'] = self.ssl_client_raw_cert"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_492:Return_L98_C8", "label": "return", "type": "return", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L69_C4", "vector": [13, 2, 1.0, 0.0102, 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 profile"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_492:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_492:Expr_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L31_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_492:If_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L41_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L44_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L52_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_492:Return_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:ClassDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_492:Expr_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_492:If_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:If_L74_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_492:Return_L75_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_492:Assign_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_492:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_492:Return_L98_C8"}] |
from gluon.contrib.pam import authenticate
def pam_auth():
"""
to use pam_login:
from gluon.contrib.login_methods.pam_auth import pam_auth
auth.settings.login_methods.append(pam_auth())
or
auth.settings.actions_disabled=[
'register','change_password','request_reset_password']
auth.settings.login_methods=[pam_auth()]
The latter method will not store the user password in auth_user.
"""
def pam_auth_aux(username, password):
return authenticate(username, password)
return pam_auth_aux
| ajibawa-2023/Python-Code-Large/train/row_493 | 6 | 22 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_493:ImportFrom_L1_C0", "label": "from gluon.contrib.pam import authenticate", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0455, 0, 0.66, 0.0, 109, 0, 1, 0, 0, 109, 0, 0], "semantic": {"name": "gluon.contrib.pam", "arg_names": [], "import_names": ["authenticate"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.contrib.pam import authenticate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_493:FunctionDef_L4_C0", "label": "pam_auth", "type": "function", "loc": [4, 22], "level": 0, "parent": null, "vector": [2, 0, 0.5909, 0.8636, 0, 0.66, 1.0, 1, 0, 0, 1, 0, 0, 0, 1], "semantic": {"name": "pam_auth", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def pam_auth():\n \"\"\"\n to use pam_login:\n from gluon.contrib.login_methods.pam_auth import pam_auth\n auth.settings.login_methods.append(pam_auth())\n\n or\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_493:Expr_L5_C4", "label": "expression", "type": "expression", "loc": [5, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_493:FunctionDef_L4_C0", "vector": [8, 1, 0.5, 0.5909, 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 to use pam_login:\n from gluon.contrib.login_methods.pam_auth import pam_auth\n auth.settings.login_methods.append(pam_auth())\n\n or\n\n auth.settings.actions_disabled=["}, {"id": "ajibawa-2023/Python-Code-Large/train/row_493:FunctionDef_L19_C4", "label": "pam_auth_aux", "type": "function", "loc": [19, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_493:FunctionDef_L4_C0", "vector": [2, 1, 0.8864, 0.0909, 1, 0.62, 0.5, 148, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "pam_auth_aux", "arg_names": ["username", "password"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def pam_auth_aux(username, password):\n return authenticate(username, password)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_493:Return_L20_C8", "label": "return", "type": "return", "loc": [20, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_493:FunctionDef_L19_C4", "vector": [13, 2, 0.9091, 0.0455, 2, 0.79, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return authenticate(username, password)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_493:Return_L22_C4", "label": "return", "type": "return", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_493:FunctionDef_L4_C0", "vector": [13, 1, 1.0, 0.0455, 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 pam_auth_aux"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_493:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_493:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_493:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_493:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_493:FunctionDef_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_493:Return_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_493:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_493:Return_L22_C4"}] |
#!/usr/bin/env python
# coding: utf8
"""
LoginRadius Authentication for web2py
Developed by Nathan Freeze (Copyright © 2013)
Email <nathan@freezable.com>
This file contains code to allow using loginradius.com
authentication services with web2py
"""
import os
from gluon import *
from gluon.storage import Storage
from gluon.contrib.simplejson import JSONDecodeError
from gluon.tools import fetch
import gluon.contrib.simplejson as json
class LoginRadiusAccount(object):
"""
from gluon.contrib.login_methods.loginradius_account import LoginRadiusAccount
auth.settings.actions_disabled=['register','change_password',
'request_reset_password']
auth.settings.login_form = LoginRadiusAccount(request,
api_key="...",
api_secret="...",
url = "http://localhost:8000/%s/default/user/login" % request.application)
"""
def __init__(self, request, api_key="", api_secret="",
url=None, on_login_failure=None):
self.request = request
self.api_key = api_key
self.api_secret = api_secret
self.url = url
self.auth_base_url = "https://hub.loginradius.com/UserProfile.ashx/"
self.profile = None
self.on_login_failure = on_login_failure
self.mappings = Storage()
def defaultmapping(profile):
first_name = profile.get('FirstName')
last_name = profile.get('LastName')
email = profile.get('Email', [{}])[0].get('Value')
reg_id = profile.get('ID', '')
username = profile.get('ProfileName', email)
return dict(registration_id=reg_id, username=username, email=email,
first_name=first_name, last_name=last_name)
self.mappings.default = defaultmapping
def get_user(self):
request = self.request
user = None
if request.vars.token:
try:
auth_url = self.auth_base_url + self.api_secret + "/" + request.vars.token
json_data = fetch(auth_url, headers={'User-Agent': "LoginRadius - Python - SDK"})
self.profile = json.loads(json_data)
provider = self.profile['Provider']
mapping = self.mappings.get(provider, self.mappings['default'])
user = mapping(self.profile)
except (JSONDecodeError, KeyError):
pass
if user is None and self.on_login_failure:
redirect(self.on_login_failure)
return user
def login_form(self):
loginradius_url = "https://hub.loginradius.com/include/js/LoginRadius.js"
loginradius_lib = SCRIPT(_src=loginradius_url, _type='text/javascript')
container = DIV(_id="interfacecontainerdiv", _class='interfacecontainerdiv')
widget = SCRIPT("""var options={}; options.login=true;
LoginRadius_SocialLogin.util.ready(function () {
$ui = LoginRadius_SocialLogin.lr_login_settings;
$ui.interfacesize = "";$ui.apikey = "%s";
$ui.callback=""; $ui.lrinterfacecontainer ="interfacecontainerdiv";
LoginRadius_SocialLogin.init(options); });""" % self.api_key)
form = DIV(container, loginradius_lib, widget)
return form
def use_loginradius(auth, filename='private/loginradius.key', **kwargs):
path = os.path.join(current.request.folder, filename)
if os.path.exists(path):
request = current.request
domain, public_key, private_key = open(path, 'r').read().strip().split(':')
url = URL('default', 'user', args='login', scheme=True)
auth.settings.actions_disabled = \
['register', 'change_password', 'request_reset_password']
auth.settings.login_form = LoginRadiusAccount(
request, api_key=public_key, api_secret=private_key,
url=url, **kwargs)
| ajibawa-2023/Python-Code-Large/train/row_494 | 55 | 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_494:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 11], "level": 0, "parent": null, "vector": [8, 0, 0.0773, 0.0825, 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 LoginRadius Authentication for web2py\n Developed by Nathan Freeze (Copyright \u00a9 2013)\n Email <nathan@freezable.com>\n\n This file contains code to allow using loginradius.com\n authentication services with web2py\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Import_L13_C0", "label": "os import os", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.134, 0.0103, 0, 0.66, 0.125, 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_494:ImportFrom_L14_C0", "label": "from gluon import *", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1443, 0.0103, 0, 0.66, 0.25, 826, 0, 1, 0, 0, 826, 0, 0], "semantic": {"name": "gluon", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:ImportFrom_L15_C0", "label": "from gluon.storage import Storage", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.1546, 0.0103, 0, 0.66, 0.375, 696, 0, 1, 0, 0, 696, 0, 0], "semantic": {"name": "gluon.storage", "arg_names": [], "import_names": ["Storage"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.storage import Storage"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:ImportFrom_L16_C0", "label": "from gluon.contrib.simplejson import JSONDecodeError", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.1649, 0.0103, 0, 0.66, 0.5, 611, 0, 1, 0, 0, 611, 0, 0], "semantic": {"name": "gluon.contrib.simplejson", "arg_names": [], "import_names": ["JSONDecodeError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.contrib.simplejson import JSONDecodeError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:ImportFrom_L17_C0", "label": "from gluon.tools import fetch", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.1753, 0.0103, 0, 0.66, 0.625, 322, 0, 1, 0, 0, 322, 0, 0], "semantic": {"name": "gluon.tools", "arg_names": [], "import_names": ["fetch"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.tools import fetch"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Import_L18_C0", "label": "gluon.contrib.simplejson import json", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1856, 0.0103, 0, 0.66, 0.75, 611, 0, 1, 0, 0, 611, 0, 0], "semantic": {"name": "gluon.contrib.simplejson", "arg_names": [], "import_names": ["json"], "rhs_call_name": "", "annotation": ""}, "snippet": "import gluon.contrib.simplejson as json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:ClassDef_L21_C0", "label": "LoginRadiusAccount", "type": "class", "loc": [21, 84], "level": 0, "parent": null, "vector": [3, 0, 0.5412, 0.6598, 0, 0.66, 0.875, 982, 0, 4, 0, 0, 186, 0, 17], "semantic": {"name": "LoginRadiusAccount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class LoginRadiusAccount(object):\n \"\"\"\n from gluon.contrib.login_methods.loginradius_account import LoginRadiusAccount\n auth.settings.actions_disabled=['register','change_password',\n 'request_reset_password']\n auth.settings.login_form = LoginRadiusAccount(request,\n api_key=\"...\",\n api_secret=\"...\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Expr_L22_C4", "label": "expression", "type": "expression", "loc": [22, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:ClassDef_L21_C0", "vector": [8, 1, 0.268, 0.0928, 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 from gluon.contrib.login_methods.loginradius_account import LoginRadiusAccount\n auth.settings.actions_disabled=['register','change_password',\n 'request_reset_password']\n auth.settings.login_form = LoginRadiusAccount(request,\n api_key=\"...\",\n api_secret=\"...\",\n url = \"http://localhost:8000/%s/default/user/login\" % request.application)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L32_C4", "label": "__init__", "type": "function", "loc": [32, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:ClassDef_L21_C0", "vector": [2, 1, 0.4433, 0.2371, 1, 0.43, 0.3333, 555, 0, 6, 1, 0, 0, 0, 8], "semantic": {"name": "__init__", "arg_names": ["self", "request", "api_key", "api_secret", "url", "on_login_failure"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, request, api_key=\"\", api_secret=\"\",\n url=None, on_login_failure=None):\n\n self.request = request\n self.api_key = api_key\n self.api_secret = api_secret\n self.url = url\n self.auth_base_url = \"https://hub.loginradius.com/UserProfile.ashx/\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L35_C8", "label": "self.request =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L32_C4", "vector": [14, 2, 0.3608, 0.0103, 2, 0.54, 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_494:Assign_L36_C8", "label": "self.api_key =", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L32_C4", "vector": [14, 2, 0.3711, 0.0103, 2, 0.54, 0.1111, 355, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.api_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.api_key = api_key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L37_C8", "label": "self.api_secret =", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L32_C4", "vector": [14, 2, 0.3814, 0.0103, 2, 0.54, 0.2222, 388, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.api_secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.api_secret = api_secret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L38_C8", "label": "self.url =", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L32_C4", "vector": [14, 2, 0.3918, 0.0103, 2, 0.54, 0.3333, 720, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.url = url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L39_C8", "label": "self.auth_base_url =", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L32_C4", "vector": [14, 2, 0.4021, 0.0103, 2, 0.54, 0.4444, 280, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.auth_base_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.auth_base_url = \"https://hub.loginradius.com/UserProfile.ashx/\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L40_C8", "label": "self.profile =", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L32_C4", "vector": [14, 2, 0.4124, 0.0103, 2, 0.54, 0.5556, 43, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.profile", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.profile = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L41_C8", "label": "self.on_login_failure =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L32_C4", "vector": [14, 2, 0.4227, 0.0103, 2, 0.54, 0.6667, 75, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.on_login_failure", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.on_login_failure = on_login_failure"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L42_C8", "label": "self.mappings = Storage()", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L32_C4", "vector": [14, 2, 0.433, 0.0103, 2, 0.54, 0.7778, 708, 3, 0, 0, 0, 850, 10, 1], "semantic": {"name": "self.mappings", "arg_names": [], "import_names": [], "rhs_call_name": "Storage", "annotation": ""}, "snippet": " self.mappings = Storage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L44_C8", "label": "defaultmapping", "type": "function", "loc": [44, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L32_C4", "vector": [2, 2, 0.4948, 0.0928, 2, 0.54, 0.8889, 265, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "defaultmapping", "arg_names": ["profile"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def defaultmapping(profile):\n first_name = profile.get('FirstName')\n last_name = profile.get('LastName')\n email = profile.get('Email', [{}])[0].get('Value')\n reg_id = profile.get('ID', '')\n username = profile.get('ProfileName', email)\n\n return dict(registration_id=reg_id, username=username, email=email,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L45_C12", "label": "first_name = get()", "type": "assigned_variable", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L44_C8", "vector": [14, 3, 0.4639, 0.0103, 3, 0.93, 0.0, 185, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "first_name", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " first_name = profile.get('FirstName')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L46_C12", "label": "last_name = get()", "type": "assigned_variable", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L44_C8", "vector": [14, 3, 0.4742, 0.0103, 3, 0.93, 0.2, 578, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "last_name", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " last_name = profile.get('LastName')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L47_C12", "label": "email = get()", "type": "assigned_variable", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L44_C8", "vector": [14, 3, 0.4845, 0.0103, 3, 0.93, 0.4, 413, 3, 1, 0, 0, 607, 10, 2], "semantic": {"name": "email", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " email = profile.get('Email', [{}])[0].get('Value')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L48_C12", "label": "reg_id = get()", "type": "assigned_variable", "loc": [48, 48], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L44_C8", "vector": [14, 3, 0.4948, 0.0103, 3, 0.93, 0.6, 812, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "reg_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " reg_id = profile.get('ID', '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L49_C12", "label": "username = get()", "type": "assigned_variable", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L44_C8", "vector": [14, 3, 0.5052, 0.0103, 3, 0.93, 0.8, 718, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "username", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " username = profile.get('ProfileName', email)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Return_L51_C12", "label": "return", "type": "return", "loc": [51, 52], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L44_C8", "vector": [13, 3, 0.5309, 0.0206, 3, 0.93, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict(registration_id=reg_id, username=username, email=email,\n first_name=first_name, last_name=last_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L54_C8", "label": "self.mappings.default =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L32_C4", "vector": [14, 2, 0.5567, 0.0103, 2, 0.54, 1.0, 515, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.mappings.default", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mappings.default = defaultmapping"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L56_C4", "label": "get_user", "type": "function", "loc": [56, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:ClassDef_L21_C0", "vector": [2, 1, 0.6546, 0.1649, 1, 0.43, 0.6667, 174, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "get_user", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_user(self):\n request = self.request\n user = None\n if request.vars.token:\n try:\n auth_url = self.auth_base_url + self.api_secret + \"/\" + request.vars.token\n json_data = fetch(auth_url, headers={'User-Agent': \"LoginRadius - Python - SDK\"})\n self.profile = json.loads(json_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L57_C8", "label": "request =", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L56_C4", "vector": [14, 2, 0.5876, 0.0103, 2, 0.56, 0.0, 50, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request = self.request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L58_C8", "label": "user =", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L56_C4", "vector": [14, 2, 0.5979, 0.0103, 2, 0.56, 0.3333, 503, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:If_L59_C8", "label": "if", "type": "if", "loc": [59, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L56_C4", "vector": [4, 2, 0.6649, 0.1237, 2, 0.56, 0.6667, 0, 7, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.vars.token:\n try:\n auth_url = self.auth_base_url + self.api_secret + \"/\" + request.vars.token\n json_data = fetch(auth_url, headers={'User-Agent': \"LoginRadius - Python - SDK\"})\n self.profile = json.loads(json_data)\n provider = self.profile['Provider']\n mapping = self.mappings.get(provider, self.mappings['default'])\n user = mapping(self.profile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Try_L60_C12", "label": "try", "type": "try", "loc": [60, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:If_L59_C8", "vector": [7, 3, 0.6598, 0.0928, 3, 0.92, 0.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n auth_url = self.auth_base_url + self.api_secret + \"/\" + request.vars.token\n json_data = fetch(auth_url, headers={'User-Agent': \"LoginRadius - Python - SDK\"})\n self.profile = json.loads(json_data)\n provider = self.profile['Provider']\n mapping = self.mappings.get(provider, self.mappings['default'])\n user = mapping(self.profile)\n except (JSONDecodeError, KeyError):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L61_C16", "label": "auth_url =", "type": "assigned_variable", "loc": [61, 61], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:Try_L60_C12", "vector": [14, 4, 0.6289, 0.0103, 4, 0.02, 0.0, 911, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "auth_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " auth_url = self.auth_base_url + self.api_secret + \"/\" + request.vars.token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L62_C16", "label": "json_data = fetch()", "type": "assigned_variable", "loc": [62, 62], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:Try_L60_C12", "vector": [14, 4, 0.6392, 0.0103, 4, 0.02, 0.2, 516, 3, 2, 0, 0, 587, 10, 1], "semantic": {"name": "json_data", "arg_names": [], "import_names": [], "rhs_call_name": "fetch", "annotation": ""}, "snippet": " json_data = fetch(auth_url, headers={'User-Agent': \"LoginRadius - Python - SDK\"})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L63_C16", "label": "self.profile = loads()", "type": "assigned_variable", "loc": [63, 63], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:Try_L60_C12", "vector": [14, 4, 0.6495, 0.0103, 4, 0.02, 0.4, 43, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "self.profile", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": " self.profile = json.loads(json_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L64_C16", "label": "provider =", "type": "assigned_variable", "loc": [64, 64], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:Try_L60_C12", "vector": [14, 4, 0.6598, 0.0103, 4, 0.02, 0.6, 736, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "provider", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " provider = self.profile['Provider']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L65_C16", "label": "mapping = get()", "type": "assigned_variable", "loc": [65, 65], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:Try_L60_C12", "vector": [14, 4, 0.6701, 0.0103, 4, 0.02, 0.8, 351, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "mapping", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " mapping = self.mappings.get(provider, self.mappings['default'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L66_C16", "label": "user = mapping()", "type": "assigned_variable", "loc": [66, 66], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:Try_L60_C12", "vector": [14, 4, 0.6804, 0.0103, 4, 0.02, 1.0, 503, 3, 1, 0, 0, 351, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "mapping", "annotation": ""}, "snippet": " user = mapping(self.profile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:If_L69_C12", "label": "if", "type": "if", "loc": [69, 70], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:If_L59_C8", "vector": [4, 3, 0.7165, 0.0206, 3, 0.92, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user is None and self.on_login_failure:\n redirect(self.on_login_failure)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Expr_L70_C16", "label": "redirect()", "type": "expression", "loc": [70, 70], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:If_L69_C12", "vector": [8, 4, 0.7216, 0.0103, 4, 0.04, 0.0, 206, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(self.on_login_failure)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Return_L71_C8", "label": "return", "type": "return", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L56_C4", "vector": [13, 2, 0.732, 0.0103, 2, 0.56, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L73_C4", "label": "login_form", "type": "function", "loc": [73, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:ClassDef_L21_C0", "vector": [2, 1, 0.8093, 0.1237, 1, 0.43, 1.0, 289, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "login_form", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def login_form(self):\n loginradius_url = \"https://hub.loginradius.com/include/js/LoginRadius.js\"\n loginradius_lib = SCRIPT(_src=loginradius_url, _type='text/javascript')\n container = DIV(_id=\"interfacecontainerdiv\", _class='interfacecontainerdiv')\n widget = SCRIPT(\"\"\"var options={}; options.login=true;\n LoginRadius_SocialLogin.util.ready(function () {\n $ui = LoginRadius_SocialLogin.lr_login_settings;\n $ui.interfacesize = \"\";$ui.apikey = \"%s\";"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L74_C8", "label": "loginradius_url =", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L73_C4", "vector": [14, 2, 0.7629, 0.0103, 2, 0.62, 0.0, 64, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "loginradius_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " loginradius_url = \"https://hub.loginradius.com/include/js/LoginRadius.js\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L75_C8", "label": "loginradius_lib = SCRIPT()", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L73_C4", "vector": [14, 2, 0.7732, 0.0103, 2, 0.62, 0.2, 368, 3, 2, 0, 0, 8, 10, 1], "semantic": {"name": "loginradius_lib", "arg_names": [], "import_names": [], "rhs_call_name": "SCRIPT", "annotation": ""}, "snippet": " loginradius_lib = SCRIPT(_src=loginradius_url, _type='text/javascript')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L76_C8", "label": "container = DIV()", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L73_C4", "vector": [14, 2, 0.7835, 0.0103, 2, 0.62, 0.4, 516, 3, 2, 0, 0, 697, 10, 1], "semantic": {"name": "container", "arg_names": [], "import_names": [], "rhs_call_name": "DIV", "annotation": ""}, "snippet": " container = DIV(_id=\"interfacecontainerdiv\", _class='interfacecontainerdiv')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L77_C8", "label": "widget = SCRIPT()", "type": "assigned_variable", "loc": [77, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L73_C4", "vector": [14, 2, 0.8196, 0.0619, 2, 0.62, 0.6, 972, 3, 1, 0, 0, 8, 10, 1], "semantic": {"name": "widget", "arg_names": [], "import_names": [], "rhs_call_name": "SCRIPT", "annotation": ""}, "snippet": " widget = SCRIPT(\"\"\"var options={}; options.login=true;\n LoginRadius_SocialLogin.util.ready(function () {\n $ui = LoginRadius_SocialLogin.lr_login_settings;\n $ui.interfacesize = \"\";$ui.apikey = \"%s\";\n $ui.callback=\"\"; $ui.lrinterfacecontainer =\"interfacecontainerdiv\";\n LoginRadius_SocialLogin.init(options); });\"\"\" % self.api_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L83_C8", "label": "form = DIV()", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L73_C4", "vector": [14, 2, 0.8557, 0.0103, 2, 0.62, 0.8, 761, 3, 3, 0, 0, 697, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "DIV", "annotation": ""}, "snippet": " form = DIV(container, loginradius_lib, widget)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Return_L84_C8", "label": "return", "type": "return", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L73_C4", "vector": [13, 2, 0.866, 0.0103, 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 form"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L87_C0", "label": "use_loginradius", "type": "function", "loc": [87, 97], "level": 0, "parent": null, "vector": [2, 0, 0.9485, 0.1134, 0, 0.66, 1.0, 286, 0, 3, 0, 0, 0, 0, 8], "semantic": {"name": "use_loginradius", "arg_names": ["auth", "filename", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def use_loginradius(auth, filename='private/loginradius.key', **kwargs):\n path = os.path.join(current.request.folder, filename)\n if os.path.exists(path):\n request = current.request\n domain, public_key, private_key = open(path, 'r').read().strip().split(':')\n url = URL('default', 'user', args='login', scheme=True)\n auth.settings.actions_disabled = \\\n ['register', 'change_password', 'request_reset_password']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L88_C4", "label": "path = join()", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L87_C0", "vector": [14, 1, 0.9072, 0.0103, 1, 0.11, 0.0, 358, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " path = os.path.join(current.request.folder, filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:If_L89_C4", "label": "if", "type": "if", "loc": [89, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L87_C0", "vector": [4, 1, 0.9588, 0.0928, 1, 0.11, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if os.path.exists(path):\n request = current.request\n domain, public_key, private_key = open(path, 'r').read().strip().split(':')\n url = URL('default', 'user', args='login', scheme=True)\n auth.settings.actions_disabled = \\\n ['register', 'change_password', 'request_reset_password']\n auth.settings.login_form = LoginRadiusAccount(\n request, api_key=public_key, api_secret=private_key,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L90_C8", "label": "request =", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:If_L89_C4", "vector": [14, 2, 0.9278, 0.0103, 2, 0.57, 0.0, 50, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request = current.request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L91_C8", "label": "domain, public_key, private_key = split()", "type": "assigned_variable", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:If_L89_C4", "vector": [14, 2, 0.9381, 0.0103, 2, 0.57, 0.25, 685, 3, 1, 0, 0, 908, 10, 4], "semantic": {"name": "domain, public_key, private_key", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " domain, public_key, private_key = open(path, 'r').read().strip().split(':')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L92_C8", "label": "url = URL()", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:If_L89_C4", "vector": [14, 2, 0.9485, 0.0103, 2, 0.57, 0.5, 789, 3, 4, 0, 0, 759, 10, 1], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "URL", "annotation": ""}, "snippet": " url = URL('default', 'user', args='login', scheme=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L93_C8", "label": "auth.settings.actions_disabled =", "type": "assigned_variable", "loc": [93, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:If_L89_C4", "vector": [14, 2, 0.9639, 0.0206, 2, 0.57, 0.75, 973, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "auth.settings.actions_disabled", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " auth.settings.actions_disabled = \\\n ['register', 'change_password', 'request_reset_password']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L95_C8", "label": "auth.settings.login_form = LoginRadiusAccount()", "type": "assigned_variable", "loc": [95, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_494:If_L89_C4", "vector": [14, 2, 0.9897, 0.0309, 2, 0.57, 1.0, 374, 3, 5, 0, 0, 982, 10, 1], "semantic": {"name": "auth.settings.login_form", "arg_names": [], "import_names": [], "rhs_call_name": "LoginRadiusAccount", "annotation": ""}, "snippet": " auth.settings.login_form = LoginRadiusAccount(\n request, api_key=public_key, api_secret=private_key,\n url=url, **kwargs)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_494:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Expr_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L44_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L44_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L44_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L44_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L44_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L49_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L44_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Return_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:If_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Try_L60_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:Try_L60_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L61_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:Try_L60_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L62_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:Try_L60_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L63_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:Try_L60_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L64_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:Try_L60_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L65_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:Try_L60_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L66_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:If_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_494:If_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:If_L69_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Expr_L70_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Return_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:ClassDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Return_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:FunctionDef_L87_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_494:If_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:If_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L90_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:If_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:If_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:If_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_494:If_L89_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_494:Assign_L95_C8"}] |
import smtplib
import logging
def email_auth(server="smtp.gmail.com:587",
domain="@gmail.com",
tls_mode=None):
"""
to use email_login:
from gluon.contrib.login_methods.email_auth import email_auth
auth.settings.login_methods.append(email_auth("smtp.gmail.com:587",
"@gmail.com"))
"""
def email_auth_aux(email,
password,
server=server,
domain=domain,
tls_mode=tls_mode):
if domain:
if not isinstance(domain, (list, tuple)):
domain = [str(domain)]
if not [d for d in domain if email[-len(d):] == d]:
return False
(host, port) = server.split(':')
if tls_mode is None: # then auto detect
tls_mode = port == '587'
try:
server = None
server = smtplib.SMTP(host, port)
server.ehlo()
if tls_mode:
server.starttls()
server.ehlo()
server.login(email, password)
server.quit()
return True
except:
logging.exception('email_auth() failed')
if server:
try:
server.quit()
except: # server might already close connection after error
pass
return False
return email_auth_aux
| ajibawa-2023/Python-Code-Large/train/row_495 | 29 | 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_495:Import_L1_C0", "label": "smtplib import smtplib", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0217, 0.0217, 0, 0.66, 0.0, 389, 0, 1, 0, 0, 389, 0, 0], "semantic": {"name": "smtplib", "arg_names": [], "import_names": ["smtplib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import smtplib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:Import_L2_C0", "label": "logging import logging", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0435, 0.0217, 0, 0.66, 0.5, 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_495:FunctionDef_L5_C0", "label": "email_auth", "type": "function", "loc": [5, 46], "level": 0, "parent": null, "vector": [2, 0, 0.5543, 0.913, 0, 0.66, 1.0, 699, 0, 3, 1, 0, 0, 0, 12], "semantic": {"name": "email_auth", "arg_names": ["server", "domain", "tls_mode"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def email_auth(server=\"smtp.gmail.com:587\",\n domain=\"@gmail.com\",\n tls_mode=None):\n \"\"\"\n to use email_login:\n from gluon.contrib.login_methods.email_auth import email_auth\n auth.settings.login_methods.append(email_auth(\"smtp.gmail.com:587\",\n \"@gmail.com\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:Expr_L8_C4", "label": "expression", "type": "expression", "loc": [8, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:FunctionDef_L5_C0", "vector": [8, 1, 0.2283, 0.1304, 1, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n to use email_login:\n from gluon.contrib.login_methods.email_auth import email_auth\n auth.settings.login_methods.append(email_auth(\"smtp.gmail.com:587\",\n \"@gmail.com\"))\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:FunctionDef_L15_C4", "label": "email_auth_aux", "type": "function", "loc": [15, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:FunctionDef_L5_C0", "vector": [2, 1, 0.6522, 0.6739, 1, 0.81, 0.5, 567, 0, 5, 1, 0, 0, 0, 12], "semantic": {"name": "email_auth_aux", "arg_names": ["email", "password", "server", "domain", "tls_mode"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def email_auth_aux(email,\n password,\n server=server,\n domain=domain,\n tls_mode=tls_mode):\n if domain:\n if not isinstance(domain, (list, tuple)):\n domain = [str(domain)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:If_L20_C8", "label": "if", "type": "if", "loc": [20, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:FunctionDef_L15_C4", "vector": [4, 2, 0.4783, 0.1087, 2, 0.11, 0.0, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if domain:\n if not isinstance(domain, (list, tuple)):\n domain = [str(domain)]\n if not [d for d in domain if email[-len(d):] == d]:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:If_L21_C12", "label": "if", "type": "if", "loc": [21, 22], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:If_L20_C8", "vector": [4, 3, 0.4674, 0.0435, 3, 0.93, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(domain, (list, tuple)):\n domain = [str(domain)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:Assign_L22_C16", "label": "domain =", "type": "assigned_variable", "loc": [22, 22], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:If_L21_C12", "vector": [14, 4, 0.4783, 0.0217, 4, 0.19, 0.0, 438, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "domain", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " domain = [str(domain)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:If_L23_C12", "label": "if", "type": "if", "loc": [23, 24], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:If_L20_C8", "vector": [4, 3, 0.5109, 0.0435, 3, 0.93, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not [d for d in domain if email[-len(d):] == d]:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:Return_L24_C16", "label": "return", "type": "return", "loc": [24, 24], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:If_L23_C12", "vector": [13, 4, 0.5217, 0.0217, 4, 0.24, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:Assign_L25_C8", "label": "host, port = split()", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:FunctionDef_L15_C4", "vector": [14, 2, 0.5435, 0.0217, 2, 0.11, 0.3333, 364, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "host, port", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " (host, port) = server.split(':')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:If_L26_C8", "label": "if", "type": "if", "loc": [26, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:FunctionDef_L15_C4", "vector": [4, 2, 0.5761, 0.0435, 2, 0.11, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tls_mode is None: # then auto detect\n tls_mode = port == '587'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:Assign_L27_C12", "label": "tls_mode =", "type": "assigned_variable", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:If_L26_C8", "vector": [14, 3, 0.587, 0.0217, 3, 0.19, 0.0, 894, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tls_mode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tls_mode = port == '587'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L28_C8", "label": "try", "type": "try", "loc": [28, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:FunctionDef_L15_C4", "vector": [7, 2, 0.7935, 0.3913, 2, 0.11, 1.0, 0, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n server = None\n server = smtplib.SMTP(host, port)\n server.ehlo()\n if tls_mode:\n server.starttls()\n server.ehlo()\n server.login(email, password)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:Assign_L29_C12", "label": "server =", "type": "assigned_variable", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L28_C8", "vector": [14, 3, 0.6304, 0.0217, 3, 0.19, 0.0, 268, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "server", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " server = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:Assign_L30_C12", "label": "server = SMTP()", "type": "assigned_variable", "loc": [30, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L28_C8", "vector": [14, 3, 0.6522, 0.0217, 3, 0.19, 0.1667, 268, 3, 2, 0, 0, 709, 10, 1], "semantic": {"name": "server", "arg_names": [], "import_names": [], "rhs_call_name": "SMTP", "annotation": ""}, "snippet": " server = smtplib.SMTP(host, port)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:Expr_L31_C12", "label": "ehlo()", "type": "expression", "loc": [31, 31], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L28_C8", "vector": [8, 3, 0.6739, 0.0217, 3, 0.19, 0.3333, 292, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ehlo", "arg_names": [], "import_names": [], "rhs_call_name": "ehlo", "annotation": ""}, "snippet": " server.ehlo()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:If_L32_C12", "label": "if", "type": "if", "loc": [32, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L28_C8", "vector": [4, 3, 0.7174, 0.0652, 3, 0.19, 0.5, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tls_mode:\n server.starttls()\n server.ehlo()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:Expr_L33_C16", "label": "starttls()", "type": "expression", "loc": [33, 33], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:If_L32_C12", "vector": [8, 4, 0.7174, 0.0217, 4, 0.33, 0.0, 262, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "starttls", "arg_names": [], "import_names": [], "rhs_call_name": "starttls", "annotation": ""}, "snippet": " server.starttls()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:Expr_L34_C16", "label": "ehlo()", "type": "expression", "loc": [34, 34], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:If_L32_C12", "vector": [8, 4, 0.7391, 0.0217, 4, 0.33, 1.0, 292, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "ehlo", "arg_names": [], "import_names": [], "rhs_call_name": "ehlo", "annotation": ""}, "snippet": " server.ehlo()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:Expr_L35_C12", "label": "login()", "type": "expression", "loc": [35, 35], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L28_C8", "vector": [8, 3, 0.7609, 0.0217, 3, 0.19, 0.6667, 724, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "login", "arg_names": [], "import_names": [], "rhs_call_name": "login", "annotation": ""}, "snippet": " server.login(email, password)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:Expr_L36_C12", "label": "quit()", "type": "expression", "loc": [36, 36], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L28_C8", "vector": [8, 3, 0.7826, 0.0217, 3, 0.19, 0.8333, 219, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "quit", "arg_names": [], "import_names": [], "rhs_call_name": "quit", "annotation": ""}, "snippet": " server.quit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:Return_L37_C12", "label": "return", "type": "return", "loc": [37, 37], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L28_C8", "vector": [13, 3, 0.8043, 0.0217, 3, 0.19, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:Expr_L39_C12", "label": "exception()", "type": "expression", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L28_C8", "vector": [8, 3, 0.8478, 0.0217, 3, 0.19, 0.0, 69, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exception", "arg_names": [], "import_names": [], "rhs_call_name": "exception", "annotation": ""}, "snippet": " logging.exception('email_auth() failed')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:If_L40_C12", "label": "if", "type": "if", "loc": [40, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L28_C8", "vector": [4, 3, 0.913, 0.1087, 3, 0.19, 0.5, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if server:\n try:\n server.quit()\n except: # server might already close connection after error\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L41_C16", "label": "try", "type": "try", "loc": [41, 44], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:If_L40_C12", "vector": [7, 4, 0.9239, 0.087, 4, 0.75, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n server.quit()\n except: # server might already close connection after error\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:Expr_L42_C20", "label": "quit()", "type": "expression", "loc": [42, 42], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L41_C16", "vector": [8, 5, 0.913, 0.0217, 5, 0.35, 0.0, 219, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "quit", "arg_names": [], "import_names": [], "rhs_call_name": "quit", "annotation": ""}, "snippet": " server.quit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:Return_L45_C12", "label": "return", "type": "return", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L28_C8", "vector": [13, 3, 0.9783, 0.0217, 3, 0.19, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_495:Return_L46_C4", "label": "return", "type": "return", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_495:FunctionDef_L5_C0", "vector": [13, 1, 1.0, 0.0217, 1, 0.81, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return email_auth_aux"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_495:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_495:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_495:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_495:If_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:If_L20_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_495:If_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:If_L21_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_495:Assign_L22_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:If_L20_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_495:If_L23_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:If_L23_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_495:Return_L24_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_495:Assign_L25_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_495:If_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:If_L26_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_495:Assign_L27_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_495:Assign_L29_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_495:Assign_L30_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_495:Expr_L31_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_495:If_L32_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:If_L32_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_495:Expr_L33_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:If_L32_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_495:Expr_L34_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_495:Expr_L35_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_495:Expr_L36_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_495:Return_L37_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_495:Expr_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_495:If_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:If_L40_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L41_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L41_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_495:Expr_L42_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:Try_L28_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_495:Return_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_495:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_495:Return_L46_C4"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu>.
License: GPL v2
Tinkered by Szabolcs Gyuris < szimszo n @ o regpreshaz dot eu>
"""
from gluon import current, redirect
class CasAuth(object):
"""
Login will be done via Web2py's CAS application, instead of web2py's
login form.
Include in your model (eg db.py)::
from gluon.contrib.login_methods.cas_auth import CasAuth
auth.define_tables(username=True)
auth.settings.login_form=CasAuth(
urlbase = "https://[your CAS provider]/app/default/user/cas",
actions=['login','validate','logout'])
where urlbase is the actual CAS server url without the login,logout...
Enjoy.
###UPDATE###
if you want to connect to a CAS version 2 JASIG Server use this:
auth.settings.login_form=CasAuth(
urlbase = "https://[Your CAS server]/cas",
actions = ['login','serviceValidate','logout'],
casversion = 2,
casusername = "cas:user")
where casusername is the xml node returned by CAS server which contains
user's username.
"""
def __init__(self, g=None, # g for backward compatibility ###
urlbase="https://web2py.com/cas/cas",
actions=['login', 'validate', 'logout'],
maps=dict(username=lambda v: v.get('username', v['user']),
email=lambda v: v.get('email', None),
user_id=lambda v: v['user']),
casversion=1,
casusername='cas:user'
):
self.urlbase = urlbase
self.cas_login_url = "%s/%s" % (self.urlbase, actions[0])
self.cas_check_url = "%s/%s" % (self.urlbase, actions[1])
self.cas_logout_url = "%s/%s" % (self.urlbase, actions[2])
self.maps = maps
self.casversion = casversion
self.casusername = casusername
http_host = current.request.env.http_x_forwarded_host
if not http_host:
http_host = current.request.env.http_host
if current.request.env.wsgi_url_scheme in ['https', 'HTTPS']:
scheme = 'https'
else:
scheme = 'http'
self.cas_my_url = '%s://%s%s' % (
scheme, http_host, current.request.env.path_info)
def login_url(self, next="/"):
current.session.token = self._CAS_login()
return next
def logout_url(self, next="/"):
current.session.token = None
current.session.auth = None
self._CAS_logout()
return next
def get_user(self):
user = current.session.token
if user:
d = {'source': 'web2py cas'}
for key in self.maps:
d[key] = self.maps[key](user)
return d
return None
def _CAS_login(self):
"""
exposed as CAS.login(request)
returns a token on success, None on failed authentication
"""
import urllib
self.ticket = current.request.vars.ticket
if not current.request.vars.ticket:
redirect("%s?service=%s" % (self.cas_login_url,
self.cas_my_url))
else:
url = "%s?service=%s&ticket=%s" % (self.cas_check_url,
self.cas_my_url,
self.ticket)
data = urllib.urlopen(url).read()
if data.startswith('yes') or data.startswith('no'):
data = data.split('\n')
if data[0] == 'yes':
if ':' in data[1]: # for Compatibility with Custom CAS
items = data[1].split(':')
a = items[0]
b = len(items) > 1 and items[1] or a
c = len(items) > 2 and items[2] or b
else:
a = b = c = data[1]
return dict(user=a, email=b, username=c)
return None
import xml.dom.minidom as dom
import xml.parsers.expat as expat
try:
dxml = dom.parseString(data)
envelop = dxml.getElementsByTagName(
"cas:authenticationSuccess")
if len(envelop) > 0:
res = dict()
for x in envelop[0].childNodes:
if x.nodeName.startswith('cas:') and len(x.childNodes):
key = x.nodeName[4:].encode('utf8')
value = x.childNodes[0].nodeValue.encode('utf8')
if not key in res:
res[key] = value
else:
if not isinstance(res[key], list):
res[key] = [res[key]]
res[key].append(value)
return res
except expat.ExpatError:
pass
return None # fallback
def _CAS_logout(self):
"""
exposed CAS.logout()
redirects to the CAS logout page
"""
import urllib
redirect("%s?service=%s" % (self.cas_logout_url, self.cas_my_url))
| ajibawa-2023/Python-Code-Large/train/row_496 | 76 | 144 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_496:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 10], "level": 0, "parent": null, "vector": [8, 0, 0.0486, 0.0486, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis file is part of web2py Web Framework (Copyrighted, 2007-2009).\nDeveloped by Massimo Di Pierro <mdipierro@cs.depaul.edu>.\nLicense: GPL v2\n\nTinkered by Szabolcs Gyuris < szimszo n @ o regpreshaz dot eu>\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:ImportFrom_L12_C0", "label": "from gluon import current, redirect", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0069, 0, 0.66, 0.5, 826, 0, 2, 0, 0, 826, 0, 0], "semantic": {"name": "gluon", "arg_names": [], "import_names": ["current", "redirect"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon import current, redirect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:ClassDef_L15_C0", "label": "CasAuth", "type": "class", "loc": [15, 144], "level": 0, "parent": null, "vector": [3, 0, 0.5521, 0.9028, 0, 0.66, 1.0, 195, 0, 6, 0, 0, 186, 0, 27], "semantic": {"name": "CasAuth", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CasAuth(object):\n \"\"\"\n Login will be done via Web2py's CAS application, instead of web2py's\n login form.\n\n Include in your model (eg db.py)::\n\n from gluon.contrib.login_methods.cas_auth import CasAuth"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Expr_L16_C4", "label": "expression", "type": "expression", "loc": [16, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:ClassDef_L15_C0", "vector": [8, 1, 0.2014, 0.1875, 1, 0.04, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Login will be done via Web2py's CAS application, instead of web2py's\n login form.\n\n Include in your model (eg db.py)::\n\n from gluon.contrib.login_methods.cas_auth import CasAuth\n auth.define_tables(username=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "label": "__init__", "type": "function", "loc": [43, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:ClassDef_L15_C0", "vector": [2, 1, 0.3819, 0.1736, 1, 0.04, 0.1667, 555, 0, 7, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "g", "urlbase", "actions", "maps", "casversion", "casusername"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, g=None, # g for backward compatibility ###\n urlbase=\"https://web2py.com/cas/cas\",\n actions=['login', 'validate', 'logout'],\n maps=dict(username=lambda v: v.get('username', v['user']),\n email=lambda v: v.get('email', None),\n user_id=lambda v: v['user']),\n casversion=1,\n casusername='cas:user'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L52_C8", "label": "self.urlbase =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "vector": [14, 2, 0.3611, 0.0069, 2, 0.77, 0.0, 752, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.urlbase", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.urlbase = urlbase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L53_C8", "label": "self.cas_login_url =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "vector": [14, 2, 0.3681, 0.0069, 2, 0.77, 0.1, 13, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.cas_login_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cas_login_url = \"%s/%s\" % (self.urlbase, actions[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L54_C8", "label": "self.cas_check_url =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "vector": [14, 2, 0.375, 0.0069, 2, 0.77, 0.2, 749, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.cas_check_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cas_check_url = \"%s/%s\" % (self.urlbase, actions[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L55_C8", "label": "self.cas_logout_url =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "vector": [14, 2, 0.3819, 0.0069, 2, 0.77, 0.3, 908, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.cas_logout_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cas_logout_url = \"%s/%s\" % (self.urlbase, actions[2])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L56_C8", "label": "self.maps =", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "vector": [14, 2, 0.3889, 0.0069, 2, 0.77, 0.4, 801, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.maps", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.maps = maps"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L57_C8", "label": "self.casversion =", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "vector": [14, 2, 0.3958, 0.0069, 2, 0.77, 0.5, 450, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.casversion", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.casversion = casversion"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L58_C8", "label": "self.casusername =", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "vector": [14, 2, 0.4028, 0.0069, 2, 0.77, 0.6, 30, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.casusername", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.casusername = casusername"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L59_C8", "label": "http_host =", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "vector": [14, 2, 0.4097, 0.0069, 2, 0.77, 0.7, 785, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "http_host", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " http_host = current.request.env.http_x_forwarded_host"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:If_L60_C8", "label": "if", "type": "if", "loc": [60, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "vector": [4, 2, 0.4201, 0.0139, 2, 0.77, 0.8, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not http_host:\n http_host = current.request.env.http_host"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L61_C12", "label": "http_host =", "type": "assigned_variable", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L60_C8", "vector": [14, 3, 0.4236, 0.0069, 3, 0.02, 0.0, 785, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "http_host", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " http_host = current.request.env.http_host"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:If_L62_C8", "label": "if", "type": "if", "loc": [62, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "vector": [4, 2, 0.441, 0.0278, 2, 0.77, 0.9, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if current.request.env.wsgi_url_scheme in ['https', 'HTTPS']:\n scheme = 'https'\n else:\n scheme = 'http'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L63_C12", "label": "scheme =", "type": "assigned_variable", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L62_C8", "vector": [14, 3, 0.4375, 0.0069, 3, 0.34, 0.0, 207, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "scheme", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scheme = 'https'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L65_C12", "label": "scheme =", "type": "assigned_variable", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L62_C8", "vector": [14, 3, 0.4514, 0.0069, 3, 0.34, 1.0, 207, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "scheme", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scheme = 'http'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L66_C8", "label": "self.cas_my_url =", "type": "assigned_variable", "loc": [66, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "vector": [14, 2, 0.4618, 0.0139, 2, 0.77, 1.0, 332, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.cas_my_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.cas_my_url = '%s://%s%s' % (\n scheme, http_host, current.request.env.path_info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L69_C4", "label": "login_url", "type": "function", "loc": [69, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:ClassDef_L15_C0", "vector": [2, 1, 0.4861, 0.0208, 1, 0.04, 0.3333, 704, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "login_url", "arg_names": ["self", "next"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def login_url(self, next=\"/\"):\n current.session.token = self._CAS_login()\n return next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L70_C8", "label": "current.session.token = _CAS_login()", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L69_C4", "vector": [14, 2, 0.4861, 0.0069, 2, 0.45, 0.0, 539, 3, 0, 0, 0, 891, 10, 1], "semantic": {"name": "current.session.token", "arg_names": [], "import_names": [], "rhs_call_name": "_CAS_login", "annotation": ""}, "snippet": " current.session.token = self._CAS_login()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Return_L71_C8", "label": "return", "type": "return", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L69_C4", "vector": [13, 2, 0.4931, 0.0069, 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 next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L73_C4", "label": "logout_url", "type": "function", "loc": [73, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:ClassDef_L15_C0", "vector": [2, 1, 0.5208, 0.0347, 1, 0.04, 0.5, 181, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "logout_url", "arg_names": ["self", "next"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def logout_url(self, next=\"/\"):\n current.session.token = None\n current.session.auth = None\n self._CAS_logout()\n return next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L74_C8", "label": "current.session.token =", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L73_C4", "vector": [14, 2, 0.5139, 0.0069, 2, 0.08, 0.0, 539, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "current.session.token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " current.session.token = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L75_C8", "label": "current.session.auth =", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L73_C4", "vector": [14, 2, 0.5208, 0.0069, 2, 0.08, 0.3333, 262, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "current.session.auth", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " current.session.auth = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Expr_L76_C8", "label": "_CAS_logout()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L73_C4", "vector": [8, 2, 0.5278, 0.0069, 2, 0.08, 0.6667, 926, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_CAS_logout", "arg_names": [], "import_names": [], "rhs_call_name": "_CAS_logout", "annotation": ""}, "snippet": " self._CAS_logout()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Return_L77_C8", "label": "return", "type": "return", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L73_C4", "vector": [13, 2, 0.5347, 0.0069, 2, 0.08, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L79_C4", "label": "get_user", "type": "function", "loc": [79, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:ClassDef_L15_C0", "vector": [2, 1, 0.5729, 0.0556, 1, 0.04, 0.6667, 174, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_user", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_user(self):\n user = current.session.token\n if user:\n d = {'source': 'web2py cas'}\n for key in self.maps:\n d[key] = self.maps[key](user)\n return d\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L80_C8", "label": "user =", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L79_C4", "vector": [14, 2, 0.5556, 0.0069, 2, 0.12, 0.0, 503, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user = current.session.token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:If_L81_C8", "label": "if", "type": "if", "loc": [81, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L79_C4", "vector": [4, 2, 0.5764, 0.0347, 2, 0.12, 0.5, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user:\n d = {'source': 'web2py cas'}\n for key in self.maps:\n d[key] = self.maps[key](user)\n return d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L82_C12", "label": "d =", "type": "assigned_variable", "loc": [82, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L81_C8", "vector": [14, 3, 0.5694, 0.0069, 3, 0.9, 0.0, 355, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d = {'source': 'web2py cas'}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:For_L83_C12", "label": "for key", "type": "for", "loc": [83, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L81_C8", "vector": [6, 3, 0.5799, 0.0139, 3, 0.9, 0.5, 230, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key in self.maps:\n d[key] = self.maps[key](user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L84_C16", "label": "assign", "type": "assigned_variable", "loc": [84, 84], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:For_L83_C12", "vector": [14, 4, 0.5833, 0.0069, 4, 0.43, 0.0, 0, 3, 1, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d[key] = self.maps[key](user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Return_L85_C12", "label": "return", "type": "return", "loc": [85, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L81_C8", "vector": [13, 3, 0.5903, 0.0069, 3, 0.9, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Return_L86_C8", "label": "return", "type": "return", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L79_C4", "vector": [13, 2, 0.5972, 0.0069, 2, 0.12, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L88_C4", "label": "_CAS_login", "type": "function", "loc": [88, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:ClassDef_L15_C0", "vector": [2, 1, 0.7778, 0.3403, 1, 0.04, 0.8333, 891, 0, 1, 1, 0, 0, 0, 20], "semantic": {"name": "_CAS_login", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _CAS_login(self):\n \"\"\"\n exposed as CAS.login(request)\n returns a token on success, None on failed authentication\n \"\"\"\n import urllib\n self.ticket = current.request.vars.ticket\n if not current.request.vars.ticket:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Expr_L89_C8", "label": "expression", "type": "expression", "loc": [89, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L88_C4", "vector": [8, 2, 0.6285, 0.0278, 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 exposed as CAS.login(request)\n returns a token on success, None on failed authentication\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Import_L93_C8", "label": "urllib import urllib", "type": "import", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L88_C4", "vector": [1, 2, 0.6458, 0.0069, 2, 0.18, 0.3333, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "urllib", "arg_names": [], "import_names": ["urllib"], "rhs_call_name": "", "annotation": ""}, "snippet": " import urllib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L94_C8", "label": "self.ticket =", "type": "assigned_variable", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L88_C4", "vector": [14, 2, 0.6528, 0.0069, 2, 0.18, 0.6667, 735, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.ticket", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ticket = current.request.vars.ticket"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:If_L95_C8", "label": "if", "type": "if", "loc": [95, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L88_C4", "vector": [4, 2, 0.8021, 0.2917, 2, 0.18, 1.0, 0, 0, 0, 0, 0, 0, 0, 20], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not current.request.vars.ticket:\n redirect(\"%s?service=%s\" % (self.cas_login_url,\n self.cas_my_url))\n else:\n url = \"%s?service=%s&ticket=%s\" % (self.cas_check_url,\n self.cas_my_url,\n self.ticket)\n data = urllib.urlopen(url).read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Expr_L96_C12", "label": "redirect()", "type": "expression", "loc": [96, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L95_C8", "vector": [8, 3, 0.6701, 0.0139, 3, 0.33, 0.0, 206, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(\"%s?service=%s\" % (self.cas_login_url,\n self.cas_my_url))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L99_C12", "label": "url =", "type": "assigned_variable", "loc": [99, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L95_C8", "vector": [14, 3, 0.6944, 0.0208, 3, 0.33, 0.1429, 789, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = \"%s?service=%s&ticket=%s\" % (self.cas_check_url,\n self.cas_my_url,\n self.ticket)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L102_C12", "label": "data = read()", "type": "assigned_variable", "loc": [102, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L95_C8", "vector": [14, 3, 0.7083, 0.0069, 3, 0.33, 0.2857, 929, 3, 0, 0, 0, 453, 10, 2], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " data = urllib.urlopen(url).read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:If_L103_C12", "label": "if", "type": "if", "loc": [103, 114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L95_C8", "vector": [4, 3, 0.7535, 0.0833, 3, 0.33, 0.4286, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if data.startswith('yes') or data.startswith('no'):\n data = data.split('\\n')\n if data[0] == 'yes':\n if ':' in data[1]: # for Compatibility with Custom CAS\n items = data[1].split(':')\n a = items[0]\n b = len(items) > 1 and items[1] or a\n c = len(items) > 2 and items[2] or b"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L104_C16", "label": "data = split()", "type": "assigned_variable", "loc": [104, 104], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L103_C12", "vector": [14, 4, 0.7222, 0.0069, 4, 0.29, 0.0, 929, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " data = data.split('\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:If_L105_C16", "label": "if", "type": "if", "loc": [105, 113], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L103_C12", "vector": [4, 4, 0.7569, 0.0625, 4, 0.29, 0.5, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if data[0] == 'yes':\n if ':' in data[1]: # for Compatibility with Custom CAS\n items = data[1].split(':')\n a = items[0]\n b = len(items) > 1 and items[1] or a\n c = len(items) > 2 and items[2] or b\n else:\n a = b = c = data[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:If_L106_C20", "label": "if", "type": "if", "loc": [106, 112], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L105_C16", "vector": [4, 5, 0.7569, 0.0486, 5, 0.77, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ':' in data[1]: # for Compatibility with Custom CAS\n items = data[1].split(':')\n a = items[0]\n b = len(items) > 1 and items[1] or a\n c = len(items) > 2 and items[2] or b\n else:\n a = b = c = data[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L107_C24", "label": "items = split()", "type": "assigned_variable", "loc": [107, 107], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L106_C20", "vector": [14, 6, 0.7431, 0.0069, 6, 0.35, 0.0, 339, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " items = data[1].split(':')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L108_C24", "label": "a =", "type": "assigned_variable", "loc": [108, 108], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L106_C20", "vector": [14, 6, 0.75, 0.0069, 6, 0.35, 0.25, 475, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " a = items[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L109_C24", "label": "b =", "type": "assigned_variable", "loc": [109, 109], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L106_C20", "vector": [14, 6, 0.7569, 0.0069, 6, 0.35, 0.5, 756, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " b = len(items) > 1 and items[1] or a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L110_C24", "label": "c =", "type": "assigned_variable", "loc": [110, 110], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L106_C20", "vector": [14, 6, 0.7639, 0.0069, 6, 0.35, 0.75, 411, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c = len(items) > 2 and items[2] or b"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L112_C24", "label": "a =", "type": "assigned_variable", "loc": [112, 112], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L106_C20", "vector": [14, 6, 0.7778, 0.0069, 6, 0.35, 1.0, 475, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " a = b = c = data[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Return_L113_C20", "label": "return", "type": "return", "loc": [113, 113], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L105_C16", "vector": [13, 5, 0.7847, 0.0069, 5, 0.77, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict(user=a, email=b, username=c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Return_L114_C16", "label": "return", "type": "return", "loc": [114, 114], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L103_C12", "vector": [13, 4, 0.7917, 0.0069, 4, 0.29, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Import_L115_C12", "label": "xml.dom.minidom import dom", "type": "import", "loc": [115, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L95_C8", "vector": [1, 3, 0.7986, 0.0069, 3, 0.33, 0.5714, 770, 0, 1, 0, 0, 770, 0, 0], "semantic": {"name": "xml.dom.minidom", "arg_names": [], "import_names": ["dom"], "rhs_call_name": "", "annotation": ""}, "snippet": " import xml.dom.minidom as dom"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Import_L116_C12", "label": "xml.parsers.expat import expat", "type": "import", "loc": [116, 116], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L95_C8", "vector": [1, 3, 0.8056, 0.0069, 3, 0.33, 0.7143, 573, 0, 1, 0, 0, 573, 0, 0], "semantic": {"name": "xml.parsers.expat", "arg_names": [], "import_names": ["expat"], "rhs_call_name": "", "annotation": ""}, "snippet": " import xml.parsers.expat as expat"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Try_L117_C12", "label": "try", "type": "try", "loc": [117, 135], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L95_C8", "vector": [7, 3, 0.875, 0.1319, 3, 0.33, 0.8571, 0, 0, 1, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n dxml = dom.parseString(data)\n envelop = dxml.getElementsByTagName(\n \"cas:authenticationSuccess\")\n if len(envelop) > 0:\n res = dict()\n for x in envelop[0].childNodes:\n if x.nodeName.startswith('cas:') and len(x.childNodes):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L118_C16", "label": "dxml = parseString()", "type": "assigned_variable", "loc": [118, 118], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:Try_L117_C12", "vector": [14, 4, 0.8194, 0.0069, 4, 0.7, 0.0, 334, 3, 1, 0, 0, 491, 10, 1], "semantic": {"name": "dxml", "arg_names": [], "import_names": [], "rhs_call_name": "parseString", "annotation": ""}, "snippet": " dxml = dom.parseString(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L119_C16", "label": "envelop = getElementsByTagName()", "type": "assigned_variable", "loc": [119, 120], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:Try_L117_C12", "vector": [14, 4, 0.8299, 0.0139, 4, 0.7, 0.5, 622, 3, 1, 0, 0, 989, 10, 1], "semantic": {"name": "envelop", "arg_names": [], "import_names": [], "rhs_call_name": "getElementsByTagName", "annotation": ""}, "snippet": " envelop = dxml.getElementsByTagName(\n \"cas:authenticationSuccess\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:If_L121_C16", "label": "if", "type": "if", "loc": [121, 133], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:Try_L117_C12", "vector": [4, 4, 0.8819, 0.0903, 4, 0.7, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(envelop) > 0:\n res = dict()\n for x in envelop[0].childNodes:\n if x.nodeName.startswith('cas:') and len(x.childNodes):\n key = x.nodeName[4:].encode('utf8')\n value = x.childNodes[0].nodeValue.encode('utf8')\n if not key in res:\n res[key] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L122_C20", "label": "res = dict()", "type": "assigned_variable", "loc": [122, 122], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L121_C16", "vector": [14, 5, 0.8472, 0.0069, 5, 0.4, 0.0, 413, 3, 0, 0, 0, 827, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " res = dict()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:For_L123_C20", "label": "for x", "type": "for", "loc": [123, 132], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L121_C16", "vector": [6, 5, 0.8854, 0.0694, 5, 0.4, 0.5, 190, 7, 0, 0, 0, 0, 0, 6], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for x in envelop[0].childNodes:\n if x.nodeName.startswith('cas:') and len(x.childNodes):\n key = x.nodeName[4:].encode('utf8')\n value = x.childNodes[0].nodeValue.encode('utf8')\n if not key in res:\n res[key] = value\n else:\n if not isinstance(res[key], list):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:If_L124_C24", "label": "if", "type": "if", "loc": [124, 132], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:For_L123_C20", "vector": [4, 6, 0.8889, 0.0625, 6, 0.37, 0.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if x.nodeName.startswith('cas:') and len(x.childNodes):\n key = x.nodeName[4:].encode('utf8')\n value = x.childNodes[0].nodeValue.encode('utf8')\n if not key in res:\n res[key] = value\n else:\n if not isinstance(res[key], list):\n res[key] = [res[key]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L125_C28", "label": "key = encode()", "type": "assigned_variable", "loc": [125, 125], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L124_C24", "vector": [14, 7, 0.8681, 0.0069, 7, 0.08, 0.0, 230, 3, 1, 0, 0, 623, 10, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": " key = x.nodeName[4:].encode('utf8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L126_C28", "label": "value = encode()", "type": "assigned_variable", "loc": [126, 126], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L124_C24", "vector": [14, 7, 0.875, 0.0069, 7, 0.08, 0.5, 441, 3, 1, 0, 0, 623, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": " value = x.childNodes[0].nodeValue.encode('utf8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:If_L127_C28", "label": "if", "type": "if", "loc": [127, 132], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L124_C24", "vector": [4, 7, 0.8993, 0.0417, 7, 0.08, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not key in res:\n res[key] = value\n else:\n if not isinstance(res[key], list):\n res[key] = [res[key]]\n res[key].append(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L128_C32", "label": "assign", "type": "assigned_variable", "loc": [128, 128], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L127_C28", "vector": [14, 8, 0.8889, 0.0069, 8, 0.34, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res[key] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:If_L130_C32", "label": "if", "type": "if", "loc": [130, 131], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L127_C28", "vector": [4, 8, 0.9062, 0.0139, 8, 0.34, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(res[key], list):\n res[key] = [res[key]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L131_C36", "label": "assign", "type": "assigned_variable", "loc": [131, 131], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L130_C32", "vector": [14, 9, 0.9097, 0.0069, 9, 0.2, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res[key] = [res[key]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Expr_L132_C32", "label": "append()", "type": "expression", "loc": [132, 132], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L127_C28", "vector": [8, 8, 0.9167, 0.0069, 8, 0.34, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " res[key].append(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Return_L133_C20", "label": "return", "type": "return", "loc": [133, 133], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L121_C16", "vector": [13, 5, 0.9236, 0.0069, 5, 0.4, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Return_L136_C12", "label": "return", "type": "return", "loc": [136, 136], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:If_L95_C8", "vector": [13, 3, 0.9444, 0.0069, 3, 0.33, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None # fallback"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L138_C4", "label": "_CAS_logout", "type": "function", "loc": [138, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:ClassDef_L15_C0", "vector": [2, 1, 0.9792, 0.0486, 1, 0.04, 1.0, 926, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_CAS_logout", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _CAS_logout(self):\n \"\"\"\n exposed CAS.logout()\n redirects to the CAS logout page\n \"\"\"\n import urllib\n redirect(\"%s?service=%s\" % (self.cas_logout_url, self.cas_my_url))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Expr_L139_C8", "label": "expression", "type": "expression", "loc": [139, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L138_C4", "vector": [8, 2, 0.9757, 0.0278, 2, 0.02, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n exposed CAS.logout()\n redirects to the CAS logout page\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_496:Import_L143_C8", "label": "urllib import urllib", "type": "import", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L138_C4", "vector": [1, 2, 0.9931, 0.0069, 2, 0.02, 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_496:Expr_L144_C8", "label": "redirect()", "type": "expression", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L138_C4", "vector": [8, 2, 1.0, 0.0069, 2, 0.02, 1.0, 206, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(\"%s?service=%s\" % (self.cas_logout_url, self.cas_my_url))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_496:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:If_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L60_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:If_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L63_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L62_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L65_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Return_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Expr_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Return_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:If_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L81_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L82_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L81_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_496:For_L83_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:For_L83_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L84_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L81_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Return_L85_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Return_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Expr_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Import_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L88_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:If_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L95_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Expr_L96_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L95_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L99_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L95_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L102_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L95_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_496:If_L103_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L103_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L104_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L103_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_496:If_L105_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L105_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_496:If_L106_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L106_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L107_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L106_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L108_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L106_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L109_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L106_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L110_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L106_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L112_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L105_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Return_L113_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L103_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Return_L114_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L95_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Import_L115_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L95_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Import_L116_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L95_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Try_L117_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:Try_L117_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L118_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:Try_L117_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L119_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:Try_L117_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_496:If_L121_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L121_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L122_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L121_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_496:For_L123_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:For_L123_C20", "t": "ajibawa-2023/Python-Code-Large/train/row_496:If_L124_C24"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L124_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L125_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L124_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L126_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L124_C24", "t": "ajibawa-2023/Python-Code-Large/train/row_496:If_L127_C28"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L127_C28", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L128_C32"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L127_C28", "t": "ajibawa-2023/Python-Code-Large/train/row_496:If_L130_C32"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L130_C32", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Assign_L131_C36"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L127_C28", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Expr_L132_C32"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L121_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Return_L133_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:If_L95_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Return_L136_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Expr_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Import_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_496:FunctionDef_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_496:Expr_L144_C8"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Loginza.ru authentication for web2py
Developed by Vladimir Dronnikov (Copyright © 2011)
Email <dronnikov@gmail.com>
"""
import urllib
from gluon.html import *
from gluon.tools import fetch
from gluon.storage import Storage
import gluon.contrib.simplejson as json
class Loginza(object):
"""
from gluon.contrib.login_methods.loginza import Loginza
auth.settings.login_form = Loginza(request,
url = "http://localhost:8000/%s/default/user/login" % request.application)
"""
def __init__(self,
request,
url="",
embed=True,
auth_url="http://loginza.ru/api/authinfo",
language="en",
prompt="loginza",
on_login_failure=None,
):
self.request = request
self.token_url = url
self.embed = embed
self.auth_url = auth_url
self.language = language
self.prompt = prompt
self.profile = None
self.on_login_failure = on_login_failure
self.mappings = Storage()
# TODO: profile.photo is the URL to the picture
# Howto download and store it locally?
# FIXME: what if email is unique=True
self.mappings["http://twitter.com/"] = lambda profile:\
dict(registration_id=profile.get("identity", ""),
username=profile.get("nickname", ""),
email=profile.get("email", ""),
last_name=profile.get("name", "").get("full_name", ""),
#avatar = profile.get("photo",""),
)
self.mappings["https://www.google.com/accounts/o8/ud"] = lambda profile:\
dict(registration_id=profile.get("identity", ""),
username=profile.get("name", "").get("full_name", ""),
email=profile.get("email", ""),
first_name=profile.get("name", "").get("first_name", ""),
last_name=profile.get("name", "").get("last_name", ""),
#avatar = profile.get("photo",""),
)
self.mappings["http://vkontakte.ru/"] = lambda profile:\
dict(registration_id=profile.get("identity", ""),
username=profile.get("name", "").get("full_name", ""),
email=profile.get("email", ""),
first_name=profile.get("name", "").get("first_name", ""),
last_name=profile.get("name", "").get("last_name", ""),
#avatar = profile.get("photo",""),
)
self.mappings.default = lambda profile:\
dict(registration_id=profile.get("identity", ""),
username=profile.get("name", "").get("full_name"),
email=profile.get("email", ""),
first_name=profile.get("name", "").get("first_name", ""),
last_name=profile.get("name", "").get("last_name", ""),
#avatar = profile.get("photo",""),
)
def get_user(self):
request = self.request
if request.vars.token:
user = Storage()
data = urllib.urlencode(dict(token=request.vars.token))
auth_info_json = fetch(self.auth_url + '?' + data)
#print auth_info_json
auth_info = json.loads(auth_info_json)
if auth_info["identity"] is not None:
self.profile = auth_info
provider = self.profile["provider"]
user = self.mappings.get(
provider, self.mappings.default)(self.profile)
#user["password"] = ???
#user["avatar"] = ???
return user
elif self.on_login_failure:
redirect(self.on_login_failure)
return None
def login_form(self):
request = self.request
args = request.args
LOGINZA_URL = "https://loginza.ru/api/widget?lang=%s&token_url=%s&overlay=loginza"
if self.embed:
form = IFRAME(_src=LOGINZA_URL % (self.language, self.token_url),
_scrolling="no",
_frameborder="no",
_style="width:359px;height:300px;")
else:
form = DIV(
A(self.prompt, _href=LOGINZA_URL % (
self.language, self.token_url), _class="loginza"),
SCRIPT(_src="https://s3-eu-west-1.amazonaws.com/s1.loginza.ru/js/widget.js", _type="text/javascript"))
return form
| ajibawa-2023/Python-Code-Large/train/row_497 | 45 | 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_497:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 8], "level": 0, "parent": null, "vector": [8, 0, 0.0522, 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": "\"\"\"\n Loginza.ru authentication for web2py\n Developed by Vladimir Dronnikov (Copyright \u00a9 2011)\n Email <dronnikov@gmail.com>\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Import_L10_C0", "label": "urllib import urllib", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.087, 0.0087, 0, 0.66, 0.1667, 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_497:ImportFrom_L11_C0", "label": "from gluon.html import *", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0957, 0.0087, 0, 0.66, 0.3333, 373, 0, 1, 0, 0, 373, 0, 0], "semantic": {"name": "gluon.html", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.html import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:ImportFrom_L12_C0", "label": "from gluon.tools import fetch", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.1043, 0.0087, 0, 0.66, 0.5, 322, 0, 1, 0, 0, 322, 0, 0], "semantic": {"name": "gluon.tools", "arg_names": [], "import_names": ["fetch"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.tools import fetch"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:ImportFrom_L13_C0", "label": "from gluon.storage import Storage", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.113, 0.0087, 0, 0.66, 0.6667, 696, 0, 1, 0, 0, 696, 0, 0], "semantic": {"name": "gluon.storage", "arg_names": [], "import_names": ["Storage"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.storage import Storage"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Import_L14_C0", "label": "gluon.contrib.simplejson import json", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1217, 0.0087, 0, 0.66, 0.8333, 611, 0, 1, 0, 0, 611, 0, 0], "semantic": {"name": "gluon.contrib.simplejson", "arg_names": [], "import_names": ["json"], "rhs_call_name": "", "annotation": ""}, "snippet": "import gluon.contrib.simplejson as json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:ClassDef_L17_C0", "label": "Loginza", "type": "class", "loc": [17, 115], "level": 0, "parent": null, "vector": [3, 0, 0.5739, 0.8609, 0, 0.66, 1.0, 112, 0, 3, 0, 0, 186, 0, 46], "semantic": {"name": "Loginza", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Loginza(object):\n\n \"\"\"\n from gluon.contrib.login_methods.loginza import Loginza\n auth.settings.login_form = Loginza(request,\n url = \"http://localhost:8000/%s/default/user/login\" % request.application)\n \"\"\"\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Expr_L19_C4", "label": "expression", "type": "expression", "loc": [19, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:ClassDef_L17_C0", "vector": [8, 1, 0.1826, 0.0435, 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 from gluon.contrib.login_methods.loginza import Loginza\n auth.settings.login_form = Loginza(request,\n url = \"http://localhost:8000/%s/default/user/login\" % request.application)\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "label": "__init__", "type": "function", "loc": [25, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:ClassDef_L17_C0", "vector": [2, 1, 0.4522, 0.4783, 1, 0.0, 0.3333, 555, 0, 8, 0, 0, 0, 0, 34], "semantic": {"name": "__init__", "arg_names": ["self", "request", "url", "embed", "auth_url", "language", "prompt", "on_login_failure"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self,\n request,\n url=\"\",\n embed=True,\n auth_url=\"http://loginza.ru/api/authinfo\",\n language=\"en\",\n prompt=\"loginza\",\n on_login_failure=None,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L35_C8", "label": "self.request =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "vector": [14, 2, 0.3043, 0.0087, 2, 0.12, 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_497:Assign_L36_C8", "label": "self.token_url =", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "vector": [14, 2, 0.313, 0.0087, 2, 0.12, 0.0833, 81, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.token_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.token_url = url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L37_C8", "label": "self.embed =", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "vector": [14, 2, 0.3217, 0.0087, 2, 0.12, 0.1667, 945, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.embed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.embed = embed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L38_C8", "label": "self.auth_url =", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "vector": [14, 2, 0.3304, 0.0087, 2, 0.12, 0.25, 649, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.auth_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.auth_url = auth_url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L39_C8", "label": "self.language =", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "vector": [14, 2, 0.3391, 0.0087, 2, 0.12, 0.3333, 164, 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_497:Assign_L40_C8", "label": "self.prompt =", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "vector": [14, 2, 0.3478, 0.0087, 2, 0.12, 0.4167, 198, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.prompt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.prompt = prompt"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L41_C8", "label": "self.profile =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "vector": [14, 2, 0.3565, 0.0087, 2, 0.12, 0.5, 43, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.profile", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.profile = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L42_C8", "label": "self.on_login_failure =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "vector": [14, 2, 0.3652, 0.0087, 2, 0.12, 0.5833, 75, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.on_login_failure", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.on_login_failure = on_login_failure"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L43_C8", "label": "self.mappings = Storage()", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "vector": [14, 2, 0.3739, 0.0087, 2, 0.12, 0.6667, 708, 3, 0, 0, 0, 850, 10, 1], "semantic": {"name": "self.mappings", "arg_names": [], "import_names": [], "rhs_call_name": "Storage", "annotation": ""}, "snippet": " self.mappings = Storage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L49_C8", "label": "assign", "type": "assigned_variable", "loc": [49, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "vector": [14, 2, 0.4522, 0.0609, 2, 0.12, 0.75, 0, 9, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mappings[\"http://twitter.com/\"] = lambda profile:\\\n dict(registration_id=profile.get(\"identity\", \"\"),\n username=profile.get(\"nickname\", \"\"),\n email=profile.get(\"email\", \"\"),\n last_name=profile.get(\"name\", \"\").get(\"full_name\", \"\"),\n #avatar = profile.get(\"photo\",\"\"),\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L56_C8", "label": "assign", "type": "assigned_variable", "loc": [56, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "vector": [14, 2, 0.5174, 0.0696, 2, 0.12, 0.8333, 0, 9, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mappings[\"https://www.google.com/accounts/o8/ud\"] = lambda profile:\\\n dict(registration_id=profile.get(\"identity\", \"\"),\n username=profile.get(\"name\", \"\").get(\"full_name\", \"\"),\n email=profile.get(\"email\", \"\"),\n first_name=profile.get(\"name\", \"\").get(\"first_name\", \"\"),\n last_name=profile.get(\"name\", \"\").get(\"last_name\", \"\"),\n #avatar = profile.get(\"photo\",\"\"),\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L64_C8", "label": "assign", "type": "assigned_variable", "loc": [64, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "vector": [14, 2, 0.587, 0.0696, 2, 0.12, 0.9167, 0, 9, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mappings[\"http://vkontakte.ru/\"] = lambda profile:\\\n dict(registration_id=profile.get(\"identity\", \"\"),\n username=profile.get(\"name\", \"\").get(\"full_name\", \"\"),\n email=profile.get(\"email\", \"\"),\n first_name=profile.get(\"name\", \"\").get(\"first_name\", \"\"),\n last_name=profile.get(\"name\", \"\").get(\"last_name\", \"\"),\n #avatar = profile.get(\"photo\",\"\"),\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L72_C8", "label": "self.mappings.default =", "type": "assigned_variable", "loc": [72, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "vector": [14, 2, 0.6565, 0.0696, 2, 0.12, 1.0, 515, 9, 0, 0, 0, 0, 0, 9], "semantic": {"name": "self.mappings.default", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mappings.default = lambda profile:\\\n dict(registration_id=profile.get(\"identity\", \"\"),\n username=profile.get(\"name\", \"\").get(\"full_name\"),\n email=profile.get(\"email\", \"\"),\n first_name=profile.get(\"name\", \"\").get(\"first_name\", \"\"),\n last_name=profile.get(\"name\", \"\").get(\"last_name\", \"\"),\n #avatar = profile.get(\"photo\",\"\"),\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L81_C4", "label": "get_user", "type": "function", "loc": [81, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:ClassDef_L17_C0", "vector": [2, 1, 0.7826, 0.1652, 1, 0.0, 0.6667, 174, 0, 1, 1, 0, 0, 0, 8], "semantic": {"name": "get_user", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_user(self):\n request = self.request\n if request.vars.token:\n user = Storage()\n data = urllib.urlencode(dict(token=request.vars.token))\n auth_info_json = fetch(self.auth_url + '?' + data)\n #print auth_info_json\n auth_info = json.loads(auth_info_json)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L82_C8", "label": "request =", "type": "assigned_variable", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L81_C4", "vector": [14, 2, 0.713, 0.0087, 2, 0.59, 0.0, 50, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request = self.request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:If_L83_C8", "label": "if", "type": "if", "loc": [83, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L81_C4", "vector": [4, 2, 0.787, 0.1391, 2, 0.59, 0.5, 0, 7, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.vars.token:\n user = Storage()\n data = urllib.urlencode(dict(token=request.vars.token))\n auth_info_json = fetch(self.auth_url + '?' + data)\n #print auth_info_json\n auth_info = json.loads(auth_info_json)\n if auth_info[\"identity\"] is not None:\n self.profile = auth_info"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L84_C12", "label": "user = Storage()", "type": "assigned_variable", "loc": [84, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:If_L83_C8", "vector": [14, 3, 0.7304, 0.0087, 3, 0.81, 0.0, 503, 3, 0, 0, 0, 850, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "Storage", "annotation": ""}, "snippet": " user = Storage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L85_C12", "label": "data = urlencode()", "type": "assigned_variable", "loc": [85, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:If_L83_C8", "vector": [14, 3, 0.7391, 0.0087, 3, 0.81, 0.25, 929, 3, 1, 0, 0, 414, 10, 2], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "urlencode", "annotation": ""}, "snippet": " data = urllib.urlencode(dict(token=request.vars.token))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L86_C12", "label": "auth_info_json = fetch()", "type": "assigned_variable", "loc": [86, 86], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:If_L83_C8", "vector": [14, 3, 0.7478, 0.0087, 3, 0.81, 0.5, 790, 3, 1, 0, 0, 587, 10, 1], "semantic": {"name": "auth_info_json", "arg_names": [], "import_names": [], "rhs_call_name": "fetch", "annotation": ""}, "snippet": " auth_info_json = fetch(self.auth_url + '?' + data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L88_C12", "label": "auth_info = loads()", "type": "assigned_variable", "loc": [88, 88], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:If_L83_C8", "vector": [14, 3, 0.7652, 0.0087, 3, 0.81, 0.75, 78, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "auth_info", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": " auth_info = json.loads(auth_info_json)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:If_L89_C12", "label": "if", "type": "if", "loc": [89, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:If_L83_C8", "vector": [4, 3, 0.813, 0.087, 3, 0.81, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if auth_info[\"identity\"] is not None:\n self.profile = auth_info\n provider = self.profile[\"provider\"]\n user = self.mappings.get(\n provider, self.mappings.default)(self.profile)\n #user[\"password\"] = ???\n #user[\"avatar\"] = ???\n return user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L90_C16", "label": "self.profile =", "type": "assigned_variable", "loc": [90, 90], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:If_L89_C12", "vector": [14, 4, 0.7826, 0.0087, 4, 0.51, 0.0, 43, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.profile", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.profile = auth_info"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L91_C16", "label": "provider =", "type": "assigned_variable", "loc": [91, 91], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:If_L89_C12", "vector": [14, 4, 0.7913, 0.0087, 4, 0.51, 0.25, 736, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "provider", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " provider = self.profile[\"provider\"]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L92_C16", "label": "user =", "type": "assigned_variable", "loc": [92, 93], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:If_L89_C12", "vector": [14, 4, 0.8043, 0.0174, 4, 0.51, 0.5, 503, 3, 1, 0, 0, 0, 10, 2], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user = self.mappings.get(\n provider, self.mappings.default)(self.profile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Return_L96_C16", "label": "return", "type": "return", "loc": [96, 96], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:If_L89_C12", "vector": [13, 4, 0.8348, 0.0087, 4, 0.51, 0.75, 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_497:If_L97_C12", "label": "if", "type": "if", "loc": [97, 98], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:If_L89_C12", "vector": [4, 4, 0.8478, 0.0174, 4, 0.51, 1.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif self.on_login_failure:\n redirect(self.on_login_failure)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Expr_L98_C16", "label": "redirect()", "type": "expression", "loc": [98, 98], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:If_L97_C12", "vector": [8, 5, 0.8522, 0.0087, 5, 0.89, 0.0, 206, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " redirect(self.on_login_failure)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Return_L99_C8", "label": "return", "type": "return", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L81_C4", "vector": [13, 2, 0.8609, 0.0087, 2, 0.59, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L101_C4", "label": "login_form", "type": "function", "loc": [101, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:ClassDef_L17_C0", "vector": [2, 1, 0.9391, 0.1304, 1, 0.0, 1.0, 289, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "login_form", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def login_form(self):\n request = self.request\n args = request.args\n LOGINZA_URL = \"https://loginza.ru/api/widget?lang=%s&token_url=%s&overlay=loginza\"\n if self.embed:\n form = IFRAME(_src=LOGINZA_URL % (self.language, self.token_url),\n _scrolling=\"no\",\n _frameborder=\"no\","}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L102_C8", "label": "request =", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L101_C4", "vector": [14, 2, 0.887, 0.0087, 2, 0.11, 0.0, 50, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request = self.request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L103_C8", "label": "args =", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L101_C4", "vector": [14, 2, 0.8957, 0.0087, 2, 0.11, 0.25, 805, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = request.args"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L104_C8", "label": "LOGINZA_URL =", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L101_C4", "vector": [14, 2, 0.9043, 0.0087, 2, 0.11, 0.5, 61, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "LOGINZA_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " LOGINZA_URL = \"https://loginza.ru/api/widget?lang=%s&token_url=%s&overlay=loginza\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:If_L105_C8", "label": "if", "type": "if", "loc": [105, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L101_C4", "vector": [4, 2, 0.9522, 0.087, 2, 0.11, 0.75, 0, 7, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.embed:\n form = IFRAME(_src=LOGINZA_URL % (self.language, self.token_url),\n _scrolling=\"no\",\n _frameborder=\"no\",\n _style=\"width:359px;height:300px;\")\n else:\n form = DIV(\n A(self.prompt, _href=LOGINZA_URL % ("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L106_C12", "label": "form = IFRAME()", "type": "assigned_variable", "loc": [106, 109], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:If_L105_C8", "vector": [14, 3, 0.9348, 0.0348, 3, 0.37, 0.0, 761, 3, 4, 0, 0, 37, 10, 1], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "IFRAME", "annotation": ""}, "snippet": " form = IFRAME(_src=LOGINZA_URL % (self.language, self.token_url),\n _scrolling=\"no\",\n _frameborder=\"no\",\n _style=\"width:359px;height:300px;\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L111_C12", "label": "form = DIV()", "type": "assigned_variable", "loc": [111, 114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:If_L105_C8", "vector": [14, 3, 0.9783, 0.0348, 3, 0.37, 1.0, 761, 3, 2, 0, 0, 697, 10, 3], "semantic": {"name": "form", "arg_names": [], "import_names": [], "rhs_call_name": "DIV", "annotation": ""}, "snippet": " form = DIV(\n A(self.prompt, _href=LOGINZA_URL % (\n self.language, self.token_url), _class=\"loginza\"),\n SCRIPT(_src=\"https://s3-eu-west-1.amazonaws.com/s1.loginza.ru/js/widget.js\", _type=\"text/javascript\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_497:Return_L115_C8", "label": "return", "type": "return", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L101_C4", "vector": [13, 2, 1.0, 0.0087, 2, 0.11, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return form"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_497:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L82_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_497:If_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:If_L83_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L84_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:If_L83_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L85_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:If_L83_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L86_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:If_L83_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L88_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:If_L83_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_497:If_L89_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:If_L89_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L90_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:If_L89_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L91_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:If_L89_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L92_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:If_L89_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Return_L96_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:If_L89_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_497:If_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:If_L97_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Expr_L98_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L81_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Return_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:ClassDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_497:If_L105_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:If_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L106_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:If_L105_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Assign_L111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_497:FunctionDef_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_497:Return_L115_C8"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Written by Michele Comitini <mcm@glisco.it>
License: GPL v3
Adds support for OAuth1.0a authentication to web2py.
Dependencies:
- python-oauth2 (http://github.com/simplegeo/python-oauth2)
"""
import oauth2 as oauth
import cgi
from urllib import urlencode
from gluon import current
class OAuthAccount(object):
"""
Login will be done via OAuth Framework, instead of web2py's
login form.
Include in your model (eg db.py)::
# define the auth_table before call to auth.define_tables()
auth_table = db.define_table(
auth.settings.table_user_name,
Field('first_name', length=128, default=""),
Field('last_name', length=128, default=""),
Field('username', length=128, default="", unique=True),
Field('password', 'password', length=256,
readable=False, label='Password'),
Field('registration_key', length=128, default= "",
writable=False, readable=False))
auth_table.username.requires = IS_NOT_IN_DB(db, auth_table.username)
.
.
.
auth.define_tables()
.
.
.
CLIENT_ID=\"<put your fb application id here>\"
CLIENT_SECRET=\"<put your fb application secret here>\"
AUTH_URL="..."
TOKEN_URL="..."
ACCESS_TOKEN_URL="..."
from gluon.contrib.login_methods.oauth10a_account import OAuthAccount
auth.settings.login_form=OAuthAccount(globals(
),CLIENT_ID,CLIENT_SECRET, AUTH_URL, TOKEN_URL, ACCESS_TOKEN_URL)
"""
def __redirect_uri(self, next=None):
"""Build the uri used by the authenticating server to redirect
the client back to the page originating the auth request.
Appends the _next action to the generated url so the flows continues.
"""
r = self.request
http_host = r.env.http_host
url_scheme = r.env.wsgi_url_scheme
if next:
path_info = next
else:
path_info = r.env.path_info
uri = '%s://%s%s' % (url_scheme, http_host, path_info)
if r.get_vars and not next:
uri += '?' + urlencode(r.get_vars)
return uri
def accessToken(self):
"""Return the access token generated by the authenticating server.
If token is already in the session that one will be used.
Otherwise the token is fetched from the auth server.
"""
if self.session.access_token:
# return the token (TODO: does it expire?)
return self.session.access_token
if self.session.request_token:
# Exchange the request token with an authorization token.
token = self.session.request_token
self.session.request_token = None
# Build an authorized client
# OAuth1.0a put the verifier!
token.set_verifier(self.request.vars.oauth_verifier)
client = oauth.Client(self.consumer, token)
resp, content = client.request(self.access_token_url, "POST")
if str(resp['status']) != '200':
self.session.request_token = None
self.globals['redirect'](self.globals[
'URL'](f='user', args='logout'))
self.session.access_token = oauth.Token.from_string(content)
return self.session.access_token
self.session.access_token = None
return None
def __init__(self, g, client_id, client_secret, auth_url, token_url, access_token_url):
self.globals = g
self.client_id = client_id
self.client_secret = client_secret
self.code = None
self.request = current.request
self.session = current.session
self.auth_url = auth_url
self.token_url = token_url
self.access_token_url = access_token_url
# consumer init
self.consumer = oauth.Consumer(self.client_id, self.client_secret)
def login_url(self, next="/"):
self.__oauth_login(next)
return next
def logout_url(self, next="/"):
self.session.request_token = None
self.session.access_token = None
return next
def get_user(self):
'''Get user data.
Since OAuth does not specify what a user
is, this function must be implemented for the specific
provider.
'''
raise NotImplementedError("Must override get_user()")
def __oauth_login(self, next):
'''This method redirects the user to the authenticating form
on authentication server if the authentication code
and the authentication token are not available to the
application yet.
Once the authentication code has been received this method is
called to set the access token into the session by calling
accessToken()
'''
if not self.accessToken():
# setup the client
client = oauth.Client(self.consumer, None)
# Get a request token.
# oauth_callback *is REQUIRED* for OAuth1.0a
# putting it in the body seems to work.
callback_url = self.__redirect_uri(next)
data = urlencode(dict(oauth_callback=callback_url))
resp, content = client.request(self.token_url, "POST", body=data)
if resp['status'] != '200':
self.session.request_token = None
self.globals['redirect'](self.globals[
'URL'](f='user', args='logout'))
# Store the request token in session.
request_token = self.session.request_token = oauth.Token.from_string(content)
# Redirect the user to the authentication URL and pass the callback url.
data = urlencode(dict(oauth_token=request_token.key,
oauth_callback=callback_url))
auth_request_url = self.auth_url + '?' + data
HTTP = self.globals['HTTP']
raise HTTP(302,
"You are not authenticated: you are being redirected to the <a href='" + auth_request_url + "'> authentication server</a>",
Location=auth_request_url)
return None
| ajibawa-2023/Python-Code-Large/train/row_499 | 70 | 183 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_499:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 13], "level": 0, "parent": null, "vector": [8, 0, 0.0464, 0.0546, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nWritten by Michele Comitini <mcm@glisco.it>\nLicense: GPL v3\n\nAdds support for OAuth1.0a authentication to web2py.\n\nDependencies:\n - python-oauth2 (http://github.com/simplegeo/python-oauth2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Import_L15_C0", "label": "oauth2 import oauth", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.082, 0.0055, 0, 0.66, 0.2, 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_499:Import_L16_C0", "label": "cgi import cgi", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0874, 0.0055, 0, 0.66, 0.4, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:ImportFrom_L18_C0", "label": "from urllib import urlencode", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0984, 0.0055, 0, 0.66, 0.6, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "urllib", "arg_names": [], "import_names": ["urlencode"], "rhs_call_name": "", "annotation": ""}, "snippet": "from urllib import urlencode"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:ImportFrom_L20_C0", "label": "from gluon import current", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.1093, 0.0055, 0, 0.66, 0.8, 826, 0, 1, 0, 0, 826, 0, 0], "semantic": {"name": "gluon", "arg_names": [], "import_names": ["current"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon import current"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:ClassDef_L22_C0", "label": "OAuthAccount", "type": "class", "loc": [22, 183], "level": 0, "parent": null, "vector": [3, 0, 0.5601, 0.8852, 0, 0.66, 1.0, 289, 0, 7, 0, 0, 186, 0, 23], "semantic": {"name": "OAuthAccount", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthAccount(object):\n \"\"\"\n Login will be done via OAuth Framework, instead of web2py's\n login form.\n\n Include in your model (eg db.py)::\n # define the auth_table before call to auth.define_tables()\n auth_table = db.define_table("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Expr_L23_C4", "label": "expression", "type": "expression", "loc": [23, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:ClassDef_L22_C0", "vector": [8, 1, 0.2186, 0.1913, 1, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Login will be done via OAuth Framework, instead of web2py's\n login form.\n\n Include in your model (eg db.py)::\n # define the auth_table before call to auth.define_tables()\n auth_table = db.define_table(\n auth.settings.table_user_name,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L59_C4", "label": "__redirect_uri", "type": "function", "loc": [59, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:ClassDef_L22_C0", "vector": [2, 1, 0.3661, 0.0929, 1, 0.72, 0.1429, 176, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__redirect_uri", "arg_names": ["self", "next"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __redirect_uri(self, next=None):\n \"\"\"Build the uri used by the authenticating server to redirect\n the client back to the page originating the auth request.\n Appends the _next action to the generated url so the flows continues.\n \"\"\"\n r = self.request\n http_host = r.env.http_host\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Expr_L60_C8", "label": "expression", "type": "expression", "loc": [60, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L59_C4", "vector": [8, 2, 0.3361, 0.0219, 2, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Build the uri used by the authenticating server to redirect\n the client back to the page originating the auth request.\n Appends the _next action to the generated url so the flows continues.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L64_C8", "label": "r =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L59_C4", "vector": [14, 2, 0.3497, 0.0055, 2, 0.56, 0.1429, 436, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r = self.request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L65_C8", "label": "http_host =", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L59_C4", "vector": [14, 2, 0.3552, 0.0055, 2, 0.56, 0.2857, 785, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "http_host", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " http_host = r.env.http_host"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L67_C8", "label": "url_scheme =", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L59_C4", "vector": [14, 2, 0.3661, 0.0055, 2, 0.56, 0.4286, 335, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "url_scheme", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url_scheme = r.env.wsgi_url_scheme"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:If_L68_C8", "label": "if", "type": "if", "loc": [68, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L59_C4", "vector": [4, 2, 0.3798, 0.0219, 2, 0.56, 0.5714, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if next:\n path_info = next\n else:\n path_info = r.env.path_info"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L69_C12", "label": "path_info =", "type": "assigned_variable", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L68_C8", "vector": [14, 3, 0.377, 0.0055, 3, 0.82, 0.0, 424, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "path_info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path_info = next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L71_C12", "label": "path_info =", "type": "assigned_variable", "loc": [71, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L68_C8", "vector": [14, 3, 0.388, 0.0055, 3, 0.82, 1.0, 424, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "path_info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path_info = r.env.path_info"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L72_C8", "label": "uri =", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L59_C4", "vector": [14, 2, 0.3934, 0.0055, 2, 0.56, 0.7143, 600, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "uri", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " uri = '%s://%s%s' % (url_scheme, http_host, path_info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:If_L73_C8", "label": "if", "type": "if", "loc": [73, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L59_C4", "vector": [4, 2, 0.4016, 0.0109, 2, 0.56, 0.8571, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if r.get_vars and not next:\n uri += '?' + urlencode(r.get_vars)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Return_L75_C8", "label": "return", "type": "return", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L59_C4", "vector": [13, 2, 0.4098, 0.0055, 2, 0.56, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return uri"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L77_C4", "label": "accessToken", "type": "function", "loc": [77, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:ClassDef_L22_C0", "vector": [2, 1, 0.5109, 0.1858, 1, 0.72, 0.2857, 888, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "accessToken", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def accessToken(self):\n \"\"\"Return the access token generated by the authenticating server.\n\n If token is already in the session that one will be used.\n Otherwise the token is fetched from the auth server.\n\n \"\"\"\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Expr_L78_C8", "label": "expression", "type": "expression", "loc": [78, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L77_C4", "vector": [8, 2, 0.4399, 0.0328, 2, 0.55, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return the access token generated by the authenticating server.\n\n If token is already in the session that one will be used.\n Otherwise the token is fetched from the auth server.\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:If_L85_C8", "label": "if", "type": "if", "loc": [85, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L77_C4", "vector": [4, 2, 0.4727, 0.0219, 2, 0.55, 0.25, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.session.access_token:\n # return the token (TODO: does it expire?)\n\n return self.session.access_token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Return_L88_C12", "label": "return", "type": "return", "loc": [88, 88], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L85_C8", "vector": [13, 3, 0.4809, 0.0055, 3, 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.session.access_token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:If_L89_C8", "label": "if", "type": "if", "loc": [89, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L77_C4", "vector": [4, 2, 0.5355, 0.1038, 2, 0.55, 0.5, 0, 7, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.session.request_token:\n # Exchange the request token with an authorization token.\n token = self.session.request_token\n self.session.request_token = None\n\n # Build an authorized client\n # OAuth1.0a put the verifier!\n token.set_verifier(self.request.vars.oauth_verifier)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L91_C12", "label": "token =", "type": "assigned_variable", "loc": [91, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L89_C8", "vector": [14, 3, 0.4973, 0.0055, 3, 0.79, 0.0, 129, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " token = self.session.request_token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L92_C12", "label": "self.session.request_token =", "type": "assigned_variable", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L89_C8", "vector": [14, 3, 0.5027, 0.0055, 3, 0.79, 0.1429, 240, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.session.request_token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session.request_token = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Expr_L96_C12", "label": "set_verifier()", "type": "expression", "loc": [96, 96], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L89_C8", "vector": [8, 3, 0.5246, 0.0055, 3, 0.79, 0.2857, 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(self.request.vars.oauth_verifier)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L97_C12", "label": "client = Client()", "type": "assigned_variable", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L89_C8", "vector": [14, 3, 0.5301, 0.0055, 3, 0.79, 0.4286, 608, 3, 2, 0, 0, 412, 10, 1], "semantic": {"name": "client", "arg_names": [], "import_names": [], "rhs_call_name": "Client", "annotation": ""}, "snippet": " client = oauth.Client(self.consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L99_C12", "label": "resp, content = request()", "type": "assigned_variable", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L89_C8", "vector": [14, 3, 0.541, 0.0055, 3, 0.79, 0.5714, 339, 3, 2, 0, 0, 50, 10, 1], "semantic": {"name": "resp, content", "arg_names": [], "import_names": [], "rhs_call_name": "request", "annotation": ""}, "snippet": " resp, content = client.request(self.access_token_url, \"POST\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:If_L100_C12", "label": "if", "type": "if", "loc": [100, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L89_C8", "vector": [4, 3, 0.5546, 0.0219, 3, 0.79, 0.7143, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if str(resp['status']) != '200':\n self.session.request_token = None\n self.globals['redirect'](self.globals[\n 'URL'](f='user', args='logout'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L101_C16", "label": "self.session.request_token =", "type": "assigned_variable", "loc": [101, 101], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L100_C12", "vector": [14, 4, 0.5519, 0.0055, 4, 0.48, 0.0, 240, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.session.request_token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session.request_token = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Expr_L102_C16", "label": "expression", "type": "expression", "loc": [102, 103], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L100_C12", "vector": [8, 4, 0.5601, 0.0109, 4, 0.48, 1.0, 0, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.globals['redirect'](self.globals[\n 'URL'](f='user', args='logout'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L105_C12", "label": "self.session.access_token = from_string()", "type": "assigned_variable", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L89_C8", "vector": [14, 3, 0.5738, 0.0055, 3, 0.79, 0.8571, 521, 3, 1, 0, 0, 423, 10, 1], "semantic": {"name": "self.session.access_token", "arg_names": [], "import_names": [], "rhs_call_name": "from_string", "annotation": ""}, "snippet": " self.session.access_token = oauth.Token.from_string(content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Return_L107_C12", "label": "return", "type": "return", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L89_C8", "vector": [13, 3, 0.5847, 0.0055, 3, 0.79, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.session.access_token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L109_C8", "label": "self.session.access_token =", "type": "assigned_variable", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L77_C4", "vector": [14, 2, 0.5956, 0.0055, 2, 0.55, 0.75, 521, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.session.access_token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session.access_token = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Return_L110_C8", "label": "return", "type": "return", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L77_C4", "vector": [13, 2, 0.6011, 0.0055, 2, 0.55, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L112_C4", "label": "__init__", "type": "function", "loc": [112, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:ClassDef_L22_C0", "vector": [2, 1, 0.6448, 0.071, 1, 0.72, 0.4286, 555, 0, 7, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "g", "client_id", "client_secret", "auth_url", "token_url", "access_token_url"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, g, client_id, client_secret, auth_url, token_url, access_token_url):\n self.globals = g\n self.client_id = client_id\n self.client_secret = client_secret\n self.code = None\n self.request = current.request\n self.session = current.session\n self.auth_url = auth_url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L113_C8", "label": "self.globals =", "type": "assigned_variable", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L112_C4", "vector": [14, 2, 0.6175, 0.0055, 2, 0.44, 0.0, 681, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.globals", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.globals = g"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L114_C8", "label": "self.client_id =", "type": "assigned_variable", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L112_C4", "vector": [14, 2, 0.623, 0.0055, 2, 0.44, 0.1111, 144, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.client_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.client_id = client_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L115_C8", "label": "self.client_secret =", "type": "assigned_variable", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L112_C4", "vector": [14, 2, 0.6284, 0.0055, 2, 0.44, 0.2222, 451, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.client_secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.client_secret = client_secret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L116_C8", "label": "self.code =", "type": "assigned_variable", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L112_C4", "vector": [14, 2, 0.6339, 0.0055, 2, 0.44, 0.3333, 296, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.code", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.code = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L117_C8", "label": "self.request =", "type": "assigned_variable", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L112_C4", "vector": [14, 2, 0.6393, 0.0055, 2, 0.44, 0.4444, 952, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.request", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.request = current.request"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L118_C8", "label": "self.session =", "type": "assigned_variable", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L112_C4", "vector": [14, 2, 0.6448, 0.0055, 2, 0.44, 0.5556, 77, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.session", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session = current.session"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L119_C8", "label": "self.auth_url =", "type": "assigned_variable", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L112_C4", "vector": [14, 2, 0.6503, 0.0055, 2, 0.44, 0.6667, 649, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.auth_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.auth_url = auth_url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L120_C8", "label": "self.token_url =", "type": "assigned_variable", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L112_C4", "vector": [14, 2, 0.6557, 0.0055, 2, 0.44, 0.7778, 81, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.token_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.token_url = token_url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L121_C8", "label": "self.access_token_url =", "type": "assigned_variable", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L112_C4", "vector": [14, 2, 0.6612, 0.0055, 2, 0.44, 0.8889, 24, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.access_token_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.access_token_url = access_token_url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L124_C8", "label": "self.consumer = Consumer()", "type": "assigned_variable", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L112_C4", "vector": [14, 2, 0.6776, 0.0055, 2, 0.44, 1.0, 33, 3, 2, 0, 0, 881, 10, 1], "semantic": {"name": "self.consumer", "arg_names": [], "import_names": [], "rhs_call_name": "Consumer", "annotation": ""}, "snippet": " self.consumer = oauth.Consumer(self.client_id, self.client_secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L126_C4", "label": "login_url", "type": "function", "loc": [126, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:ClassDef_L22_C0", "vector": [2, 1, 0.694, 0.0164, 1, 0.72, 0.5714, 704, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "login_url", "arg_names": ["self", "next"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def login_url(self, next=\"/\"):\n self.__oauth_login(next)\n return next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Expr_L127_C8", "label": "__oauth_login()", "type": "expression", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L126_C4", "vector": [8, 2, 0.694, 0.0055, 2, 0.69, 0.0, 10, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "__oauth_login", "arg_names": [], "import_names": [], "rhs_call_name": "__oauth_login", "annotation": ""}, "snippet": " self.__oauth_login(next)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Return_L128_C8", "label": "return", "type": "return", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L126_C4", "vector": [13, 2, 0.6995, 0.0055, 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 next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L130_C4", "label": "logout_url", "type": "function", "loc": [130, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:ClassDef_L22_C0", "vector": [2, 1, 0.7186, 0.0219, 1, 0.72, 0.7143, 181, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "logout_url", "arg_names": ["self", "next"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def logout_url(self, next=\"/\"):\n self.session.request_token = None\n self.session.access_token = None\n return next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L131_C8", "label": "self.session.request_token =", "type": "assigned_variable", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L130_C4", "vector": [14, 2, 0.7158, 0.0055, 2, 0.28, 0.0, 240, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.session.request_token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session.request_token = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L132_C8", "label": "self.session.access_token =", "type": "assigned_variable", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L130_C4", "vector": [14, 2, 0.7213, 0.0055, 2, 0.28, 0.5, 521, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.session.access_token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session.access_token = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Return_L133_C8", "label": "return", "type": "return", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L130_C4", "vector": [13, 2, 0.7268, 0.0055, 2, 0.28, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L135_C4", "label": "get_user", "type": "function", "loc": [135, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:ClassDef_L22_C0", "vector": [2, 1, 0.7568, 0.0437, 1, 0.72, 0.8571, 174, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "get_user", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_user(self):\n '''Get user data.\n\n Since OAuth does not specify what a user\n is, this function must be implemented for the specific\n provider.\n '''\n raise NotImplementedError(\"Must override get_user()\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Expr_L136_C8", "label": "expression", "type": "expression", "loc": [136, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L135_C4", "vector": [8, 2, 0.7568, 0.0328, 2, 0.47, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Get user data.\n\n Since OAuth does not specify what a user\n is, this function must be implemented for the specific\n provider.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L144_C4", "label": "__oauth_login", "type": "function", "loc": [144, 183], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:ClassDef_L22_C0", "vector": [2, 1, 0.8934, 0.2186, 1, 0.72, 1.0, 10, 0, 2, 1, 0, 0, 0, 12], "semantic": {"name": "__oauth_login", "arg_names": ["self", "next"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __oauth_login(self, next):\n '''This method redirects the user to the authenticating form\n on authentication server if the authentication code\n and the authentication token are not available to the\n application yet.\n\n Once the authentication code has been received this method is\n called to set the access token into the session by calling"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Expr_L145_C8", "label": "expression", "type": "expression", "loc": [145, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L144_C4", "vector": [8, 2, 0.8142, 0.0492, 2, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''This method redirects the user to the authenticating form\n on authentication server if the authentication code\n and the authentication token are not available to the\n application yet.\n\n Once the authentication code has been received this method is\n called to set the access token into the session by calling\n accessToken()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:If_L155_C8", "label": "if", "type": "if", "loc": [155, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L144_C4", "vector": [4, 2, 0.918, 0.1475, 2, 0.67, 0.5, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.accessToken():\n # setup the client\n client = oauth.Client(self.consumer, None)\n # Get a request token.\n # oauth_callback *is REQUIRED* for OAuth1.0a\n # putting it in the body seems to work.\n callback_url = self.__redirect_uri(next)\n data = urlencode(dict(oauth_callback=callback_url))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L157_C12", "label": "client = Client()", "type": "assigned_variable", "loc": [157, 157], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L155_C8", "vector": [14, 3, 0.8579, 0.0055, 3, 0.35, 0.0, 608, 3, 2, 0, 0, 412, 10, 1], "semantic": {"name": "client", "arg_names": [], "import_names": [], "rhs_call_name": "Client", "annotation": ""}, "snippet": " client = oauth.Client(self.consumer, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L161_C12", "label": "callback_url = __redirect_uri()", "type": "assigned_variable", "loc": [161, 161], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L155_C8", "vector": [14, 3, 0.8798, 0.0055, 3, 0.35, 0.125, 96, 3, 1, 0, 0, 176, 10, 1], "semantic": {"name": "callback_url", "arg_names": [], "import_names": [], "rhs_call_name": "__redirect_uri", "annotation": ""}, "snippet": " callback_url = self.__redirect_uri(next)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L162_C12", "label": "data = urlencode()", "type": "assigned_variable", "loc": [162, 162], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L155_C8", "vector": [14, 3, 0.8852, 0.0055, 3, 0.35, 0.25, 929, 3, 1, 0, 0, 414, 10, 2], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "urlencode", "annotation": ""}, "snippet": " data = urlencode(dict(oauth_callback=callback_url))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L163_C12", "label": "resp, content = request()", "type": "assigned_variable", "loc": [163, 163], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L155_C8", "vector": [14, 3, 0.8907, 0.0055, 3, 0.35, 0.375, 339, 3, 3, 0, 0, 50, 10, 1], "semantic": {"name": "resp, content", "arg_names": [], "import_names": [], "rhs_call_name": "request", "annotation": ""}, "snippet": " resp, content = client.request(self.token_url, \"POST\", body=data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:If_L164_C12", "label": "if", "type": "if", "loc": [164, 167], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L155_C8", "vector": [4, 3, 0.9044, 0.0219, 3, 0.35, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if resp['status'] != '200':\n self.session.request_token = None\n self.globals['redirect'](self.globals[\n 'URL'](f='user', args='logout'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L165_C16", "label": "self.session.request_token =", "type": "assigned_variable", "loc": [165, 165], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L164_C12", "vector": [14, 4, 0.9016, 0.0055, 4, 0.5, 0.0, 240, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.session.request_token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.session.request_token = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Expr_L166_C16", "label": "expression", "type": "expression", "loc": [166, 167], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L164_C12", "vector": [8, 4, 0.9098, 0.0109, 4, 0.5, 1.0, 0, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.globals['redirect'](self.globals[\n 'URL'](f='user', args='logout'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L170_C12", "label": "request_token = from_string()", "type": "assigned_variable", "loc": [170, 170], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L155_C8", "vector": [14, 3, 0.929, 0.0055, 3, 0.35, 0.625, 279, 3, 1, 0, 0, 423, 10, 1], "semantic": {"name": "request_token", "arg_names": [], "import_names": [], "rhs_call_name": "from_string", "annotation": ""}, "snippet": " request_token = self.session.request_token = oauth.Token.from_string(content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L173_C12", "label": "data = urlencode()", "type": "assigned_variable", "loc": [173, 174], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L155_C8", "vector": [14, 3, 0.9481, 0.0109, 3, 0.35, 0.75, 929, 3, 1, 0, 0, 414, 10, 2], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "urlencode", "annotation": ""}, "snippet": " data = urlencode(dict(oauth_token=request_token.key,\n oauth_callback=callback_url))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L175_C12", "label": "auth_request_url =", "type": "assigned_variable", "loc": [175, 175], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L155_C8", "vector": [14, 3, 0.9563, 0.0055, 3, 0.35, 0.875, 421, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "auth_request_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " auth_request_url = self.auth_url + '?' + data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L177_C12", "label": "HTTP =", "type": "assigned_variable", "loc": [177, 177], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:If_L155_C8", "vector": [14, 3, 0.9672, 0.0055, 3, 0.35, 1.0, 806, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "HTTP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " HTTP = self.globals['HTTP']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_499:Return_L183_C8", "label": "return", "type": "return", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L144_C4", "vector": [13, 2, 1.0, 0.0055, 2, 0.67, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_499:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Expr_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Expr_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:If_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L68_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L68_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:If_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Return_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Expr_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:If_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L85_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Return_L88_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:If_L89_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L91_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L92_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Expr_L96_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L97_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L99_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_499:If_L100_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L100_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L101_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L100_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Expr_L102_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L105_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L89_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Return_L107_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Return_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L124_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Expr_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Return_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L130_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Return_L133_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Expr_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Expr_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:If_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L155_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L157_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L155_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L161_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L155_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L162_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L155_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L163_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L155_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_499:If_L164_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L164_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L165_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L164_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Expr_L166_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L155_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L170_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L155_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L173_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L155_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L175_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:If_L155_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Assign_L177_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_499:FunctionDef_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_499:Return_L183_C8"}] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of web2py Web Framework (Copyrighted, 2007-2009).
Developed by Massimo Di Pierro <mdipierro@cs.depaul.edu> and
Robin B <robi123@gmail.com>.
License: GPL v2
"""
__all__ = ['MEMDB', 'Field']
import re
import sys
import os
import types
import datetime
import thread
import cStringIO
import csv
import copy
import gluon.validators as validators
from gluon.storage import Storage
from gluon import SQLTABLE
import random
SQL_DIALECTS = {'memcache': {
'boolean': bool,
'string': unicode,
'text': unicode,
'password': unicode,
'blob': unicode,
'upload': unicode,
'integer': long,
'double': float,
'date': datetime.date,
'time': datetime.time,
'datetime': datetime.datetime,
'id': int,
'reference': int,
'lower': None,
'upper': None,
'is null': 'IS NULL',
'is not null': 'IS NOT NULL',
'extract': None,
'left join': None,
}}
def cleanup(text):
if re.compile('[^0-9a-zA-Z_]').findall(text):
raise SyntaxError('Can\'t cleanup \'%s\': only [0-9a-zA-Z_] allowed in table and field names' % text)
return text
def assert_filter_fields(*fields):
for field in fields:
if isinstance(field, (Field, Expression)) and field.type\
in ['text', 'blob']:
raise SyntaxError('AppEngine does not index by: %s'
% field.type)
def dateobj_to_datetime(object):
# convert dates,times to datetimes for AppEngine
if isinstance(object, datetime.date):
object = datetime.datetime(object.year, object.month,
object.day)
if isinstance(object, datetime.time):
object = datetime.datetime(
1970,
1,
1,
object.hour,
object.minute,
object.second,
object.microsecond,
)
return object
def sqlhtml_validators(field_type, length):
v = {
'boolean': [],
'string': validators.IS_LENGTH(length),
'text': [],
'password': validators.IS_LENGTH(length),
'blob': [],
'upload': [],
'double': validators.IS_FLOAT_IN_RANGE(-1e100, 1e100),
'integer': validators.IS_INT_IN_RANGE(-1e100, 1e100),
'date': validators.IS_DATE(),
'time': validators.IS_TIME(),
'datetime': validators.IS_DATETIME(),
'reference': validators.IS_INT_IN_RANGE(0, 1e100),
}
try:
return v[field_type[:9]]
except KeyError:
return []
class DALStorage(dict):
"""
a dictionary that let you do d['a'] as well as d.a
"""
def __getattr__(self, key):
return self[key]
def __setattr__(self, key, value):
if key in self:
raise SyntaxError(
'Object \'%s\'exists and cannot be redefined' % key)
self[key] = value
def __repr__(self):
return '<DALStorage ' + dict.__repr__(self) + '>'
class SQLCallableList(list):
def __call__(self):
return copy.copy(self)
class MEMDB(DALStorage):
"""
an instance of this class represents a database connection
Example::
db=MEMDB(Client())
db.define_table('tablename',Field('fieldname1'),
Field('fieldname2'))
"""
def __init__(self, client):
self._dbname = 'memdb'
self['_lastsql'] = ''
self.tables = SQLCallableList()
self._translator = SQL_DIALECTS['memcache']
self.client = client
def define_table(
self,
tablename,
*fields,
**args
):
tablename = cleanup(tablename)
if tablename in dir(self) or tablename[0] == '_':
raise SyntaxError('invalid table name: %s' % tablename)
if not tablename in self.tables:
self.tables.append(tablename)
else:
raise SyntaxError('table already defined: %s' % tablename)
t = self[tablename] = Table(self, tablename, *fields)
t._create()
return t
def __call__(self, where=''):
return Set(self, where)
class SQLALL(object):
def __init__(self, table):
self.table = table
class Table(DALStorage):
"""
an instance of this class represents a database table
Example::
db=MEMDB(Client())
db.define_table('users',Field('name'))
db.users.insert(name='me')
"""
def __init__(
self,
db,
tablename,
*fields
):
self._db = db
self._tablename = tablename
self.fields = SQLCallableList()
self._referenced_by = []
fields = list(fields)
fields.insert(0, Field('id', 'id'))
for field in fields:
self.fields.append(field.name)
self[field.name] = field
field._tablename = self._tablename
field._table = self
field._db = self._db
self.ALL = SQLALL(self)
def _create(self):
fields = []
myfields = {}
for k in self.fields:
field = self[k]
attr = {}
if not field.type[:9] in ['id', 'reference']:
if field.notnull:
attr = dict(required=True)
if field.type[:2] == 'id':
continue
if field.type[:9] == 'reference':
referenced = field.type[10:].strip()
if not referenced:
raise SyntaxError('Table %s: reference \'%s\' to nothing!' % (
self._tablename, k))
if not referenced in self._db:
raise SyntaxError(
'Table: table %s does not exist' % referenced)
referee = self._db[referenced]
ftype = \
self._db._translator[field.type[:9]](
self._db[referenced]._tableobj)
if self._tablename in referee.fields: # ## THIS IS OK
raise SyntaxError('Field: table \'%s\' has same name as a field '
'in referenced table \'%s\'' % (
self._tablename, referenced))
self._db[referenced]._referenced_by.append((self._tablename,
field.name))
elif not field.type in self._db._translator\
or not self._db._translator[field.type]:
raise SyntaxError('Field: unkown field type %s' % field.type)
self._tableobj = self._db.client
return None
def create(self):
# nothing to do, here for backward compatility
pass
def drop(self):
# nothing to do, here for backward compatibility
self._db(self.id > 0).delete()
def insert(self, **fields):
id = self._create_id()
if self.update(id, **fields):
return long(id)
else:
return None
def get(self, id):
val = self._tableobj.get(self._id_to_key(id))
if val:
return Storage(val)
else:
return None
def update(self, id, **fields):
for field in fields:
if not field in fields and self[field].default\
is not None:
fields[field] = self[field].default
if field in fields:
fields[field] = obj_represent(fields[field],
self[field].type, self._db)
return self._tableobj.set(self._id_to_key(id), fields)
def delete(self, id):
return self._tableobj.delete(self._id_to_key(id))
def _shard_key(self, shard):
return self._id_to_key('s/%s' % shard)
def _id_to_key(self, id):
return '__memdb__/t/%s/k/%s' % (self._tablename, str(id))
def _create_id(self):
shard = random.randint(10, 99)
shard_id = self._shard_key(shard)
id = self._tableobj.incr(shard_id)
if not id:
if self._tableobj.set(shard_id, '0'):
id = 0
else:
raise Exception('cannot set memcache')
return long(str(shard) + str(id))
def __str__(self):
return self._tablename
class Expression(object):
def __init__(
self,
name,
type='string',
db=None,
):
(self.name, self.type, self._db) = (name, type, db)
def __str__(self):
return self.name
def __or__(self, other): # for use in sortby
assert_filter_fields(self, other)
return Expression(self.name + '|' + other.name, None, None)
def __invert__(self):
assert_filter_fields(self)
return Expression('-' + self.name, self.type, None)
# for use in Query
def __eq__(self, value):
return Query(self, '=', value)
def __ne__(self, value):
return Query(self, '!=', value)
def __lt__(self, value):
return Query(self, '<', value)
def __le__(self, value):
return Query(self, '<=', value)
def __gt__(self, value):
return Query(self, '>', value)
def __ge__(self, value):
return Query(self, '>=', value)
# def like(self,value): return Query(self,' LIKE ',value)
# def belongs(self,value): return Query(self,' IN ',value)
# for use in both Query and sortby
def __add__(self, other):
return Expression('%s+%s' % (self, other), 'float', None)
def __sub__(self, other):
return Expression('%s-%s' % (self, other), 'float', None)
def __mul__(self, other):
return Expression('%s*%s' % (self, other), 'float', None)
def __div__(self, other):
return Expression('%s/%s' % (self, other), 'float', None)
class Field(Expression):
"""
an instance of this class represents a database field
example::
a = Field(name, 'string', length=32, required=False,
default=None, requires=IS_NOT_EMPTY(), notnull=False,
unique=False, uploadfield=True)
to be used as argument of GQLDB.define_table
allowed field types:
string, boolean, integer, double, text, blob,
date, time, datetime, upload, password
strings must have a length or 512 by default.
fields should have a default or they will be required in SQLFORMs
the requires argument are used to validate the field input in SQLFORMs
"""
def __init__(
self,
fieldname,
type='string',
length=None,
default=None,
required=False,
requires=sqlhtml_validators,
ondelete='CASCADE',
notnull=False,
unique=False,
uploadfield=True,
):
self.name = cleanup(fieldname)
if fieldname in dir(Table) or fieldname[0] == '_':
raise SyntaxError('Field: invalid field name: %s' % fieldname)
if isinstance(type, Table):
type = 'reference ' + type._tablename
if not length:
length = 512
self.type = type # 'string', 'integer'
self.length = length # the length of the string
self.default = default # default value for field
self.required = required # is this field required
self.ondelete = ondelete.upper() # this is for reference fields only
self.notnull = notnull
self.unique = unique
self.uploadfield = uploadfield
if requires == sqlhtml_validators:
requires = sqlhtml_validators(type, length)
elif requires is None:
requires = []
self.requires = requires # list of validators
def formatter(self, value):
if value is None or not self.requires:
return value
if not isinstance(self.requires, (list, tuple)):
requires = [self.requires]
else:
requires = copy.copy(self.requires)
requires.reverse()
for item in requires:
if hasattr(item, 'formatter'):
value = item.formatter(value)
return value
def __str__(self):
return '%s.%s' % (self._tablename, self.name)
MEMDB.Field = Field # ## required by gluon/globals.py session.connect
def obj_represent(object, fieldtype, db):
if object is not None:
if fieldtype == 'date' and not isinstance(object,
datetime.date):
(y, m, d) = [int(x) for x in str(object).strip().split('-')]
object = datetime.date(y, m, d)
elif fieldtype == 'time' and not isinstance(object, datetime.time):
time_items = [int(x) for x in str(object).strip().split(':')[:3]]
if len(time_items) == 3:
(h, mi, s) = time_items
else:
(h, mi, s) = time_items + [0]
object = datetime.time(h, mi, s)
elif fieldtype == 'datetime' and not isinstance(object,
datetime.datetime):
(y, m, d) = [int(x) for x in
str(object)[:10].strip().split('-')]
time_items = [int(x) for x in
str(object)[11:].strip().split(':')[:3]]
if len(time_items) == 3:
(h, mi, s) = time_items
else:
(h, mi, s) = time_items + [0]
object = datetime.datetime(
y,
m,
d,
h,
mi,
s,
)
elif fieldtype == 'integer' and not isinstance(object, long):
object = long(object)
return object
class QueryException:
def __init__(self, **a):
self.__dict__ = a
class Query(object):
"""
A query object necessary to define a set.
It can be stored or can be passed to GQLDB.__call__() to obtain a Set
Example:
query=db.users.name=='Max'
set=db(query)
records=set.select()
"""
def __init__(
self,
left,
op=None,
right=None,
):
if isinstance(right, (Field, Expression)):
raise SyntaxError(
'Query: right side of filter must be a value or entity')
if isinstance(left, Field) and left.name == 'id':
if op == '=':
self.get_one = \
QueryException(tablename=left._tablename,
id=long(right))
return
else:
raise SyntaxError('only equality by id is supported')
raise SyntaxError('not supported')
def __str__(self):
return str(self.left)
class Set(object):
"""
As Set represents a set of records in the database,
the records are identified by the where=Query(...) object.
normally the Set is generated by GQLDB.__call__(Query(...))
given a set, for example
set=db(db.users.name=='Max')
you can:
set.update(db.users.name='Massimo')
set.delete() # all elements in the set
set.select(orderby=db.users.id,groupby=db.users.name,limitby=(0,10))
and take subsets:
subset=set(db.users.id<5)
"""
def __init__(self, db, where=None):
self._db = db
self._tables = []
self.filters = []
if hasattr(where, 'get_all'):
self.where = where
self._tables.insert(0, where.get_all)
elif hasattr(where, 'get_one') and isinstance(where.get_one,
QueryException):
self.where = where.get_one
else:
# find out which tables are involved
if isinstance(where, Query):
self.filters = where.left
self.where = where
self._tables = [field._tablename for (field, op, val) in
self.filters]
def __call__(self, where):
if isinstance(self.where, QueryException) or isinstance(where,
QueryException):
raise SyntaxError('neither self.where nor where can be a QueryException instance')
if self.where:
return Set(self._db, self.where & where)
else:
return Set(self._db, where)
def _get_table_or_raise(self):
tablenames = list(set(self._tables)) # unique
if len(tablenames) < 1:
raise SyntaxError('Set: no tables selected')
if len(tablenames) > 1:
raise SyntaxError('Set: no join in appengine')
return self._db[tablenames[0]]._tableobj
def _getitem_exception(self):
(tablename, id) = (self.where.tablename, self.where.id)
fields = self._db[tablename].fields
self.colnames = ['%s.%s' % (tablename, t) for t in fields]
item = self._db[tablename].get(id)
return (item, fields, tablename, id)
def _select_except(self):
(item, fields, tablename, id) = self._getitem_exception()
if not item:
return []
new_item = []
for t in fields:
if t == 'id':
new_item.append(long(id))
else:
new_item.append(getattr(item, t))
r = [new_item]
return Rows(self._db, r, *self.colnames)
def select(self, *fields, **attributes):
"""
Always returns a Rows object, even if it may be empty
"""
if isinstance(self.where, QueryException):
return self._select_except()
else:
raise SyntaxError('select arguments not supported')
def count(self):
return len(self.select())
def delete(self):
if isinstance(self.where, QueryException):
(item, fields, tablename, id) = self._getitem_exception()
if not item:
return
self._db[tablename].delete(id)
else:
raise Exception('deletion not implemented')
def update(self, **update_fields):
if isinstance(self.where, QueryException):
(item, fields, tablename, id) = self._getitem_exception()
if not item:
return
for (key, value) in update_fields.items():
setattr(item, key, value)
self._db[tablename].update(id, **item)
else:
raise Exception('update not implemented')
def update_record(
t,
s,
id,
a,
):
item = s.get(id)
for (key, value) in a.items():
t[key] = value
setattr(item, key, value)
s.update(id, **item)
class Rows(object):
"""
A wrapper for the return value of a select. It basically represents a table.
It has an iterator and each row is represented as a dictionary.
"""
# ## this class still needs some work to care for ID/OID
def __init__(
self,
db,
response,
*colnames
):
self._db = db
self.colnames = colnames
self.response = response
def __len__(self):
return len(self.response)
def __getitem__(self, i):
if i >= len(self.response) or i < 0:
raise SyntaxError('Rows: no such row: %i' % i)
if len(self.response[0]) != len(self.colnames):
raise SyntaxError('Rows: internal error')
row = DALStorage()
for j in xrange(len(self.colnames)):
value = self.response[i][j]
if isinstance(value, unicode):
value = value.encode('utf-8')
packed = self.colnames[j].split('.')
try:
(tablename, fieldname) = packed
except:
if not '_extra' in row:
row['_extra'] = DALStorage()
row['_extra'][self.colnames[j]] = value
continue
table = self._db[tablename]
field = table[fieldname]
if not tablename in row:
row[tablename] = DALStorage()
if field.type[:9] == 'reference':
referee = field.type[10:].strip()
rid = value
row[tablename][fieldname] = rid
elif field.type == 'boolean' and value is not None:
# row[tablename][fieldname]=Set(self._db[referee].id==rid)
if value == True or value == 'T':
row[tablename][fieldname] = True
else:
row[tablename][fieldname] = False
elif field.type == 'date' and value is not None\
and not isinstance(value, datetime.date):
(y, m, d) = [int(x) for x in
str(value).strip().split('-')]
row[tablename][fieldname] = datetime.date(y, m, d)
elif field.type == 'time' and value is not None\
and not isinstance(value, datetime.time):
time_items = [int(x) for x in
str(value).strip().split(':')[:3]]
if len(time_items) == 3:
(h, mi, s) = time_items
else:
(h, mi, s) = time_items + [0]
row[tablename][fieldname] = datetime.time(h, mi, s)
elif field.type == 'datetime' and value is not None\
and not isinstance(value, datetime.datetime):
(y, m, d) = [int(x) for x in
str(value)[:10].strip().split('-')]
time_items = [int(x) for x in
str(value)[11:].strip().split(':')[:3]]
if len(time_items) == 3:
(h, mi, s) = time_items
else:
(h, mi, s) = time_items + [0]
row[tablename][fieldname] = datetime.datetime(
y,
m,
d,
h,
mi,
s,
)
else:
row[tablename][fieldname] = value
if fieldname == 'id':
id = row[tablename].id
row[tablename].update_record = lambda t = row[tablename], \
s = self._db[tablename], id = id, **a: update_record(t,
s, id, a)
for (referee_table, referee_name) in \
table._referenced_by:
s = self._db[referee_table][referee_name]
row[tablename][referee_table] = Set(self._db, s
== id)
if len(row.keys()) == 1:
return row[row.keys()[0]]
return row
def __iter__(self):
"""
iterator over records
"""
for i in xrange(len(self)):
yield self[i]
def __str__(self):
"""
serializes the table into a csv file
"""
s = cStringIO.StringIO()
writer = csv.writer(s)
writer.writerow(self.colnames)
c = len(self.colnames)
for i in xrange(len(self)):
row = [self.response[i][j] for j in xrange(c)]
for k in xrange(c):
if isinstance(row[k], unicode):
row[k] = row[k].encode('utf-8')
writer.writerow(row)
return s.getvalue()
def xml(self):
"""
serializes the table using SQLTABLE (if present)
"""
return SQLTABLE(self).xml()
def test_all():
"""
How to run from web2py dir:
export PYTHONPATH=.:YOUR_PLATFORMS_APPENGINE_PATH
python gluon/contrib/memdb.py
Setup the UTC timezone and database stubs
>>> import os
>>> os.environ['TZ'] = 'UTC'
>>> import time
>>> if hasattr(time, 'tzset'):
... time.tzset()
>>>
>>> from google.appengine.api import apiproxy_stub_map
>>> from google.appengine.api.memcache import memcache_stub
>>> apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap()
>>> apiproxy_stub_map.apiproxy.RegisterStub('memcache', memcache_stub.MemcacheServiceStub())
Create a table with all possible field types
>>> from google.appengine.api.memcache import Client
>>> db=MEMDB(Client())
>>> tmp=db.define_table('users', Field('stringf','string',length=32,required=True), Field('booleanf','boolean',default=False), Field('passwordf','password',notnull=True), Field('blobf','blob'), Field('uploadf','upload'), Field('integerf','integer',unique=True), Field('doublef','double',unique=True,notnull=True), Field('datef','date',default=datetime.date.today()), Field('timef','time'), Field('datetimef','datetime'), migrate='test_user.table')
Insert a field
>>> user_id = db.users.insert(stringf='a',booleanf=True,passwordf='p',blobf='0A', uploadf=None, integerf=5,doublef=3.14, datef=datetime.date(2001,1,1), timef=datetime.time(12,30,15), datetimef=datetime.datetime(2002,2,2,12,30,15))
>>> user_id != None
True
Select all
# >>> all = db().select(db.users.ALL)
Drop the table
# >>> db.users.drop()
Select many entities
>>> tmp = db.define_table(\"posts\", Field('body','text'), Field('total','integer'), Field('created_at','datetime'))
>>> many = 20 #2010 # more than 1000 single fetch limit (it can be slow)
>>> few = 5
>>> most = many - few
>>> 0 < few < most < many
True
>>> for i in range(many):
... f=db.posts.insert(body='', total=i,created_at=datetime.datetime(2008, 7, 6, 14, 15, 42, i))
>>>
# test timezones
>>> class TZOffset(datetime.tzinfo):
... def __init__(self,offset=0):
... self.offset = offset
... def utcoffset(self, dt): return datetime.timedelta(hours=self.offset)
... def dst(self, dt): return datetime.timedelta(0)
... def tzname(self, dt): return 'UTC' + str(self.offset)
...
>>> SERVER_OFFSET = -8
>>>
>>> stamp = datetime.datetime(2008, 7, 6, 14, 15, 42, 828201)
>>> post_id = db.posts.insert(created_at=stamp,body='body1')
>>> naive_stamp = db(db.posts.id==post_id).select()[0].created_at
>>> utc_stamp=naive_stamp.replace(tzinfo=TZOffset())
>>> server_stamp = utc_stamp.astimezone(TZOffset(SERVER_OFFSET))
>>> stamp == naive_stamp
True
>>> utc_stamp == server_stamp
True
>>> rows = db(db.posts.id==post_id).select()
>>> len(rows) == 1
True
>>> rows[0].body == 'body1'
True
>>> db(db.posts.id==post_id).delete()
>>> rows = db(db.posts.id==post_id).select()
>>> len(rows) == 0
True
>>> id = db.posts.insert(total='0') # coerce str to integer
>>> rows = db(db.posts.id==id).select()
>>> len(rows) == 1
True
>>> rows[0].total == 0
True
Examples of insert, select, update, delete
>>> tmp=db.define_table('person', Field('name'), Field('birth','date'), migrate='test_person.table')
>>> marco_id=db.person.insert(name=\"Marco\",birth='2005-06-22')
>>> person_id=db.person.insert(name=\"Massimo\",birth='1971-12-21')
>>> me=db(db.person.id==person_id).select()[0] # test select
>>> me.name
'Massimo'
>>> db(db.person.id==person_id).update(name='massimo') # test update
>>> me = db(db.person.id==person_id).select()[0]
>>> me.name
'massimo'
>>> str(me.birth)
'1971-12-21'
# resave date to ensure it comes back the same
>>> me=db(db.person.id==person_id).update(birth=me.birth) # test update
>>> me = db(db.person.id==person_id).select()[0]
>>> me.birth
datetime.date(1971, 12, 21)
>>> db(db.person.id==marco_id).delete() # test delete
>>> len(db(db.person.id==marco_id).select())
0
Update a single record
>>> me.update_record(name=\"Max\")
>>> me.name
'Max'
>>> me = db(db.person.id == person_id).select()[0]
>>> me.name
'Max'
"""
SQLField = Field
SQLTable = Table
SQLXorable = Expression
SQLQuery = Query
SQLSet = Set
SQLRows = Rows
SQLStorage = DALStorage
if __name__ == '__main__':
import doctest
doctest.testmod()
| ajibawa-2023/Python-Code-Large/train/row_500 | 400 | 906 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L4_C0", "label": "expression", "type": "expression", "loc": [4, 9], "level": 0, "parent": null, "vector": [8, 0, 0.0072, 0.0066, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"\nThis file is part of web2py Web Framework (Copyrighted, 2007-2009).\nDeveloped by Massimo Di Pierro <mdipierro@cs.depaul.edu> and\nRobin B <robi123@gmail.com>.\nLicense: GPL v2\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L11_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.0121, 0.0011, 0, 0.66, 0.0238, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = ['MEMDB', 'Field']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Import_L13_C0", "label": "re import re", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.0143, 0.0011, 0, 0.66, 0.0476, 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_500:Import_L14_C0", "label": "sys import sys", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.0155, 0.0011, 0, 0.66, 0.0714, 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_500:Import_L15_C0", "label": "os import os", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.0166, 0.0011, 0, 0.66, 0.0952, 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_500:Import_L16_C0", "label": "types import types", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.0177, 0.0011, 0, 0.66, 0.119, 209, 0, 1, 0, 0, 209, 0, 0], "semantic": {"name": "types", "arg_names": [], "import_names": ["types"], "rhs_call_name": "", "annotation": ""}, "snippet": "import types"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Import_L17_C0", "label": "datetime import datetime", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0188, 0.0011, 0, 0.66, 0.1429, 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_500:Import_L18_C0", "label": "thread import thread", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0199, 0.0011, 0, 0.66, 0.1667, 260, 0, 1, 0, 0, 260, 0, 0], "semantic": {"name": "thread", "arg_names": [], "import_names": ["thread"], "rhs_call_name": "", "annotation": ""}, "snippet": "import thread"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Import_L19_C0", "label": "cStringIO import cStringIO", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.021, 0.0011, 0, 0.66, 0.1905, 764, 0, 1, 0, 0, 764, 0, 0], "semantic": {"name": "cStringIO", "arg_names": [], "import_names": ["cStringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cStringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Import_L20_C0", "label": "csv import csv", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.0221, 0.0011, 0, 0.66, 0.2143, 312, 0, 1, 0, 0, 312, 0, 0], "semantic": {"name": "csv", "arg_names": [], "import_names": ["csv"], "rhs_call_name": "", "annotation": ""}, "snippet": "import csv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Import_L21_C0", "label": "copy import copy", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.0232, 0.0011, 0, 0.66, 0.2381, 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_500:Import_L22_C0", "label": "gluon.validators import validators", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.0243, 0.0011, 0, 0.66, 0.2619, 435, 0, 1, 0, 0, 435, 0, 0], "semantic": {"name": "gluon.validators", "arg_names": [], "import_names": ["validators"], "rhs_call_name": "", "annotation": ""}, "snippet": "import gluon.validators as validators"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:ImportFrom_L23_C0", "label": "from gluon.storage import Storage", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.0254, 0.0011, 0, 0.66, 0.2857, 696, 0, 1, 0, 0, 696, 0, 0], "semantic": {"name": "gluon.storage", "arg_names": [], "import_names": ["Storage"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon.storage import Storage"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:ImportFrom_L24_C0", "label": "from gluon import SQLTABLE", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.0265, 0.0011, 0, 0.66, 0.3095, 826, 0, 1, 0, 0, 826, 0, 0], "semantic": {"name": "gluon", "arg_names": [], "import_names": ["SQLTABLE"], "rhs_call_name": "", "annotation": ""}, "snippet": "from gluon import SQLTABLE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Import_L25_C0", "label": "random import random", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.0276, 0.0011, 0, 0.66, 0.3333, 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_500:Assign_L27_C0", "label": "SQL_DIALECTS =", "type": "assigned_variable", "loc": [27, 47], "level": 0, "parent": null, "vector": [14, 0, 0.0408, 0.0232, 0, 0.66, 0.3571, 849, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "SQL_DIALECTS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SQL_DIALECTS = {'memcache': {\n 'boolean': bool,\n 'string': unicode,\n 'text': unicode,\n 'password': unicode,\n 'blob': unicode,\n 'upload': unicode,\n 'integer': long,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L50_C0", "label": "cleanup", "type": "function", "loc": [50, 53], "level": 0, "parent": null, "vector": [2, 0, 0.0568, 0.0044, 0, 0.66, 0.381, 656, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "cleanup", "arg_names": ["text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def cleanup(text):\n if re.compile('[^0-9a-zA-Z_]').findall(text):\n raise SyntaxError('Can\\'t cleanup \\'%s\\': only [0-9a-zA-Z_] allowed in table and field names' % text)\n return text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L51_C4", "label": "if", "type": "if", "loc": [51, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L50_C0", "vector": [4, 1, 0.0568, 0.0022, 1, 0.36, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if re.compile('[^0-9a-zA-Z_]').findall(text):\n raise SyntaxError('Can\\'t cleanup \\'%s\\': only [0-9a-zA-Z_] allowed in table and field names' % text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L53_C4", "label": "return", "type": "return", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L50_C0", "vector": [13, 1, 0.0585, 0.0011, 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 text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L56_C0", "label": "assert_filter_fields", "type": "function", "loc": [56, 61], "level": 0, "parent": null, "vector": [2, 0, 0.0646, 0.0066, 0, 0.66, 0.4048, 510, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assert_filter_fields", "arg_names": ["fields"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def assert_filter_fields(*fields):\n for field in fields:\n if isinstance(field, (Field, Expression)) and field.type\\\n in ['text', 'blob']:\n raise SyntaxError('AppEngine does not index by: %s'\n % field.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:For_L57_C4", "label": "for field", "type": "for", "loc": [57, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L56_C0", "vector": [6, 1, 0.0651, 0.0055, 1, 0.31, 0.0, 480, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for field in fields:\n if isinstance(field, (Field, Expression)) and field.type\\\n in ['text', 'blob']:\n raise SyntaxError('AppEngine does not index by: %s'\n % field.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L58_C8", "label": "if", "type": "if", "loc": [58, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L57_C4", "vector": [4, 2, 0.0657, 0.0044, 2, 0.45, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(field, (Field, Expression)) and field.type\\\n in ['text', 'blob']:\n raise SyntaxError('AppEngine does not index by: %s'\n % field.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L64_C0", "label": "dateobj_to_datetime", "type": "function", "loc": [64, 81], "level": 0, "parent": null, "vector": [2, 0, 0.08, 0.0199, 0, 0.66, 0.4286, 420, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "dateobj_to_datetime", "arg_names": ["object"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def dateobj_to_datetime(object):\n\n # convert dates,times to datetimes for AppEngine\n\n if isinstance(object, datetime.date):\n object = datetime.datetime(object.year, object.month,\n object.day)\n if isinstance(object, datetime.time):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L68_C4", "label": "if", "type": "if", "loc": [68, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L64_C0", "vector": [4, 1, 0.0762, 0.0033, 1, 0.34, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(object, datetime.date):\n object = datetime.datetime(object.year, object.month,\n object.day)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L69_C8", "label": "object = datetime()", "type": "assigned_variable", "loc": [69, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L68_C4", "vector": [14, 2, 0.0767, 0.0022, 2, 0.1, 0.0, 186, 3, 3, 0, 0, 426, 10, 1], "semantic": {"name": "object", "arg_names": [], "import_names": [], "rhs_call_name": "datetime", "annotation": ""}, "snippet": " object = datetime.datetime(object.year, object.month,\n object.day)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L71_C4", "label": "if", "type": "if", "loc": [71, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L64_C0", "vector": [4, 1, 0.0833, 0.011, 1, 0.34, 0.5, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(object, datetime.time):\n object = datetime.datetime(\n 1970,\n 1,\n 1,\n object.hour,\n object.minute,\n object.second,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L72_C8", "label": "object = datetime()", "type": "assigned_variable", "loc": [72, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L71_C4", "vector": [14, 2, 0.0839, 0.0099, 2, 0.64, 0.0, 186, 3, 7, 0, 0, 426, 10, 1], "semantic": {"name": "object", "arg_names": [], "import_names": [], "rhs_call_name": "datetime", "annotation": ""}, "snippet": " object = datetime.datetime(\n 1970,\n 1,\n 1,\n object.hour,\n object.minute,\n object.second,\n object.microsecond,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L81_C4", "label": "return", "type": "return", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L64_C0", "vector": [13, 1, 0.0894, 0.0011, 1, 0.34, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return object"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L84_C0", "label": "sqlhtml_validators", "type": "function", "loc": [84, 102], "level": 0, "parent": null, "vector": [2, 0, 0.1026, 0.021, 0, 0.66, 0.4524, 114, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "sqlhtml_validators", "arg_names": ["field_type", "length"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def sqlhtml_validators(field_type, length):\n v = {\n 'boolean': [],\n 'string': validators.IS_LENGTH(length),\n 'text': [],\n 'password': validators.IS_LENGTH(length),\n 'blob': [],\n 'upload': [],"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L85_C4", "label": "v =", "type": "assigned_variable", "loc": [85, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L84_C0", "vector": [14, 1, 0.101, 0.0155, 1, 0.31, 0.0, 553, 0, 0, 0, 0, 0, 6, 8], "semantic": {"name": "v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " v = {\n 'boolean': [],\n 'string': validators.IS_LENGTH(length),\n 'text': [],\n 'password': validators.IS_LENGTH(length),\n 'blob': [],\n 'upload': [],\n 'double': validators.IS_FLOAT_IN_RANGE(-1e100, 1e100),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Try_L99_C4", "label": "try", "type": "try", "loc": [99, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L84_C0", "vector": [7, 1, 0.1109, 0.0044, 1, 0.31, 1.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return v[field_type[:9]]\n except KeyError:\n return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L100_C8", "label": "return", "type": "return", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:Try_L99_C4", "vector": [13, 2, 0.1104, 0.0011, 2, 0.24, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return v[field_type[:9]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L102_C8", "label": "return", "type": "return", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:Try_L99_C4", "vector": [13, 2, 0.1126, 0.0011, 2, 0.24, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L105_C0", "label": "DALStorage", "type": "class", "loc": [105, 121], "level": 0, "parent": null, "vector": [3, 0, 0.1247, 0.0188, 0, 0.66, 0.4762, 640, 0, 3, 0, 0, 827, 0, 2], "semantic": {"name": "DALStorage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DALStorage(dict):\n\n \"\"\"\n a dictionary that let you do d['a'] as well as d.a\n \"\"\"\n\n def __getattr__(self, key):\n return self[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L107_C4", "label": "expression", "type": "expression", "loc": [107, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L105_C0", "vector": [8, 1, 0.1192, 0.0033, 1, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n a dictionary that let you do d['a'] as well as d.a\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L111_C4", "label": "__getattr__", "type": "function", "loc": [111, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L105_C0", "vector": [2, 1, 0.1231, 0.0022, 1, 0.05, 0.3333, 210, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__getattr__", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getattr__(self, key):\n return self[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L112_C8", "label": "return", "type": "return", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L111_C4", "vector": [13, 2, 0.1236, 0.0011, 2, 0.38, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L114_C4", "label": "__setattr__", "type": "function", "loc": [114, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L105_C0", "vector": [2, 1, 0.128, 0.0055, 1, 0.05, 0.6667, 112, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__setattr__", "arg_names": ["self", "key", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __setattr__(self, key, value):\n if key in self:\n raise SyntaxError(\n 'Object \\'%s\\'exists and cannot be redefined' % key)\n self[key] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L115_C8", "label": "if", "type": "if", "loc": [115, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L114_C4", "vector": [4, 2, 0.128, 0.0033, 2, 0.62, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if key in self:\n raise SyntaxError(\n 'Object \\'%s\\'exists and cannot be redefined' % key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L118_C8", "label": "assign", "type": "assigned_variable", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L114_C4", "vector": [14, 2, 0.1302, 0.0011, 2, 0.62, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self[key] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L120_C4", "label": "__repr__", "type": "function", "loc": [120, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L105_C0", "vector": [2, 1, 0.133, 0.0022, 1, 0.05, 1.0, 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 '<DALStorage ' + dict.__repr__(self) + '>'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L121_C8", "label": "return", "type": "return", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L120_C4", "vector": [13, 2, 0.1336, 0.0011, 2, 0.0, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '<DALStorage ' + dict.__repr__(self) + '>'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L124_C0", "label": "SQLCallableList", "type": "class", "loc": [124, 127], "level": 0, "parent": null, "vector": [3, 0, 0.1385, 0.0044, 0, 0.66, 0.5, 408, 0, 1, 0, 0, 430, 0, 1], "semantic": {"name": "SQLCallableList", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SQLCallableList(list):\n\n def __call__(self):\n return copy.copy(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L126_C4", "label": "__call__", "type": "function", "loc": [126, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L124_C0", "vector": [2, 1, 0.1396, 0.0022, 1, 0.91, 0.0, 319, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__call__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __call__(self):\n return copy.copy(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L127_C8", "label": "return", "type": "return", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L126_C4", "vector": [13, 2, 0.1402, 0.0011, 2, 0.14, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return copy.copy(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L130_C0", "label": "MEMDB", "type": "class", "loc": [130, 167], "level": 0, "parent": null, "vector": [3, 0, 0.1639, 0.0419, 0, 0.66, 0.5238, 158, 0, 3, 0, 0, 640, 0, 9], "semantic": {"name": "MEMDB", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MEMDB(DALStorage):\n\n \"\"\"\n an instance of this class represents a database connection\n\n Example::\n\n db=MEMDB(Client())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L132_C4", "label": "expression", "type": "expression", "loc": [132, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L130_C0", "vector": [8, 1, 0.1501, 0.0099, 1, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n an instance of this class represents a database connection\n\n Example::\n\n db=MEMDB(Client())\n db.define_table('tablename',Field('fieldname1'),\n Field('fieldname2'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L142_C4", "label": "__init__", "type": "function", "loc": [142, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L130_C0", "vector": [2, 1, 0.1595, 0.0066, 1, 0.75, 0.3333, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "client"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, client):\n self._dbname = 'memdb'\n self['_lastsql'] = ''\n self.tables = SQLCallableList()\n self._translator = SQL_DIALECTS['memcache']\n self.client = client"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L143_C8", "label": "self._dbname =", "type": "assigned_variable", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L142_C4", "vector": [14, 2, 0.1578, 0.0011, 2, 0.33, 0.0, 78, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self._dbname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._dbname = 'memdb'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L144_C8", "label": "assign", "type": "assigned_variable", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L142_C4", "vector": [14, 2, 0.1589, 0.0011, 2, 0.33, 0.25, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self['_lastsql'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L145_C8", "label": "self.tables = SQLCallableList()", "type": "assigned_variable", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L142_C4", "vector": [14, 2, 0.16, 0.0011, 2, 0.33, 0.5, 140, 3, 0, 0, 0, 408, 10, 1], "semantic": {"name": "self.tables", "arg_names": [], "import_names": [], "rhs_call_name": "SQLCallableList", "annotation": ""}, "snippet": " self.tables = SQLCallableList()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L146_C8", "label": "self._translator =", "type": "assigned_variable", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L142_C4", "vector": [14, 2, 0.1611, 0.0011, 2, 0.33, 0.75, 251, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._translator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._translator = SQL_DIALECTS['memcache']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L147_C8", "label": "self.client =", "type": "assigned_variable", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L142_C4", "vector": [14, 2, 0.1623, 0.0011, 2, 0.33, 1.0, 349, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.client", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.client = client"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L149_C4", "label": "define_table", "type": "function", "loc": [149, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L130_C0", "vector": [2, 1, 0.1727, 0.0177, 1, 0.75, 0.6667, 874, 0, 4, 1, 0, 0, 0, 7], "semantic": {"name": "define_table", "arg_names": ["self", "tablename", "fields", "args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def define_table(\n self,\n tablename,\n *fields,\n **args\n ):\n tablename = cleanup(tablename)\n if tablename in dir(self) or tablename[0] == '_':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L155_C8", "label": "tablename = cleanup()", "type": "assigned_variable", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L149_C4", "vector": [14, 2, 0.1711, 0.0011, 2, 0.64, 0.0, 821, 3, 1, 0, 0, 656, 10, 1], "semantic": {"name": "tablename", "arg_names": [], "import_names": [], "rhs_call_name": "cleanup", "annotation": ""}, "snippet": " tablename = cleanup(tablename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L156_C8", "label": "if", "type": "if", "loc": [156, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L149_C4", "vector": [4, 2, 0.1727, 0.0022, 2, 0.64, 0.2, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tablename in dir(self) or tablename[0] == '_':\n raise SyntaxError('invalid table name: %s' % tablename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L158_C8", "label": "if", "type": "if", "loc": [158, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L149_C4", "vector": [4, 2, 0.176, 0.0044, 2, 0.64, 0.4, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not tablename in self.tables:\n self.tables.append(tablename)\n else:\n raise SyntaxError('table already defined: %s' % tablename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L159_C12", "label": "append()", "type": "expression", "loc": [159, 159], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L158_C8", "vector": [8, 3, 0.1755, 0.0011, 3, 0.83, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.tables.append(tablename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L162_C8", "label": "t = Table()", "type": "assigned_variable", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L149_C4", "vector": [14, 2, 0.1788, 0.0011, 2, 0.64, 0.6, 15, 3, 3, 0, 0, 79, 10, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "Table", "annotation": ""}, "snippet": " t = self[tablename] = Table(self, tablename, *fields)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L163_C8", "label": "_create()", "type": "expression", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L149_C4", "vector": [8, 2, 0.1799, 0.0011, 2, 0.64, 0.8, 533, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_create", "arg_names": [], "import_names": [], "rhs_call_name": "_create", "annotation": ""}, "snippet": " t._create()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L164_C8", "label": "return", "type": "return", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L149_C4", "vector": [13, 2, 0.181, 0.0011, 2, 0.64, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L166_C4", "label": "__call__", "type": "function", "loc": [166, 167], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L130_C0", "vector": [2, 1, 0.1838, 0.0022, 1, 0.75, 1.0, 319, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__call__", "arg_names": ["self", "where"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __call__(self, where=''):\n return Set(self, where)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L167_C8", "label": "return", "type": "return", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L166_C4", "vector": [13, 2, 0.1843, 0.0011, 2, 0.14, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Set(self, where)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L170_C0", "label": "SQLALL", "type": "class", "loc": [170, 173], "level": 0, "parent": null, "vector": [3, 0, 0.1893, 0.0044, 0, 0.66, 0.5476, 1, 0, 1, 0, 0, 186, 0, 0], "semantic": {"name": "SQLALL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class SQLALL(object):\n\n def __init__(self, table):\n self.table = table"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L172_C4", "label": "__init__", "type": "function", "loc": [172, 173], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L170_C0", "vector": [2, 1, 0.1904, 0.0022, 1, 0.05, 0.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "table"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, table):\n self.table = table"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L173_C8", "label": "self.table =", "type": "assigned_variable", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L172_C4", "vector": [14, 2, 0.1909, 0.0011, 2, 0.7, 0.0, 327, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.table = table"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "label": "Table", "type": "class", "loc": [176, 300], "level": 0, "parent": null, "vector": [3, 0, 0.2627, 0.138, 0, 0.66, 0.5714, 79, 0, 12, 0, 0, 640, 0, 37], "semantic": {"name": "Table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Table(DALStorage):\n\n \"\"\"\n an instance of this class represents a database table\n\n Example::\n\n db=MEMDB(Client())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L178_C4", "label": "expression", "type": "expression", "loc": [178, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "vector": [8, 1, 0.2009, 0.0099, 1, 0.51, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n an instance of this class represents a database table\n\n Example::\n\n db=MEMDB(Client())\n db.define_table('users',Field('name'))\n db.users.insert(name='me')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L188_C4", "label": "__init__", "type": "function", "loc": [188, 206], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "vector": [2, 1, 0.2174, 0.021, 1, 0.51, 0.0833, 555, 0, 4, 0, 0, 0, 0, 6], "semantic": {"name": "__init__", "arg_names": ["self", "db", "tablename", "fields"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(\n self,\n db,\n tablename,\n *fields\n ):\n self._db = db\n self._tablename = tablename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L194_C8", "label": "self._db =", "type": "assigned_variable", "loc": [194, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L188_C4", "vector": [14, 2, 0.2141, 0.0011, 2, 0.8, 0.0, 896, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._db", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._db = db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L195_C8", "label": "self._tablename =", "type": "assigned_variable", "loc": [195, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L188_C4", "vector": [14, 2, 0.2152, 0.0011, 2, 0.8, 0.1429, 141, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._tablename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._tablename = tablename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L196_C8", "label": "self.fields = SQLCallableList()", "type": "assigned_variable", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L188_C4", "vector": [14, 2, 0.2163, 0.0011, 2, 0.8, 0.2857, 318, 3, 0, 0, 0, 408, 10, 1], "semantic": {"name": "self.fields", "arg_names": [], "import_names": [], "rhs_call_name": "SQLCallableList", "annotation": ""}, "snippet": " self.fields = SQLCallableList()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L197_C8", "label": "self._referenced_by =", "type": "assigned_variable", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L188_C4", "vector": [14, 2, 0.2174, 0.0011, 2, 0.8, 0.4286, 47, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self._referenced_by", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._referenced_by = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L198_C8", "label": "fields = list()", "type": "assigned_variable", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L188_C4", "vector": [14, 2, 0.2185, 0.0011, 2, 0.8, 0.5714, 358, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "fields", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " fields = list(fields)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L199_C8", "label": "insert()", "type": "expression", "loc": [199, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L188_C4", "vector": [8, 2, 0.2196, 0.0011, 2, 0.8, 0.7143, 368, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " fields.insert(0, Field('id', 'id'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:For_L200_C8", "label": "for field", "type": "for", "loc": [200, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L188_C4", "vector": [6, 2, 0.2235, 0.0066, 2, 0.8, 0.8571, 480, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for field in fields:\n self.fields.append(field.name)\n self[field.name] = field\n field._tablename = self._tablename\n field._table = self\n field._db = self._db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L201_C12", "label": "append()", "type": "expression", "loc": [201, 201], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L200_C8", "vector": [8, 3, 0.2219, 0.0011, 3, 0.36, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.fields.append(field.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L202_C12", "label": "assign", "type": "assigned_variable", "loc": [202, 202], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L200_C8", "vector": [14, 3, 0.223, 0.0011, 3, 0.36, 0.25, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self[field.name] = field"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L203_C12", "label": "field._tablename =", "type": "assigned_variable", "loc": [203, 203], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L200_C8", "vector": [14, 3, 0.2241, 0.0011, 3, 0.36, 0.5, 610, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "field._tablename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field._tablename = self._tablename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L204_C12", "label": "field._table =", "type": "assigned_variable", "loc": [204, 204], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L200_C8", "vector": [14, 3, 0.2252, 0.0011, 3, 0.36, 0.75, 506, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "field._table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field._table = self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L205_C12", "label": "field._db =", "type": "assigned_variable", "loc": [205, 205], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L200_C8", "vector": [14, 3, 0.2263, 0.0011, 3, 0.36, 1.0, 187, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "field._db", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field._db = self._db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L206_C8", "label": "self.ALL = SQLALL()", "type": "assigned_variable", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L188_C4", "vector": [14, 2, 0.2274, 0.0011, 2, 0.8, 1.0, 254, 3, 1, 0, 0, 1, 10, 1], "semantic": {"name": "self.ALL", "arg_names": [], "import_names": [], "rhs_call_name": "SQLALL", "annotation": ""}, "snippet": " self.ALL = SQLALL(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L208_C4", "label": "_create", "type": "function", "loc": [208, 241], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "vector": [2, 1, 0.2478, 0.0375, 1, 0.51, 0.1667, 533, 0, 1, 1, 0, 0, 0, 8], "semantic": {"name": "_create", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _create(self):\n fields = []\n myfields = {}\n for k in self.fields:\n field = self[k]\n attr = {}\n if not field.type[:9] in ['id', 'reference']:\n if field.notnull:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L209_C8", "label": "fields =", "type": "assigned_variable", "loc": [209, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L208_C4", "vector": [14, 2, 0.2307, 0.0011, 2, 0.74, 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_500:Assign_L210_C8", "label": "myfields =", "type": "assigned_variable", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L208_C4", "vector": [14, 2, 0.2318, 0.0011, 2, 0.74, 0.25, 948, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "myfields", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " myfields = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:For_L211_C8", "label": "for k", "type": "for", "loc": [211, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L208_C4", "vector": [6, 2, 0.2483, 0.032, 2, 0.74, 0.5, 954, 7, 0, 0, 0, 0, 0, 8], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k in self.fields:\n field = self[k]\n attr = {}\n if not field.type[:9] in ['id', 'reference']:\n if field.notnull:\n attr = dict(required=True)\n if field.type[:2] == 'id':\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L212_C12", "label": "field =", "type": "assigned_variable", "loc": [212, 212], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L211_C8", "vector": [14, 3, 0.234, 0.0011, 3, 0.86, 0.0, 480, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field = self[k]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L213_C12", "label": "attr =", "type": "assigned_variable", "loc": [213, 213], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L211_C8", "vector": [14, 3, 0.2351, 0.0011, 3, 0.86, 0.25, 400, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "attr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " attr = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L214_C12", "label": "if", "type": "if", "loc": [214, 216], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L211_C8", "vector": [4, 3, 0.2373, 0.0033, 3, 0.86, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not field.type[:9] in ['id', 'reference']:\n if field.notnull:\n attr = dict(required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L215_C16", "label": "if", "type": "if", "loc": [215, 216], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L214_C12", "vector": [4, 4, 0.2379, 0.0022, 4, 0.01, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field.notnull:\n attr = dict(required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L216_C20", "label": "attr = dict()", "type": "assigned_variable", "loc": [216, 216], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L215_C16", "vector": [14, 5, 0.2384, 0.0011, 5, 0.46, 0.0, 400, 3, 1, 0, 0, 827, 10, 1], "semantic": {"name": "attr", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " attr = dict(required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L217_C12", "label": "if", "type": "if", "loc": [217, 218], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L211_C8", "vector": [4, 3, 0.2401, 0.0022, 3, 0.86, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field.type[:2] == 'id':\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L219_C12", "label": "if", "type": "if", "loc": [219, 239], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L211_C8", "vector": [4, 3, 0.2528, 0.0232, 3, 0.86, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field.type[:9] == 'reference':\n referenced = field.type[10:].strip()\n if not referenced:\n raise SyntaxError('Table %s: reference \\'%s\\' to nothing!' % (\n self._tablename, k))\n if not referenced in self._db:\n raise SyntaxError(\n 'Table: table %s does not exist' % referenced)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L220_C16", "label": "referenced = strip()", "type": "assigned_variable", "loc": [220, 220], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L219_C12", "vector": [14, 4, 0.2428, 0.0011, 4, 0.05, 0.0, 512, 3, 0, 0, 0, 973, 10, 1], "semantic": {"name": "referenced", "arg_names": [], "import_names": [], "rhs_call_name": "strip", "annotation": ""}, "snippet": " referenced = field.type[10:].strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L221_C16", "label": "if", "type": "if", "loc": [221, 223], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L219_C12", "vector": [4, 4, 0.245, 0.0033, 4, 0.05, 0.1429, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not referenced:\n raise SyntaxError('Table %s: reference \\'%s\\' to nothing!' % (\n self._tablename, k))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L224_C16", "label": "if", "type": "if", "loc": [224, 226], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L219_C12", "vector": [4, 4, 0.2483, 0.0033, 4, 0.05, 0.2857, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not referenced in self._db:\n raise SyntaxError(\n 'Table: table %s does not exist' % referenced)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L227_C16", "label": "referee =", "type": "assigned_variable", "loc": [227, 227], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L219_C12", "vector": [14, 4, 0.2506, 0.0011, 4, 0.05, 0.4286, 212, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "referee", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " referee = self._db[referenced]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L228_C16", "label": "ftype =", "type": "assigned_variable", "loc": [228, 230], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L219_C12", "vector": [14, 4, 0.2528, 0.0033, 4, 0.05, 0.5714, 364, 3, 1, 0, 0, 0, 10, 1], "semantic": {"name": "ftype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ftype = \\\n self._db._translator[field.type[:9]](\n self._db[referenced]._tableobj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L231_C16", "label": "if", "type": "if", "loc": [231, 234], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L219_C12", "vector": [4, 4, 0.2566, 0.0044, 4, 0.05, 0.7143, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._tablename in referee.fields: # ## THIS IS OK\n raise SyntaxError('Field: table \\'%s\\' has same name as a field '\n 'in referenced table \\'%s\\'' % (\n self._tablename, referenced))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L235_C16", "label": "append()", "type": "expression", "loc": [235, 236], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L219_C12", "vector": [8, 4, 0.2599, 0.0022, 4, 0.05, 0.8571, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self._db[referenced]._referenced_by.append((self._tablename,\n field.name))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L237_C12", "label": "if", "type": "if", "loc": [237, 239], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L219_C12", "vector": [4, 4, 0.2627, 0.0033, 4, 0.05, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif not field.type in self._db._translator\\\n or not self._db._translator[field.type]:\n raise SyntaxError('Field: unkown field type %s' % field.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L240_C8", "label": "self._tableobj =", "type": "assigned_variable", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L208_C4", "vector": [14, 2, 0.2649, 0.0011, 2, 0.74, 0.75, 80, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._tableobj", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._tableobj = self._db.client"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L241_C8", "label": "return", "type": "return", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L208_C4", "vector": [13, 2, 0.266, 0.0011, 2, 0.74, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L243_C4", "label": "create", "type": "function", "loc": [243, 247], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "vector": [2, 1, 0.2704, 0.0055, 1, 0.51, 0.25, 316, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "create", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def create(self):\n\n # nothing to do, here for backward compatility\n\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L249_C4", "label": "drop", "type": "function", "loc": [249, 253], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "vector": [2, 1, 0.277, 0.0055, 1, 0.51, 0.3333, 255, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "drop", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def drop(self):\n\n # nothing to do, here for backward compatibility\n\n self._db(self.id > 0).delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L253_C8", "label": "delete()", "type": "expression", "loc": [253, 253], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L249_C4", "vector": [8, 2, 0.2792, 0.0011, 2, 0.22, 0.0, 266, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " self._db(self.id > 0).delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L255_C4", "label": "insert", "type": "function", "loc": [255, 260], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "vector": [2, 1, 0.2842, 0.0066, 1, 0.51, 0.4167, 368, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "insert", "arg_names": ["self", "fields"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def insert(self, **fields):\n id = self._create_id()\n if self.update(id, **fields):\n return long(id)\n else:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L256_C8", "label": "id = _create_id()", "type": "assigned_variable", "loc": [256, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L255_C4", "vector": [14, 2, 0.2826, 0.0011, 2, 0.68, 0.0, 941, 3, 0, 0, 0, 37, 10, 1], "semantic": {"name": "id", "arg_names": [], "import_names": [], "rhs_call_name": "_create_id", "annotation": ""}, "snippet": " id = self._create_id()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L257_C8", "label": "if", "type": "if", "loc": [257, 260], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L255_C4", "vector": [4, 2, 0.2853, 0.0044, 2, 0.68, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.update(id, **fields):\n return long(id)\n else:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L258_C12", "label": "return", "type": "return", "loc": [258, 258], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L257_C8", "vector": [13, 3, 0.2848, 0.0011, 3, 0.25, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return long(id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L260_C12", "label": "return", "type": "return", "loc": [260, 260], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L257_C8", "vector": [13, 3, 0.287, 0.0011, 3, 0.25, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L262_C4", "label": "get", "type": "function", "loc": [262, 267], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "vector": [2, 1, 0.2919, 0.0066, 1, 0.51, 0.5, 607, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "get", "arg_names": ["self", "id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self, id):\n val = self._tableobj.get(self._id_to_key(id))\n if val:\n return Storage(val)\n else:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L263_C8", "label": "val = get()", "type": "assigned_variable", "loc": [263, 263], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L262_C4", "vector": [14, 2, 0.2903, 0.0011, 2, 0.24, 0.0, 618, 3, 1, 0, 0, 607, 10, 2], "semantic": {"name": "val", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " val = self._tableobj.get(self._id_to_key(id))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L264_C8", "label": "if", "type": "if", "loc": [264, 267], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L262_C4", "vector": [4, 2, 0.293, 0.0044, 2, 0.24, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if val:\n return Storage(val)\n else:\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L265_C12", "label": "return", "type": "return", "loc": [265, 265], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L264_C8", "vector": [13, 3, 0.2925, 0.0011, 3, 0.43, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Storage(val)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L267_C12", "label": "return", "type": "return", "loc": [267, 267], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L264_C8", "vector": [13, 3, 0.2947, 0.0011, 3, 0.43, 1.0, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L269_C4", "label": "update", "type": "function", "loc": [269, 277], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "vector": [2, 1, 0.3013, 0.0099, 1, 0.51, 0.5833, 637, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "update", "arg_names": ["self", "id", "fields"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update(self, id, **fields):\n for field in fields:\n if not field in fields and self[field].default\\\n is not None:\n fields[field] = self[field].default\n if field in fields:\n fields[field] = obj_represent(fields[field],\n self[field].type, self._db)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:For_L270_C8", "label": "for field", "type": "for", "loc": [270, 276], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L269_C4", "vector": [6, 2, 0.3013, 0.0077, 2, 0.9, 0.0, 480, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for field in fields:\n if not field in fields and self[field].default\\\n is not None:\n fields[field] = self[field].default\n if field in fields:\n fields[field] = obj_represent(fields[field],\n self[field].type, self._db)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L271_C12", "label": "if", "type": "if", "loc": [271, 273], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L270_C8", "vector": [4, 3, 0.3002, 0.0033, 3, 0.61, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not field in fields and self[field].default\\\n is not None:\n fields[field] = self[field].default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L273_C16", "label": "assign", "type": "assigned_variable", "loc": [273, 273], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L271_C12", "vector": [14, 4, 0.3013, 0.0011, 4, 0.66, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fields[field] = self[field].default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L274_C12", "label": "if", "type": "if", "loc": [274, 276], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L270_C8", "vector": [4, 3, 0.3035, 0.0033, 3, 0.61, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field in fields:\n fields[field] = obj_represent(fields[field],\n self[field].type, self._db)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L275_C16", "label": " = obj_represent()", "type": "assigned_variable", "loc": [275, 276], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L274_C12", "vector": [14, 4, 0.3041, 0.0022, 4, 0.81, 0.0, 0, 3, 3, 0, 0, 637, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "obj_represent", "annotation": ""}, "snippet": " fields[field] = obj_represent(fields[field],\n self[field].type, self._db)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L277_C8", "label": "return", "type": "return", "loc": [277, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L269_C4", "vector": [13, 2, 0.3057, 0.0011, 2, 0.9, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._tableobj.set(self._id_to_key(id), fields)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L279_C4", "label": "delete", "type": "function", "loc": [279, 280], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "vector": [2, 1, 0.3085, 0.0022, 1, 0.51, 0.6667, 266, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": ["self", "id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def delete(self, id):\n return self._tableobj.delete(self._id_to_key(id))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L280_C8", "label": "return", "type": "return", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L279_C4", "vector": [13, 2, 0.3091, 0.0011, 2, 0.29, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._tableobj.delete(self._id_to_key(id))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L282_C4", "label": "_shard_key", "type": "function", "loc": [282, 283], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "vector": [2, 1, 0.3118, 0.0022, 1, 0.51, 0.75, 799, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "_shard_key", "arg_names": ["self", "shard"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _shard_key(self, shard):\n return self._id_to_key('s/%s' % shard)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L283_C8", "label": "return", "type": "return", "loc": [283, 283], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L282_C4", "vector": [13, 2, 0.3124, 0.0011, 2, 0.67, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._id_to_key('s/%s' % shard)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L285_C4", "label": "_id_to_key", "type": "function", "loc": [285, 286], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "vector": [2, 1, 0.3151, 0.0022, 1, 0.51, 0.8333, 214, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "_id_to_key", "arg_names": ["self", "id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _id_to_key(self, id):\n return '__memdb__/t/%s/k/%s' % (self._tablename, str(id))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L286_C8", "label": "return", "type": "return", "loc": [286, 286], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L285_C4", "vector": [13, 2, 0.3157, 0.0011, 2, 0.72, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '__memdb__/t/%s/k/%s' % (self._tablename, str(id))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L288_C4", "label": "_create_id", "type": "function", "loc": [288, 297], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "vector": [2, 1, 0.3228, 0.011, 1, 0.51, 0.9167, 37, 0, 1, 1, 0, 0, 0, 8], "semantic": {"name": "_create_id", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _create_id(self):\n shard = random.randint(10, 99)\n shard_id = self._shard_key(shard)\n id = self._tableobj.incr(shard_id)\n if not id:\n if self._tableobj.set(shard_id, '0'):\n id = 0\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L289_C8", "label": "shard = randint()", "type": "assigned_variable", "loc": [289, 289], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L288_C4", "vector": [14, 2, 0.319, 0.0011, 2, 0.34, 0.0, 319, 3, 2, 0, 0, 449, 10, 1], "semantic": {"name": "shard", "arg_names": [], "import_names": [], "rhs_call_name": "randint", "annotation": ""}, "snippet": " shard = random.randint(10, 99)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L290_C8", "label": "shard_id = _shard_key()", "type": "assigned_variable", "loc": [290, 290], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L288_C4", "vector": [14, 2, 0.3201, 0.0011, 2, 0.34, 0.25, 71, 3, 1, 0, 0, 799, 10, 1], "semantic": {"name": "shard_id", "arg_names": [], "import_names": [], "rhs_call_name": "_shard_key", "annotation": ""}, "snippet": " shard_id = self._shard_key(shard)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L291_C8", "label": "id = incr()", "type": "assigned_variable", "loc": [291, 291], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L288_C4", "vector": [14, 2, 0.3212, 0.0011, 2, 0.34, 0.5, 941, 3, 1, 0, 0, 621, 10, 1], "semantic": {"name": "id", "arg_names": [], "import_names": [], "rhs_call_name": "incr", "annotation": ""}, "snippet": " id = self._tableobj.incr(shard_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L292_C8", "label": "if", "type": "if", "loc": [292, 296], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L288_C4", "vector": [4, 2, 0.3245, 0.0055, 2, 0.34, 0.75, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not id:\n if self._tableobj.set(shard_id, '0'):\n id = 0\n else:\n raise Exception('cannot set memcache')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L293_C12", "label": "if", "type": "if", "loc": [293, 296], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L292_C8", "vector": [4, 3, 0.3251, 0.0044, 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 self._tableobj.set(shard_id, '0'):\n id = 0\n else:\n raise Exception('cannot set memcache')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L294_C16", "label": "id =", "type": "assigned_variable", "loc": [294, 294], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L293_C12", "vector": [14, 4, 0.3245, 0.0011, 4, 0.23, 0.0, 941, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " id = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L297_C8", "label": "return", "type": "return", "loc": [297, 297], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L288_C4", "vector": [13, 2, 0.3278, 0.0011, 2, 0.34, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return long(str(shard) + str(id))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L299_C4", "label": "__str__", "type": "function", "loc": [299, 300], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "vector": [2, 1, 0.3306, 0.0022, 1, 0.51, 1.0, 527, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n return self._tablename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L300_C8", "label": "return", "type": "return", "loc": [300, 300], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L299_C4", "vector": [13, 2, 0.3311, 0.0011, 2, 0.01, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._tablename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "label": "Expression", "type": "class", "loc": [303, 358], "level": 0, "parent": null, "vector": [3, 0, 0.3648, 0.0618, 0, 0.66, 0.5952, 516, 0, 14, 0, 0, 186, 0, 14], "semantic": {"name": "Expression", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Expression(object):\n\n def __init__(\n self,\n name,\n type='string',\n db=None,\n ):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L305_C4", "label": "__init__", "type": "function", "loc": [305, 311], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "vector": [2, 1, 0.34, 0.0077, 1, 0.37, 0.0, 555, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "name", "type", "db"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(\n self,\n name,\n type='string',\n db=None,\n ):\n (self.name, self.type, self._db) = (name, type, db)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L311_C8", "label": "assign", "type": "assigned_variable", "loc": [311, 311], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L305_C4", "vector": [14, 2, 0.3433, 0.0011, 2, 0.37, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (self.name, self.type, self._db) = (name, type, db)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L313_C4", "label": "__str__", "type": "function", "loc": [313, 314], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "vector": [2, 1, 0.346, 0.0022, 1, 0.37, 0.0769, 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.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L314_C8", "label": "return", "type": "return", "loc": [314, 314], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L313_C4", "vector": [13, 2, 0.3466, 0.0011, 2, 0.06, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L316_C4", "label": "__or__", "type": "function", "loc": [316, 318], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "vector": [2, 1, 0.3499, 0.0033, 1, 0.37, 0.1538, 789, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__or__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __or__(self, other): # for use in sortby\n assert_filter_fields(self, other)\n return Expression(self.name + '|' + other.name, None, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L317_C8", "label": "assert_filter_fields()", "type": "expression", "loc": [317, 317], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L316_C4", "vector": [8, 2, 0.3499, 0.0011, 2, 0.32, 0.0, 510, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assert_filter_fields", "arg_names": [], "import_names": [], "rhs_call_name": "assert_filter_fields", "annotation": ""}, "snippet": " assert_filter_fields(self, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L318_C8", "label": "return", "type": "return", "loc": [318, 318], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L316_C4", "vector": [13, 2, 0.351, 0.0011, 2, 0.32, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Expression(self.name + '|' + other.name, None, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L320_C4", "label": "__invert__", "type": "function", "loc": [320, 322], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "vector": [2, 1, 0.3543, 0.0033, 1, 0.37, 0.2308, 504, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "__invert__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __invert__(self):\n assert_filter_fields(self)\n return Expression('-' + self.name, self.type, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L321_C8", "label": "assert_filter_fields()", "type": "expression", "loc": [321, 321], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L320_C4", "vector": [8, 2, 0.3543, 0.0011, 2, 0.43, 0.0, 510, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assert_filter_fields", "arg_names": [], "import_names": [], "rhs_call_name": "assert_filter_fields", "annotation": ""}, "snippet": " assert_filter_fields(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L322_C8", "label": "return", "type": "return", "loc": [322, 322], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L320_C4", "vector": [13, 2, 0.3554, 0.0011, 2, 0.43, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Expression('-' + self.name, self.type, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L326_C4", "label": "__eq__", "type": "function", "loc": [326, 327], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "vector": [2, 1, 0.3604, 0.0022, 1, 0.37, 0.3077, 763, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__eq__", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __eq__(self, value):\n return Query(self, '=', value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L327_C8", "label": "return", "type": "return", "loc": [327, 327], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L326_C4", "vector": [13, 2, 0.3609, 0.0011, 2, 0.95, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Query(self, '=', value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L329_C4", "label": "__ne__", "type": "function", "loc": [329, 330], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "vector": [2, 1, 0.3637, 0.0022, 1, 0.37, 0.3846, 254, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__ne__", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __ne__(self, value):\n return Query(self, '!=', value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L330_C8", "label": "return", "type": "return", "loc": [330, 330], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L329_C4", "vector": [13, 2, 0.3642, 0.0011, 2, 0.09, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Query(self, '!=', value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L332_C4", "label": "__lt__", "type": "function", "loc": [332, 333], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "vector": [2, 1, 0.367, 0.0022, 1, 0.37, 0.4615, 217, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__lt__", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __lt__(self, value):\n return Query(self, '<', value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L333_C8", "label": "return", "type": "return", "loc": [333, 333], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L332_C4", "vector": [13, 2, 0.3675, 0.0011, 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 Query(self, '<', value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L335_C4", "label": "__le__", "type": "function", "loc": [335, 336], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "vector": [2, 1, 0.3703, 0.0022, 1, 0.37, 0.5385, 308, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__le__", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __le__(self, value):\n return Query(self, '<=', value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L336_C8", "label": "return", "type": "return", "loc": [336, 336], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L335_C4", "vector": [13, 2, 0.3709, 0.0011, 2, 0.15, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Query(self, '<=', value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L338_C4", "label": "__gt__", "type": "function", "loc": [338, 339], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "vector": [2, 1, 0.3736, 0.0022, 1, 0.37, 0.6154, 974, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__gt__", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __gt__(self, value):\n return Query(self, '>', value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L339_C8", "label": "return", "type": "return", "loc": [339, 339], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L338_C4", "vector": [13, 2, 0.3742, 0.0011, 2, 0.9, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Query(self, '>', value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L341_C4", "label": "__ge__", "type": "function", "loc": [341, 342], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "vector": [2, 1, 0.3769, 0.0022, 1, 0.37, 0.6923, 518, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__ge__", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __ge__(self, value):\n return Query(self, '>=', value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L342_C8", "label": "return", "type": "return", "loc": [342, 342], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L341_C4", "vector": [13, 2, 0.3775, 0.0011, 2, 0.89, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Query(self, '>=', value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L348_C4", "label": "__add__", "type": "function", "loc": [348, 349], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "vector": [2, 1, 0.3847, 0.0022, 1, 0.37, 0.7692, 899, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__add__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __add__(self, other):\n return Expression('%s+%s' % (self, other), 'float', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L349_C8", "label": "return", "type": "return", "loc": [349, 349], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L348_C4", "vector": [13, 2, 0.3852, 0.0011, 2, 0.53, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Expression('%s+%s' % (self, other), 'float', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L351_C4", "label": "__sub__", "type": "function", "loc": [351, 352], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "vector": [2, 1, 0.388, 0.0022, 1, 0.37, 0.8462, 555, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__sub__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __sub__(self, other):\n return Expression('%s-%s' % (self, other), 'float', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L352_C8", "label": "return", "type": "return", "loc": [352, 352], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L351_C4", "vector": [13, 2, 0.3885, 0.0011, 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 Expression('%s-%s' % (self, other), 'float', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L354_C4", "label": "__mul__", "type": "function", "loc": [354, 355], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "vector": [2, 1, 0.3913, 0.0022, 1, 0.37, 0.9231, 215, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__mul__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __mul__(self, other):\n return Expression('%s*%s' % (self, other), 'float', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L355_C8", "label": "return", "type": "return", "loc": [355, 355], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L354_C4", "vector": [13, 2, 0.3918, 0.0011, 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 Expression('%s*%s' % (self, other), 'float', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L357_C4", "label": "__div__", "type": "function", "loc": [357, 358], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "vector": [2, 1, 0.3946, 0.0022, 1, 0.37, 1.0, 399, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__div__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __div__(self, other):\n return Expression('%s/%s' % (self, other), 'float', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L358_C8", "label": "return", "type": "return", "loc": [358, 358], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L357_C4", "vector": [13, 2, 0.3951, 0.0011, 2, 0.91, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Expression('%s/%s' % (self, other), 'float', None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L361_C0", "label": "Field", "type": "class", "loc": [361, 433], "level": 0, "parent": null, "vector": [3, 0, 0.4382, 0.0806, 0, 0.66, 0.619, 949, 0, 3, 0, 0, 516, 0, 11], "semantic": {"name": "Field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Field(Expression):\n\n \"\"\"\n an instance of this class represents a database field\n\n example::\n\n a = Field(name, 'string', length=32, required=False,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L363_C4", "label": "expression", "type": "expression", "loc": [363, 382], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L361_C0", "vector": [8, 1, 0.4111, 0.0221, 1, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n an instance of this class represents a database field\n\n example::\n\n a = Field(name, 'string', length=32, required=False,\n default=None, requires=IS_NOT_EMPTY(), notnull=False,\n unique=False, uploadfield=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "label": "__init__", "type": "function", "loc": [384, 417], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L361_C0", "vector": [2, 1, 0.4421, 0.0375, 1, 0.76, 0.3333, 555, 0, 11, 0, 0, 0, 0, 6], "semantic": {"name": "__init__", "arg_names": ["self", "fieldname", "type", "length", "default", "required", "requires", "ondelete", "notnull", "unique", "uploadfield"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(\n self,\n fieldname,\n type='string',\n length=None,\n default=None,\n required=False,\n requires=sqlhtml_validators,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L398_C8", "label": "self.name = cleanup()", "type": "assigned_variable", "loc": [398, 398], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "vector": [14, 2, 0.4393, 0.0011, 2, 0.32, 0.0, 689, 3, 1, 0, 0, 656, 10, 1], "semantic": {"name": "self.name", "arg_names": [], "import_names": [], "rhs_call_name": "cleanup", "annotation": ""}, "snippet": " self.name = cleanup(fieldname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L399_C8", "label": "if", "type": "if", "loc": [399, 400], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "vector": [4, 2, 0.4409, 0.0022, 2, 0.32, 0.0769, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if fieldname in dir(Table) or fieldname[0] == '_':\n raise SyntaxError('Field: invalid field name: %s' % fieldname)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L401_C8", "label": "if", "type": "if", "loc": [401, 402], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "vector": [4, 2, 0.4432, 0.0022, 2, 0.32, 0.1538, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(type, Table):\n type = 'reference ' + type._tablename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L402_C12", "label": "type =", "type": "assigned_variable", "loc": [402, 402], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L401_C8", "vector": [14, 3, 0.4437, 0.0011, 3, 0.08, 0.0, 801, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'reference ' + type._tablename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L403_C8", "label": "if", "type": "if", "loc": [403, 404], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "vector": [4, 2, 0.4454, 0.0022, 2, 0.32, 0.2308, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not length:\n length = 512"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L404_C12", "label": "length =", "type": "assigned_variable", "loc": [404, 404], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L403_C8", "vector": [14, 3, 0.4459, 0.0011, 3, 0.26, 0.0, 221, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "length", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " length = 512"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L405_C8", "label": "self.type =", "type": "assigned_variable", "loc": [405, 405], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "vector": [14, 2, 0.447, 0.0011, 2, 0.32, 0.3077, 398, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.type = type # 'string', 'integer'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L406_C8", "label": "self.length =", "type": "assigned_variable", "loc": [406, 406], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "vector": [14, 2, 0.4481, 0.0011, 2, 0.32, 0.3846, 879, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.length", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.length = length # the length of the string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L407_C8", "label": "self.default =", "type": "assigned_variable", "loc": [407, 407], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "vector": [14, 2, 0.4492, 0.0011, 2, 0.32, 0.4615, 762, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.default", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.default = default # default value for field"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L408_C8", "label": "self.required =", "type": "assigned_variable", "loc": [408, 408], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "vector": [14, 2, 0.4503, 0.0011, 2, 0.32, 0.5385, 770, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.required", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.required = required # is this field required"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L409_C8", "label": "self.ondelete = upper()", "type": "assigned_variable", "loc": [409, 409], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "vector": [14, 2, 0.4514, 0.0011, 2, 0.32, 0.6154, 263, 3, 0, 0, 0, 347, 10, 1], "semantic": {"name": "self.ondelete", "arg_names": [], "import_names": [], "rhs_call_name": "upper", "annotation": ""}, "snippet": " self.ondelete = ondelete.upper() # this is for reference fields only"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L410_C8", "label": "self.notnull =", "type": "assigned_variable", "loc": [410, 410], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "vector": [14, 2, 0.4525, 0.0011, 2, 0.32, 0.6923, 318, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.notnull", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.notnull = notnull"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L411_C8", "label": "self.unique =", "type": "assigned_variable", "loc": [411, 411], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "vector": [14, 2, 0.4536, 0.0011, 2, 0.32, 0.7692, 29, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.unique", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.unique = unique"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L412_C8", "label": "self.uploadfield =", "type": "assigned_variable", "loc": [412, 412], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "vector": [14, 2, 0.4547, 0.0011, 2, 0.32, 0.8462, 104, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.uploadfield", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.uploadfield = uploadfield"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L413_C8", "label": "if", "type": "if", "loc": [413, 416], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "vector": [4, 2, 0.4575, 0.0044, 2, 0.32, 0.9231, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if requires == sqlhtml_validators:\n requires = sqlhtml_validators(type, length)\n elif requires is None:\n requires = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L414_C12", "label": "requires = sqlhtml_validators()", "type": "assigned_variable", "loc": [414, 414], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L413_C8", "vector": [14, 3, 0.457, 0.0011, 3, 0.35, 0.0, 151, 3, 2, 0, 0, 114, 10, 1], "semantic": {"name": "requires", "arg_names": [], "import_names": [], "rhs_call_name": "sqlhtml_validators", "annotation": ""}, "snippet": " requires = sqlhtml_validators(type, length)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L415_C8", "label": "if", "type": "if", "loc": [415, 416], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L413_C8", "vector": [4, 3, 0.4586, 0.0022, 3, 0.35, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif requires is None:\n requires = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L416_C12", "label": "requires =", "type": "assigned_variable", "loc": [416, 416], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L415_C8", "vector": [14, 4, 0.4592, 0.0011, 4, 0.63, 0.0, 151, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "requires", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " requires = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L417_C8", "label": "self.requires =", "type": "assigned_variable", "loc": [417, 417], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "vector": [14, 2, 0.4603, 0.0011, 2, 0.32, 1.0, 469, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.requires", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.requires = requires # list of validators"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L419_C4", "label": "formatter", "type": "function", "loc": [419, 430], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L361_C0", "vector": [2, 1, 0.4685, 0.0132, 1, 0.76, 0.6667, 791, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "formatter", "arg_names": ["self", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def formatter(self, value):\n if value is None or not self.requires:\n return value\n if not isinstance(self.requires, (list, tuple)):\n requires = [self.requires]\n else:\n requires = copy.copy(self.requires)\n requires.reverse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L420_C8", "label": "if", "type": "if", "loc": [420, 421], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L419_C4", "vector": [4, 2, 0.4641, 0.0022, 2, 0.88, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value is None or not self.requires:\n return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L421_C12", "label": "return", "type": "return", "loc": [421, 421], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L420_C8", "vector": [13, 3, 0.4647, 0.0011, 3, 0.93, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L422_C8", "label": "if", "type": "if", "loc": [422, 425], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L419_C4", "vector": [4, 2, 0.4674, 0.0044, 2, 0.88, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(self.requires, (list, tuple)):\n requires = [self.requires]\n else:\n requires = copy.copy(self.requires)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L423_C12", "label": "requires =", "type": "assigned_variable", "loc": [423, 423], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L422_C8", "vector": [14, 3, 0.4669, 0.0011, 3, 0.85, 0.0, 151, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "requires", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " requires = [self.requires]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L425_C12", "label": "requires = copy()", "type": "assigned_variable", "loc": [425, 425], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L422_C8", "vector": [14, 3, 0.4691, 0.0011, 3, 0.85, 1.0, 151, 3, 1, 0, 0, 739, 10, 1], "semantic": {"name": "requires", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " requires = copy.copy(self.requires)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L426_C8", "label": "reverse()", "type": "expression", "loc": [426, 426], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L419_C4", "vector": [8, 2, 0.4702, 0.0011, 2, 0.88, 0.5, 109, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reverse", "arg_names": [], "import_names": [], "rhs_call_name": "reverse", "annotation": ""}, "snippet": " requires.reverse()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:For_L427_C8", "label": "for item", "type": "for", "loc": [427, 429], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L419_C4", "vector": [6, 2, 0.4724, 0.0033, 2, 0.88, 0.75, 434, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in requires:\n if hasattr(item, 'formatter'):\n value = item.formatter(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L428_C12", "label": "if", "type": "if", "loc": [428, 429], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L427_C8", "vector": [4, 3, 0.473, 0.0022, 3, 0.14, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(item, 'formatter'):\n value = item.formatter(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L429_C16", "label": "value = formatter()", "type": "assigned_variable", "loc": [429, 429], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L428_C12", "vector": [14, 4, 0.4735, 0.0011, 4, 0.89, 0.0, 441, 3, 1, 0, 0, 791, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "formatter", "annotation": ""}, "snippet": " value = item.formatter(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L430_C8", "label": "return", "type": "return", "loc": [430, 430], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L419_C4", "vector": [13, 2, 0.4746, 0.0011, 2, 0.88, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L432_C4", "label": "__str__", "type": "function", "loc": [432, 433], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L361_C0", "vector": [2, 1, 0.4774, 0.0022, 1, 0.76, 1.0, 527, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n return '%s.%s' % (self._tablename, self.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L433_C8", "label": "return", "type": "return", "loc": [433, 433], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L432_C4", "vector": [13, 2, 0.4779, 0.0011, 2, 0.7, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s.%s' % (self._tablename, self.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L436_C0", "label": "MEMDB.Field =", "type": "assigned_variable", "loc": [436, 436], "level": 0, "parent": null, "vector": [14, 0, 0.4812, 0.0011, 0, 0.66, 0.6429, 149, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "MEMDB.Field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MEMDB.Field = Field # ## required by gluon/globals.py session.connect"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L439_C0", "label": "obj_represent", "type": "function", "loc": [439, 473], "level": 0, "parent": null, "vector": [2, 0, 0.5033, 0.0386, 0, 0.66, 0.6667, 637, 0, 3, 1, 0, 0, 0, 26], "semantic": {"name": "obj_represent", "arg_names": ["object", "fieldtype", "db"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def obj_represent(object, fieldtype, db):\n if object is not None:\n if fieldtype == 'date' and not isinstance(object,\n datetime.date):\n (y, m, d) = [int(x) for x in str(object).strip().split('-')]\n object = datetime.date(y, m, d)\n elif fieldtype == 'time' and not isinstance(object, datetime.time):\n time_items = [int(x) for x in str(object).strip().split(':')[:3]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L440_C4", "label": "if", "type": "if", "loc": [440, 471], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L439_C0", "vector": [4, 1, 0.5028, 0.0353, 1, 0.69, 0.0, 0, 0, 0, 0, 0, 0, 0, 26], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if object is not None:\n if fieldtype == 'date' and not isinstance(object,\n datetime.date):\n (y, m, d) = [int(x) for x in str(object).strip().split('-')]\n object = datetime.date(y, m, d)\n elif fieldtype == 'time' and not isinstance(object, datetime.time):\n time_items = [int(x) for x in str(object).strip().split(':')[:3]]\n if len(time_items) == 3:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L441_C8", "label": "if", "type": "if", "loc": [441, 471], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L440_C4", "vector": [4, 2, 0.5033, 0.0342, 2, 0.93, 0.0, 0, 0, 0, 0, 0, 0, 0, 26], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if fieldtype == 'date' and not isinstance(object,\n datetime.date):\n (y, m, d) = [int(x) for x in str(object).strip().split('-')]\n object = datetime.date(y, m, d)\n elif fieldtype == 'time' and not isinstance(object, datetime.time):\n time_items = [int(x) for x in str(object).strip().split(':')[:3]]\n if len(time_items) == 3:\n (h, mi, s) = time_items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L443_C12", "label": "y, m, d =", "type": "assigned_variable", "loc": [443, 443], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L441_C8", "vector": [14, 3, 0.489, 0.0011, 3, 0.08, 0.0, 356, 5, 0, 0, 0, 0, 0, 4], "semantic": {"name": "y, m, d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (y, m, d) = [int(x) for x in str(object).strip().split('-')]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L444_C12", "label": "object = date()", "type": "assigned_variable", "loc": [444, 444], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L441_C8", "vector": [14, 3, 0.4901, 0.0011, 3, 0.08, 0.5, 186, 3, 3, 0, 0, 56, 10, 1], "semantic": {"name": "object", "arg_names": [], "import_names": [], "rhs_call_name": "date", "annotation": ""}, "snippet": " object = datetime.date(y, m, d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L445_C8", "label": "if", "type": "if", "loc": [445, 471], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L441_C8", "vector": [4, 3, 0.5055, 0.0298, 3, 0.08, 1.0, 0, 0, 0, 0, 0, 0, 0, 20], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif fieldtype == 'time' and not isinstance(object, datetime.time):\n time_items = [int(x) for x in str(object).strip().split(':')[:3]]\n if len(time_items) == 3:\n (h, mi, s) = time_items\n else:\n (h, mi, s) = time_items + [0]\n object = datetime.time(h, mi, s)\n elif fieldtype == 'datetime' and not isinstance(object,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L446_C12", "label": "time_items =", "type": "assigned_variable", "loc": [446, 446], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L445_C8", "vector": [14, 4, 0.4923, 0.0011, 4, 0.58, 0.0, 490, 5, 0, 0, 0, 0, 0, 4], "semantic": {"name": "time_items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " time_items = [int(x) for x in str(object).strip().split(':')[:3]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L447_C12", "label": "if", "type": "if", "loc": [447, 450], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L445_C8", "vector": [4, 4, 0.495, 0.0044, 4, 0.58, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(time_items) == 3:\n (h, mi, s) = time_items\n else:\n (h, mi, s) = time_items + [0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L448_C16", "label": "h, mi, s =", "type": "assigned_variable", "loc": [448, 448], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L447_C12", "vector": [14, 5, 0.4945, 0.0011, 5, 0.65, 0.0, 415, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "h, mi, s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (h, mi, s) = time_items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L450_C16", "label": "h, mi, s =", "type": "assigned_variable", "loc": [450, 450], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L447_C12", "vector": [14, 5, 0.4967, 0.0011, 5, 0.65, 1.0, 415, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "h, mi, s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (h, mi, s) = time_items + [0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L451_C12", "label": "object = time()", "type": "assigned_variable", "loc": [451, 451], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L445_C8", "vector": [14, 4, 0.4978, 0.0011, 4, 0.58, 0.6667, 186, 3, 3, 0, 0, 654, 10, 1], "semantic": {"name": "object", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " object = datetime.time(h, mi, s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L452_C8", "label": "if", "type": "if", "loc": [452, 471], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L445_C8", "vector": [4, 4, 0.5094, 0.0221, 4, 0.58, 1.0, 0, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif fieldtype == 'datetime' and not isinstance(object,\n datetime.datetime):\n (y, m, d) = [int(x) for x in\n str(object)[:10].strip().split('-')]\n time_items = [int(x) for x in\n str(object)[11:].strip().split(':')[:3]]\n if len(time_items) == 3:\n (h, mi, s) = time_items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L454_C12", "label": "y, m, d =", "type": "assigned_variable", "loc": [454, 455], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L452_C8", "vector": [14, 5, 0.5017, 0.0022, 5, 0.63, 0.0, 356, 5, 0, 0, 0, 0, 0, 4], "semantic": {"name": "y, m, d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (y, m, d) = [int(x) for x in\n str(object)[:10].strip().split('-')]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L456_C12", "label": "time_items =", "type": "assigned_variable", "loc": [456, 457], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L452_C8", "vector": [14, 5, 0.5039, 0.0022, 5, 0.63, 0.25, 490, 5, 0, 0, 0, 0, 0, 4], "semantic": {"name": "time_items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " time_items = [int(x) for x in\n str(object)[11:].strip().split(':')[:3]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L458_C12", "label": "if", "type": "if", "loc": [458, 461], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L452_C8", "vector": [4, 5, 0.5072, 0.0044, 5, 0.63, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(time_items) == 3:\n (h, mi, s) = time_items\n else:\n (h, mi, s) = time_items + [0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L459_C16", "label": "h, mi, s =", "type": "assigned_variable", "loc": [459, 459], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L458_C12", "vector": [14, 6, 0.5066, 0.0011, 6, 0.9, 0.0, 415, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "h, mi, s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (h, mi, s) = time_items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L461_C16", "label": "h, mi, s =", "type": "assigned_variable", "loc": [461, 461], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L458_C12", "vector": [14, 6, 0.5088, 0.0011, 6, 0.9, 1.0, 415, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "h, mi, s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (h, mi, s) = time_items + [0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L462_C12", "label": "object = datetime()", "type": "assigned_variable", "loc": [462, 469], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L452_C8", "vector": [14, 5, 0.5138, 0.0088, 5, 0.63, 0.75, 186, 3, 6, 0, 0, 426, 10, 1], "semantic": {"name": "object", "arg_names": [], "import_names": [], "rhs_call_name": "datetime", "annotation": ""}, "snippet": " object = datetime.datetime(\n y,\n m,\n d,\n h,\n mi,\n s,\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L470_C8", "label": "if", "type": "if", "loc": [470, 471], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L452_C8", "vector": [4, 5, 0.5193, 0.0022, 5, 0.63, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif fieldtype == 'integer' and not isinstance(object, long):\n object = long(object)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L471_C12", "label": "object = long()", "type": "assigned_variable", "loc": [471, 471], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L470_C8", "vector": [14, 6, 0.5199, 0.0011, 6, 0.09, 0.0, 186, 3, 1, 0, 0, 37, 10, 1], "semantic": {"name": "object", "arg_names": [], "import_names": [], "rhs_call_name": "long", "annotation": ""}, "snippet": " object = long(object)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L473_C4", "label": "return", "type": "return", "loc": [473, 473], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L439_C0", "vector": [13, 1, 0.5221, 0.0011, 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 object"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L476_C0", "label": "QueryException", "type": "class", "loc": [476, 479], "level": 0, "parent": null, "vector": [3, 0, 0.527, 0.0044, 0, 0.66, 0.6905, 626, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "QueryException", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class QueryException:\n\n def __init__(self, **a):\n self.__dict__ = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L478_C4", "label": "__init__", "type": "function", "loc": [478, 479], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L476_C0", "vector": [2, 1, 0.5281, 0.0022, 1, 0.61, 0.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "a"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, **a):\n self.__dict__ = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L479_C8", "label": "self.__dict__ =", "type": "assigned_variable", "loc": [479, 479], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L478_C4", "vector": [14, 2, 0.5287, 0.0011, 2, 0.72, 0.0, 711, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.__dict__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__dict__ = a"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L482_C0", "label": "Query", "type": "class", "loc": [482, 514], "level": 0, "parent": null, "vector": [3, 0, 0.5497, 0.0364, 0, 0.66, 0.7143, 279, 0, 2, 0, 0, 186, 0, 8], "semantic": {"name": "Query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Query(object):\n\n \"\"\"\n A query object necessary to define a set.\n It can be stored or can be passed to GQLDB.__call__() to obtain a Set\n\n Example:\n query=db.users.name=='Max'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L484_C4", "label": "expression", "type": "expression", "loc": [484, 492], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L482_C0", "vector": [8, 1, 0.5386, 0.0099, 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 A query object necessary to define a set.\n It can be stored or can be passed to GQLDB.__call__() to obtain a Set\n\n Example:\n query=db.users.name=='Max'\n set=db(query)\n records=set.select()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L494_C4", "label": "__init__", "type": "function", "loc": [494, 511], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L482_C0", "vector": [2, 1, 0.5546, 0.0199, 1, 0.42, 0.5, 555, 0, 4, 0, 0, 0, 0, 7], "semantic": {"name": "__init__", "arg_names": ["self", "left", "op", "right"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(\n self,\n left,\n op=None,\n right=None,\n ):\n if isinstance(right, (Field, Expression)):\n raise SyntaxError("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L500_C8", "label": "if", "type": "if", "loc": [500, 502], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L494_C4", "vector": [4, 2, 0.553, 0.0033, 2, 0.86, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(right, (Field, Expression)):\n raise SyntaxError(\n 'Query: right side of filter must be a value or entity')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L503_C8", "label": "if", "type": "if", "loc": [503, 510], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L494_C4", "vector": [4, 2, 0.5591, 0.0088, 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 isinstance(left, Field) and left.name == 'id':\n if op == '=':\n self.get_one = \\\n QueryException(tablename=left._tablename,\n id=long(right))\n return\n else:\n raise SyntaxError('only equality by id is supported')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L504_C12", "label": "if", "type": "if", "loc": [504, 510], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L503_C8", "vector": [4, 3, 0.5596, 0.0077, 3, 0.78, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if op == '=':\n self.get_one = \\\n QueryException(tablename=left._tablename,\n id=long(right))\n return\n else:\n raise SyntaxError('only equality by id is supported')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L505_C16", "label": "self.get_one = QueryException()", "type": "assigned_variable", "loc": [505, 507], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L504_C12", "vector": [14, 4, 0.5585, 0.0033, 4, 0.17, 0.0, 758, 3, 2, 0, 0, 626, 10, 2], "semantic": {"name": "self.get_one", "arg_names": [], "import_names": [], "rhs_call_name": "QueryException", "annotation": ""}, "snippet": " self.get_one = \\\n QueryException(tablename=left._tablename,\n id=long(right))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L508_C16", "label": "return", "type": "return", "loc": [508, 508], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L504_C12", "vector": [13, 4, 0.5607, 0.0011, 4, 0.17, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L513_C4", "label": "__str__", "type": "function", "loc": [513, 514], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L482_C0", "vector": [2, 1, 0.5668, 0.0022, 1, 0.42, 1.0, 527, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n return str(self.left)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L514_C8", "label": "return", "type": "return", "loc": [514, 514], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L513_C4", "vector": [13, 2, 0.5673, 0.0011, 2, 0.89, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str(self.left)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L517_C0", "label": "Set", "type": "class", "loc": [517, 622], "level": 0, "parent": null, "vector": [3, 0, 0.6286, 0.117, 0, 0.66, 0.7381, 438, 0, 9, 0, 0, 186, 0, 38], "semantic": {"name": "Set", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Set(object):\n\n \"\"\"\n As Set represents a set of records in the database,\n the records are identified by the where=Query(...) object.\n normally the Set is generated by GQLDB.__call__(Query(...))\n\n given a set, for example"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L519_C4", "label": "expression", "type": "expression", "loc": [519, 532], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L517_C0", "vector": [8, 1, 0.58, 0.0155, 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 As Set represents a set of records in the database,\n the records are identified by the where=Query(...) object.\n normally the Set is generated by GQLDB.__call__(Query(...))\n\n given a set, for example\n set=db(db.users.name=='Max')\n you can:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L534_C4", "label": "__init__", "type": "function", "loc": [534, 552], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L517_C0", "vector": [2, 1, 0.5993, 0.021, 1, 0.71, 0.1111, 555, 0, 3, 0, 0, 0, 0, 5], "semantic": {"name": "__init__", "arg_names": ["self", "db", "where"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, db, where=None):\n self._db = db\n self._tables = []\n self.filters = []\n if hasattr(where, 'get_all'):\n self.where = where\n self._tables.insert(0, where.get_all)\n elif hasattr(where, 'get_one') and isinstance(where.get_one,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L535_C8", "label": "self._db =", "type": "assigned_variable", "loc": [535, 535], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L534_C4", "vector": [14, 2, 0.5905, 0.0011, 2, 0.07, 0.0, 896, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._db", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._db = db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L536_C8", "label": "self._tables =", "type": "assigned_variable", "loc": [536, 536], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L534_C4", "vector": [14, 2, 0.5916, 0.0011, 2, 0.07, 0.3333, 567, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self._tables", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._tables = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L537_C8", "label": "self.filters =", "type": "assigned_variable", "loc": [537, 537], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L534_C4", "vector": [14, 2, 0.5927, 0.0011, 2, 0.07, 0.6667, 384, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.filters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.filters = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L538_C8", "label": "if", "type": "if", "loc": [538, 552], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L534_C4", "vector": [4, 2, 0.6015, 0.0166, 2, 0.07, 1.0, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(where, 'get_all'):\n self.where = where\n self._tables.insert(0, where.get_all)\n elif hasattr(where, 'get_one') and isinstance(where.get_one,\n QueryException):\n self.where = where.get_one\n else:\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L539_C12", "label": "self.where =", "type": "assigned_variable", "loc": [539, 539], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L538_C8", "vector": [14, 3, 0.5949, 0.0011, 3, 0.37, 0.0, 236, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.where", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.where = where"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L540_C12", "label": "insert()", "type": "expression", "loc": [540, 540], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L538_C8", "vector": [8, 3, 0.596, 0.0011, 3, 0.37, 0.5, 368, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " self._tables.insert(0, where.get_all)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L541_C8", "label": "if", "type": "if", "loc": [541, 552], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L538_C8", "vector": [4, 3, 0.6032, 0.0132, 3, 0.37, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif hasattr(where, 'get_one') and isinstance(where.get_one,\n QueryException):\n self.where = where.get_one\n else:\n\n # find out which tables are involved\n\n if isinstance(where, Query):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L543_C12", "label": "self.where =", "type": "assigned_variable", "loc": [543, 543], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L541_C8", "vector": [14, 4, 0.5993, 0.0011, 4, 0.48, 0.0, 236, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.where", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.where = where.get_one"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L548_C12", "label": "if", "type": "if", "loc": [548, 549], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L541_C8", "vector": [4, 4, 0.6054, 0.0022, 4, 0.48, 0.3333, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(where, Query):\n self.filters = where.left"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L549_C16", "label": "self.filters =", "type": "assigned_variable", "loc": [549, 549], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L548_C12", "vector": [14, 5, 0.606, 0.0011, 5, 0.9, 0.0, 384, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.filters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.filters = where.left"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L550_C12", "label": "self.where =", "type": "assigned_variable", "loc": [550, 550], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L541_C8", "vector": [14, 4, 0.6071, 0.0011, 4, 0.48, 0.6667, 236, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.where", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.where = where"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L551_C12", "label": "self._tables =", "type": "assigned_variable", "loc": [551, 552], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L541_C8", "vector": [14, 4, 0.6087, 0.0022, 4, 0.48, 1.0, 567, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._tables", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._tables = [field._tablename for (field, op, val) in\n self.filters]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L554_C4", "label": "__call__", "type": "function", "loc": [554, 561], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L517_C0", "vector": [2, 1, 0.6153, 0.0088, 1, 0.71, 0.2222, 319, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "__call__", "arg_names": ["self", "where"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __call__(self, where):\n if isinstance(self.where, QueryException) or isinstance(where,\n QueryException):\n raise SyntaxError('neither self.where nor where can be a QueryException instance')\n if self.where:\n return Set(self._db, self.where & where)\n else:\n return Set(self._db, where)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L555_C8", "label": "if", "type": "if", "loc": [555, 557], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L554_C4", "vector": [4, 2, 0.6137, 0.0033, 2, 0.58, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(self.where, QueryException) or isinstance(where,\n QueryException):\n raise SyntaxError('neither self.where nor where can be a QueryException instance')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L558_C8", "label": "if", "type": "if", "loc": [558, 561], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L554_C4", "vector": [4, 2, 0.6175, 0.0044, 2, 0.58, 1.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.where:\n return Set(self._db, self.where & where)\n else:\n return Set(self._db, where)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L559_C12", "label": "return", "type": "return", "loc": [559, 559], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L558_C8", "vector": [13, 3, 0.617, 0.0011, 3, 0.24, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Set(self._db, self.where & where)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L561_C12", "label": "return", "type": "return", "loc": [561, 561], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L558_C8", "vector": [13, 3, 0.6192, 0.0011, 3, 0.24, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Set(self._db, where)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L563_C4", "label": "_get_table_or_raise", "type": "function", "loc": [563, 569], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L517_C0", "vector": [2, 1, 0.6247, 0.0077, 1, 0.71, 0.3333, 470, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "_get_table_or_raise", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_table_or_raise(self):\n tablenames = list(set(self._tables)) # unique\n if len(tablenames) < 1:\n raise SyntaxError('Set: no tables selected')\n if len(tablenames) > 1:\n raise SyntaxError('Set: no join in appengine')\n return self._db[tablenames[0]]._tableobj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L564_C8", "label": "tablenames = list()", "type": "assigned_variable", "loc": [564, 564], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L563_C4", "vector": [14, 2, 0.6225, 0.0011, 2, 0.49, 0.0, 444, 3, 1, 0, 0, 430, 10, 2], "semantic": {"name": "tablenames", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " tablenames = list(set(self._tables)) # unique"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L565_C8", "label": "if", "type": "if", "loc": [565, 566], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L563_C4", "vector": [4, 2, 0.6242, 0.0022, 2, 0.49, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(tablenames) < 1:\n raise SyntaxError('Set: no tables selected')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L567_C8", "label": "if", "type": "if", "loc": [567, 568], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L563_C4", "vector": [4, 2, 0.6264, 0.0022, 2, 0.49, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(tablenames) > 1:\n raise SyntaxError('Set: no join in appengine')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L569_C8", "label": "return", "type": "return", "loc": [569, 569], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L563_C4", "vector": [13, 2, 0.628, 0.0011, 2, 0.49, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._db[tablenames[0]]._tableobj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L571_C4", "label": "_getitem_exception", "type": "function", "loc": [571, 576], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L517_C0", "vector": [2, 1, 0.633, 0.0066, 1, 0.71, 0.4444, 147, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "_getitem_exception", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _getitem_exception(self):\n (tablename, id) = (self.where.tablename, self.where.id)\n fields = self._db[tablename].fields\n self.colnames = ['%s.%s' % (tablename, t) for t in fields]\n item = self._db[tablename].get(id)\n return (item, fields, tablename, id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L572_C8", "label": "tablename, id =", "type": "assigned_variable", "loc": [572, 572], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L571_C4", "vector": [14, 2, 0.6313, 0.0011, 2, 0.01, 0.0, 951, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "tablename, id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (tablename, id) = (self.where.tablename, self.where.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L573_C8", "label": "fields =", "type": "assigned_variable", "loc": [573, 573], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L571_C4", "vector": [14, 2, 0.6325, 0.0011, 2, 0.01, 0.25, 358, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fields", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fields = self._db[tablename].fields"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L574_C8", "label": "self.colnames =", "type": "assigned_variable", "loc": [574, 574], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L571_C4", "vector": [14, 2, 0.6336, 0.0011, 2, 0.01, 0.5, 105, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.colnames", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.colnames = ['%s.%s' % (tablename, t) for t in fields]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L575_C8", "label": "item = get()", "type": "assigned_variable", "loc": [575, 575], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L571_C4", "vector": [14, 2, 0.6347, 0.0011, 2, 0.01, 0.75, 434, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " item = self._db[tablename].get(id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L576_C8", "label": "return", "type": "return", "loc": [576, 576], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L571_C4", "vector": [13, 2, 0.6358, 0.0011, 2, 0.01, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (item, fields, tablename, id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L578_C4", "label": "_select_except", "type": "function", "loc": [578, 589], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L517_C0", "vector": [2, 1, 0.644, 0.0132, 1, 0.71, 0.5556, 326, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "_select_except", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _select_except(self):\n (item, fields, tablename, id) = self._getitem_exception()\n if not item:\n return []\n new_item = []\n for t in fields:\n if t == 'id':\n new_item.append(long(id))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L579_C8", "label": "item, fields, tablename, id = _getitem_exception()", "type": "assigned_variable", "loc": [579, 579], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L578_C4", "vector": [14, 2, 0.6391, 0.0011, 2, 0.19, 0.0, 51, 3, 0, 0, 0, 147, 10, 1], "semantic": {"name": "item, fields, tablename, id", "arg_names": [], "import_names": [], "rhs_call_name": "_getitem_exception", "annotation": ""}, "snippet": " (item, fields, tablename, id) = self._getitem_exception()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L580_C8", "label": "if", "type": "if", "loc": [580, 581], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L578_C4", "vector": [4, 2, 0.6407, 0.0022, 2, 0.19, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not item:\n return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L581_C12", "label": "return", "type": "return", "loc": [581, 581], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L580_C8", "vector": [13, 3, 0.6413, 0.0011, 3, 0.43, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L582_C8", "label": "new_item =", "type": "assigned_variable", "loc": [582, 582], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L578_C4", "vector": [14, 2, 0.6424, 0.0011, 2, 0.19, 0.4, 572, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_item = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:For_L583_C8", "label": "for t", "type": "for", "loc": [583, 587], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L578_C4", "vector": [6, 2, 0.6457, 0.0055, 2, 0.19, 0.6, 15, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for t in fields:\n if t == 'id':\n new_item.append(long(id))\n else:\n new_item.append(getattr(item, t))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L584_C12", "label": "if", "type": "if", "loc": [584, 587], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L583_C8", "vector": [4, 3, 0.6462, 0.0044, 3, 0.54, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if t == 'id':\n new_item.append(long(id))\n else:\n new_item.append(getattr(item, t))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L585_C16", "label": "append()", "type": "expression", "loc": [585, 585], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L584_C12", "vector": [8, 4, 0.6457, 0.0011, 4, 0.42, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_item.append(long(id))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L587_C16", "label": "append()", "type": "expression", "loc": [587, 587], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L584_C12", "vector": [8, 4, 0.6479, 0.0011, 4, 0.42, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_item.append(getattr(item, t))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L588_C8", "label": "r =", "type": "assigned_variable", "loc": [588, 588], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L578_C4", "vector": [14, 2, 0.649, 0.0011, 2, 0.19, 0.8, 436, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r = [new_item]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L589_C8", "label": "return", "type": "return", "loc": [589, 589], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L578_C4", "vector": [13, 2, 0.6501, 0.0011, 2, 0.19, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Rows(self._db, r, *self.colnames)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L591_C4", "label": "select", "type": "function", "loc": [591, 599], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L517_C0", "vector": [2, 1, 0.6567, 0.0099, 1, 0.71, 0.6667, 438, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "select", "arg_names": ["self", "fields", "attributes"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def select(self, *fields, **attributes):\n \"\"\"\n Always returns a Rows object, even if it may be empty\n \"\"\"\n\n if isinstance(self.where, QueryException):\n return self._select_except()\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L592_C8", "label": "expression", "type": "expression", "loc": [592, 594], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L591_C4", "vector": [8, 2, 0.6545, 0.0033, 2, 0.55, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n Always returns a Rows object, even if it may be empty\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L596_C8", "label": "if", "type": "if", "loc": [596, 599], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L591_C4", "vector": [4, 2, 0.6595, 0.0044, 2, 0.55, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(self.where, QueryException):\n return self._select_except()\n else:\n raise SyntaxError('select arguments not supported')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L597_C12", "label": "return", "type": "return", "loc": [597, 597], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L596_C8", "vector": [13, 3, 0.6589, 0.0011, 3, 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._select_except()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L601_C4", "label": "count", "type": "function", "loc": [601, 602], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L517_C0", "vector": [2, 1, 0.6639, 0.0022, 1, 0.71, 0.7778, 778, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "count", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def count(self):\n return len(self.select())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L602_C8", "label": "return", "type": "return", "loc": [602, 602], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L601_C4", "vector": [13, 2, 0.6645, 0.0011, 2, 0.21, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self.select())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L604_C4", "label": "delete", "type": "function", "loc": [604, 611], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L517_C0", "vector": [2, 1, 0.6705, 0.0088, 1, 0.71, 0.8889, 266, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "delete", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def delete(self):\n if isinstance(self.where, QueryException):\n (item, fields, tablename, id) = self._getitem_exception()\n if not item:\n return\n self._db[tablename].delete(id)\n else:\n raise Exception('deletion not implemented')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L605_C8", "label": "if", "type": "if", "loc": [605, 611], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L604_C4", "vector": [4, 2, 0.6711, 0.0077, 2, 0.02, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(self.where, QueryException):\n (item, fields, tablename, id) = self._getitem_exception()\n if not item:\n return\n self._db[tablename].delete(id)\n else:\n raise Exception('deletion not implemented')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L606_C12", "label": "item, fields, tablename, id = _getitem_exception()", "type": "assigned_variable", "loc": [606, 606], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L605_C8", "vector": [14, 3, 0.6689, 0.0011, 3, 0.93, 0.0, 51, 3, 0, 0, 0, 147, 10, 1], "semantic": {"name": "item, fields, tablename, id", "arg_names": [], "import_names": [], "rhs_call_name": "_getitem_exception", "annotation": ""}, "snippet": " (item, fields, tablename, id) = self._getitem_exception()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L607_C12", "label": "if", "type": "if", "loc": [607, 608], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L605_C8", "vector": [4, 3, 0.6705, 0.0022, 3, 0.93, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not item:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L608_C16", "label": "return", "type": "return", "loc": [608, 608], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L607_C12", "vector": [13, 4, 0.6711, 0.0011, 4, 0.05, 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_500:Expr_L609_C12", "label": "delete()", "type": "expression", "loc": [609, 609], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L605_C8", "vector": [8, 3, 0.6722, 0.0011, 3, 0.93, 1.0, 266, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " self._db[tablename].delete(id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L613_C4", "label": "update", "type": "function", "loc": [613, 622], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L517_C0", "vector": [2, 1, 0.6816, 0.011, 1, 0.71, 1.0, 637, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "update", "arg_names": ["self", "update_fields"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update(self, **update_fields):\n if isinstance(self.where, QueryException):\n (item, fields, tablename, id) = self._getitem_exception()\n if not item:\n return\n for (key, value) in update_fields.items():\n setattr(item, key, value)\n self._db[tablename].update(id, **item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L614_C8", "label": "if", "type": "if", "loc": [614, 622], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L613_C4", "vector": [4, 2, 0.6821, 0.0099, 2, 0.09, 0.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(self.where, QueryException):\n (item, fields, tablename, id) = self._getitem_exception()\n if not item:\n return\n for (key, value) in update_fields.items():\n setattr(item, key, value)\n self._db[tablename].update(id, **item)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L615_C12", "label": "item, fields, tablename, id = _getitem_exception()", "type": "assigned_variable", "loc": [615, 615], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L614_C8", "vector": [14, 3, 0.6788, 0.0011, 3, 0.32, 0.0, 51, 3, 0, 0, 0, 147, 10, 1], "semantic": {"name": "item, fields, tablename, id", "arg_names": [], "import_names": [], "rhs_call_name": "_getitem_exception", "annotation": ""}, "snippet": " (item, fields, tablename, id) = self._getitem_exception()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L616_C12", "label": "if", "type": "if", "loc": [616, 617], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L614_C8", "vector": [4, 3, 0.6805, 0.0022, 3, 0.32, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not item:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L617_C16", "label": "return", "type": "return", "loc": [617, 617], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L616_C12", "vector": [13, 4, 0.681, 0.0011, 4, 0.02, 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_500:For_L618_C12", "label": "for key, value", "type": "for", "loc": [618, 619], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L614_C8", "vector": [6, 3, 0.6827, 0.0022, 3, 0.32, 0.6667, 839, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for (key, value) in update_fields.items():\n setattr(item, key, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L619_C16", "label": "setattr()", "type": "expression", "loc": [619, 619], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L618_C12", "vector": [8, 4, 0.6832, 0.0011, 4, 0.99, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(item, key, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L620_C12", "label": "update()", "type": "expression", "loc": [620, 620], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L614_C8", "vector": [8, 3, 0.6843, 0.0011, 3, 0.32, 1.0, 637, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self._db[tablename].update(id, **item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L625_C0", "label": "update_record", "type": "function", "loc": [625, 635], "level": 0, "parent": null, "vector": [2, 0, 0.6954, 0.0121, 0, 0.66, 0.7619, 720, 0, 4, 0, 0, 0, 0, 4], "semantic": {"name": "update_record", "arg_names": ["t", "s", "id", "a"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def update_record(\n t,\n s,\n id,\n a,\n):\n item = s.get(id)\n for (key, value) in a.items():"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L631_C4", "label": "item = get()", "type": "assigned_variable", "loc": [631, 631], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L625_C0", "vector": [14, 1, 0.6965, 0.0011, 1, 0.24, 0.0, 434, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " item = s.get(id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:For_L632_C4", "label": "for key, value", "type": "for", "loc": [632, 634], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L625_C0", "vector": [6, 1, 0.6987, 0.0033, 1, 0.24, 0.5, 839, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for (key, value) in a.items():\n t[key] = value\n setattr(item, key, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L633_C8", "label": "assign", "type": "assigned_variable", "loc": [633, 633], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L632_C4", "vector": [14, 2, 0.6987, 0.0011, 2, 0.01, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " t[key] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L634_C8", "label": "setattr()", "type": "expression", "loc": [634, 634], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L632_C4", "vector": [8, 2, 0.6998, 0.0011, 2, 0.01, 1.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(item, key, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L635_C4", "label": "update()", "type": "expression", "loc": [635, 635], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L625_C0", "vector": [8, 1, 0.7009, 0.0011, 1, 0.24, 1.0, 637, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " s.update(id, **item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L638_C0", "label": "Rows", "type": "class", "loc": [638, 772], "level": 0, "parent": null, "vector": [3, 0, 0.7781, 0.149, 0, 0.66, 0.7857, 9, 0, 6, 0, 0, 186, 0, 60], "semantic": {"name": "Rows", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Rows(object):\n\n \"\"\"\n A wrapper for the return value of a select. It basically represents a table.\n It has an iterator and each row is represented as a dictionary.\n \"\"\"\n\n # ## this class still needs some work to care for ID/OID"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L640_C4", "label": "expression", "type": "expression", "loc": [640, 643], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L638_C0", "vector": [8, 1, 0.7081, 0.0044, 1, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n A wrapper for the return value of a select. It basically represents a table.\n It has an iterator and each row is represented as a dictionary.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L647_C4", "label": "__init__", "type": "function", "loc": [647, 655], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L638_C0", "vector": [2, 1, 0.7185, 0.0099, 1, 0.59, 0.1667, 555, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "db", "response", "colnames"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(\n self,\n db,\n response,\n *colnames\n ):\n self._db = db\n self.colnames = colnames"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L653_C8", "label": "self._db =", "type": "assigned_variable", "loc": [653, 653], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L647_C4", "vector": [14, 2, 0.7208, 0.0011, 2, 0.78, 0.0, 896, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._db", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._db = db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L654_C8", "label": "self.colnames =", "type": "assigned_variable", "loc": [654, 654], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L647_C4", "vector": [14, 2, 0.7219, 0.0011, 2, 0.78, 0.5, 105, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.colnames", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.colnames = colnames"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L655_C8", "label": "self.response =", "type": "assigned_variable", "loc": [655, 655], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L647_C4", "vector": [14, 2, 0.723, 0.0011, 2, 0.78, 1.0, 498, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.response", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.response = response"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L657_C4", "label": "__len__", "type": "function", "loc": [657, 658], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L638_C0", "vector": [2, 1, 0.7257, 0.0022, 1, 0.59, 0.3333, 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.response)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L658_C8", "label": "return", "type": "return", "loc": [658, 658], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L657_C4", "vector": [13, 2, 0.7263, 0.0011, 2, 0.36, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self.response)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L660_C4", "label": "__getitem__", "type": "function", "loc": [660, 740], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L638_C0", "vector": [2, 1, 0.7726, 0.0894, 1, 0.59, 0.5, 698, 0, 2, 1, 0, 0, 0, 43], "semantic": {"name": "__getitem__", "arg_names": ["self", "i"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, i):\n if i >= len(self.response) or i < 0:\n raise SyntaxError('Rows: no such row: %i' % i)\n if len(self.response[0]) != len(self.colnames):\n raise SyntaxError('Rows: internal error')\n row = DALStorage()\n for j in xrange(len(self.colnames)):\n value = self.response[i][j]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L661_C8", "label": "if", "type": "if", "loc": [661, 662], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L660_C4", "vector": [4, 2, 0.7301, 0.0022, 2, 0.65, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i >= len(self.response) or i < 0:\n raise SyntaxError('Rows: no such row: %i' % i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L663_C8", "label": "if", "type": "if", "loc": [663, 664], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L660_C4", "vector": [4, 2, 0.7323, 0.0022, 2, 0.65, 0.2, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(self.response[0]) != len(self.colnames):\n raise SyntaxError('Rows: internal error')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L665_C8", "label": "row = DALStorage()", "type": "assigned_variable", "loc": [665, 665], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L660_C4", "vector": [14, 2, 0.734, 0.0011, 2, 0.65, 0.4, 767, 3, 0, 0, 0, 640, 10, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "DALStorage", "annotation": ""}, "snippet": " row = DALStorage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:For_L666_C8", "label": "for j", "type": "for", "loc": [666, 737], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L660_C4", "vector": [6, 2, 0.7743, 0.0795, 2, 0.65, 0.6, 100, 3, 0, 0, 0, 0, 0, 34], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for j in xrange(len(self.colnames)):\n value = self.response[i][j]\n if isinstance(value, unicode):\n value = value.encode('utf-8')\n packed = self.colnames[j].split('.')\n try:\n (tablename, fieldname) = packed\n except:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L667_C12", "label": "value =", "type": "assigned_variable", "loc": [667, 667], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L666_C8", "vector": [14, 3, 0.7362, 0.0011, 3, 0.98, 0.0, 441, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = self.response[i][j]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L668_C12", "label": "if", "type": "if", "loc": [668, 669], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L666_C8", "vector": [4, 3, 0.7379, 0.0022, 3, 0.98, 0.125, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, unicode):\n value = value.encode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L669_C16", "label": "value = encode()", "type": "assigned_variable", "loc": [669, 669], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L668_C12", "vector": [14, 4, 0.7384, 0.0011, 4, 0.57, 0.0, 441, 3, 1, 0, 0, 623, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": " value = value.encode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L670_C12", "label": "packed = split()", "type": "assigned_variable", "loc": [670, 670], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L666_C8", "vector": [14, 3, 0.7395, 0.0011, 3, 0.98, 0.25, 321, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "packed", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " packed = self.colnames[j].split('.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Try_L671_C12", "label": "try", "type": "try", "loc": [671, 677], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L666_C8", "vector": [7, 3, 0.7439, 0.0077, 3, 0.98, 0.375, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n (tablename, fieldname) = packed\n except:\n if not '_extra' in row:\n row['_extra'] = DALStorage()\n row['_extra'][self.colnames[j]] = value\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L672_C16", "label": "tablename, fieldname =", "type": "assigned_variable", "loc": [672, 672], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:Try_L671_C12", "vector": [14, 4, 0.7417, 0.0011, 4, 0.41, 0.0, 117, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tablename, fieldname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (tablename, fieldname) = packed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L674_C16", "label": "if", "type": "if", "loc": [674, 675], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:Try_L671_C12", "vector": [4, 4, 0.7445, 0.0022, 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 not '_extra' in row:\n row['_extra'] = DALStorage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L675_C20", "label": " = DALStorage()", "type": "assigned_variable", "loc": [675, 675], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L674_C16", "vector": [14, 5, 0.745, 0.0011, 5, 0.94, 0.0, 0, 3, 0, 0, 0, 640, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "DALStorage", "annotation": ""}, "snippet": " row['_extra'] = DALStorage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L676_C16", "label": "assign", "type": "assigned_variable", "loc": [676, 676], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:Try_L671_C12", "vector": [14, 4, 0.7461, 0.0011, 4, 0.41, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " row['_extra'][self.colnames[j]] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L678_C12", "label": "table =", "type": "assigned_variable", "loc": [678, 678], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L666_C8", "vector": [14, 3, 0.7483, 0.0011, 3, 0.98, 0.5, 338, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "table", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " table = self._db[tablename]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L679_C12", "label": "field =", "type": "assigned_variable", "loc": [679, 679], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L666_C8", "vector": [14, 3, 0.7494, 0.0011, 3, 0.98, 0.625, 480, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "field", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " field = table[fieldname]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L680_C12", "label": "if", "type": "if", "loc": [680, 681], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L666_C8", "vector": [4, 3, 0.7511, 0.0022, 3, 0.98, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not tablename in row:\n row[tablename] = DALStorage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L681_C16", "label": " = DALStorage()", "type": "assigned_variable", "loc": [681, 681], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L680_C12", "vector": [14, 4, 0.7517, 0.0011, 4, 0.28, 0.0, 0, 3, 0, 0, 0, 640, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "DALStorage", "annotation": ""}, "snippet": " row[tablename] = DALStorage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L682_C12", "label": "if", "type": "if", "loc": [682, 727], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L666_C8", "vector": [4, 3, 0.7776, 0.0508, 3, 0.98, 0.875, 0, 0, 0, 0, 0, 0, 0, 25], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if field.type[:9] == 'reference':\n referee = field.type[10:].strip()\n rid = value\n row[tablename][fieldname] = rid\n elif field.type == 'boolean' and value is not None:\n\n # row[tablename][fieldname]=Set(self._db[referee].id==rid)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L683_C16", "label": "referee = strip()", "type": "assigned_variable", "loc": [683, 683], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L682_C12", "vector": [14, 4, 0.7539, 0.0011, 4, 0.5, 0.0, 212, 3, 0, 0, 0, 973, 10, 1], "semantic": {"name": "referee", "arg_names": [], "import_names": [], "rhs_call_name": "strip", "annotation": ""}, "snippet": " referee = field.type[10:].strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L684_C16", "label": "rid =", "type": "assigned_variable", "loc": [684, 684], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L682_C12", "vector": [14, 4, 0.755, 0.0011, 4, 0.5, 0.3333, 349, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "rid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rid = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L685_C16", "label": "assign", "type": "assigned_variable", "loc": [685, 685], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L682_C12", "vector": [14, 4, 0.7561, 0.0011, 4, 0.5, 0.6667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " row[tablename][fieldname] = rid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L686_C12", "label": "if", "type": "if", "loc": [686, 727], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L682_C12", "vector": [4, 4, 0.7798, 0.0464, 4, 0.5, 1.0, 0, 0, 0, 0, 0, 0, 0, 24], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif field.type == 'boolean' and value is not None:\n\n # row[tablename][fieldname]=Set(self._db[referee].id==rid)\n\n if value == True or value == 'T':\n row[tablename][fieldname] = True\n else:\n row[tablename][fieldname] = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L690_C16", "label": "if", "type": "if", "loc": [690, 693], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L686_C12", "vector": [4, 5, 0.7632, 0.0044, 5, 0.16, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value == True or value == 'T':\n row[tablename][fieldname] = True\n else:\n row[tablename][fieldname] = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L691_C20", "label": "assign", "type": "assigned_variable", "loc": [691, 691], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L690_C16", "vector": [14, 6, 0.7627, 0.0011, 6, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " row[tablename][fieldname] = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L693_C20", "label": "assign", "type": "assigned_variable", "loc": [693, 693], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L690_C16", "vector": [14, 6, 0.7649, 0.0011, 6, 0.45, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " row[tablename][fieldname] = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L694_C12", "label": "if", "type": "if", "loc": [694, 727], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L686_C12", "vector": [4, 5, 0.7842, 0.0375, 5, 0.16, 1.0, 0, 0, 0, 0, 0, 0, 0, 24], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif field.type == 'date' and value is not None\\\n and not isinstance(value, datetime.date):\n (y, m, d) = [int(x) for x in\n str(value).strip().split('-')]\n row[tablename][fieldname] = datetime.date(y, m, d)\n elif field.type == 'time' and value is not None\\\n and not isinstance(value, datetime.time):\n time_items = [int(x) for x in"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L696_C16", "label": "y, m, d =", "type": "assigned_variable", "loc": [696, 697], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L694_C12", "vector": [14, 6, 0.7688, 0.0022, 6, 0.78, 0.0, 356, 5, 0, 0, 0, 0, 0, 4], "semantic": {"name": "y, m, d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (y, m, d) = [int(x) for x in\n str(value).strip().split('-')]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L698_C16", "label": " = date()", "type": "assigned_variable", "loc": [698, 698], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L694_C12", "vector": [14, 6, 0.7704, 0.0011, 6, 0.78, 0.5, 0, 3, 3, 0, 0, 56, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "date", "annotation": ""}, "snippet": " row[tablename][fieldname] = datetime.date(y, m, d)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L699_C12", "label": "if", "type": "if", "loc": [699, 727], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L694_C12", "vector": [4, 6, 0.787, 0.032, 6, 0.78, 1.0, 0, 0, 0, 0, 0, 0, 0, 18], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif field.type == 'time' and value is not None\\\n and not isinstance(value, datetime.time):\n time_items = [int(x) for x in\n str(value).strip().split(':')[:3]]\n if len(time_items) == 3:\n (h, mi, s) = time_items\n else:\n (h, mi, s) = time_items + [0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L701_C16", "label": "time_items =", "type": "assigned_variable", "loc": [701, 702], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L699_C12", "vector": [14, 7, 0.7743, 0.0022, 7, 0.88, 0.0, 490, 5, 0, 0, 0, 0, 0, 4], "semantic": {"name": "time_items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " time_items = [int(x) for x in\n str(value).strip().split(':')[:3]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L703_C16", "label": "if", "type": "if", "loc": [703, 706], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L699_C12", "vector": [4, 7, 0.7776, 0.0044, 7, 0.88, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(time_items) == 3:\n (h, mi, s) = time_items\n else:\n (h, mi, s) = time_items + [0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L704_C20", "label": "h, mi, s =", "type": "assigned_variable", "loc": [704, 704], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L703_C16", "vector": [14, 8, 0.777, 0.0011, 8, 0.02, 0.0, 415, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "h, mi, s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (h, mi, s) = time_items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L706_C20", "label": "h, mi, s =", "type": "assigned_variable", "loc": [706, 706], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L703_C16", "vector": [14, 8, 0.7792, 0.0011, 8, 0.02, 1.0, 415, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "h, mi, s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (h, mi, s) = time_items + [0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L707_C16", "label": " = time()", "type": "assigned_variable", "loc": [707, 707], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L699_C12", "vector": [14, 7, 0.7804, 0.0011, 7, 0.88, 0.6667, 0, 3, 3, 0, 0, 654, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "time", "annotation": ""}, "snippet": " row[tablename][fieldname] = datetime.time(h, mi, s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L708_C12", "label": "if", "type": "if", "loc": [708, 727], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L699_C12", "vector": [4, 7, 0.7919, 0.0221, 7, 0.88, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif field.type == 'datetime' and value is not None\\\n and not isinstance(value, datetime.datetime):\n (y, m, d) = [int(x) for x in\n str(value)[:10].strip().split('-')]\n time_items = [int(x) for x in\n str(value)[11:].strip().split(':')[:3]]\n if len(time_items) == 3:\n (h, mi, s) = time_items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L710_C16", "label": "y, m, d =", "type": "assigned_variable", "loc": [710, 711], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L708_C12", "vector": [14, 8, 0.7842, 0.0022, 8, 0.29, 0.0, 356, 5, 0, 0, 0, 0, 0, 4], "semantic": {"name": "y, m, d", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (y, m, d) = [int(x) for x in\n str(value)[:10].strip().split('-')]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L712_C16", "label": "time_items =", "type": "assigned_variable", "loc": [712, 713], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L708_C12", "vector": [14, 8, 0.7864, 0.0022, 8, 0.29, 0.25, 490, 5, 0, 0, 0, 0, 0, 4], "semantic": {"name": "time_items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " time_items = [int(x) for x in\n str(value)[11:].strip().split(':')[:3]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L714_C16", "label": "if", "type": "if", "loc": [714, 717], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L708_C12", "vector": [4, 8, 0.7897, 0.0044, 8, 0.29, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(time_items) == 3:\n (h, mi, s) = time_items\n else:\n (h, mi, s) = time_items + [0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L715_C20", "label": "h, mi, s =", "type": "assigned_variable", "loc": [715, 715], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L714_C16", "vector": [14, 9, 0.7892, 0.0011, 9, 0.44, 0.0, 415, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "h, mi, s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (h, mi, s) = time_items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L717_C20", "label": "h, mi, s =", "type": "assigned_variable", "loc": [717, 717], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L714_C16", "vector": [14, 9, 0.7914, 0.0011, 9, 0.44, 1.0, 415, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "h, mi, s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (h, mi, s) = time_items + [0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L718_C16", "label": " = datetime()", "type": "assigned_variable", "loc": [718, 725], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L708_C12", "vector": [14, 8, 0.7964, 0.0088, 8, 0.29, 0.75, 0, 3, 6, 0, 0, 426, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "datetime", "annotation": ""}, "snippet": " row[tablename][fieldname] = datetime.datetime(\n y,\n m,\n d,\n h,\n mi,\n s,\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L727_C16", "label": "assign", "type": "assigned_variable", "loc": [727, 727], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L708_C12", "vector": [14, 8, 0.8024, 0.0011, 8, 0.29, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " row[tablename][fieldname] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L728_C12", "label": "if", "type": "if", "loc": [728, 737], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L666_C8", "vector": [4, 3, 0.8085, 0.011, 3, 0.98, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if fieldname == 'id':\n id = row[tablename].id\n row[tablename].update_record = lambda t = row[tablename], \\\n s = self._db[tablename], id = id, **a: update_record(t,\n s, id, a)\n for (referee_table, referee_name) in \\\n table._referenced_by:\n s = self._db[referee_table][referee_name]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L729_C16", "label": "id =", "type": "assigned_variable", "loc": [729, 729], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L728_C12", "vector": [14, 4, 0.8046, 0.0011, 4, 0.14, 0.0, 941, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " id = row[tablename].id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L730_C16", "label": "row[tablename].update_record =", "type": "assigned_variable", "loc": [730, 732], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L728_C12", "vector": [14, 4, 0.8068, 0.0033, 4, 0.14, 0.5, 648, 9, 0, 0, 0, 0, 0, 1], "semantic": {"name": "row[tablename].update_record", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " row[tablename].update_record = lambda t = row[tablename], \\\n s = self._db[tablename], id = id, **a: update_record(t,\n s, id, a)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:For_L733_C16", "label": "for referee_table, referee_name", "type": "for", "loc": [733, 737], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L728_C12", "vector": [6, 4, 0.8113, 0.0055, 4, 0.14, 1.0, 430, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "referee_table, referee_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for (referee_table, referee_name) in \\\n table._referenced_by:\n s = self._db[referee_table][referee_name]\n row[tablename][referee_table] = Set(self._db, s\n == id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L735_C20", "label": "s =", "type": "assigned_variable", "loc": [735, 735], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L733_C16", "vector": [14, 5, 0.8113, 0.0011, 5, 0.01, 0.0, 553, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = self._db[referee_table][referee_name]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L736_C20", "label": " = Set()", "type": "assigned_variable", "loc": [736, 737], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L733_C16", "vector": [14, 5, 0.8129, 0.0022, 5, 0.01, 1.0, 0, 3, 2, 0, 0, 438, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "Set", "annotation": ""}, "snippet": " row[tablename][referee_table] = Set(self._db, s\n == id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L738_C8", "label": "if", "type": "if", "loc": [738, 739], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L660_C4", "vector": [4, 2, 0.8151, 0.0022, 2, 0.65, 0.8, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(row.keys()) == 1:\n return row[row.keys()[0]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L739_C12", "label": "return", "type": "return", "loc": [739, 739], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L738_C8", "vector": [13, 3, 0.8157, 0.0011, 3, 0.43, 0.0, 0, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return row[row.keys()[0]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L740_C8", "label": "return", "type": "return", "loc": [740, 740], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L660_C4", "vector": [13, 2, 0.8168, 0.0011, 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 row"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L742_C4", "label": "__iter__", "type": "function", "loc": [742, 748], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L638_C0", "vector": [2, 1, 0.8223, 0.0077, 1, 0.59, 0.6667, 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 \"\"\"\n iterator over records\n \"\"\"\n\n for i in xrange(len(self)):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L743_C8", "label": "expression", "type": "expression", "loc": [743, 745], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L742_C4", "vector": [8, 2, 0.8212, 0.0033, 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 iterator over records\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:For_L747_C8", "label": "for i", "type": "for", "loc": [747, 748], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L742_C4", "vector": [6, 2, 0.8251, 0.0022, 2, 0.84, 1.0, 826, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange(len(self)):\n yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L748_C12", "label": "expression", "type": "expression", "loc": [748, 748], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L747_C8", "vector": [8, 3, 0.8256, 0.0011, 3, 0.32, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield self[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L750_C4", "label": "__str__", "type": "function", "loc": [750, 765], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L638_C0", "vector": [2, 1, 0.8361, 0.0177, 1, 0.59, 0.8333, 527, 0, 1, 1, 0, 0, 0, 12], "semantic": {"name": "__str__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __str__(self):\n \"\"\"\n serializes the table into a csv file\n \"\"\"\n\n s = cStringIO.StringIO()\n writer = csv.writer(s)\n writer.writerow(self.colnames)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L751_C8", "label": "expression", "type": "expression", "loc": [751, 753], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L750_C4", "vector": [8, 2, 0.83, 0.0033, 2, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n serializes the table into a csv file\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L755_C8", "label": "s = StringIO()", "type": "assigned_variable", "loc": [755, 755], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L750_C4", "vector": [14, 2, 0.8333, 0.0011, 2, 0.59, 0.1667, 553, 3, 0, 0, 0, 609, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": " s = cStringIO.StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L756_C8", "label": "writer = writer()", "type": "assigned_variable", "loc": [756, 756], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L750_C4", "vector": [14, 2, 0.8344, 0.0011, 2, 0.59, 0.3333, 614, 3, 1, 0, 0, 614, 10, 1], "semantic": {"name": "writer", "arg_names": [], "import_names": [], "rhs_call_name": "writer", "annotation": ""}, "snippet": " writer = csv.writer(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L757_C8", "label": "writerow()", "type": "expression", "loc": [757, 757], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L750_C4", "vector": [8, 2, 0.8355, 0.0011, 2, 0.59, 0.5, 941, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "writerow", "arg_names": [], "import_names": [], "rhs_call_name": "writerow", "annotation": ""}, "snippet": " writer.writerow(self.colnames)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L758_C8", "label": "c = len()", "type": "assigned_variable", "loc": [758, 758], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L750_C4", "vector": [14, 2, 0.8366, 0.0011, 2, 0.59, 0.6667, 411, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " c = len(self.colnames)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:For_L759_C8", "label": "for i", "type": "for", "loc": [759, 764], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L750_C4", "vector": [6, 2, 0.8405, 0.0066, 2, 0.59, 0.8333, 826, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange(len(self)):\n row = [self.response[i][j] for j in xrange(c)]\n for k in xrange(c):\n if isinstance(row[k], unicode):\n row[k] = row[k].encode('utf-8')\n writer.writerow(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L760_C12", "label": "row =", "type": "assigned_variable", "loc": [760, 760], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L759_C8", "vector": [14, 3, 0.8389, 0.0011, 3, 0.47, 0.0, 767, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "row", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " row = [self.response[i][j] for j in xrange(c)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:For_L761_C12", "label": "for k", "type": "for", "loc": [761, 763], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L759_C8", "vector": [6, 3, 0.8411, 0.0033, 3, 0.47, 0.5, 954, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k in xrange(c):\n if isinstance(row[k], unicode):\n row[k] = row[k].encode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L762_C16", "label": "if", "type": "if", "loc": [762, 763], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L761_C12", "vector": [4, 4, 0.8416, 0.0022, 4, 0.02, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(row[k], unicode):\n row[k] = row[k].encode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L763_C20", "label": " = encode()", "type": "assigned_variable", "loc": [763, 763], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L762_C16", "vector": [14, 5, 0.8422, 0.0011, 5, 0.78, 0.0, 0, 3, 1, 0, 0, 623, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "encode", "annotation": ""}, "snippet": " row[k] = row[k].encode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L764_C12", "label": "writerow()", "type": "expression", "loc": [764, 764], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:For_L759_C8", "vector": [8, 3, 0.8433, 0.0011, 3, 0.47, 1.0, 941, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "writerow", "arg_names": [], "import_names": [], "rhs_call_name": "writerow", "annotation": ""}, "snippet": " writer.writerow(row)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L765_C8", "label": "return", "type": "return", "loc": [765, 765], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L750_C4", "vector": [13, 2, 0.8444, 0.0011, 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 s.getvalue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L767_C4", "label": "xml", "type": "function", "loc": [767, 772], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L638_C0", "vector": [2, 1, 0.8493, 0.0066, 1, 0.59, 1.0, 324, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "xml", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def xml(self):\n \"\"\"\n serializes the table using SQLTABLE (if present)\n \"\"\"\n\n return SQLTABLE(self).xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L768_C8", "label": "expression", "type": "expression", "loc": [768, 770], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L767_C4", "vector": [8, 2, 0.8488, 0.0033, 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 serializes the table using SQLTABLE (if present)\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L772_C8", "label": "return", "type": "return", "loc": [772, 772], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L767_C4", "vector": [13, 2, 0.8521, 0.0011, 2, 0.72, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return SQLTABLE(self).xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L775_C0", "label": "test_all", "type": "function", "loc": [775, 894], "level": 0, "parent": null, "vector": [2, 0, 0.9211, 0.1325, 0, 0.66, 0.8095, 839, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "test_all", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def test_all():\n \"\"\"\n How to run from web2py dir:\n export PYTHONPATH=.:YOUR_PLATFORMS_APPENGINE_PATH\n python gluon/contrib/memdb.py\n\n Setup the UTC timezone and database stubs\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L776_C4", "label": "expression", "type": "expression", "loc": [776, 894], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L775_C0", "vector": [8, 1, 0.9216, 0.1313, 1, 0.89, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"\n How to run from web2py dir:\n export PYTHONPATH=.:YOUR_PLATFORMS_APPENGINE_PATH\n python gluon/contrib/memdb.py\n\n Setup the UTC timezone and database stubs\n\n >>> import os"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L896_C0", "label": "SQLField =", "type": "assigned_variable", "loc": [896, 896], "level": 0, "parent": null, "vector": [14, 0, 0.989, 0.0011, 0, 0.66, 0.8333, 919, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "SQLField", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SQLField = Field"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L897_C0", "label": "SQLTable =", "type": "assigned_variable", "loc": [897, 897], "level": 0, "parent": null, "vector": [14, 0, 0.9901, 0.0011, 0, 0.66, 0.8571, 953, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "SQLTable", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SQLTable = Table"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L898_C0", "label": "SQLXorable =", "type": "assigned_variable", "loc": [898, 898], "level": 0, "parent": null, "vector": [14, 0, 0.9912, 0.0011, 0, 0.66, 0.881, 677, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "SQLXorable", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SQLXorable = Expression"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L899_C0", "label": "SQLQuery =", "type": "assigned_variable", "loc": [899, 899], "level": 0, "parent": null, "vector": [14, 0, 0.9923, 0.0011, 0, 0.66, 0.9048, 330, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "SQLQuery", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SQLQuery = Query"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L900_C0", "label": "SQLSet =", "type": "assigned_variable", "loc": [900, 900], "level": 0, "parent": null, "vector": [14, 0, 0.9934, 0.0011, 0, 0.66, 0.9286, 556, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "SQLSet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SQLSet = Set"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L901_C0", "label": "SQLRows =", "type": "assigned_variable", "loc": [901, 901], "level": 0, "parent": null, "vector": [14, 0, 0.9945, 0.0011, 0, 0.66, 0.9524, 5, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "SQLRows", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SQLRows = Rows"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L902_C0", "label": "SQLStorage =", "type": "assigned_variable", "loc": [902, 902], "level": 0, "parent": null, "vector": [14, 0, 0.9956, 0.0011, 0, 0.66, 0.9762, 485, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "SQLStorage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SQLStorage = DALStorage"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:If_L904_C0", "label": "if", "type": "if", "loc": [904, 906], "level": 0, "parent": null, "vector": [4, 0, 0.9989, 0.0033, 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 import doctest\n doctest.testmod()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Import_L905_C4", "label": "doctest import doctest", "type": "import", "loc": [905, 905], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L904_C0", "vector": [1, 1, 0.9989, 0.0011, 1, 0.12, 0.0, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "doctest", "arg_names": [], "import_names": ["doctest"], "rhs_call_name": "", "annotation": ""}, "snippet": " import doctest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L906_C4", "label": "testmod()", "type": "expression", "loc": [906, 906], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_500:If_L904_C0", "vector": [8, 1, 1.0, 0.0011, 1, 0.12, 1.0, 116, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "testmod", "arg_names": [], "import_names": [], "rhs_call_name": "testmod", "annotation": ""}, "snippet": " doctest.testmod()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:For_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Try_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:Try_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:Try_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L102_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L105_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L105_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L112_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L105_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L105_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L120_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L121_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L124_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L126_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L130_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L130_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L142_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L142_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L142_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L142_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L142_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L130_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L158_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L159_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L149_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L130_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L166_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L170_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L172_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L173_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L194_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L195_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L196_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L199_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:For_L200_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L201_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L202_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L203_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L204_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L200_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L205_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L206_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L208_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L209_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L210_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:For_L211_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L211_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L212_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L211_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L213_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L211_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L214_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L214_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L215_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L215_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L216_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L211_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L217_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L211_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L219_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L219_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L220_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L219_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L221_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L219_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L224_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L219_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L227_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L219_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L228_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L219_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L231_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L219_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L235_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L219_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L237_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L241_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L249_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L249_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L253_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L255_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L255_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L256_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L255_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L257_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L257_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L258_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L257_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L260_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L262_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L262_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L263_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L262_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L264_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L264_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L265_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L264_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L267_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L269_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L269_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:For_L270_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L270_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L271_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L271_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L273_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L270_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L274_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L274_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L275_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L269_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L277_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L279_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L279_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L280_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L282_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L282_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L283_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L285_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L285_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L286_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L288_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L288_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L289_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L288_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L290_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L288_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L291_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L288_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L292_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L292_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L293_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L293_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L294_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L288_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L297_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L299_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L299_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L300_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L305_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L305_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L311_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L313_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L313_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L314_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L316_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L316_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L317_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L316_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L318_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L320_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L320_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L321_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L320_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L322_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L326_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L327_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L329_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L329_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L330_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L332_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L332_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L333_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L335_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L335_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L336_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L338_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L338_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L339_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L341_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L341_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L342_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L348_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L348_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L349_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L351_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L351_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L352_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L354_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L354_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L355_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L303_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L357_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L357_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L358_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L361_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L363_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L361_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L398_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L399_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L401_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L401_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L402_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L403_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L403_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L404_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L405_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L406_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L407_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L408_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L409_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L410_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L411_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L412_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L413_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L413_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L414_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L413_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L415_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L415_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L416_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L384_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L417_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L361_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L419_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L419_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L420_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L420_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L421_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L419_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L422_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L422_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L423_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L422_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L425_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L419_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L426_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L419_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:For_L427_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L427_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L428_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L428_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L429_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L419_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L430_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L361_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L432_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L432_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L433_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L439_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L440_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L440_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L441_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L441_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L443_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L441_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L444_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L441_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L445_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L445_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L446_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L445_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L447_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L447_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L448_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L447_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L450_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L445_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L451_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L445_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L452_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L452_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L454_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L452_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L456_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L452_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L458_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L458_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L459_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L458_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L461_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L452_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L462_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L452_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L470_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L470_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L471_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L439_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L473_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L476_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L478_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L478_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L479_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L482_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L484_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L482_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L494_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L494_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L500_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L494_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L503_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L503_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L504_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L504_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L505_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L504_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L508_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L482_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L513_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L513_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L514_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L517_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L519_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L517_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L534_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L534_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L535_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L534_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L536_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L534_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L537_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L534_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L538_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L538_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L539_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L538_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L540_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L538_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L541_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L541_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L543_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L541_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L548_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L548_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L549_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L541_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L550_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L541_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L551_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L517_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L554_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L554_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L555_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L554_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L558_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L558_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L559_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L558_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L561_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L517_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L563_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L563_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L564_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L563_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L565_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L563_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L567_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L563_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L569_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L517_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L571_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L572_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L573_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L574_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L575_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L571_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L576_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L517_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L578_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L578_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L579_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L578_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L580_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L580_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L581_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L578_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L582_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L578_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:For_L583_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L583_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L584_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L584_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L585_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L584_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L587_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L578_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L588_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L578_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L589_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L517_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L591_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L591_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L592_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L591_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L596_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L596_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L597_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L517_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L601_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L601_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L602_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L517_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L604_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L604_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L605_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L605_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L606_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L605_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L607_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L607_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L608_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L605_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L609_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L517_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L613_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L613_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L614_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L614_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L615_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L614_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L616_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L616_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L617_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L614_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:For_L618_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L618_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L619_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L614_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L620_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L625_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L631_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L625_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:For_L632_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L632_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L633_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L632_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L634_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L625_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L635_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L638_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L640_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L638_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L647_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L653_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L654_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L647_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L655_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L638_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L657_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L657_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L658_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L638_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L660_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L660_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L661_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L660_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L663_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L660_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L665_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L660_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:For_L666_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L666_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L667_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L666_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L668_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L668_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L669_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L666_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L670_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L666_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Try_L671_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:Try_L671_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L672_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:Try_L671_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L674_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L674_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L675_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:Try_L671_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L676_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L666_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L678_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L666_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L679_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L666_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L680_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L680_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L681_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L666_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L682_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L682_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L683_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L682_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L684_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L682_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L685_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L682_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L686_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L686_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L690_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L690_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L691_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L690_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L693_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L686_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L694_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L694_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L696_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L694_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L698_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L694_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L699_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L699_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L701_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L699_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L703_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L703_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L704_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L703_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L706_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L699_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L707_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L699_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L708_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L708_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L710_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L708_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L712_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L708_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L714_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L714_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L715_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L714_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L717_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L708_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L718_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L708_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L727_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L666_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L728_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L728_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L729_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L728_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L730_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L728_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:For_L733_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L733_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L735_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L733_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L736_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L660_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L738_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L738_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L739_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L660_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L740_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L638_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L742_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L743_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L742_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:For_L747_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L747_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L748_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L638_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L750_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L750_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L751_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L750_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L755_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L750_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L756_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L750_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L757_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L750_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L758_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L750_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:For_L759_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L759_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L760_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L759_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:For_L761_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L761_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_500:If_L762_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L762_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Assign_L763_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:For_L759_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L764_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L750_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L765_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:ClassDef_L638_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L767_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L767_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L768_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L767_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Return_L772_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:FunctionDef_L775_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L776_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L904_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Import_L905_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_500:If_L904_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_500:Expr_L906_C4"}] |
# Only Python 2.6 and up, because of NamedTuple.
import time
from collections import namedtuple
Score = namedtuple('Score', ['tag', 'stamp'])
class TimeCollector(object):
def __init__(self):
'''The first time stamp is created here'''
self.scores = [Score(tag='start', stamp=time.clock())]
def addStamp(self, description):
'''Adds a new time stamp, with a description.'''
self.scores.append(Score(tag=description, stamp=time.clock()))
def _stampDelta(self, index1, index2):
'''Private utility function to clean up this common calculation.'''
return self.scores[index1].stamp - self.scores[index2].stamp
def getReportItems(self, orderByCost=True):
'''Returns a list of dicts. Each dict has
start (ms),
end (ms),
delta (ms),
perc (%),
tag (str)
'''
self.scores.append(Score(tag='finish', stamp=time.clock()))
total_time = self._stampDelta(-1, 0)
data = []
for i in range(1, len(self.scores)):
delta = self._stampDelta(i, i - 1)
if abs(total_time) < 1e-6:
perc = 0
else:
perc = delta / total_time * 100
data.append(
dict(
start=self._stampDelta(i - 1, 0) * 1000,
end=self._stampDelta(i, 0) * 1000,
delta=delta * 1000,
perc=perc,
tag=self.scores[i].tag
)
)
if orderByCost:
data.sort(key=lambda x: x['perc'], reverse=True)
return data
def getReportLines(self, orderByCost=True):
'''Produces a report of logged time-stamps as a list of strings.
if orderByCost is False, then the order of the stamps is
chronological.'''
data = self.getReportItems(orderByCost)
headerTemplate = '%10s | %10s | %10s | %11s | %-30s'
headerData = ('Start(ms)', 'End(ms)', 'Delta(ms)', 'Time Cost',
'Description')
bodyTemplate = '%(start)10.0f | %(end)10.0f | %(delta)10.0f |' \
+ ' %(perc)10.0f%% | %(tag)-30s'
return [headerTemplate % headerData] + [bodyTemplate % d for d in data]
def getReportText(self, **kwargs):
return '\n'.join(self.getReportLines(**kwargs))
def restart(self):
self.scores = [Score(tag='start', stamp=time.clock())]
if __name__ == '__main__':
print('')
print('Testing:')
print('')
# First create the collector
t = TimeCollector()
x = [i for i in range(1000)]
# Every time some work gets done, add a stamp
t.addStamp('Initialization Section')
x = [i for i in range(10000)]
t.addStamp('A big loop')
x = [i for i in range(100000)]
t.addStamp('calling builder function')
# Finally, obtain the results
print('')
print(t.getReportText())
# If you want to measure something else in the same scope, you can
# restart the collector.
t.restart()
x = [i for i in range(1000000)]
t.addStamp('Part 2')
x = [i for i in range(1000000)]
t.addStamp('Cleanup')
# And once again report results
print('')
print(t.getReportText())
t.restart()
for y in range(1, 200, 20):
x = [i for i in range(10000) * y]
t.addStamp('Iteration when y = ' + str(y))
print('')
# You can turn off ordering of results
print(t.getReportText(orderByCost=False))
| ajibawa-2023/Python-Code-Large/train/row_501 | 64 | 102 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_501:Import_L2_C0", "label": "time import time", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0196, 0.0098, 0, 0.66, 0.0, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_name": "", "annotation": ""}, "snippet": "import time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:ImportFrom_L3_C0", "label": "from collections import namedtuple", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0294, 0.0098, 0, 0.66, 0.25, 193, 0, 1, 0, 0, 193, 0, 0], "semantic": {"name": "collections", "arg_names": [], "import_names": ["namedtuple"], "rhs_call_name": "", "annotation": ""}, "snippet": "from collections import namedtuple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L4_C0", "label": "Score = namedtuple()", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.0392, 0.0098, 0, 0.66, 0.5, 887, 3, 2, 0, 0, 829, 10, 1], "semantic": {"name": "Score", "arg_names": [], "import_names": [], "rhs_call_name": "namedtuple", "annotation": ""}, "snippet": "Score = namedtuple('Score', ['tag', 'stamp'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:ClassDef_L7_C0", "label": "TimeCollector", "type": "class", "loc": [7, 66], "level": 0, "parent": null, "vector": [3, 0, 0.3578, 0.5882, 0, 0.66, 0.75, 53, 0, 7, 0, 0, 186, 0, 23], "semantic": {"name": "TimeCollector", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TimeCollector(object):\n def __init__(self):\n '''The first time stamp is created here'''\n self.scores = [Score(tag='start', stamp=time.clock())]\n\n def addStamp(self, description):\n '''Adds a new time stamp, with a description.'''\n self.scores.append(Score(tag=description, stamp=time.clock()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L8_C4", "label": "__init__", "type": "function", "loc": [8, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:ClassDef_L7_C0", "vector": [2, 1, 0.0882, 0.0294, 1, 0.51, 0.0, 555, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n '''The first time stamp is created here'''\n self.scores = [Score(tag='start', stamp=time.clock())]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L9_C8", "label": "expression", "type": "expression", "loc": [9, 9], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L8_C4", "vector": [8, 2, 0.0882, 0.0098, 2, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''The first time stamp is created here'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L10_C8", "label": "self.scores =", "type": "assigned_variable", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L8_C4", "vector": [14, 2, 0.098, 0.0098, 2, 0.49, 1.0, 516, 0, 0, 0, 0, 0, 5, 2], "semantic": {"name": "self.scores", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.scores = [Score(tag='start', stamp=time.clock())]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L12_C4", "label": "addStamp", "type": "function", "loc": [12, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:ClassDef_L7_C0", "vector": [2, 1, 0.1275, 0.0294, 1, 0.51, 0.1667, 95, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "addStamp", "arg_names": ["self", "description"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def addStamp(self, description):\n '''Adds a new time stamp, with a description.'''\n self.scores.append(Score(tag=description, stamp=time.clock()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L13_C8", "label": "expression", "type": "expression", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L12_C4", "vector": [8, 2, 0.1275, 0.0098, 2, 0.39, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Adds a new time stamp, with a description.'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L14_C8", "label": "append()", "type": "expression", "loc": [14, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L12_C4", "vector": [8, 2, 0.1373, 0.0098, 2, 0.39, 1.0, 243, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.scores.append(Score(tag=description, stamp=time.clock()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L16_C4", "label": "_stampDelta", "type": "function", "loc": [16, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:ClassDef_L7_C0", "vector": [2, 1, 0.1667, 0.0294, 1, 0.51, 0.3333, 298, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "_stampDelta", "arg_names": ["self", "index1", "index2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _stampDelta(self, index1, index2):\n '''Private utility function to clean up this common calculation.'''\n return self.scores[index1].stamp - self.scores[index2].stamp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L17_C8", "label": "expression", "type": "expression", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L16_C4", "vector": [8, 2, 0.1667, 0.0098, 2, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Private utility function to clean up this common calculation.'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Return_L18_C8", "label": "return", "type": "return", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L16_C4", "vector": [13, 2, 0.1765, 0.0098, 2, 0.54, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.scores[index1].stamp - self.scores[index2].stamp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L20_C4", "label": "getReportItems", "type": "function", "loc": [20, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:ClassDef_L7_C0", "vector": [2, 1, 0.3333, 0.2843, 1, 0.51, 0.5, 50, 0, 2, 1, 0, 0, 0, 13], "semantic": {"name": "getReportItems", "arg_names": ["self", "orderByCost"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def getReportItems(self, orderByCost=True):\n '''Returns a list of dicts. Each dict has\n start (ms),\n end (ms),\n delta (ms),\n perc (%),\n tag (str)\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L21_C8", "label": "expression", "type": "expression", "loc": [21, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L20_C4", "vector": [8, 2, 0.2353, 0.0686, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Returns a list of dicts. Each dict has\n start (ms),\n end (ms),\n delta (ms),\n perc (%),\n tag (str)\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L28_C8", "label": "append()", "type": "expression", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L20_C4", "vector": [8, 2, 0.2745, 0.0098, 2, 0.83, 0.1667, 243, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.scores.append(Score(tag='finish', stamp=time.clock()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L29_C8", "label": "total_time = _stampDelta()", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L20_C4", "vector": [14, 2, 0.2843, 0.0098, 2, 0.83, 0.3333, 875, 3, 2, 0, 0, 298, 10, 1], "semantic": {"name": "total_time", "arg_names": [], "import_names": [], "rhs_call_name": "_stampDelta", "annotation": ""}, "snippet": " total_time = self._stampDelta(-1, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L30_C8", "label": "data =", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L20_C4", "vector": [14, 2, 0.2941, 0.0098, 2, 0.83, 0.5, 929, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:For_L31_C8", "label": "for i", "type": "for", "loc": [31, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L20_C4", "vector": [6, 2, 0.3725, 0.1471, 2, 0.83, 0.6667, 826, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(1, len(self.scores)):\n delta = self._stampDelta(i, i - 1)\n if abs(total_time) < 1e-6:\n perc = 0\n else:\n perc = delta / total_time * 100\n data.append(\n dict("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L32_C12", "label": "delta = _stampDelta()", "type": "assigned_variable", "loc": [32, 32], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:For_L31_C8", "vector": [14, 3, 0.3137, 0.0098, 3, 0.48, 0.0, 593, 3, 2, 0, 0, 298, 10, 1], "semantic": {"name": "delta", "arg_names": [], "import_names": [], "rhs_call_name": "_stampDelta", "annotation": ""}, "snippet": " delta = self._stampDelta(i, i - 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:If_L33_C12", "label": "if", "type": "if", "loc": [33, 36], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:For_L31_C8", "vector": [4, 3, 0.3382, 0.0392, 3, 0.48, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if abs(total_time) < 1e-6:\n perc = 0\n else:\n perc = delta / total_time * 100"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L34_C16", "label": "perc =", "type": "assigned_variable", "loc": [34, 34], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L33_C12", "vector": [14, 4, 0.3333, 0.0098, 4, 0.63, 0.0, 254, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "perc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " perc = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L36_C16", "label": "perc =", "type": "assigned_variable", "loc": [36, 36], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L33_C12", "vector": [14, 4, 0.3529, 0.0098, 4, 0.63, 1.0, 254, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "perc", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " perc = delta / total_time * 100"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L37_C12", "label": "append()", "type": "expression", "loc": [37, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:For_L31_C8", "vector": [8, 3, 0.402, 0.0882, 3, 0.48, 1.0, 243, 3, 1, 0, 0, 0, 0, 4], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " data.append(\n dict(\n start=self._stampDelta(i - 1, 0) * 1000,\n end=self._stampDelta(i, 0) * 1000,\n delta=delta * 1000,\n perc=perc,\n tag=self.scores[i].tag\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:If_L46_C8", "label": "if", "type": "if", "loc": [46, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L20_C4", "vector": [4, 2, 0.4559, 0.0196, 2, 0.83, 0.8333, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if orderByCost:\n data.sort(key=lambda x: x['perc'], reverse=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L47_C12", "label": "sort()", "type": "expression", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L46_C8", "vector": [8, 3, 0.4608, 0.0098, 3, 0.24, 0.0, 489, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " data.sort(key=lambda x: x['perc'], reverse=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Return_L48_C8", "label": "return", "type": "return", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L20_C4", "vector": [13, 2, 0.4706, 0.0098, 2, 0.83, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L50_C4", "label": "getReportLines", "type": "function", "loc": [50, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:ClassDef_L7_C0", "vector": [2, 1, 0.5392, 0.1078, 1, 0.51, 0.6667, 100, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "getReportLines", "arg_names": ["self", "orderByCost"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def getReportLines(self, orderByCost=True):\n '''Produces a report of logged time-stamps as a list of strings.\n if orderByCost is False, then the order of the stamps is\n chronological.'''\n data = self.getReportItems(orderByCost)\n headerTemplate = '%10s | %10s | %10s | %11s | %-30s'\n headerData = ('Start(ms)', 'End(ms)', 'Delta(ms)', 'Time Cost',\n 'Description')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L51_C8", "label": "expression", "type": "expression", "loc": [51, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L50_C4", "vector": [8, 2, 0.5098, 0.0294, 2, 0.33, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''Produces a report of logged time-stamps as a list of strings.\n if orderByCost is False, then the order of the stamps is\n chronological.'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L54_C8", "label": "data = getReportItems()", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L50_C4", "vector": [14, 2, 0.5294, 0.0098, 2, 0.33, 0.2, 929, 3, 1, 0, 0, 50, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "getReportItems", "annotation": ""}, "snippet": " data = self.getReportItems(orderByCost)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L55_C8", "label": "headerTemplate =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L50_C4", "vector": [14, 2, 0.5392, 0.0098, 2, 0.33, 0.4, 654, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "headerTemplate", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headerTemplate = '%10s | %10s | %10s | %11s | %-30s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L56_C8", "label": "headerData =", "type": "assigned_variable", "loc": [56, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L50_C4", "vector": [14, 2, 0.5539, 0.0196, 2, 0.33, 0.6, 522, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "headerData", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headerData = ('Start(ms)', 'End(ms)', 'Delta(ms)', 'Time Cost',\n 'Description')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L58_C8", "label": "bodyTemplate =", "type": "assigned_variable", "loc": [58, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L50_C4", "vector": [14, 2, 0.5735, 0.0196, 2, 0.33, 0.8, 826, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "bodyTemplate", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bodyTemplate = '%(start)10.0f | %(end)10.0f | %(delta)10.0f |' \\\n + ' %(perc)10.0f%% | %(tag)-30s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Return_L60_C8", "label": "return", "type": "return", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L50_C4", "vector": [13, 2, 0.5882, 0.0098, 2, 0.33, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [headerTemplate % headerData] + [bodyTemplate % d for d in data]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L62_C4", "label": "getReportText", "type": "function", "loc": [62, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:ClassDef_L7_C0", "vector": [2, 1, 0.6127, 0.0196, 1, 0.51, 0.8333, 601, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "getReportText", "arg_names": ["self", "kwargs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def getReportText(self, **kwargs):\n return '\\n'.join(self.getReportLines(**kwargs))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Return_L63_C8", "label": "return", "type": "return", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L62_C4", "vector": [13, 2, 0.6176, 0.0098, 2, 0.25, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\\n'.join(self.getReportLines(**kwargs))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L65_C4", "label": "restart", "type": "function", "loc": [65, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:ClassDef_L7_C0", "vector": [2, 1, 0.6422, 0.0196, 1, 0.51, 1.0, 442, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "restart", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def restart(self):\n self.scores = [Score(tag='start', stamp=time.clock())]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L66_C8", "label": "self.scores =", "type": "assigned_variable", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L65_C4", "vector": [14, 2, 0.6471, 0.0098, 2, 0.4, 0.0, 516, 0, 0, 0, 0, 0, 5, 2], "semantic": {"name": "self.scores", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.scores = [Score(tag='start', stamp=time.clock())]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "label": "if", "type": "if", "loc": [68, 102], "level": 0, "parent": null, "vector": [4, 0, 0.8333, 0.3431, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 29], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n print('')\n print('Testing:')\n print('')\n\n # First create the collector\n t = TimeCollector()\n x = [i for i in range(1000)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L69_C4", "label": "print()", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [8, 1, 0.6765, 0.0098, 1, 0.13, 0.0, 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_501:Expr_L70_C4", "label": "print()", "type": "expression", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [8, 1, 0.6863, 0.0098, 1, 0.13, 0.0455, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Testing:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L71_C4", "label": "print()", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [8, 1, 0.6961, 0.0098, 1, 0.13, 0.0909, 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_501:Assign_L74_C4", "label": "t = TimeCollector()", "type": "assigned_variable", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [14, 1, 0.7255, 0.0098, 1, 0.13, 0.1364, 15, 3, 0, 0, 0, 53, 10, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "TimeCollector", "annotation": ""}, "snippet": " t = TimeCollector()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L75_C4", "label": "x =", "type": "assigned_variable", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [14, 1, 0.7353, 0.0098, 1, 0.13, 0.1818, 190, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " x = [i for i in range(1000)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L77_C4", "label": "addStamp()", "type": "expression", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [8, 1, 0.7549, 0.0098, 1, 0.13, 0.2273, 95, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addStamp", "arg_names": [], "import_names": [], "rhs_call_name": "addStamp", "annotation": ""}, "snippet": " t.addStamp('Initialization Section')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L78_C4", "label": "x =", "type": "assigned_variable", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [14, 1, 0.7647, 0.0098, 1, 0.13, 0.2727, 190, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " x = [i for i in range(10000)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L79_C4", "label": "addStamp()", "type": "expression", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [8, 1, 0.7745, 0.0098, 1, 0.13, 0.3182, 95, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addStamp", "arg_names": [], "import_names": [], "rhs_call_name": "addStamp", "annotation": ""}, "snippet": " t.addStamp('A big loop')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L80_C4", "label": "x =", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [14, 1, 0.7843, 0.0098, 1, 0.13, 0.3636, 190, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " x = [i for i in range(100000)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L81_C4", "label": "addStamp()", "type": "expression", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [8, 1, 0.7941, 0.0098, 1, 0.13, 0.4091, 95, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addStamp", "arg_names": [], "import_names": [], "rhs_call_name": "addStamp", "annotation": ""}, "snippet": " t.addStamp('calling builder function')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L83_C4", "label": "print()", "type": "expression", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [8, 1, 0.8137, 0.0098, 1, 0.13, 0.4545, 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_501:Expr_L84_C4", "label": "print()", "type": "expression", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [8, 1, 0.8235, 0.0098, 1, 0.13, 0.5, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(t.getReportText())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L87_C4", "label": "restart()", "type": "expression", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [8, 1, 0.8529, 0.0098, 1, 0.13, 0.5455, 442, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "restart", "arg_names": [], "import_names": [], "rhs_call_name": "restart", "annotation": ""}, "snippet": " t.restart()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L88_C4", "label": "x =", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [14, 1, 0.8627, 0.0098, 1, 0.13, 0.5909, 190, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " x = [i for i in range(1000000)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L89_C4", "label": "addStamp()", "type": "expression", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [8, 1, 0.8725, 0.0098, 1, 0.13, 0.6364, 95, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addStamp", "arg_names": [], "import_names": [], "rhs_call_name": "addStamp", "annotation": ""}, "snippet": " t.addStamp('Part 2')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L90_C4", "label": "x =", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [14, 1, 0.8824, 0.0098, 1, 0.13, 0.6818, 190, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " x = [i for i in range(1000000)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L91_C4", "label": "addStamp()", "type": "expression", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [8, 1, 0.8922, 0.0098, 1, 0.13, 0.7273, 95, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "addStamp", "arg_names": [], "import_names": [], "rhs_call_name": "addStamp", "annotation": ""}, "snippet": " t.addStamp('Cleanup')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L93_C4", "label": "print()", "type": "expression", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [8, 1, 0.9118, 0.0098, 1, 0.13, 0.7727, 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_501:Expr_L94_C4", "label": "print()", "type": "expression", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [8, 1, 0.9216, 0.0098, 1, 0.13, 0.8182, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(t.getReportText())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L95_C4", "label": "restart()", "type": "expression", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [8, 1, 0.9314, 0.0098, 1, 0.13, 0.8636, 442, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "restart", "arg_names": [], "import_names": [], "rhs_call_name": "restart", "annotation": ""}, "snippet": " t.restart()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:For_L96_C4", "label": "for y", "type": "for", "loc": [96, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [6, 1, 0.951, 0.0294, 1, 0.13, 0.9091, 304, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "y", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for y in range(1, 200, 20):\n x = [i for i in range(10000) * y]\n t.addStamp('Iteration when y = ' + str(y))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L97_C8", "label": "x =", "type": "assigned_variable", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:For_L96_C4", "vector": [14, 2, 0.951, 0.0098, 2, 0.89, 0.0, 190, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " x = [i for i in range(10000) * y]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L98_C8", "label": "addStamp()", "type": "expression", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:For_L96_C4", "vector": [8, 2, 0.9608, 0.0098, 2, 0.89, 1.0, 95, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "addStamp", "arg_names": [], "import_names": [], "rhs_call_name": "addStamp", "annotation": ""}, "snippet": " t.addStamp('Iteration when y = ' + str(y))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L100_C4", "label": "print()", "type": "expression", "loc": [100, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [8, 1, 0.9804, 0.0098, 1, 0.13, 0.9545, 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_501:Expr_L102_C4", "label": "print()", "type": "expression", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "vector": [8, 1, 1.0, 0.0098, 1, 0.13, 1.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(t.getReportText(orderByCost=False))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_501:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Return_L18_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:For_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:For_L31_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L32_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:For_L31_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_501:If_L33_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L33_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L34_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L33_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L36_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:For_L31_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L37_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:If_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L46_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Return_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L55_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Return_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Return_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:FunctionDef_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:For_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:For_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Assign_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:For_L96_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_501:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_501:Expr_L102_C4"}] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.